:root {
    --bg: #e9eaeb;
    --panel: #ffffff;
    --soft: #f6f6f4;
    --text: #101513;
    --muted: #8a938e;
    --line: #ecefed;
    --primary: #107346;
    --primary-dark: #075b35;
    --primary-soft: #e9f5ee;
    --danger: #b42318;
    --font-text: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-text); color: var(--text); background: radial-gradient(circle at 50% 0%, #f7f8f7 0, var(--bg) 46%, #dddedd 100%); }
a { color: inherit; text-decoration: none; font-family: var(--font-text); }
h1, h2 { margin: 0 0 14px; line-height: 1.2; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; }
input, select, button { font: inherit; }
input, select, textarea { font-family: var(--font-text); }
input::placeholder, textarea::placeholder { font-family: var(--font-text); color: #a0a8a3; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; color: var(--text); outline: none; }
input:focus, select:focus { border-color: rgba(16,115,70,.35); box-shadow: 0 0 0 4px rgba(16,115,70,.08); }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 72px); width: min(1720px, calc(100% - 72px)); margin: 36px auto; background: #f8f8f6; border: 12px solid rgba(255,255,255,.75); border-radius: 30px; box-shadow: 0 30px 90px rgba(16, 24, 40, .14); overflow: hidden; }
.sidebar { background: #f3f4f2; color: var(--text); padding: 24px 20px; display: flex; flex-direction: column; gap: 26px; border-right: 1px solid rgba(16,24,40,.04); }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 18px; font-weight: 800; padding: 0 10px 28px; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--primary); border: 3px solid var(--primary); font-weight: 900; }
.sidebar nav { display: grid; gap: 6px; }
.nav-label { color: var(--muted); font-size: 11px; text-transform: uppercase; padding: 18px 12px 8px; letter-spacing: .04em; }
.sidebar a { position: relative; display: flex; align-items: center; gap: 12px; color: #8a938e; padding: 12px 14px; border-radius: 14px; font-weight: 650; }
.sidebar a i { width: 18px; font-size: 17px; color: currentColor; }
.sidebar a.active { color: var(--text); background: #fff; box-shadow: 0 10px 24px rgba(16,24,40,.06); }
.sidebar a.active::after { content: ""; position: absolute; left: -20px; top: 8px; bottom: 8px; width: 5px; border-radius: 999px; background: var(--primary); }
.sidebar a:hover { background: #fff; color: var(--text); }
.content { padding: 18px; max-width: none; width: 100%; }
.topbar { display: grid; grid-template-columns: minmax(240px, 360px) 1fr auto; gap: 18px; align-items: center; background: #fff; border-radius: 22px; padding: 16px 18px; margin-bottom: 8px; box-shadow: 0 12px 26px rgba(16,24,40,.04); }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.menu-toggle { display: none; width: 46px; height: 46px; border: 0; border-radius: 14px; background: var(--primary); color: #fff; cursor: pointer; align-items: center; justify-content: center; flex-direction: column; gap: 5px; flex: 0 0 auto; }
.menu-toggle span { width: 20px; height: 2px; border-radius: 999px; background: currentColor; transition: transform .2s ease, opacity .2s ease; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu-backdrop { display: none; }
.search-pill { display: flex; align-items: center; gap: 10px; background: #f7f7f5; border-radius: 16px; padding: 8px 12px; }
.search-pill span { width: 15px; height: 15px; border: 2px solid #111; border-radius: 50%; position: relative; flex: 0 0 auto; }
.search-pill span::after { content: ""; position: absolute; width: 7px; height: 2px; background: #111; right: -5px; bottom: -3px; transform: rotate(45deg); border-radius: 2px; }
.search-pill input { border: 0; box-shadow: none; background: transparent; padding: 8px; }
.search-pill input:focus { box-shadow: none; }
.user-chip { display: flex; align-items: center; gap: 12px; background: #f8f8f6; padding: 8px 12px 8px 8px; border-radius: 18px; }
.user-chip span { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; background: #f3d1c2; border: 3px solid #fff; color: #2a1a13; font-weight: 900; }
.user-chip div { display: grid; gap: 2px; }
.user-chip strong { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.user-chip small { color: var(--muted); font-size: 12px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: 0 24px 70px rgba(16,24,40,.12); }
.auth-card.wide { width: min(680px, 100%); }
.auth-link { color: var(--primary); font-weight: 700; font-size: 14px; justify-self: start; }
.auth-link:hover { color: var(--primary-dark); text-decoration: underline; }
.auth-link.center { justify-self: center; }
.auth-reset-link { display: block; color: var(--primary); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 52px; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.password-toggle:hover { background: #f1f3f1; color: var(--text); }
.password-toggle i { font-size: 18px; }

.panel, .card { background: var(--panel); border: 1px solid rgba(16,24,40,.04); border-radius: 22px; box-shadow: 0 12px 28px rgba(16,24,40,.045); }
.panel { padding: 22px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 14px; }
.card { position: relative; min-height: 130px; padding: 22px; display: grid; align-content: space-between; gap: 14px; overflow: hidden; font-family: var(--font-display); }
.card:first-child { background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 32%), linear-gradient(140deg, #1c8a56, #064f2f); color: #fff; }
.card:first-child span { color: rgba(255,255,255,.82); }
.card span, .muted { color: var(--muted); font-size: 14px; }
.card span { font-family: var(--font-display); font-weight: 600; }
.card strong { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -.03em; }
.card-icon { position: absolute; right: 18px; top: 18px; width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid rgba(16,115,70,.22); color: var(--primary); background: #fff; font-size: 17px; }
.card:first-child .card-icon { color: #fff; border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.12); }
.small { font-size: 12px; word-break: break-all; }
.hidden { display: none !important; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-stack { display: grid; gap: 14px; }
.inline-form, .filters, .actions, .row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { margin: 18px 0 14px; justify-content: flex-end; }
.accordion-panel { padding: 0; overflow: hidden; }
.accordion-panel summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px; font-weight: 800; }
.accordion-panel summary::-webkit-details-marker { display: none; }
.accordion-panel summary::after { content: "+"; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--primary); color: var(--primary); border-radius: 50%; font-size: 20px; line-height: 1; }
.accordion-panel[open] summary::after { content: "-"; }
.accordion-panel summary small { color: var(--muted); font-weight: 650; margin-left: auto; }
.accordion-panel > form, .accordion-panel .category-list { margin-left: 22px; margin-right: 22px; }
.accordion-panel .category-list { margin-bottom: 22px; }
.category-list { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; align-items: center; }
.category-item input { min-width: min(420px, 100%); }
.category-delete { display: flex; }
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(15, 23, 42, .56); }
.modal.is-open { display: flex; }
.modal__dialog { width: min(920px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border-radius: 22px; border: 1px solid var(--line); padding: 22px; box-shadow: 0 24px 80px rgba(15, 23, 42, .28); }
.modal__dialog--small { width: min(460px, 100%); }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.modal__header h2 { margin: 0; }
.modal__close { border: 0; background: #eef2f6; color: #344054; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; font-size: 24px; line-height: 1; }
.filters { margin-bottom: 18px; }
.filters input, .filters select, .inline-form input, .inline-form select { width: auto; min-width: 160px; }
.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.table-wrap { overflow-x: auto; }
.btn { border: 0; background: var(--primary); color: #fff; border-radius: 999px; padding: 12px 18px; cursor: pointer; font-family: var(--font-display); font-weight: 700; display: inline-flex; justify-content: center; align-items: center; min-height: 44px; }
.btn:hover { background: var(--primary-dark); }
.btn-muted { background: #f1f3f1; color: #47524c; }
.btn-muted:hover { background: #e6eae7; }
.btn-danger { background: var(--danger); }
.full { width: 100%; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 8px 12px; background: var(--primary-soft); color: var(--primary); font-family: var(--font-display); font-size: 12px; font-weight: 700; }
.dashboard-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.notice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.notice-card { position: relative; border-radius: 20px; padding: 18px; display: grid; gap: 8px; min-height: 112px; overflow: hidden; font-family: var(--font-display); }
.notice-card i { position: absolute; right: 18px; top: 18px; font-size: 24px; opacity: .7; }
.notice-card span { color: rgba(16,21,19,.7); font-weight: 600; }
.notice-card strong { font-size: 34px; line-height: 1; }
.notice-card.danger { background: #fff0ed; color: #a23a2a; }
.notice-card.warning { background: #fff8e7; color: #9a6a10; }
.notice-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.notice-lists h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 16px; }
.notice-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 16px; margin-bottom: 8px; background: #f8f8f6; border: 1px solid rgba(16,24,40,.04); }
.notice-item strong { display: block; font-family: var(--font-display); font-size: 14px; }
.notice-item small { color: var(--muted); }
.notice-item span { font-family: var(--font-display); font-weight: 700; white-space: nowrap; }
.notice-item.danger { border-left: 4px solid #c2412f; }
.notice-item.warning { border-left: 4px solid #d99a18; }
.empty-state { color: var(--muted); background: #f8f8f6; border-radius: 16px; padding: 14px; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; background: #eff8ff; border: 1px solid #b2ddff; color: #175cd3; }
.alert.error { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.alert.success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.code-box { background: #101828; color: #fff; border-radius: 8px; padding: 16px; font: 700 18px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; word-break: break-all; margin: 14px 0; }
.two-factor-setup { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: center; margin: 18px 0; }
.two-factor-setup.compact { grid-template-columns: 200px 1fr; }
.qr-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; display: inline-grid; place-items: center; }
.qr-card img { display: block; max-width: 100%; height: auto; }
.help-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 18px 0; }
.help-box ol { margin: 0; padding-left: 20px; color: var(--text); }
.help-box li { margin: 8px 0; }
.logo-preview { width: 58px; height: 58px; border: 1px dashed var(--line); border-radius: 12px; display: inline-grid; place-items: center; background: #fff; }
.logo-preview::before { content: "Logo"; color: var(--muted); font-size: 12px; }
.logo-preview:has(img:not(.hidden))::before { display: none; }
.card-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 4px; vertical-align: middle; margin-right: 8px; }
.logo-preview img { width: 48px; height: 48px; object-fit: contain; }
.credit-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.credit-card-summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; }
.credit-card-summary strong, .credit-card-summary b { font-family: var(--font-display); }
.credit-card-summary span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bars { display: grid; gap: 12px; }
.bars div { display: grid; gap: 5px; }
.bars i { display: block; height: 34px; border-radius: 999px; background: repeating-linear-gradient(135deg, rgba(16,115,70,.25) 0 4px, rgba(16,115,70,.08) 4px 8px), var(--primary-soft); overflow: hidden; }

@media (max-width: 900px) {
    body { background: #f2f3f2; }
    .app-shell { grid-template-columns: 1fr; width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
    body.menu-open { overflow: hidden; }
    .mobile-menu-backdrop { position: fixed; inset: 0; z-index: 70; display: block; background: rgba(16, 24, 40, .45); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    body.menu-open .mobile-menu-backdrop { opacity: 1; pointer-events: auto; }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(320px, 86vw); padding: 22px 18px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 22px 0 46px rgba(16,24,40,.18); overflow-y: auto; }
    body.menu-open .sidebar { transform: translateX(0); }
    .sidebar nav { grid-template-columns: 1fr; }
    .sidebar a { border-radius: 12px; }
    .sidebar a.active::after { left: -18px; }
    .content { padding: 18px; }
    .topbar { grid-template-columns: auto 1fr; gap: 12px; padding: 14px; border-radius: 0 0 18px 18px; margin: -18px -18px 14px; position: sticky; top: 0; z-index: 60; }
    .menu-toggle { display: inline-flex; }
    .search-pill { grid-column: 1 / -1; order: 3; }
    .topbar > div:nth-of-type(2) { min-width: 0; }
    .topbar h1 { font-size: 24px; overflow-wrap: anywhere; }
    .topbar .muted { margin-bottom: 4px; }
    .user-chip { justify-content: flex-start; }
    .topbar .user-chip { grid-column: 1 / -1; order: 4; }
    .cards, .grid.two, .form-grid { grid-template-columns: 1fr; }
    .notice-cards, .notice-lists, .credit-card-grid { grid-template-columns: 1fr; }
    .two-factor-setup, .two-factor-setup.compact { grid-template-columns: 1fr; }
    .filters input, .filters select, .inline-form input, .inline-form select, .filters .btn { width: 100%; }
}
