/* India FTA & EXIM Desk - offline stylesheet (no external fonts or CDNs) */
:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1c2330; --muted: #5d6779; --line: #e2e5eb; --line2: #eef0f3;
  --brand: #0f4c81; --brand-ink: #fff; --accent: #0f766e; --accent-soft: #e6f4f1;
  --ok: #157347; --ok-soft: #e7f5ec; --warn: #9a6700; --warn-soft: #fff6dc; --bad: #b42318; --bad-soft: #fdecea;
  --info-soft: #eaf2fb; --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}
body.area-admin { --accent: #b45309; --accent-soft: #fdf1e3; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, code { font-family: var(--mono); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- public layout ---------- */
.pubbar { background: var(--brand); color: var(--brand-ink); }
.pubbar .in { max-width: 1180px; margin: auto; display: flex; align-items: center; gap: 22px; padding: 12px 20px; }
.brand { font-weight: 700; font-size: 16px; color: inherit; display: flex; align-items: center; gap: 9px; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 6px; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.pubbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.pubbar nav a { color: #dbe7f5; padding: 6px 10px; border-radius: 6px; }
.pubbar nav a:hover, .pubbar nav a.on { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.pubbar .acts { display: flex; gap: 8px; }
.pub { max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; }
.pubfoot { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
.pubfoot .in { max-width: 1180px; margin: auto; padding: 16px 20px; }

/* ---------- private (user/admin) shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.area-admin .side { background: #1f2430; border-color: #1f2430; color: #c9cfdb; }
.side .brand { color: var(--brand); padding: 4px 8px 12px; }
body.area-admin .side .brand { color: #fff; }
body.area-admin .side .brand .logo { background: var(--accent); color: #fff; }
.side .areatag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 2px 6px;
  border-radius: 4px; background: var(--accent-soft); color: var(--accent); margin: 0 8px 10px; }
body.area-admin .side .areatag { background: var(--accent); color: #fff; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 8px 4px; }
body.area-admin .side .grp { color: #8a93a6; }
.side a, .side button.link { display: block; width: 100%; text-align: left; padding: 6px 10px; border-radius: 6px;
  color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; }
body.area-admin .side a, body.area-admin .side button.link { color: #d7dce6; }
.side a:hover, .side button.link:hover { background: var(--line2); text-decoration: none; }
body.area-admin .side a:hover, body.area-admin .side button.link:hover { background: #2c3242; }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
body.area-admin .side a.on { background: #3a2f22; color: #fbbf72; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.content { padding: 22px 24px 40px; max-width: 1400px; }

/* ---------- components ---------- */
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > .cardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.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)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }
@media (max-width: 640px) { .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; } }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--line2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.94); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn.ghost-light:hover { background: rgba(255,255,255,.12); }
.btn.danger { color: var(--bad); border-color: #f1c4bf; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cdd2db; border-radius: 6px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[readonly] { background: var(--line2); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); margin: 0; }
.check input { width: auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; max-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.formacts { display: flex; gap: 8px; margin-top: 8px; }

table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; }
.t th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t tbody tr:hover { background: #fafbfd; }
.t tfoot td { font-weight: 650; border-top: 2px solid var(--line); background: #fafbfc; }
.t.compact th, .t.compact td { padding: 5px 8px; }
.t td.th { color: var(--muted); width: 40%; }
.tablewrap { overflow-x: auto; }
table.items td { padding: 4px; }
table.items input, table.items select { padding: 5px 6px; min-width: 60px; }
table.items .w-hsn { min-width: 110px; } table.items .w-desc { min-width: 200px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line2); color: var(--muted); white-space: nowrap; }
.badge.ok, .badge.Submitted, .badge.Paid, .badge.Fully.Realised, .badge.Active { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .badge.Draft, .badge.Partly { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge.Cancelled, .badge.Unpaid, .badge.Pending { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--brand); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b7e0c6; color: #0f5132; }
.flash.error { background: var(--bad-soft); border-color: #f5c2bd; color: #842029; }
.flash.warn { background: var(--warn-soft); border-color: #f2dc9b; color: #6b4a00; }
.flash.info { background: var(--info-soft); border-color: #c4d8f0; color: #0b3d6b; }
.alert { display: flex; gap: 10px; padding: 8px 12px; border-left: 3px solid var(--line); background: #fafbfc; margin-bottom: 6px; border-radius: 4px; }
.alert.danger { border-color: var(--bad); background: var(--bad-soft); }
.alert.warn { border-color: var(--warn); background: var(--warn-soft); }
.alert.info { border-color: var(--brand); background: var(--info-soft); }
.alert .k { font-weight: 650; min-width: 130px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px; }

/* autocomplete */
.ac-wrap { position: relative; }
.ac-list { position: absolute; z-index: 50; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(16,24,40,.14); max-height: 300px; overflow-y: auto; min-width: 380px; }
.ac-item { padding: 7px 10px; cursor: pointer; display: flex; gap: 10px; }
.ac-item:hover, .ac-item.on { background: var(--accent-soft); }
.ac-item .c { font-family: var(--mono); font-weight: 600; min-width: 80px; }

/* home / calculator */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; margin: 8px 0 24px; }
.hero h1 { font-size: 30px; line-height: 1.2; margin-bottom: 10px; }
.hero .lead { font-size: 16px; color: var(--muted); }
.hero .stats { display: flex; gap: 28px; margin-top: 16px; }
.hero .stats b { display: block; font-size: 22px; }
.receipt { background: #1f2430; color: #e7eaf0; border-radius: 10px; padding: 18px 20px; font-family: var(--mono); font-size: 13px; box-shadow: var(--shadow); }
.receipt .row { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt .tot { border-top: 1px dashed #59617a; margin-top: 6px; padding-top: 6px; font-weight: 700; color: #fff; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.calc { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .calc { grid-template-columns: 1fr; } }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare .col { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.compare .col.applied { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.compare .col .ttl { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 650; }
.line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.line:last-child { border-bottom: 0; }
.line.big { font-size: 16px; font-weight: 700; border-top: 2px solid var(--line); padding-top: 6px; }
.saving { background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: 10px 14px; font-weight: 600; margin: 12px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.progress { height: 8px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }

/* login */
.loginpage { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #0f4c81 0%, #0b3157 100%); padding: 20px; }
.loginpage.admin { background: linear-gradient(160deg, #262b38 0%, #12151c 100%); }
.loginbox { width: 380px; max-width: 100%; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.loginbox .tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 3px 8px; border-radius: 4px; background: var(--info-soft); color: var(--brand); margin-bottom: 10px; }
.loginpage.admin .loginbox .tag { background: #fdf1e3; color: #b45309; }
.loginbox .switch { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* calculator tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 8px 0 16px; scroll-margin-top: 16px; }
.tab { font: inherit; font-weight: 600; padding: 10px 18px; border: 1px solid transparent; border-bottom: 0; background: none;
  color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; margin-bottom: -2px; }
.tab:hover { color: var(--ink); }
.tab.on { background: #fff; color: var(--brand); border-color: var(--line); border-bottom: 2px solid #fff; }
.tabpane[hidden] { display: none; }

/* menus, inline add rows */
details.menu { position: relative; display: inline-block; }
details.menu > summary, details.addrow > summary { list-style: none; }
details.menu > summary::-webkit-details-marker, details.addrow > summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; right: 0; top: 110%; z-index: 20; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(16,24,40,.14); min-width: 220px; padding: 4px; }
details.menu .menu-list a { display: block; padding: 7px 10px; border-radius: 4px; color: var(--ink); }
details.menu .menu-list a:hover { background: var(--line2); text-decoration: none; }
details.addrow { margin-top: 10px; }
td.bad { color: var(--bad); font-weight: 600; }

/* print */
.printdoc { max-width: 900px; margin: 20px auto; background: #fff; padding: 28px; border: 1px solid var(--line); }
.printdoc h1 { font-size: 18px; }
.printdoc .t th, .printdoc .t td { border: 1px solid #c9ced8; padding: 5px 7px; font-size: 12px; }
.printbar { max-width: 900px; margin: 14px auto 0; display: flex; gap: 8px; }
@media print {
  .printbar, .pubbar, .side, .topbar, .noprint { display: none !important; }
  body { background: #fff; }
  .printdoc { border: 0; margin: 0; padding: 0; max-width: none; }
}
