/* ==========================================================================
   Sugilanon — Photography & Videography Management Dashboard
   One shared stylesheet. Theme colors are CSS variables that the
   Settings → Appearance page changes at runtime (see js/app.js).
   ========================================================================== */

:root {
  --primary: #2F5D62;
  --primary-600: #244a4e;
  --primary-50: #e9f0f0;
  --primary-100: #d2e1e2;
  --accent: #C08A5B;
  --accent-50: #f7efe7;

  --bg: #F5F6F4;
  --surface: #FFFFFF;
  --surface-2: #F9FAF8;
  --border: #E4E7E3;
  --border-soft: #EEF0ED;
  --text: #1F2A2C;
  --text-2: #5D6B6E;
  --text-3: #8A9699;

  --sidebar-bg: #1C2B2D;
  --sidebar-text: #B8C6C7;
  --sidebar-active: rgba(255, 255, 255, .09);
  --sidebar-strong: #FFFFFF;

  --ok: #2E9B6A;
  --warn: #D9A23B;
  --danger: #C2524A;
  --info: #2F7DD1;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 30, 32, .05), 0 4px 16px rgba(20, 30, 32, .05);
  --shadow-lg: 0 18px 50px rgba(20, 30, 32, .22);
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --sidebar-w: 248px;
}

/* Dark mode (Settings → Appearance) */
:root[data-mode="dark"] {
  --bg: #121819;
  --surface: #1A2224;
  --surface-2: #1F282A;
  --border: #2C383A;
  --border-soft: #253032;
  --text: #E6ECEC;
  --text-2: #A8B5B7;
  --text-3: #7D8B8D;
  --primary-50: rgba(255, 255, 255, .06);
  --primary-100: rgba(255, 255, 255, .1);
  --accent-50: rgba(255, 255, 255, .06);
  --sidebar-bg: #0E1415;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
/* Light sidebar option */
:root[data-sidebar="light"] {
  --sidebar-bg: var(--surface);
  --sidebar-text: var(--text-2);
  --sidebar-active: var(--primary-50);
  --sidebar-strong: var(--primary);
}
:root[data-radius="square"] { --radius: 6px; --radius-sm: 5px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; line-height: 1.5; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary); }
button { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.right { text-align: right; }
.mt { margin-top: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 40; overflow-y: auto;
  border-right: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; text-decoration: none; color: var(--sidebar-strong); }
.brand-wrap { position: relative; }
.brand-wrap .brand { padding-right: 44px; }
.brand-edit { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); color: var(--sidebar-text); opacity: .55; }
.brand-edit:hover, .brand-edit:focus-visible { opacity: 1; color: var(--sidebar-strong); }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 15.5px; line-height: 1.15; }
.brand-sub { font-size: 11.5px; opacity: .7; color: var(--sidebar-text); }
.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--sidebar-text); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--sidebar-active); color: var(--sidebar-strong); }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-strong); box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; font-size: 12px; }
.sync-pill { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--sidebar-active); }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.sync-pill.online .dot { background: var(--ok); }
.sync-pill.error .dot { background: var(--danger); }
.user-chip { display: flex; align-items: center; gap: 9px; margin-top: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-100); color: var(--primary); font-weight: 700; font-size: 12px; flex: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; margin-left: var(--sidebar-w);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .menu-btn { display: none; }
.topbar-title { font-weight: 700; font-size: 16px; }
.global-search { position: relative; margin-left: auto; width: min(360px, 40vw); }
.global-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); font: inherit; }
.global-search .icon { position: absolute; left: 12px; top: 10px; color: var(--text-3); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 380px; overflow-y: auto; padding: 6px; }
.search-results button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; }
.search-results button:hover, .search-results button:focus { background: var(--primary-50); }
.search-results .kind { font-size: 11px; color: var(--text-3); margin-left: auto; }

.main { margin-left: var(--sidebar-w); padding: 24px 28px 60px; max-width: calc(1360px + var(--sidebar-w)); }
.page-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 25px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backdrop { display: none; }
.demo-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 11px 16px; border-radius: var(--radius); background: var(--accent-50); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); margin-bottom: 18px; font-size: 13.5px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-title { font-size: 16px; }
.card-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stats-6 .stat { padding: 14px; } .stats-6 .stat-icon { display: none; } .stats-6 .stat-value { font-size: 19px; } }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .span-2 { grid-column: auto; } }

.stat { display: flex; gap: 13px; align-items: flex-start; padding: 17px 18px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--primary-100); }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.stat-icon.accent { background: var(--accent-50); color: var(--accent); }
.stat-icon.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.stat-icon.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.stat-icon.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.quick button { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; font-weight: 600; text-align: left; }
.quick button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--border-soft); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item.clickable { cursor: pointer; border-radius: var(--radius-sm); }
.list-item.clickable:hover { background: var(--surface-2); }
.date-chip { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--primary-50); color: var(--primary); padding: 5px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 17px; }
.date-chip span { font-size: 10.5px; text-transform: uppercase; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-50); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { min-height: 31px; padding: 0 11px; font-size: 12.5px; }
.icon-btn { width: 32px; min-height: 32px; padding: 0; }
.icon-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-soft); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, transparent); border-color: transparent; }
.badge.warn { color: #a87713; background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: transparent; }
.badge.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, transparent); border-color: transparent; }
.badge.info { color: var(--info); background: color-mix(in srgb, var(--info) 11%, transparent); border-color: transparent; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--primary-50); color: var(--primary); font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; }
.conflict { color: var(--danger); display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .field-label { font-size: 12.5px; font-weight: 700; color: var(--text); }
.field .req { color: var(--danger); }
.field .help { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--danger); font-weight: 600; }
.input, .field input:not([type=checkbox]):not([type=color]):not([type=file]), .field select, .field textarea, .toolbar select, .toolbar input {
  width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.field textarea { min-height: 80px; padding: 9px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .toolbar select:focus, .toolbar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field input[type=color] { width: 54px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; background: var(--surface); cursor: pointer; }
.prefix { position: relative; }
.prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 700; pointer-events: none; }
.field .prefix input { padding-left: 28px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; }
.checks .check small { color: var(--text-3); margin-left: 4px; }
.checks .busy { color: var(--danger); font-size: 11.5px; font-weight: 700; }
.form-section { grid-column: 1 / -1; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 800; padding-top: 6px; border-top: 1px solid var(--border-soft); margin-top: 4px; }
.calc-box { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--primary-50); }
.calc-box div span { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.calc-box div b { font-size: 16px; }
.warn-box { grid-column: 1 / -1; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 9%, transparent); color: var(--danger); font-weight: 600; font-size: 13px; }

/* ---------- Toolbar, tables, pagination ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 140px; }
.toolbar .search { position: relative; flex: 1 1 220px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 11px; color: var(--text-3); width: 17px; height: 17px; }
.toolbar .search input { padding-left: 36px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); font-weight: 700; background: var(--surface-2); padding: 11px 12px; white-space: nowrap; border-bottom: 1px solid var(--border-soft); }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .arrow { font-size: 10px; margin-left: 3px; }
.table td { padding: 11px 12px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .act { text-align: right; white-space: nowrap; width: 1%; }
.table tfoot td { font-weight: 800; background: var(--surface-2); }
.card .table-wrap { box-shadow: none; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text-2); }
.pager .row { gap: 6px; }

.empty { text-align: center; padding: 40px 18px; color: var(--text-2); }
.empty .empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.empty .empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Modal & drawer ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100vw - 20px)); max-height: calc(100vh - 20px); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); overflow: hidden; }
dialog.modal.small { width: min(430px, calc(100vw - 20px)); }
dialog.modal.wide { width: min(900px, calc(100vw - 20px)); }
dialog.modal::backdrop, dialog.drawer::backdrop { background: rgba(15, 22, 24, .45); }
dialog.modal > form, dialog.modal > .modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 20px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 13px 20px; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.confirm-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); margin-bottom: 12px; }

dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); border: 0; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.drawer[open] { display: flex; flex-direction: column; animation: slide-in .22s ease; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.drawer .modal-body { flex: 1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.section-title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 800; margin: 20px 0 10px; }
.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-row div { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.money-row span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.money-row b { font-size: 16px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 380px; padding: 11px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: toast-in .2s ease; }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 99px; background: var(--border-soft); overflow: hidden; min-width: 70px; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { font-size: 19px; min-width: 190px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); text-align: center; }
.cal-day { min-height: 112px; padding: 6px; border-top: 1px solid var(--border-soft); border-left: 1px solid var(--border-soft); cursor: pointer; min-width: 0; }
.cal-day:nth-child(7n + 1) { border-left: 0; }
.cal-day.other { background: var(--surface-2); color: var(--text-3); }
.cal-day.today .num { background: var(--primary); color: #fff; }
.cal-day:hover { background: var(--primary-50); }
.cal-day .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12.5px; font-weight: 700; }
.cal-day .warn-dot { float: right; color: var(--danger); }
.ev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--c, var(--primary)); background: color-mix(in srgb, var(--c, var(--primary)) 12%, var(--surface)); color: var(--text); border-radius: 5px; padding: 2px 6px; margin-top: 3px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ev.sched { border-left-style: dashed; }
.ev.clash { box-shadow: inset 0 0 0 1px var(--danger); }
.more { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-col { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 8px; min-height: 260px; min-width: 0; }
.week-col h4 { font-size: 12.5px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.week-col.today { border-color: var(--primary); }
.week-col .ev { white-space: normal; padding: 5px 7px; }
.day-list .ev { white-space: normal; padding: 10px 12px; font-size: 13.5px; margin-top: 8px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }

/* ---------- Projects board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.board-col h3 { font-size: 13px; display: flex; align-items: center; gap: 7px; margin: 2px 4px 10px; }
.board-col h3 .n { margin-left: auto; color: var(--text-3); font-weight: 600; }
.pcard { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 11px; padding: 11px; margin-bottom: 9px; box-shadow: var(--shadow); cursor: pointer; }
.pcard:hover { border-color: var(--primary-100); }
.pcard .t { font-weight: 700; font-size: 13.5px; }
.pcard .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.pcard .late { color: var(--danger); font-weight: 700; }

/* ---------- Packages ---------- */
.pkg { display: flex; flex-direction: column; gap: 10px; }
.pkg.inactive { opacity: .6; }
.pkg-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.pkg ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.pkg-foot { display: flex; gap: 6px; align-items: center; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-soft); }

/* ---------- Editable lists (Settings) ---------- */
.edit-list { display: flex; flex-direction: column; gap: 6px; }
.edit-row { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface); }
.edit-row .name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.edit-row input[type=color] { width: 30px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.edit-row select { min-height: 30px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.logo-preview { width: 72px; height: 72px; border-radius: 16px; border: 1px dashed var(--border); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); color: var(--text-3); font-weight: 800; font-size: 24px; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

.chart-box { position: relative; height: 270px; }
.chart-box.sm { height: 220px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: min(400px, 100%); padding: 30px; }
.login-card .brand-logo { width: 54px; height: 54px; margin: 0 auto 12px; font-size: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 22, 24, .45); z-index: 30; }
  .topbar, .main { margin-left: 0; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .main { padding: 18px 16px 50px; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .global-search { width: auto; flex: 1; }
  .topbar-title { display: none; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .money-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .cal-day { min-height: 64px; padding: 3px; }
  .cal-day .ev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; background: var(--c, var(--primary)); }
  .week-grid { grid-template-columns: 1fr; }
  .week-col { min-height: 0; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .hide-sm { display: none; }
  .modal-foot .btn { flex: 1; }
}

/* ---------- Print / PDF ---------- */
@media print {
  .sidebar, .topbar, .backdrop, .toasts, .no-print, .actions, .toolbar, .pager, .demo-banner, .tabs, .act { display: none !important; }
  body { background: #fff; color: #000; }
  .main { margin: 0; padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .print-head { display: block !important; margin-bottom: 14px; }
}
.print-head { display: none; }
