:root {
  --bg: #111416;
  --sidebar: #15191b;
  --surface: #1b2023;
  --surface-raised: #22282c;
  --surface-soft: #181c1f;
  --border: #30373b;
  --border-soft: #262c30;
  --text: #f2f5f6;
  --muted: #929da4;
  --faint: #68737a;
  --green: #38d39f;
  --green-soft: rgba(56, 211, 159, .14);
  --cyan: #59b8f6;
  --cyan-soft: rgba(89, 184, 246, .14);
  --amber: #f2b84b;
  --amber-soft: rgba(242, 184, 75, .14);
  --coral: #ff746d;
  --coral-soft: rgba(255, 116, 109, .14);
  --violet: #a997ee;
  --violet-soft: rgba(169, 151, 238, .14);
  --sidebar-width: 244px;
  font-family: "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); padding: 27px 18px 20px; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border-soft); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; background: var(--green); color: #092319; border-radius: 7px; }
.brand-mark svg { width: 21px; height: 21px; stroke-width: 2.2; }
.brand div { display: flex; flex-direction: column; gap: 1px; }
.brand strong { font-size: 18px; line-height: 1; }
.brand span:last-child { color: var(--muted); font-size: 10px; }
.main-nav { display: grid; gap: 5px; margin-top: 42px; }
.nav-link { width: 100%; min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; transition: .18s ease; }
.nav-link:hover { color: var(--text); background: var(--surface-raised); }
.nav-link.active { color: var(--text); background: #252c2f; box-shadow: inset 3px 0 var(--green); }
.nav-link.active svg { color: var(--green); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 14px; }
.secure-note { padding: 13px; display: flex; gap: 10px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--surface-soft); }
.secure-note svg { flex: 0 0 auto; color: var(--green); }
.secure-note div { display: grid; gap: 4px; }
.secure-note strong { font-size: 10px; line-height: 1.4; }
.secure-note span { color: var(--faint); font-size: 9px; line-height: 1.5; }
.logout { font-size: 12px; }
.main-area { min-height: 100vh; margin-left: var(--sidebar-width); }
.page-wrap { width: min(1520px, 100%); margin: 0 auto; padding: 38px 42px 56px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--green); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.page-header h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); line-height: 1.15; font-weight: 600; }
.page-header p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.button { min-height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 700; transition: .18s ease; white-space: nowrap; }
.button.primary { background: var(--green); color: #08251a; }
.button.primary:hover { background: #54e0b1; transform: translateY(-1px); }
.button.secondary, .button.quiet { background: var(--surface-raised); border-color: var(--border); color: var(--text); }
.button.secondary:hover, .button.quiet:hover { border-color: #465159; }
.icon-button { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-raised); color: var(--muted); cursor: pointer; transition: .18s ease; }
.icon-button:hover { color: var(--text); border-color: #4b565d; }
.icon-button.accent { background: var(--green); color: #092319; border-color: var(--green); }
.icon-button.danger:hover { color: var(--coral); border-color: rgba(255,116,109,.45); background: var(--coral-soft); }

.metric-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--surface); }
.metric { min-height: 112px; padding: 22px 24px; display: flex; align-items: center; gap: 15px; border-right: 1px solid var(--border); }
.metric:last-child { border-right: 0; }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric > div:not(.progress-ring) { display: grid; gap: 4px; }
.metric span:not(.metric-icon) { color: var(--muted); font-size: 10px; }
.metric strong { font-size: 21px; font-weight: 600; }
.metric small { color: var(--faint); font-size: 9px; }
.danger-text { color: var(--coral); font-weight: 600; }
.progress-ring { --progress: 0; width: 54px; height: 54px; flex: 0 0 54px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--progress) * 1%), #30373a 0); }
.progress-ring::before { content: ""; position: absolute; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); }
.progress-ring span { position: relative; z-index: 1; color: var(--text) !important; font-size: 9px !important; font-weight: 700; }

.planner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.calendar-panel, .upcoming-panel, .payment-table-wrap { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); overflow: hidden; }
.calendar-toolbar { height: 64px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.month-control { display: flex; align-items: center; gap: 14px; }
.month-control strong { min-width: 142px; text-align: center; font-size: 13px; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); height: 36px; align-items: center; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.weekdays span { color: var(--faint); font-size: 9px; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day { min-width: 0; min-height: 125px; position: relative; padding: 10px 8px 8px; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); transition: background .15s ease; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:nth-last-child(-n+7) { border-bottom: 0; }
.calendar-day:hover { background: #1f2528; }
.calendar-day.muted { background: #171b1d; }
.calendar-day.muted > header, .calendar-day.muted .day-payments { opacity: .38; }
.calendar-day > header { height: 22px; display: flex; align-items: center; justify-content: space-between; }
.calendar-day > header > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 700; }
.calendar-day.today > header > span { background: var(--green); color: #08251a; }
.calendar-day header small { color: var(--green); font-size: 8px; }
.day-payments { display: grid; gap: 4px; margin-top: 8px; }
.calendar-payment { min-width: 0; padding: 6px 7px; display: grid; gap: 2px; text-align: left; border: 0; border-left: 2px solid currentColor; border-radius: 3px; background: var(--surface-raised); cursor: pointer; }
.calendar-payment span { min-width: 0; overflow: hidden; color: var(--text); font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.calendar-payment b { color: currentColor; font-size: 8px; font-weight: 700; }
.calendar-payment.paid { opacity: .48; }
.calendar-payment.cyan, .category-icon.cyan, .category-dot.cyan { color: var(--cyan); }
.calendar-payment.violet, .category-icon.violet, .category-dot.violet { color: var(--violet); }
.calendar-payment.amber, .category-icon.amber, .category-dot.amber { color: var(--amber); }
.calendar-payment.green, .category-icon.green, .category-dot.green { color: var(--green); }
.calendar-payment.coral, .category-icon.coral, .category-dot.coral { color: var(--coral); }
.more-payments { color: var(--muted); font-size: 8px; }
.day-add { width: 23px; height: 23px; display: none; place-items: center; position: absolute; right: 6px; bottom: 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-raised); color: var(--muted); cursor: pointer; }
.day-add svg { width: 13px; height: 13px; }
.calendar-day:hover .day-add { display: grid; }

.upcoming-panel { padding: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading a { color: var(--muted); }
.upcoming-list { display: grid; }
.upcoming-item { min-width: 0; padding: 13px 0; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 29px; gap: 10px; align-items: center; border-bottom: 1px solid var(--border-soft); }
.upcoming-item:last-child { border-bottom: 0; }
.date-tile { width: 38px; height: 42px; display: grid; place-content: center; gap: 1px; text-align: center; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-soft); }
.date-tile strong { font-size: 13px; }
.date-tile span { color: var(--faint); font-size: 7px; text-transform: uppercase; }
.date-tile.today { border-color: var(--green); background: var(--green-soft); }
.upcoming-copy { min-width: 0; display: grid; gap: 4px; }
.upcoming-copy strong { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.upcoming-copy span, .category-label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.category-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; }
.upcoming-item > b { font-size: 9px; white-space: nowrap; }
.check-button { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer; }
.check-button:hover { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.check-button svg { width: 13px; height: 13px; }
.empty-state { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; color: var(--muted); }
.empty-state > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.empty-state strong { color: var(--text); font-size: 12px; }
.empty-state p { margin: 0; font-size: 9px; }
.mobile-agenda, .mobile-header { display: none; }

.list-summary { min-height: 78px; margin-bottom: 18px; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.list-summary > div { min-width: 180px; padding: 0 24px; display: grid; gap: 5px; border-right: 1px solid var(--border); }
.list-summary > div:last-child { border-right: 0; }
.list-summary span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.list-summary strong { font-size: 18px; }
.filter-bar { margin-bottom: 14px; display: grid; grid-template-columns: minmax(220px, 1fr) 180px 180px auto; gap: 9px; }
.filter-bar select, .search-field { height: 40px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.filter-bar select { padding: 0 12px; color: var(--text); }
.search-field { padding: 0 12px; display: flex; align-items: center; gap: 9px; }
.search-field svg { color: var(--faint); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.payment-table-wrap { overflow-x: auto; }
.payment-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.payment-table th { height: 40px; padding: 0 16px; color: var(--faint); background: var(--surface-soft); font-size: 8px; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.payment-table td { height: 68px; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); }
.payment-table tr:last-child td { border-bottom: 0; }
.payment-table td > strong { display: block; font-size: 10px; }
.payment-table td > small { color: var(--faint); font-size: 8px; }
.payment-name { width: 100%; min-width: 210px; padding: 0; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.payment-name > span:last-child { min-width: 0; display: grid; gap: 4px; }
.payment-name strong { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.payment-name small { overflow: hidden; color: var(--faint); font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.category-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 6px; background: color-mix(in srgb, currentColor 12%, transparent); }
.category-icon svg { width: 16px; height: 16px; }
.status-badge { width: fit-content; padding: 5px 8px; display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; font-size: 8px; font-weight: 700; }
.status-badge svg { width: 11px; height: 11px; }
.status-badge.paid { color: var(--green); background: var(--green-soft); }
.status-badge.pending { color: var(--amber); background: var(--amber-soft); }
.status-badge.overdue { color: var(--coral); background: var(--coral-soft); }
.row-actions { display: flex; gap: 5px; }
.row-actions form { margin: 0; }
.row-actions .icon-button { width: 30px; height: 30px; }
.row-actions svg { width: 14px; height: 14px; }
.table-empty { min-height: 250px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.payment-dialog { width: min(550px, calc(100vw - 28px)); padding: 26px; border: 1px solid #3c464b; border-radius: 8px; background: #1c2124; color: var(--text); box-shadow: 0 28px 90px rgba(0,0,0,.6); }
.payment-dialog::backdrop { background: rgba(4, 7, 8, .74); backdrop-filter: blur(5px); }
.dialog-close-form { position: absolute; top: 18px; right: 18px; }
.dialog-heading { margin-bottom: 22px; padding-right: 42px; }
.dialog-heading h2 { margin: 0; font-size: 23px; }
.dialog-heading p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.payment-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field.full, .dialog-actions.full { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 9px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 10px 12px; outline: 0; border: 1px solid var(--border); border-radius: 6px; background: #15191b; color: var(--text); resize: vertical; transition: border .16s ease; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dialog-actions { margin-top: 5px; display: flex; justify-content: flex-end; gap: 8px; }

.login-body { overflow-x: hidden; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.login-intro { min-height: 100vh; position: relative; padding: 42px clamp(38px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: #14191b; border-right: 1px solid var(--border); }
.login-intro::after { content: ""; width: 620px; height: 620px; position: absolute; right: -260px; bottom: -300px; border: 1px solid #2b3539; border-radius: 50%; box-shadow: 0 0 0 90px rgba(48,58,62,.12), 0 0 0 180px rgba(48,58,62,.07); }
.login-brand { padding: 0; position: relative; z-index: 1; }
.intro-copy { position: relative; z-index: 1; max-width: 650px; margin: auto 0; padding: 60px 0; }
.intro-copy h1 { margin: 0; font-size: clamp(44px, 6vw, 78px); line-height: 1.03; font-weight: 500; }
.intro-copy p { max-width: 500px; margin: 24px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.login-preview { position: relative; z-index: 1; max-width: 530px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview-line { min-width: 0; padding: 13px; display: grid; grid-template-columns: 38px minmax(0,1fr) 8px; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 7px; background: rgba(28,33,36,.86); }
.preview-date { width: 36px; height: 38px; display: grid; place-items: center; border-radius: 5px; background: var(--surface-raised); font-weight: 700; }
.preview-line div { min-width: 0; display: grid; gap: 4px; }
.preview-line strong, .preview-line div span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.preview-line strong { font-size: 9px; }
.preview-line div span { color: var(--muted); font-size: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.amber { color: var(--amber); }.status-dot.cyan { color: var(--cyan); }
.login-panel { min-height: 100vh; padding: 40px; display: grid; place-items: center; background: var(--bg); }
.login-form { width: min(380px, 100%); display: grid; gap: 19px; }
.login-form h2 { margin: 0; font-size: 29px; font-weight: 600; }
.login-form p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; top: 50%; left: 13px; width: 15px; height: 15px; color: var(--faint); transform: translateY(-50%); }
.input-with-icon input { padding-left: 39px; }
.login-button { width: 100%; margin-top: 3px; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font-size: 8px; }
.login-footnote svg { width: 13px; height: 13px; color: var(--green); }
.form-error { padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,116,109,.3); border-radius: 6px; background: var(--coral-soft); color: #ff9d98; font-size: 10px; }
.form-error svg { width: 15px; height: 15px; }
.mobile-header { height: 58px; padding: 0 14px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--sidebar); }
.brand.compact { padding: 0; gap: 7px; }.brand.compact .brand-mark { width: 29px; height: 29px; flex-basis: 29px; }.brand.compact .brand-mark svg { width: 16px; height: 16px; }.brand.compact strong { font-size: 15px; }
.sidebar-scrim { display: none; }

@media (max-width: 1180px) {
  .planner-layout { grid-template-columns: 1fr; }
  .upcoming-panel { padding: 20px 24px; }
  .upcoming-list { grid-template-columns: 1fr 1fr; gap: 0 24px; }
}

@media (max-width: 840px) {
  :root { --sidebar-width: 226px; }
  .mobile-header { display: flex; }
  .sidebar { transform: translateX(-102%); box-shadow: 20px 0 60px rgba(0,0,0,.45); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.62); }
  .sidebar-scrim.visible { display: block; }
  .main-area { margin-left: 0; }
  .page-wrap { padding: 25px 18px 40px; }
  .desktop-add { display: none; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  .filter-bar { grid-template-columns: 1fr 1fr; }.search-field { grid-column: 1/-1; }
}

@media (max-width: 620px) {
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 27px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric { min-height: 92px; padding: 17px; border-right: 0; border-bottom: 1px solid var(--border); }
  .metric:nth-child(3) { grid-column: auto; border-top: 0; border-bottom: 0; }
  .calendar-panel, .upcoming-panel { display: none; }
  .mobile-agenda { display: block; }
  .mobile-agenda .section-heading { margin-top: 25px; }
  .agenda-row { min-width: 0; min-height: 66px; padding: 10px 0; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: center; border-bottom: 1px solid var(--border-soft); }
  .agenda-row > div:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
  .agenda-row > div:nth-child(2) strong { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
  .agenda-row > div:nth-child(2) span { color: var(--muted); font-size: 8px; }
  .agenda-row > b { font-size: 9px; white-space: nowrap; }
  .upcoming-list { grid-template-columns: 1fr; }
  .list-summary { overflow-x: auto; }.list-summary > div { min-width: 145px; padding: 0 17px; }
  .filter-bar { grid-template-columns: 1fr; }.search-field { grid-column: auto; }
  .payment-form { grid-template-columns: 1fr; }.field.full, .dialog-actions.full { grid-column: auto; }
  .payment-dialog { padding: 22px 18px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .login-panel { min-height: 100svh; padding: 28px 22px; }
}

