@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@500;600&family=Fira+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --accent: #6d5ce7; --success: #047857;
  --warning: #a16207; --orange: #c2410c; --danger: #b42318; --ink: #101828; --muted: #667085;
  --bg: #f6f8fc; --surface: #fff; --soft: #f1f5fb; --border: #dfe5ef; --sidebar: #101828;
  --radius: 14px; --shadow: 0 8px 28px rgba(16, 24, 40, .07); --sidebar-width: 254px;
}
* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 16px/1.5 'Fira Sans', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a, select { touch-action: manipulation; }
a { color: var(--primary); }
img { max-width: 100%; }
.sr-only { position: absolute!important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 2000; top: 8px; left: 8px; padding: 10px 14px; background: #fff; transform: translateY(-150%); border-radius: 8px; }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }

.sidebar { position: fixed; z-index: 80; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 24px 16px; color: #d0d5dd; background: var(--sidebar); transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; color: #fff; }
.brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; background: #fff; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; }.brand small { color: #98a2b3; font-size: 12px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-link { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; text-decoration: none; font-weight: 500; transition: background .18s ease, color .18s ease; }
.nav-link:hover { background: #1d2939; color: #fff; }.nav-link.active { background: #2947b6; color: #fff; }
.nav-icon, [data-icon] { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: 0 0 auto; }
[data-icon] svg { width: 100%; height: 100%; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid #344054; }
.logout-link:hover { color: #fecaca; }
.sidebar-scrim { position: fixed; z-index: 70; inset: 0; border: 0; background: rgba(16,24,40,.55); }

.app-shell { margin-left: var(--sidebar-width); min-height: 100dvh; }
.topbar { position: sticky; z-index: 50; top: 0; min-height: 76px; display: flex; align-items: center; gap: 18px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); }
.page-heading { margin-right: auto; }.page-heading h1 { margin: 0; font-size: 22px; line-height: 1.25; }.mobile-brand { display: none; }
.client-picker { position: relative; width: min(340px, 34vw); }
.picker-button { width: 100%; min-height: 46px; display: grid; grid-template-columns: 20px 1fr 20px; align-items: center; gap: 10px; padding: 0 13px; color: #344054; text-align: left; background: #fff; border: 1px solid #cfd6e3; border-radius: 10px; cursor: pointer; }
.picker-panel { position: absolute; z-index: 100; top: calc(100% + 8px); left: 0; right: 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.picker-panel input { width: 100%; min-height: 44px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid #cfd6e3; border-radius: 9px; }
.picker-results { max-height: 310px; overflow: auto; }.picker-results a { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }.picker-results a:hover { background: var(--soft); }
.picker-empty { padding: 16px; color: var(--muted); text-align: center; }
.admin-pill { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--soft); color: #344054; font-weight: 600; }
.icon-button { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; padding: 0; color: var(--ink); background: #fff; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }.mobile-menu { display: none; }
.main-content { width: min(100%, 1540px); margin: 0 auto; padding: 28px; }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-intro h2 { margin: 0 0 4px; font-size: clamp(23px, 2vw, 30px); line-height: 1.2; }.page-intro p { margin: 0; color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid #cfd6e3; border-radius: 9px; background: #fff; color: #344054; font-weight: 600; text-decoration: none; cursor: pointer; transition: color .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease; }
.button:hover { background: var(--soft); }.button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }.button.primary:hover { background: var(--primary-dark); }.button.danger { color: var(--danger); border-color: #f2c3bf; }.button.ghost { background: transparent; }.button.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }.button.full { width: 100%; }.button:disabled { opacity: .5; cursor: not-allowed; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card, .panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 10px rgba(16,24,40,.035); }
.metric-card { min-height: 126px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card .metric-top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .025em; text-transform: uppercase; }
.metric-card .metric-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: #eff6ff; }.metric-card strong { display: block; margin-top: 12px; font: 600 clamp(24px, 2.3vw, 32px)/1.1 'Fira Code', monospace; letter-spacing: -.04em; }.metric-note { margin-top: 6px; color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }.grid-3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-bottom: 24px; }
.panel { padding: 20px; margin-bottom: 20px; }.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }.panel-header h2, .panel-header h3 { margin: 0; font-size: 18px; }.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.list { display: grid; }.list-item { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid #edf0f5; }.list-item:first-child { border-top: 0; }.list-main { min-width: 0; }.list-main strong, .list-main span { display: block; }.list-main span { margin-top: 2px; color: var(--muted); font-size: 13px; }.list-amount { color: var(--ink); font-family: 'Fira Code', monospace; font-size: 14px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; }.badge.success { color: #05603a; background: #dff8eb; }.badge.warning { color: #854a0e; background: #fff3d4; }.badge.orange { color: #9a3412; background: #ffead5; }.badge.danger { color: #a51d18; background: #fee4e2; }.badge.neutral { color: #475467; background: #eef2f6; }.badge.info { color: #1849a9; background: #e6efff; }
.attention-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); font-size: 12px; font-weight: 700; }
.table-wrap { width: 100%; overflow-x: auto; }.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }.data-table th { padding: 11px 12px; color: #475467; background: #f8fafc; font-size: 12px; text-align: left; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }.data-table td { padding: 13px 12px; border-top: 1px solid #edf0f5; vertical-align: middle; }.data-table tbody tr:hover { background: #fafcff; }.data-table .number { font-family: 'Fira Code', monospace; font-size: 13px; white-space: nowrap; }.client-link { color: var(--ink); font-weight: 600; text-decoration: none; }.client-link:hover { color: var(--primary); }.link-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.mobile-cards { display: none; }
.pin-cell { width: 48px; padding-right: 0!important; }.pin-form { display: inline-flex; }.pin-button { min-width: 38px; min-height: 38px; color: #667085; border-color: transparent; background: transparent; }.pin-button:hover { color: var(--primary); background: #eff6ff; }.pin-button.active { color: var(--primary); background: #eaf2ff; border-color: #b9cdfb; }.pin-button.active svg { fill: currentColor; }.pinned-row { background: #fbfdff; }.mobile-pin { flex: 0 0 auto; }.client-card-title { min-width: 0; flex: 1; }
.filters { display: grid; grid-template-columns: minmax(220px,1.6fr) repeat(3,minmax(150px,1fr)) auto; gap: 12px; align-items: end; }.field { display: grid; gap: 6px; }.field label, .fieldset-title { color: #344054; font-size: 14px; font-weight: 600; }.field input, .field select, .field textarea, .status-select { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid #cfd6e3; border-radius: 9px; }.field textarea { min-height: 104px; resize: vertical; }.field small { color: var(--muted); }.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }.form-section { margin: 0 0 24px; padding: 0; border: 0; }.form-section legend { width: 100%; margin-bottom: 16px; padding-bottom: 9px; border-bottom: 1px solid var(--border); font-size: 17px; font-weight: 700; }.span-2 { grid-column: span 2; }.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.alert { padding: 12px 14px; margin-bottom: 16px; border-radius: 9px; font-size: 14px; }.alert.danger { color: #8f1b15; background: #fee4e2; border: 1px solid #f6b9b5; }.alert.info { color: #194185; background: #eaf2ff; border: 1px solid #c7d7fe; }.alert.warning { color: #7a2e0e; background: #fff2df; border: 1px solid #fed7aa; }.alert.success { color: #05603a; background: #e6f8ee; border: 1px solid #a9e3c3; }
.empty-state { padding: 48px 18px; text-align: center; }.empty-state .empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 14px; color: var(--primary); background: #eff6ff; }.empty-state h3 { margin: 0 0 6px; }.empty-state p { max-width: 430px; margin: 0 auto 18px; color: var(--muted); }
.toast { position: fixed; z-index: 120; right: 22px; bottom: 22px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; color: #fff; background: #101828; border-radius: 10px; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }.toast.show { transform: none; opacity: 1; }.main-content > .toast { position: static; max-width: none; margin-bottom: 16px; color: #fff; opacity: 1; transform: none; }.toast.success { background: #05603a; }.toast.danger { background: #9f1d18; }
.modal { position: fixed; z-index: 110; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(16,24,40,.58); }.modal[hidden] { display: none; }.modal-card { width: min(560px, 100%); max-height: calc(100dvh - 36px); overflow: auto; padding: 22px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); animation: modal-in .18s ease-out; }.modal-header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }.modal-header h2 { margin: 0; font-size: 20px; }.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }.stack-form { display: grid; gap: 16px; }.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.profile-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }.profile-title h2 { margin: 0 0 5px; font-size: 28px; }.profile-title p { margin: 0; color: var(--muted); }.status-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }.status-box { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }.status-box label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }.status-select { font-weight: 600; }
.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }.info-list { display: grid; grid-template-columns: 145px 1fr; gap: 12px; margin: 0; }.info-list dt { color: var(--muted); }.info-list dd { min-width: 0; margin: 0; font-weight: 500; overflow-wrap: anywhere; }.notes-box { padding: 15px; color: #344054; background: #f8fafc; border-radius: 10px; white-space: pre-wrap; }.timeline { position: relative; display: grid; gap: 0; }.timeline-item { position: relative; padding: 0 0 18px 28px; }.timeline-item::before { content: ''; position: absolute; left: 7px; top: 7px; bottom: -4px; width: 1px; background: #dce3ed; }.timeline-item:last-child::before { display: none; }.timeline-dot { position: absolute; left: 2px; top: 6px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px #b7cdfc; }.timeline-item strong { display: block; font-size: 14px; }.timeline-item time { color: var(--muted); font-size: 12px; }.comment { padding: 14px 0; border-top: 1px solid #edf0f5; }.comment:first-child { border-top: 0; }.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.comment-head strong { font-size: 14px; }.comment p { margin: 8px 0 0; white-space: pre-wrap; }.inline-form { display: inline; }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }.pagination a, .pagination span { min-width: 40px; min-height: 40px; display: grid; place-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; color: #344054; text-decoration: none; }.pagination .current { color: #fff; background: var(--primary); border-color: var(--primary); }
.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #e7efff 0, #f6f8fc 43%); }.login-card { width: min(430px,100%); padding: 34px; border: 1px solid var(--border); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }.login-brand { margin-bottom: 24px; text-align: center; }.login-brand img { width: 72px; height: 72px; object-fit: contain; border-radius: 18px; }.login-brand p { margin: 12px 0 2px; color: var(--primary); font-size: 13px; font-weight: 700; letter-spacing: .14em; }.login-brand h1 { margin: 0; font-size: 27px; }.login-brand span { display: block; margin-top: 7px; color: var(--muted); }.password-field { position: relative; }.password-field input { padding-right: 50px; }.password-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; }
.danger-zone { border-color: #f2c3bf; }.danger-zone .panel-header h3 { color: var(--danger); }.check-row { display: flex; align-items: flex-start; gap: 10px; }.check-row input { width: 20px; height: 20px; margin-top: 2px; }
.logo-mark { position: relative; width: 44px; height: 44px; flex: 0 0 44px; display: block; overflow: hidden; border-radius: 12px; background: #fff; }
.logo-mark img { position: absolute; width: 176px; height: 176px; max-width: none; left: -11px; top: -66px; object-fit: contain; }
.login-logo { width: 72px; height: 72px; margin: 0 auto; border-radius: 18px; }
.login-logo img { width: 288px; height: 288px; left: -18px; top: -108px; }
.filters { grid-template-columns: minmax(220px,1.6fr) repeat(4,minmax(140px,1fr)) auto; }
.cards.three { grid-template-columns: repeat(3,minmax(0,1fr)); }

@media (max-width: 1180px) { .cards { grid-template-columns: repeat(2,minmax(0,1fr)); }.filters { grid-template-columns: repeat(2,minmax(0,1fr)); }.filters .search-field { grid-column: span 2; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }.sidebar.open { transform: none; }.app-shell { margin-left: 0; }.mobile-menu { display: inline-grid; }.topbar { padding: 10px 18px; }.page-heading h1 { font-size: 19px; }.admin-pill { display: none; }.client-picker { width: min(330px,45vw); }.main-content { padding: 22px 18px; }
  .dashboard-grid, .info-grid { grid-template-columns: 1fr; }.status-strip { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .topbar { gap: 10px; flex-wrap: wrap; }.page-heading { margin-right: 0; flex: 1; }.page-heading h1 { display: none; }.mobile-brand { display: block; font-weight: 700; }.client-picker { order: 3; width: 100%; }.picker-panel { position: fixed; top: 116px; left: 14px; right: 14px; }
  .main-content { padding: 20px 14px 40px; }.page-intro, .profile-header { align-items: stretch; flex-direction: column; }.action-row .button { flex: 1 1 auto; }.cards { gap: 10px; }.metric-card { min-height: 112px; padding: 14px; }.metric-card strong { font-size: 22px; }.metric-card .metric-icon { width: 32px; height: 32px; }
  .panel { padding: 16px; }.grid-2, .grid-3, .form-grid, .status-strip, .filters { grid-template-columns: 1fr; }.span-2, .filters .search-field { grid-column: auto; }.form-actions { flex-direction: column-reverse; }.form-actions .button { width: 100%; }.info-list { grid-template-columns: 1fr; gap: 3px; }.info-list dd { margin-bottom: 10px; }
  .desktop-table { display: none; }.mobile-cards { display: grid; gap: 12px; }.client-card { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }.client-card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 14px; }.client-card-head a { color: var(--ink); font-weight: 700; text-decoration: none; }.client-card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }.client-card-grid small, .client-card-status small { display: block; color: var(--muted); font-size: 12px; }.client-card-grid strong { display: block; margin-top: 2px; font-family: 'Fira Code', monospace; font-size: 14px; }.client-card-status { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 14px; }
  .modal { align-items: end; padding: 0; }.modal-card { max-height: 92dvh; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }.modal-actions { flex-direction: column-reverse; }.modal-actions .button { width: 100%; }
  .login-card { padding: 26px 20px; }.toast { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) { .cards { grid-template-columns: 1fr; }.metric-card { min-height: 102px; }.client-card-grid { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto!important; animation-duration: .01ms!important; transition-duration: .01ms!important; } }
