/* Shribhuvan Money – gold loan management */
:root {
  --bg: #f5f3ee;
  --panel: #ffffff;
  --ink: #1f2420;
  --muted: #6b716c;
  --line: #e2ded4;
  --brand: #14532d;        /* deep green */
  --brand-2: #1d6b3c;
  --gold: #b7862c;
  --gold-soft: #f6ecd6;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --ok: #18794e;
  --ok-soft: #e3f5ea;
  --info-soft: #e8f0fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 20, .06), 0 1px 1px rgba(20, 30, 20, .04);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Malayalam", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: #10301d; color: #dfe9e2; padding: 14px 10px 30px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; border-bottom: 1px solid #234a33; margin-bottom: 10px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #f3d48a, #b7862c 60%, #8a6214); color: #3b2a06; font-weight: 800;
}
.brand b { display: block; font-size: .98rem; letter-spacing: .02em; color: #fff; }
.brand span { font-size: .74rem; color: #9fbcaa; }
.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: #86a893; }
.side a.nav {
  display: block; padding: 6px 10px; border-radius: 6px; color: #dfe9e2; font-size: .93rem;
}
.side a.nav:hover { background: #1a4429; text-decoration: none; }
.side a.nav.active { background: #23593a; color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.goldpill {
  display: inline-flex; align-items: center; gap: 8px; background: var(--gold-soft); color: #5f4510;
  border: 1px solid #ead7ad; padding: 4px 10px; border-radius: 999px; font-size: .88rem;
}
.goldpill.stale { background: var(--danger-soft); color: var(--danger); border-color: #f5c2bd; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.content { padding: 20px 22px 50px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.menu-btn { display: none; }

/* ---------- panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .sub { font-size: .84rem; color: var(--muted); }
.stat.alert { border-color: #f1c58b; background: #fffaf0; }
.stat.bad { border-color: #f5c2bd; background: #fff7f6; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
table.data th, table.data td { padding: 6px 9px; border-bottom: 1px solid #eeebe3; text-align: left; vertical-align: top; }
table.data th { background: #f8f6f0; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #4f5651; position: sticky; top: 0; white-space: nowrap; }
table.data tbody tr:hover { background: #fbfaf6; }
table.data tfoot td { font-weight: 650; background: #faf8f2; border-top: 2px solid var(--line); }
table.kv td { padding: 4px 10px 4px 0; vertical-align: top; }
table.kv td:first-child { color: var(--muted); white-space: nowrap; width: 1%; }
tr.cancelled td { text-decoration: line-through; color: #9aa09b; }

/* ---------- forms ---------- */
form.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
label { display: block; font-size: .8rem; color: #4b524d; margin-bottom: 3px; font-weight: 550; }
.field { margin-bottom: 10px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cfcabd; border-radius: 6px; background: #fff; font: inherit; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc7ab; border-color: var(--brand-2); }
input[readonly] { background: #f6f5f0; }
textarea { min-height: 70px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; margin: 6px 0; }
.check input { margin-top: 3px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid #c9c4b6;
  background: #fff; color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f4f2ec; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--danger); border-color: #eab0aa; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 3px 9px; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.items-table input { padding: 5px 6px; }
.items-table td { padding: 4px; }
.items-table .x { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 1.1rem; }

/* ---------- messages / badges ---------- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; border: 1px solid; }
.flash.success { background: var(--ok-soft); border-color: #b5e2c6; color: #10512f; }
.flash.error { background: var(--danger-soft); border-color: #f2b8b2; color: #7a1a12; }
.flash.warning { background: var(--warn-soft); border-color: #f0d48b; color: #6b4a00; }
.flash.info { background: var(--info-soft); border-color: #c4d6f1; color: #1f3b66; }
.note { padding: 10px 12px; border-radius: 6px; background: var(--info-soft); border: 1px solid #c4d6f1; color: #1f3b66; font-size: .9rem; }
.note.warn { background: var(--warn-soft); border-color: #f0d48b; color: #6b4a00; }
.note.bad { background: var(--danger-soft); border-color: #f2b8b2; color: #7a1a12; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.b-Open, .b-Listed, .b-Scheduled, .b-InStock { background: var(--ok-soft); color: #10512f; border-color: #b5e2c6; }
.b-Closed, .b-Completed, .b-Redeemed { background: #eceeed; color: #444; border-color: #d6d9d7; }
.b-Renewed { background: var(--info-soft); color: #1f3b66; border-color: #c4d6f1; }
.b-Auctioned, .b-Sold { background: var(--gold-soft); color: #6a4b0e; border-color: #ead7ad; }
.b-Cancelled, .b-Withdrawn, .b-Unsold { background: var(--danger-soft); color: #7a1a12; border-color: #f2b8b2; }
.b-warn { background: var(--warn-soft); color: #6b4a00; border-color: #f0d48b; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 6px 6px 0 0; color: var(--muted); border: 1px solid transparent; border-bottom: none; }
.tabs a.on { background: var(--panel); border-color: var(--line); color: var(--ink); margin-bottom: -1px; }

.calc-box { align-self: start; background: #faf8f2; border: 1px dashed #d9d2bf; border-radius: 6px; padding: 10px 12px; }
.calc-box .big { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 0; }
.perm-grid legend { font-weight: 650; font-size: .9rem; padding: 0 4px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #10301d, #1d6b3c); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 250px; left: -260px; transition: left .2s; }
  .side.open { left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: 14px 12px 40px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}

/* ---------- print ---------- */
.print-page { background: #fff; max-width: 820px; margin: 0 auto; padding: 22px 26px; color: #000; }
.print-toolbar { max-width: 820px; margin: 12px auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ph { text-align: center; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
.ph b { font-size: 1.35rem; letter-spacing: .04em; display: block; }
.ph .s { font-size: .85rem; }
.pt { border-collapse: collapse; width: 100%; }
.pt th, .pt td { border: 1px solid #333; padding: 4px 6px; font-size: .88rem; }
.pt th { background: #eee; }
.sig { display: flex; justify-content: space-between; margin-top: 46px; font-size: .9rem; }
.cut { border-top: 1px dashed #777; margin: 26px 0; position: relative; }
.ml { font-family: "Noto Sans Malayalam", "Kartika", "Manjari", sans-serif; line-height: 1.75; text-align: justify; }
.page-break { page-break-after: always; break-after: page; }
@media print {
  body { background: #fff; }
  .no-print, .side, .topbar, .print-toolbar, .flash { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .print-page { padding: 0; max-width: none; }
  @page { size: A4; margin: 12mm; }
}
