:root {
  --navy: #102532;
  --navy-2: #183b49;
  --ink: #17252e;
  --muted: #68747c;
  --canvas: #f5f5f0;
  --surface: #ffffff;
  --line: #e1e5e2;
  --yellow: #f4c430;
  --yellow-soft: #fff4bf;
  --green: #238655;
  --green-soft: #e2f4e8;
  --red: #c5493c;
  --red-soft: #ffebe8;
  --blue: #2f78a7;
  --blue-soft: #e6f1f8;
  --shadow: 0 10px 30px rgba(16, 37, 50, 0.08);
  --sidebar-width: 236px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }

.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(244,196,48,.18), transparent 34%),
    radial-gradient(circle at 88% 78%, rgba(47,120,167,.16), transparent 36%),
    linear-gradient(165deg, #0d1f29, #16313f 55%, #0a1820);
}
.login-card {
  width: min(420px, 100%); padding: 28px 26px 24px; border-radius: 16px;
  background: #fff; box-shadow: 0 28px 70px rgba(0,0,0,.28);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark {
  width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid rgba(16,37,50,.25); border-radius: 50%; color: #102532;
  font-family: Georgia, serif; font-size: 25px; background: #fff8d8;
}
.login-brand strong { display: block; font-size: 21px; letter-spacing: -.7px; line-height: 1; color: var(--ink); }
.login-brand span { display: block; margin-top: 6px; color: #8a6d05; font-size: 9px; font-weight: 800; letter-spacing: 2.2px; text-transform: uppercase; }
.login-card h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.8px; }
.login-copy { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-field { display: grid; gap: 6px; margin-bottom: 12px; }
.login-field span { font-size: 10px; font-weight: 750; color: #4d5a63; letter-spacing: .4px; text-transform: uppercase; }
.login-field input {
  height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfbf8; color: var(--ink);
}
.login-field input:focus { outline: 2px solid rgba(244,196,48,.55); border-color: #e2c24a; }
.login-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.login-submit { width: 100%; min-height: 46px; margin-top: 4px; }
.login-log { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #fbfbf8; }
.login-log table { width: 100%; border-collapse: collapse; font-size: 10px; }
.login-log th, .login-log td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.login-log th { color: var(--muted); font-weight: 750; background: #f3f4f1; position: sticky; top: 0; }
.login-log tr:last-child td { border-bottom: 0; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-width); padding: 28px 14px 18px;
  display: flex; flex-direction: column; color: #fff;
  background: radial-gradient(circle at 80% 0, rgba(244,196,48,.13), transparent 28%), linear-gradient(165deg, #16313f, #071b27 72%);
  box-shadow: 12px 0 30px rgba(6, 23, 33, .08);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 11px 27px; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(244,196,48,.65); border-radius: 50%; color: var(--yellow); font-family: Georgia, serif; font-size: 25px; }
.brand strong { display: block; font-size: 21px; letter-spacing: -.7px; line-height: 1; }
.brand span { display: block; margin-top: 6px; color: var(--yellow); font-size: 9px; font-weight: 800; letter-spacing: 2.2px; text-transform: uppercase; }
.side-nav { display: grid; gap: 5px; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
.nav-item { width: 100%; min-height: 47px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: #e8eef0; text-align: left; font-size: 13px; transition: .18s ease; }
.nav-item > span { width: 25px; color: #c5d0d5; text-align: center; font-size: 18px; }
.nav-item:hover { background: rgba(255,255,255,.08); transform: translateX(2px); }
.nav-item.active { color: #17252e; background: linear-gradient(110deg, var(--yellow), #ffda4d); font-weight: 750; box-shadow: 0 8px 20px rgba(244,196,48,.16); }
.nav-item.active > span { color: #17252e; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.11); display: flex; align-items: center; gap: 10px; }
.sidebar-footer b, .sidebar-footer small { display: block; }
.sidebar-footer b { font-size: 11px; }
.sidebar-footer small { margin-top: 3px; color: #aebbc1; font-size: 9px; }

.avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: linear-gradient(#fff, #e1e4e2); border: 1px solid #d7dcda; color: var(--ink); font-size: 11px; font-weight: 800; }
.avatar-button { border: 0; }
.main-area { min-height: 100vh; margin-left: var(--sidebar-width); padding: 24px 28px 42px; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.topbar-left, .top-actions { display: flex; align-items: center; gap: 13px; }
.eyebrow { margin: 0 0 5px; color: #8a6d05; font-size: 9px; font-weight: 850; letter-spacing: 1.7px; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(22px, 2.3vw, 30px); line-height: 1.1; letter-spacing: -.9px; }
.icon-button { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 19px; }
.menu-button { display: none; }
.site-filter select { height: 44px; min-width: 176px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 11px; }
.primary-button, .secondary-button, .danger-button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 8px; font-size: 11px; font-weight: 750; transition: .16s ease; }
.primary-button { border: 0; background: linear-gradient(110deg, var(--yellow), #ffd746); box-shadow: 0 7px 18px rgba(244,196,48,.2); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(244,196,48,.28); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); }
.secondary-button:hover { border-color: #c6ccc8; background: #fffdf5; }
.danger-button { border: 1px solid #efc0ba; background: var(--red-soft); color: var(--red); }
.view-container { animation: fade-up .22s ease; }

.hero { min-height: 164px; margin-bottom: 14px; padding: 27px; display: flex; align-items: center; justify-content: space-between; gap: 30px; overflow: hidden; position: relative; border-radius: 14px; color: #fff; background: linear-gradient(115deg, #102532, #194251 72%); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 330px; height: 330px; right: -70px; top: -205px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.017); }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--yellow); }
.hero h2 { max-width: 650px; margin: 6px 0 7px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -1.2px; }
.hero p { max-width: 660px; margin: 0; color: #cad5da; font-size: 12px; line-height: 1.6; }
.hero-actions { display: flex; gap: 9px; }
.hero .secondary-button { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.07); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card { min-height: 122px; padding: 17px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 3px 11px rgba(16,37,50,.045); }
.kpi-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--yellow-soft); font-size: 18px; font-weight: 800; }
.kpi-icon.green { color: var(--green); background: var(--green-soft); }
.kpi-icon.blue { color: var(--blue); background: var(--blue-soft); }
.kpi-icon.red { color: var(--red); background: var(--red-soft); }
.kpi-card small, .kpi-card strong, .kpi-card span { display: block; }
.kpi-card small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .6px; }
.kpi-card strong { margin-top: 6px; font-size: clamp(20px, 2vw, 28px); line-height: 1; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.kpi-card span { margin-top: 7px; color: var(--muted); font-size: 9px; }

.content-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 13px; margin-bottom: 13px; }
.content-grid.three { grid-template-columns: repeat(3, 1fr); }
.panel { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 3px 12px rgba(16,37,50,.045); }
.panel-head { min-height: 34px; margin-bottom: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.panel-head h2 { margin: 0; font-size: 16px; letter-spacing: -.25px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.text-button { padding: 5px; border: 0; background: transparent; color: #16659b; font-size: 10px; font-weight: 700; }

.module-header { margin-bottom: 14px; padding: 20px 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; border-radius: 12px; color: #fff; background: linear-gradient(110deg, #102532, #1b4855); }
.module-header .eyebrow { color: var(--yellow); }
.module-header h2 { margin: 5px 0 4px; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.8px; }
.module-header p { margin: 0; color: #c7d4d9; font-size: 11px; }
.module-actions { display: flex; gap: 8px; }
.module-header .secondary-button { border-color: rgba(255,255,255,.24); color: #fff; background: rgba(255,255,255,.08); }
.toolbar { min-height: 56px; margin-bottom: 13px; padding: 8px 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.toolbar input, .toolbar select { height: 37px; padding: 0 10px; border: 1px solid #dce1de; border-radius: 7px; background: #fff; color: var(--ink); font-size: 10px; outline: 0; }
.toolbar input:focus, .toolbar select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(244,196,48,.18); }
.toolbar .search { min-width: min(260px, 100%); }
.toolbar-spacer { margin-left: auto; }
.date-chip, .info-chip { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 7px; color: #665100; background: var(--yellow-soft); font-size: 9px; font-weight: 750; }
.info-chip.green { color: #16663c; background: var(--green-soft); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.data-table { width: 100%; min-width: 820px; border-collapse: collapse; background: #fff; }
.data-table th { height: 38px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #fafaf7; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .55px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { min-height: 56px; padding: 10px; border-bottom: 1px solid var(--line); font-size: 10px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fffdf4; }
.data-table b { font-size: 10px; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.amount { font-size: 12px !important; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 5px; }
.mini-button { min-height: 29px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 8px; font-weight: 700; }

.badge { min-height: 21px; padding: 3px 8px; display: inline-flex; align-items: center; border: 1px solid #eed572; border-radius: 20px; background: var(--yellow-soft); color: #6e5700; font-size: 8px; font-weight: 750; white-space: nowrap; }
.badge.green { border-color: #bee1ca; background: var(--green-soft); color: #17663d; }
.badge.red { border-color: #efc4be; background: var(--red-soft); color: #97362d; }
.badge.blue { border-color: #c6ddeb; background: var(--blue-soft); color: #235f85; }
.badge.gray { border-color: #d8dedd; background: #eef1ef; color: #58646b; }

.site-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.site-card { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 3px 10px rgba(16,37,50,.05); }
.site-visual { height: 100px; padding: 18px; display: flex; align-items: center; justify-content: space-between; color: #fff; background: linear-gradient(120deg, #536c65, #789078); }
.site-card:nth-child(3n+2) .site-visual { background: linear-gradient(120deg, #536b7e, #7890a1); }
.site-card:nth-child(3n+3) .site-visual { background: linear-gradient(120deg, #76664e, #998469); }
.site-building { font-size: 31px; }
.site-body { padding: 15px; }
.site-body h3 { margin: 0; font-size: 14px; }
.site-body p { margin: 5px 0; color: var(--muted); font-size: 9px; }
.progress { height: 8px; margin: 13px 0 6px; overflow: hidden; border-radius: 8px; background: #eaedea; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #eab82c, var(--yellow)); }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }

.activity-list { display: grid; }
.activity { min-height: 58px; padding: 9px 0; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.activity-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow-soft); }
.activity b, .activity small { display: block; }
.activity b { font-size: 10px; }
.activity small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.activity time { color: var(--muted); font-size: 8px; white-space: nowrap; }

.expense-bars { display: grid; gap: 13px; }
.expense-row { display: grid; grid-template-columns: minmax(100px, 170px) 1fr auto; align-items: center; gap: 10px; font-size: 9px; }
.expense-bar { height: 10px; overflow: hidden; border-radius: 10px; background: #eceeec; }
.expense-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1f8051, #38a76e); }
.expense-row:nth-child(4n+2) .expense-bar i { background: linear-gradient(90deg, #39789e, #56a1cf); }
.expense-row:nth-child(4n+3) .expense-bar i { background: linear-gradient(90deg, #c9a012, #e8c43a); }
.expense-row:nth-child(4n+4) .expense-bar i { background: linear-gradient(90deg, #8a5a3b, #b07a52); }
.expense-row strong { min-width: 72px; text-align: right; font-size: 10px; }

.report-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 13px; }
.report-card { min-height: 148px; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 3px 12px rgba(16,37,50,.045); transition: .16s ease; }
.report-card:hover { transform: translateY(-1px); border-color: #d5dbd7; box-shadow: 0 8px 18px rgba(16,37,50,.08); }
.report-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 16px; font-weight: 800; background: var(--yellow-soft); color: #6e5700; }
.report-icon.green { color: var(--green); background: var(--green-soft); }
.report-icon.blue { color: var(--blue); background: var(--blue-soft); }
.report-icon.yellow { color: #8a6a00; background: var(--yellow-soft); }
.report-icon.red { color: var(--red); background: var(--red-soft); }
.report-card b { font-size: 13px; letter-spacing: -.2px; }
.report-card small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.report-open { margin-top: auto; color: #16659b; font-size: 10px; font-weight: 750; }
.report-open i { font-style: normal; }
.report-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 13px; margin-bottom: 13px; }
.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.audit-list li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.audit-check { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; }
.audit-list b, .audit-list small { display: block; }
.audit-list b { font-size: 11px; }
.audit-list small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.report-log-list { display: grid; gap: 0; }
.report-log { min-height: 72px; padding: 12px 0; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: start; border-bottom: 1px solid var(--line); }
.report-log:last-child { border-bottom: 0; }
.log-date { width: 48px; height: 48px; display: grid; place-content: center; text-align: center; border-radius: 10px; background: #f3f5f3; }
.log-date b { font-size: 15px; line-height: 1; }
.log-date span { margin-top: 2px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.report-log h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.report-log p { margin: 5px 0 0; font-size: 10px; line-height: 1.45; }
.report-log small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.log-author { color: var(--muted); font-size: 9px; white-space: nowrap; }

.info-banner { margin-bottom: 13px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid #efd97a; border-radius: 11px; background: #fff9dc; }
.info-banner b { display: block; font-size: 12px; }
.info-banner p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.manage-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.manage-tab { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 700; }
.manage-tab span { min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: #eef1ef; color: var(--ink); font-size: 9px; }
.manage-tab.active { border-color: #efd97a; background: var(--yellow-soft); color: #6e5700; }
.manage-tab.active span { background: #fff; color: #6e5700; }
.manage-panel .manage-search { width: 100%; height: 42px; margin-bottom: 12px; padding: 0 12px; border: 1px solid #dce1de; border-radius: 9px; background: #fff; font-size: 11px; }
.manage-list { display: grid; }
.manage-row { min-height: 72px; padding: 12px 0; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.manage-row:last-child { border-bottom: 0; }
.manage-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow-soft); color: #6e5700; font-size: 12px; font-weight: 800; }
.manage-row:nth-child(3n+2) .manage-avatar { background: var(--blue-soft); color: var(--blue); }
.manage-row:nth-child(3n+3) .manage-avatar { background: var(--green-soft); color: var(--green); }
.manage-row h3 { margin: 0; font-size: 13px; }
.manage-row b { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 650; }
.manage-row p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.manage-row .delete-button { color: var(--red); border-color: #efc0ba; background: #fff; }
.manage-locked { color: var(--muted); font-size: 9px; font-weight: 700; }
.manage-empty { min-height: 180px; padding: 28px 16px; display: grid; place-items: center; text-align: center; }
.manage-empty strong { font-size: 14px; }
.manage-empty p { max-width: 360px; margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.empty-state { min-height: 220px; padding: 25px; display: grid; place-items: center; text-align: center; border: 1px dashed #cfd6d2; border-radius: 10px; background: #fbfbf8; }
.empty-state strong { display: block; font-size: 14px; }
.empty-state p { max-width: 410px; margin: 7px auto 15px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.app-dialog { width: min(680px, calc(100vw - 30px)); max-height: min(90vh, 850px); padding: 0; border: 0; border-radius: 15px; background: transparent; overflow: visible; }
.app-dialog::backdrop { background: rgba(5,20,29,.6); backdrop-filter: blur(3px); }
.dialog-card { max-height: min(90vh, 850px); display: flex; flex-direction: column; overflow: hidden; border-radius: 15px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.dialog-head { padding: 22px 23px 15px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 3px 0 3px; font-size: 22px; letter-spacing: -.5px; }
.dialog-head p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.dialog-close { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 50%; background: #f0f2f0; font-size: 21px; }
.dialog-body { padding: 4px 23px 20px; overflow-y: auto; }
.dialog-actions { padding: 14px 23px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: #fbfbf8; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field { margin-top: 13px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-size: 9px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #d7ddda; border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; outline: 0; }
.field textarea { min-height: 82px; resize: vertical; }
.field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.formula-box { margin-top: 14px; padding: 13px; border: 1px solid #efd97a; border-radius: 9px; background: #fff9dc; font-size: 10px; line-height: 1.6; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding-top: 12px; }
.quick-card { min-height: 92px; padding: 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-align: left; }
.quick-card:hover { border-color: #e8ca52; background: #fffdf3; }
.quick-card .activity-icon { flex: 0 0 auto; }
.quick-card b, .quick-card small { display: block; }
.quick-card b { font-size: 11px; }
.quick-card small { margin-top: 5px; color: var(--muted); font-size: 8px; line-height: 1.4; }

.toast-region { position: fixed; z-index: 130; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { min-width: 230px; max-width: 360px; padding: 12px 15px; border-radius: 9px; color: #fff; background: #102532; box-shadow: 0 14px 35px rgba(0,0,0,.2); font-size: 10px; animation: toast-in .2s ease; }
.toast.error { background: #9f392f; }
.mobile-nav { display: none; }

.payroll-formula { color: #5d4a00; background: #fff7cf; border: 1px solid #efd874; }
.loan-balance { font-size: 13px; font-weight: 850; }
.photo-preview { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.file-link { color: #146497; font-weight: 700; text-decoration: none; }
.file-link:hover { text-decoration: underline; }
.print-only { display: none; }

@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .site-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid.three { grid-template-columns: 1fr 1fr; }
  .top-actions .avatar-button { display: none; }
}

@media (max-width: 860px) {
  :root { --sidebar-width: 0px; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { width: min(286px, 86vw); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(7,24,34,.48); }
  .main-area { margin-left: 0; padding: 17px 18px 30px; }
  .menu-button { display: grid; }
  .topbar { align-items: flex-start; }
  .top-actions { margin-left: auto; }
  .site-filter select { min-width: 145px; max-width: 170px; }
  .primary-button b { display: none; }
  .top-actions .primary-button { width: 44px; padding: 0; font-size: 20px; }
  .content-grid { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; inset: auto 0 0 0; z-index: 42; min-height: 66px; padding: 7px 14px calc(7px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); align-items: end; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); box-shadow: 0 -8px 22px rgba(16,37,50,.06); }
  .mobile-nav button { min-height: 48px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; background: transparent; color: #7b858a; font-size: 17px; }
  .mobile-nav button small { font-size: 7px; }
  .mobile-nav button.active { color: var(--ink); font-weight: 800; }
  .mobile-nav .mobile-add { width: 48px; height: 48px; min-height: 48px; align-self: center; justify-self: center; margin-top: -21px; border-radius: 14px; color: var(--ink); background: var(--yellow); box-shadow: 0 8px 22px rgba(244,196,48,.34); font-size: 25px; }
}

@media (max-width: 620px) {
  .main-area { padding: 14px 13px 25px; }
  .topbar { min-height: 57px; gap: 9px; margin-bottom: 12px; }
  .topbar-left { gap: 9px; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; }
  .icon-button { width: 40px; height: 40px; }
  .top-actions { gap: 6px; }
  .site-filter select { width: 116px; min-width: 0; max-width: 116px; height: 40px; padding-left: 8px; font-size: 9px; }
  .top-actions .primary-button { width: 40px; min-height: 40px; }
  .hero { min-height: 180px; padding: 21px; align-items: flex-end; }
  .hero h2 { font-size: 25px; }
  .hero-actions { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { min-height: 104px; padding: 13px 11px; gap: 9px; }
  .kpi-icon { width: 39px; height: 39px; font-size: 15px; }
  .kpi-card strong { font-size: 20px; }
  .kpi-card span { display: none; }
  .site-grid, .content-grid.three { grid-template-columns: 1fr; }
  .module-header { padding: 18px; align-items: flex-start; }
  .module-header p { max-width: 230px; }
  .module-actions { flex-direction: column; }
  .module-actions .secondary-button { display: none; }
  .module-actions .secondary-button.mobile-visible-action { display: inline-flex; }
  .toolbar { align-items: stretch; }
  .toolbar > input, .toolbar > select, .toolbar .search { flex: 1 1 130px; min-width: 0; }
  .toolbar-spacer { display: none; }
  .panel { padding: 14px; }
  .expense-row { grid-template-columns: 105px 1fr; }
  .expense-row strong { grid-column: 2; text-align: left; }
  .report-card-grid, .report-layout { grid-template-columns: 1fr; }
  .report-log { grid-template-columns: 48px 1fr; }
  .log-author { grid-column: 2; }
  .manage-row { grid-template-columns: 40px 1fr; }
  .manage-row .delete-button, .manage-locked { grid-column: 2; justify-self: start; }
  .form-grid, .quick-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .dialog-head { padding: 19px 17px 13px; }
  .dialog-body { padding: 3px 17px 17px; }
  .dialog-actions { padding: 12px 17px; }
  .app-dialog { width: calc(100vw - 16px); max-height: 94vh; }
  .dialog-card { max-height: 94vh; }
}

@media (max-width: 430px) {
  .topbar-left > div { display: none; }
  .site-filter select { width: min(42vw, 128px); max-width: 128px; }
}

@media (max-width: 360px) {
  .kpi-card { align-items: flex-start; }
  .kpi-card .kpi-icon { display: none; }
}

@media print {
  body { background: #fff; padding: 0; }
  .sidebar, .topbar, .mobile-nav, .module-header, .toolbar, .no-print, .row-actions { display: none !important; }
  .main-area { margin: 0; padding: 0; }
  .print-only { display: block; }
  .panel, .table-wrap { border-color: #bbb; box-shadow: none; }
  .data-table { min-width: 0; }
}

.login-back {
  display: block; margin-top: 14px; text-align: center; color: #68747c;
  font-size: 11px; font-weight: 650; text-decoration: none;
}
.login-back:hover { color: #102532; text-decoration: underline; }

.login-storage {
  margin: -8px 0 16px; padding: 8px 10px; border-radius: 8px;
  background: #eef5f1; color: #1f6b45; font-size: 10px; font-weight: 650;
}
.login-storage.local {
  background: #fff4e5; color: #8a5a00;
}


.status-online {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-weight: 750; font-size: 9px;
}


.data-table th.no-print:last-child, .data-table td.no-print:last-child { position: sticky; right: 0; z-index: 2; background: #fff; box-shadow: -7px 0 12px rgba(16,37,50,.05); }


.delete-button { border-color: #efc0ba; background: var(--red-soft); color: #a13b31; }


.site-actions { margin-top: 13px; padding-top: 11px; display: flex; justify-content: flex-end; gap: 7px; border-top: 1px solid var(--line); }


.delete-warning { margin-top: 15px; padding: 14px; border: 1px solid #efc0ba; border-radius: 9px; background: var(--red-soft); color: #7f2f27; }


.delete-impact-list { margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }


.dialog-section-title { margin: 18px 0 8px; }
