/* Gannita v118 — app-wide polish: forms, modals, empty states, locked features, search, reports,
   invoice detail, plans, toasts, login. Loaded last; delete the <link> to undo. */

/* ---- Form labels + inputs, everywhere ---- */
.card .field > label, .modal .field > label, .auth-card .field > label, .modal .item-row label {
  text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; font-weight: 700; color: var(--muted-2); margin-bottom: 6px;
}
.field > label .muted, .field > label span, .modal .field > label small { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; }
.field.row > label, .field > label:has(input[type=checkbox]), label[for$="restock"] { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { min-height: 46px; }
select { -webkit-appearance: none; appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238793ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
textarea { line-height: 1.45; }
.field small, .field .hint, .card p.muted { color: var(--muted); }
input[type=text][placeholder^="Search"], input:not([type])[placeholder^="Search"] {
  padding-left: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238793ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}

/* ---- Modals / bottom sheets ---- */
.modal > h2, .modal-wide > h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.modal > h2::before { display: none; }
@media (max-width: 640px) {
  .modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: -2px auto 12px; }
}
.modal .row[style*="justify-content:flex-end"] { gap: 8px; }
.modal .row[style*="justify-content:flex-end"] .btn { flex: 1 1 0; }
@media (min-width: 641px) { .modal .row[style*="justify-content:flex-end"] .btn { flex: 0 0 auto; min-width: 110px; } }

/* ---- Buttons: clearer disabled, press feedback ---- */
.btn:disabled, .btn[disabled] { filter: grayscale(.35); opacity: .5; box-shadow: none; transform: none; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.small { padding: 8px 14px; font-size: 13px; }

/* ---- Empty states (class added by enhance.js) ---- */
.empty-state { text-align: center; color: var(--muted); border: 1.5px dashed var(--border-strong); background: var(--panel-2); border-radius: 18px; padding: 30px 20px !important; margin: 10px 0; font-size: 14px; line-height: 1.5; }
.empty-state .es-ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); }
.empty-state .es-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Locked ("Gold plan") feature cards ---- */
.card[style*="text-align:center"][style*="padding:32px"] {
  background: radial-gradient(300px 200px at 100% 0, rgba(10,132,255,.4), transparent 62%), linear-gradient(135deg, #0b1a2c, #102845 70%, #123a6b) !important;
  color: #cfe3ff; border: 0; box-shadow: var(--shadow-md);
}
.card[style*="text-align:center"][style*="padding:32px"]::before { content: ""; display: block; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; background: rgba(255,255,255,.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%236bb6ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center no-repeat; }
.card[style*="text-align:center"][style*="padding:32px"] div[style*="font-weight:650"] { color: #fff; font-family: var(--serif); font-size: 19px; font-weight: 600 !important; }
.card[style*="text-align:center"][style*="padding:32px"] p { color: #a9c3e8; }
.card[style*="text-align:center"][style*="padding:32px"] .btn { background: #fff; color: #0b1a2c; box-shadow: none; }

/* ---- Reports tabs → segmented pills ---- */
.rep-tab { border-radius: 99px; background: var(--panel-2); border: 1.5px solid transparent; color: var(--muted); box-shadow: none; }
.rep-tab.active { background: linear-gradient(135deg, #1a6fe0, var(--ink-2)); color: #fff; box-shadow: 0 8px 16px -8px rgba(11,40,90,.7); }

/* ---- Invoice / quotation / bill detail ---- */
.card:has(#more-actions) > .row.between > h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.card:has(#more-actions) .rec-amount-sub { color: var(--muted); font-weight: 500; }
.card:has(#more-actions) .totals {
  background: radial-gradient(260px 160px at 100% 0, rgba(10,132,255,.3), transparent 65%), linear-gradient(135deg, #0b1a2c, #102845 70%, #123a6b);
  color: #cfe3ff; border: 0; border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-md);
}
.card:has(#more-actions) .totals .line { color: #a9c3e8; }
.card:has(#more-actions) .totals .line span:last-child { color: #fff; font-variant-numeric: tabular-nums; }
.card:has(#more-actions) .totals .grand { color: #fff; border-top: 1px solid rgba(255,255,255,.18); }
.card:has(#more-actions) .totals .grand span:last-child { color: #fff; font-family: var(--serif); font-size: 26px; font-weight: 600; }
.card:has(#more-actions) .totals .line:last-child span:last-child { color: #ffd479; font-weight: 700; }
.card:has(#more-actions) h3, .card:has(#more-actions) h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

/* ---- Section sub-headings inside cards (settings etc.) ---- */
.card h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.card h3::before { content: ""; display: inline-block; width: 3px; height: 15px; margin-right: 8px; vertical-align: -2px; border-radius: 3px; background: linear-gradient(180deg, var(--accent), var(--ink-3)); }

/* ---- Plans ---- */
.plan-card { border-radius: 22px; padding: 24px; }
.plan-card.current { border-color: transparent; background: radial-gradient(300px 200px at 100% 0, rgba(10,132,255,.35), transparent 62%), linear-gradient(135deg, #0b1a2c, #102845 70%, #123a6b); color: #cfe3ff; box-shadow: var(--shadow-md); }
.plan-card.current h2, .plan-card.current .plan-price { color: #fff; }
.plan-card.current .plan-price span { color: #8fc4ff; }
.plan-price { font-family: var(--serif); font-weight: 600; font-size: 32px; letter-spacing: -.02em; color: var(--text); }
.plan-badge { background: linear-gradient(135deg, #1a8bff, var(--ink-3)); color: #fff; border-radius: 99px; letter-spacing: .08em; text-transform: uppercase; font-size: 10px; font-weight: 800; }

/* ---- Toasts ---- */
.toast { border-radius: 16px; background: rgba(11,26,44,.96); color: #fff; border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px); }

/* ---- Tables (desktop reports, ledgers) ---- */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th { background: var(--panel-2); border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; }
th:first-child { border-top-left-radius: 12px; } th:last-child { border-top-right-radius: 12px; }
td { padding: 12px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

/* ---- Login / sign-up ---- */
.auth-wrap { background: radial-gradient(520px 320px at 50% -60px, rgba(10,132,255,.18), transparent 70%); }
.auth-card { border-radius: 26px; box-shadow: var(--shadow-lg); border-color: transparent; }
.auth-card .btn { border-radius: 14px; min-height: 50px; font-size: 15.5px; }

/* ---- Dark-mode pairings for the above ---- */
html[data-theme="dark"] .empty-state { background: var(--panel-2); border-color: var(--border-strong); }
html[data-theme="dark"] .rep-tab { background: var(--panel-2); color: var(--muted); }
html[data-theme="dark"] .rep-tab.active { color: #fff; }
html[data-theme="dark"] th { background: var(--panel-2); }
html[data-theme="dark"] .plan-card:not(.current) { background: var(--panel); }
html[data-theme="dark"] .plan-price { color: var(--text); }
html[data-theme="dark"] .plan-card.current .plan-price { color: #fff; }
html[data-theme="dark"] select { background-color: var(--panel-2); }
html[data-theme="dark"] .auth-card { background: var(--panel); }
html[data-theme="dark"] .card:has(#more-actions) .rec-amount-sub { color: var(--muted); }
*:has(> .empty-state:only-child):not(.card):not(.modal):not(body) { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 0 !important; }
html[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a8c8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
html[data-theme="dark"] input[type=text][placeholder^="Search"], html[data-theme="dark"] input:not([type])[placeholder^="Search"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a8c8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
