/* Gannita v117 — quotation / credit-note / purchase-bill forms, monthly target, activity feed, dark mode. */

/* ---- Document modals (quotation, credit note): same premium treatment as the invoice form ---- */
.modal:has(#qt-items) > h2, .modal:has(#cn-desc) > h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.modal:has(#qt-items) .field > label, .modal:has(#cn-desc) .field > label, .modal:has(#qt-items) .item-row label, .modal:has(#cn-desc) .item-row label { text-transform: uppercase; letter-spacing: .09em; font-size: 10.5px; font-weight: 700; color: var(--muted-2); }
.modal:has(#qt-items) .grid.cols-2 { gap: 14px; }
#qt-add-item { border-style: dashed; border-width: 1.5px; background: transparent; color: var(--accent-2); width: 100%; padding: 12px; margin: 2px 0 4px; box-shadow: none; }
#qt-add-item:hover { background: var(--accent-soft); }
#qt-totals.totals, #pb-totals.totals {
  background: radial-gradient(260px 160px at 100% 0, rgba(10,132,255,.35), transparent 65%), linear-gradient(135deg, #0b1a2c, #102845 70%, #123a6b);
  color: #cfe3ff; border: 0; border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-md);
}
#qt-totals .line, #pb-totals .line { color: #a9c3e8; }
#qt-totals .line span:last-child, #pb-totals .line span:last-child { color: #fff; font-variant-numeric: tabular-nums; }
#qt-totals .grand, #pb-totals .grand { border-top: 1px solid rgba(255,255,255,.18); color: #fff; }
#qt-totals .grand span:last-child, #pb-totals .grand span:last-child { color: #fff; font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.modal:has(#qt-items) > .row:has(#qt-save), .modal:has(#cn-save) > .row:has(#cn-save) { position: sticky; bottom: -1px; z-index: 5; padding: 10px 0 2px; margin-top: 12px; background: linear-gradient(180deg, transparent, var(--panel) 32%); flex-wrap: nowrap; }
.modal:has(#qt-items) > .row:has(#qt-save) .btn, .modal:has(#cn-save) > .row:has(#cn-save) .btn { flex: 1 1 0; white-space: nowrap; padding: 12px 8px; margin: 0; }

/* ---- Monthly target ---- */
.tgt-card { margin-bottom: 14px; }
.tgt-empty { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tgt-empty h2 { margin-bottom: 6px; }
.tgt-edit { background: transparent; border: 0; color: var(--accent-2); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 2px 4px; box-shadow: none; }
.tgt-nums { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 12px; }
.tgt-nums b { font-family: var(--serif); font-weight: 600; font-size: 28px; letter-spacing: -.02em; color: var(--text); }
.tgt-nums span { color: var(--muted); font-size: 13.5px; }
.tgt-nums em { margin-left: auto; font-style: normal; font-weight: 800; font-size: 13px; color: var(--accent-2); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; }
.tgt-nums em.hit { color: #0f8a4b; background: #e5f6ec; }
.tgt-bar { height: 10px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.tgt-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0a84ff, #6bb6ff); min-width: 4px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.tgt-sub { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.tgt-sub span:first-child { font-weight: 700; color: var(--text); }

/* ---- Activity feed ---- */
.feed-card { padding-bottom: 8px; }
.feed-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); cursor: pointer; }
.feed-row:first-child { border-top: 0; }
.feed-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.feed-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feed-ic.pay { background: #e5f6ec; color: #0f8a4b; }
.feed-ic.inv { background: var(--accent-soft); color: var(--accent-2); }
.feed-ic.quo { background: #fdf1de; color: #b45309; }
.feed-mid { flex: 1; min-width: 0; }
.feed-t { font-weight: 700; font-size: 13.5px; }
.feed-s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-r { text-align: right; flex-shrink: 0; }
.feed-a { font-family: var(--serif); font-weight: 600; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.feed-a.in { color: #0f8a4b; }
.feed-w { font-size: 11.5px; color: var(--muted-2); }

/* ---- Theme toggle ---- */
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; padding: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; box-shadow: none; flex-shrink: 0; }

/* =================== DARK MODE =================== */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] {
  --bg: #070e1a; --panel: #0f1b2e; --panel-2: #132338; --panel-3: #19304d;
  --border: #1d3150; --border-strong: #2b4670;
  --text: #e6eefb; --muted: #94a8c8; --muted-2: #6f86ab;
  --accent: #3a9bff; --accent-2: #6bb6ff; --accent-soft: rgba(58,155,255,.16);
  --good-soft: rgba(22,163,74,.16); --warn-soft: rgba(217,119,6,.18); --bad-soft: rgba(220,38,38,.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 18px 36px -20px rgba(0,0,0,.7); --shadow-lg: 0 28px 60px -24px rgba(0,0,0,.85);
}
html[data-theme="dark"] body { background: radial-gradient(900px 420px at 8% -6%, rgba(10,132,255,.12), transparent 60%), radial-gradient(700px 380px at 100% 0, rgba(15,76,154,.14), transparent 55%), var(--bg) !important; }
html[data-theme="dark"] .topbar { background: rgba(7,14,26,.85); border-bottom-color: rgba(255,255,255,.06); }
html[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }
html[data-theme="dark"] .card, html[data-theme="dark"] .modal, html[data-theme="dark"] .rec-row, html[data-theme="dark"] .stat { background: var(--panel); border-color: var(--border); }
html[data-theme="dark"] .rec-row { box-shadow: none; }
html[data-theme="dark"] .rec-row:hover { border-color: rgba(58,155,255,.5); }
html[data-theme="dark"] .rec-amount, html[data-theme="dark"] .stat .n, html[data-theme="dark"] .tgt-nums b { color: var(--text); }
html[data-theme="dark"] .rec-amount-sub { color: #ff8a8f; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--muted-2); }
html[data-theme="dark"] .btn.secondary { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); box-shadow: none; }
html[data-theme="dark"] .btn.secondary:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
html[data-theme="dark"] .segment { background: var(--panel-2); box-shadow: none; }
html[data-theme="dark"] .segment button { color: var(--muted); }
html[data-theme="dark"] .segment button.active { background: var(--panel-3); color: var(--text); }
html[data-theme="dark"] tbody tr:hover td { background: var(--panel-2); }
html[data-theme="dark"] .badge.sent { background: rgba(58,155,255,.18); color: #7cc0ff; }
html[data-theme="dark"] .badge.paid { background: rgba(22,163,74,.2); color: #4ade80; }
html[data-theme="dark"] .badge.partially_paid { background: rgba(217,119,6,.22); color: #fbbf24; }
html[data-theme="dark"] .badge.overdue { background: rgba(220,38,38,.22); color: #ff8a8f; }
html[data-theme="dark"] .badge.draft, html[data-theme="dark"] .badge.void { background: var(--panel-3); color: var(--muted); }
html[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.65); }
html[data-theme="dark"] .item-row { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border-color: var(--border); }
html[data-theme="dark"] .item-row .del { background: var(--panel-2); border-color: var(--border-strong); color: var(--muted); }
html[data-theme="dark"] .item-row .it-total { color: var(--text); }
html[data-theme="dark"] .totals { background: var(--panel-2); border-color: var(--border); }
html[data-theme="dark"] #totals-preview.totals, html[data-theme="dark"] #qt-totals.totals, html[data-theme="dark"] #pb-totals.totals { background: radial-gradient(260px 160px at 100% 0, rgba(10,132,255,.35), transparent 65%), linear-gradient(135deg, #0a1626, #0f2442 70%, #123a6b); }
html[data-theme="dark"] .card:has(#save-draft) .row:has(#save-draft) { background: rgba(15,27,46,.92); border-color: var(--border); }
html[data-theme="dark"] .share-quick button { background: var(--panel-2); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .more-sheet-list button { color: var(--text); border-bottom-color: var(--border); }
html[data-theme="dark"] .more-sheet-list button:active { background: var(--panel-2); }
html[data-theme="dark"] .searchable-select .ss-list, html[data-theme="dark"] .ss-menu, html[data-theme="dark"] .ss-dropdown { background: var(--panel-2); border-color: var(--border-strong); color: var(--text); }
html[data-theme="dark"] .feed-ic.pay { background: rgba(22,163,74,.2); color: #4ade80; }
html[data-theme="dark"] .feed-ic.quo { background: rgba(217,119,6,.22); color: #fbbf24; }
html[data-theme="dark"] .feed-a.in { color: #4ade80; }
html[data-theme="dark"] .tgt-nums em.hit { background: rgba(22,163,74,.2); color: #4ade80; }
html[data-theme="dark"] .theme-toggle { background: var(--panel-2); }
html[data-theme="dark"] .plan-pill { background: var(--panel-2); color: var(--muted); border-color: var(--border); }
html[data-theme="dark"] .sidebar { background: var(--panel); }
html[data-theme="dark"] hr { border-color: var(--border); }

/* fit-fixes */
.card:has(#save-draft) .row:has(#save-draft) .btn { white-space: normal; line-height: 1.15; font-size: 13px; }
.topbar .who .theme-toggle { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
