/* ---------- INDBUY Books: app look ---------- */
:root {
  --bg:#f4f6fb; --card:#fff; --ink:#0f172a; --ink2:#334155; --muted:#64748b; --line:#e6e9f0; --line2:#eef1f6;
  --brand:#4f46e5; --brand2:#6366f1; --brand-soft:#eef0ff; --brand-ink:#fff;
  --side:#0e1530; --side2:#161f42; --side-ink:#aab3d4;
  --neg:#dc2626; --neg-soft:#fef2f2; --pos:#059669; --pos-soft:#ecfdf5; --warn:#fffbeb; --amber:#d97706;
  --shadow:0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05); --r:14px;
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:14px/1.5 Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color:var(--ink); background:var(--bg); font-feature-settings:"tnum" 1, "cv11" 1; }
a { color:var(--brand); text-decoration:none; } a:hover { color:#3730a3; }
svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:none; }

/* sidebar */
body.app { padding-left:248px; }
.side { position:fixed; inset:0 auto 0 0; width:248px; background:linear-gradient(180deg,var(--side) 0%,#121a3a 100%); color:var(--side-ink); display:flex; flex-direction:column; padding:18px 14px; z-index:30; }
.side .brand { display:flex; align-items:center; gap:11px; padding:4px 8px 20px; color:#fff; }
.side .brand img { width:38px; height:38px; border-radius:10px; background:#fff; object-fit:contain; padding:3px; }
.side .brand .mark { width:38px; height:38px; border-radius:10px; display:grid; place-items:center; font-weight:700; background:linear-gradient(135deg,#6366f1,#22d3ee); color:#fff; }
.side .brand b { display:block; font-size:15px; letter-spacing:.2px; line-height:1.2; }
.side .brand small { color:#7f89b3; font-size:12px; }
.side nav { display:flex; flex-direction:column; gap:2px; flex:1; overflow-y:auto; }
.side nav a { display:flex; align-items:center; gap:12px; padding:9px 12px; border-radius:10px; color:var(--side-ink); font-weight:500; transition:background .15s,color .15s; }
.side nav a:hover { background:var(--side2); color:#fff; }
.side nav a.on { background:linear-gradient(90deg,rgba(99,102,241,.95),rgba(99,102,241,.75)); color:#fff; box-shadow:0 6px 18px rgba(79,70,229,.35); }
.side .who { display:flex; align-items:center; gap:10px; padding:12px 8px 2px; border-top:1px solid rgba(255,255,255,.07); margin-top:10px; }
.side .avatar { width:34px; height:34px; border-radius:50%; background:#26305a; color:#c7d0f5; display:grid; place-items:center; font-size:12px; font-weight:600; }
.side .nm { flex:1; min-width:0; } .side .nm b { display:block; color:#e6e9f7; font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .side .nm small { font-size:11.5px; }
.side .who .link { color:#7f89b3; padding:6px; border-radius:8px; } .side .who .link:hover { color:#fff; background:var(--side2); }
.mtop, .scrim { display:none; }

main { max-width:1240px; margin:0 auto; padding:28px 32px 48px; }
body.guest main { max-width:none; padding:0; }

/* type */
h1 { font-size:24px; font-weight:700; letter-spacing:-.4px; margin:4px 0 18px; display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
h1 .small { font-size:13px; font-weight:500; background:var(--brand-soft); color:var(--brand); padding:2px 10px; border-radius:99px; letter-spacing:0; }
h2 { font-size:16px; font-weight:650; margin:28px 0 12px; letter-spacing:-.2px; } h3 { font-size:14.5px; font-weight:600; margin:18px 0 8px; }
.muted { color:var(--muted); } .small { font-size:12.5px; } .neg { color:var(--neg); } .pos { color:var(--pos); } .r { text-align:right; } .mt { margin-top:16px; }
.strike td { text-decoration:line-through; opacity:.6; }
.row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; } .between { justify-content:space-between; }
.row.between { margin-bottom:6px; } .row.between > h1 { margin-bottom:12px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.narrow { max-width:760px; }
.stack > * { display:block; margin-bottom:12px; }

/* cards */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:22px; margin-bottom:18px; box-shadow:var(--shadow); }
.grid2,.grid3,.grid4 { display:grid; gap:12px 16px; } .grid2 { grid-template-columns:repeat(2,1fr); } .grid3 { grid-template-columns:repeat(3,1fr); } .grid4 { grid-template-columns:repeat(4,1fr); }
fieldset { border:1px solid var(--line); border-radius:12px; padding:14px 18px 16px; margin:0 0 16px; background:#fbfcfe; }
legend { font-weight:600; padding:0 6px; color:var(--ink2); font-size:13px; }

/* forms */
label { display:block; font-size:12.5px; font-weight:500; color:var(--ink2); margin-bottom:10px; }
label.check { display:inline-flex; gap:8px; align-items:center; font-size:14px; font-weight:400; color:var(--ink); margin-right:16px; }
input,select,textarea { width:100%; font:inherit; color:var(--ink); padding:9px 12px; border:1px solid #d6dbe6; border-radius:10px; background:#fff; margin-top:5px; transition:border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color:#9aa4b8; }
input[type=checkbox],input[type=radio] { width:16px; height:16px; margin:0; accent-color:var(--brand); }
.seg { display:inline-flex; background:var(--line2); border:1px solid var(--line); border-radius:10px; padding:3px; gap:2px; margin:0 0 12px; }
.seg label { display:flex; align-items:center; gap:7px; margin:0; padding:7px 14px; border-radius:8px; font-size:14px; font-weight:500; color:var(--ink2); cursor:pointer; }
.seg label:has(input:checked) { background:var(--card); color:var(--brand); box-shadow:0 1px 3px rgba(15,23,42,.12); }
.seg input { position:absolute; opacity:0; pointer-events:none; }
input[type=file] { width:auto; border:1.5px dashed #c7cde0; padding:10px; background:#fafbff; border-radius:10px; }
input[type=file]::file-selector-button { font:inherit; font-weight:550; border:1px solid #d6dbe6; background:#fff; border-radius:8px; padding:6px 12px; margin-right:10px; cursor:pointer; }
input:focus,select:focus,textarea:focus { outline:none; border-color:var(--brand2); box-shadow:0 0 0 4px rgba(99,102,241,.15); }

/* buttons */
.btn { display:inline-flex; align-items:center; gap:7px; padding:9px 16px; border:1px solid #d6dbe6; background:#fff; color:var(--ink); border-radius:10px; cursor:pointer; font:inherit; font-weight:550; white-space:nowrap; transition:all .15s; box-shadow:0 1px 1px rgba(15,23,42,.04); }
.btn:hover { background:#f6f7fb; color:var(--ink); border-color:#c5cbdb; }
.btn.primary { background:linear-gradient(180deg,#5b53f0,#4f46e5); border-color:#4338ca; color:#fff; box-shadow:0 4px 12px rgba(79,70,229,.28); }
.btn.primary:hover { background:#4338ca; color:#fff; }
.btn.danger { color:var(--neg); border-color:#fecaca; background:#fff; } .btn.danger:hover { background:var(--neg-soft); }
.btn.small { padding:5px 11px; font-size:12.5px; border-radius:8px; }
button.link { background:none; border:none; color:var(--brand); cursor:pointer; padding:0; font:inherit; box-shadow:none; }
form.inline { display:inline; }

/* tables */
table { width:100%; border-collapse:separate; border-spacing:0; background:var(--card); border:1px solid var(--line); border-radius:var(--r); overflow:hidden; box-shadow:var(--shadow); }
th,td { padding:11px 14px; border-bottom:1px solid var(--line2); text-align:left; vertical-align:middle; }
th { background:#f8f9fc; font-size:11.5px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.5px; border-bottom:1px solid var(--line); }
tr:last-child td { border-bottom:none; }
table tr:not(:first-child):hover td { background:#fafbff; }
td a { font-weight:550; }
th.r { text-align:right; } tr.total td { font-weight:700; background:#f8f9fc; border-top:1px solid var(--line); } tr.h td { font-weight:700; background:var(--brand-soft); color:#312e81; }
table.items { box-shadow:none; } table.items td { padding:6px; } table.items input { margin:0; } .num { text-align:right; }
.scroll { overflow-x:auto; border-radius:var(--r); }
.nowrap { white-space:nowrap; }

/* stat tiles */
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin-bottom:8px; }
.tile { position:relative; background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:18px 18px 16px 20px; box-shadow:var(--shadow); overflow:hidden; }
.tile::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--accent,var(--brand)); }
.tile::after { content:""; position:absolute; right:-30px; top:-30px; width:96px; height:96px; border-radius:50%; background:var(--accent,var(--brand)); opacity:.07; }
.tile:nth-child(6n+1) { --accent:#6366f1; } .tile:nth-child(6n+2) { --accent:#10b981; } .tile:nth-child(6n+3) { --accent:#f59e0b; }
.tile:nth-child(6n+4) { --accent:#0ea5e9; } .tile:nth-child(6n+5) { --accent:#ec4899; } .tile:nth-child(6n+6) { --accent:#8b5cf6; }
a.tile { display:block; color:var(--ink); transition:transform .15s, box-shadow .15s; } a.tile:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(15,23,42,.08); color:var(--ink); }
.tile .k { font-size:12.5px; color:var(--muted); font-weight:500; }
.tile .v { white-space:nowrap; font-size:24px; font-weight:700; margin-top:6px; letter-spacing:-.5px; }
.tile .muted.small { margin-top:4px; }
.sum .k { font-size:12px; color:var(--muted); } .sum .v { font-size:20px; font-weight:700; padding-top:6px; }

/* pills for balances and states */
.pill { display:inline-block; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:600; }
.pill.neg { background:var(--neg-soft); color:var(--neg); } .pill.pos { background:var(--pos-soft); color:var(--pos); }
.pill.muted { background:#f1f5f9; color:var(--muted); } .pill.brand { background:var(--brand-soft); color:var(--brand); } .pill.amber { background:#fef3c7; color:#92400e; }

/* notices */
.flash { background:var(--pos-soft); border:1px solid #a7f3d0; color:#065f46; padding:12px 16px; border-radius:12px; margin-bottom:18px; font-weight:500; }
.warn { background:var(--warn); border:1px solid #fde68a; color:#78350f; padding:12px 16px; border-radius:12px; margin-bottom:18px; }
.error { background:var(--neg-soft); border:1px solid #fecaca; color:#991b1b; padding:12px 16px; border-radius:12px; margin-bottom:12px; }

/* filters */
.filters { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin-bottom:16px; background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:12px 14px; box-shadow:var(--shadow); }
.filters input,.filters select { width:auto; margin-top:0; } .filters input[name=q] { flex:1; min-width:200px; } .filters label { margin:0; display:flex; align-items:center; gap:6px; }
.card.upload > b { display:block; font-size:15px; margin-bottom:3px; } .upload .row { margin-top:14px; } .upload select { width:auto; }

/* sign-in */
body.guest { min-height:100vh; display:grid; place-items:center; background:radial-gradient(1200px 600px at 10% -10%,#c7d2fe 0%,transparent 60%),radial-gradient(900px 500px at 110% 110%,#a5f3fc 0%,transparent 55%),#eef2ff; }
.auth { width:min(420px,calc(100vw - 32px)); margin:40px auto; padding:34px; border-radius:20px; box-shadow:0 20px 50px rgba(30,41,99,.15); }
.auth .logo { width:56px; height:56px; object-fit:contain; border-radius:14px; background:#fff; border:1px solid var(--line); padding:6px; margin-bottom:14px; }
.auth h1 { font-size:22px; margin-bottom:4px; } .auth .btn.primary { width:100%; justify-content:center; padding:11px; }

.report table { border:none; box-shadow:none; } .report td:last-child { width:200px; }
.pre { white-space:pre-line; }
tr.unmatched td { background:#fffbeb; }
table.import input[list] { min-width:220px; }
.pager { display:flex; gap:12px; align-items:center; justify-content:center; margin:18px 0; }
details > summary { cursor:pointer; font-weight:550; }
.thumb { max-height:48px; vertical-align:middle; margin:4px 8px 4px 0; border:1px solid var(--line); border-radius:6px; }

/* printed invoice wrapper */
.invoice { background:#fff; border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); margin:16px 0; }

/* phones and tablets */
@media (max-width:960px) {
  body.app { padding-left:0; }
  .side { transform:translateX(-100%); transition:transform .2s ease; }
  #navtoggle:checked ~ .side { transform:none; box-shadow:10px 0 40px rgba(0,0,0,.25); }
  #navtoggle:checked ~ .scrim { display:block; position:fixed; inset:0; background:rgba(15,23,42,.4); z-index:20; }
  .mtop { display:flex; align-items:center; gap:12px; position:sticky; top:0; z-index:10; background:var(--side); color:#fff; padding:12px 16px; }
  .mtop .burger { display:grid; place-items:center; cursor:pointer; margin:0; color:#fff; } .mtop .burger svg { width:22px; height:22px; }
  .mtop .brand-sm { color:#fff; font-weight:600; }
  main { padding:18px 16px 40px; }
  .grid2,.grid3,.grid4 { grid-template-columns:1fr; }
  .tiles { grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
  .tile .v { font-size:19px; }
  main > table { display:block; overflow-x:auto; white-space:nowrap; }
  h1 { font-size:21px; } .row.between > .actions { margin-bottom:14px; } .actions .btn { padding:7px 12px; font-size:13px; }
}

@media print {
  body, body.app { background:#fff; padding:0; } .no-print, .side, .mtop, .flash { display:none !important; } main { padding:0; max-width:none; }
  .invoice { border:none; padding:0; margin:0; box-shadow:none; border-radius:0; } table { border-color:#999; box-shadow:none; border-radius:0; } th,td { border-color:#bbb; } .card,.tile { border:none; padding:0; box-shadow:none; }
}
/* INDBUY export invoice, matching the company's existing format */
.ib { color: #111; font-size: 12px; padding: 22px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-feature-settings: normal; }
.ib .pre { white-space: pre-line; }
.ib-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.ib-logo { width: 80px; height: 80px; object-fit: contain; }
.ib-co { flex: 1; } .ib-co h2 { font-size: 20px; margin: 0 0 6px; }
.ib-contact { text-align: right; line-height: 1.6; }
.ib-box { border: 1px solid #1f6fb2; }
.ib-title { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid #1f6fb2; padding: 4px 6px; }
.ib-h { font-size: 18px; font-weight: 700; color: #1f6fb2; letter-spacing: .5px; text-align: center; }
.ib-orig { text-align: right; font-weight: 700; font-size: 11px; }
.ib-lut { text-align: center; font-weight: 700; font-size: 11px; border-bottom: 1px solid #1f6fb2; padding: 3px; }
.ib-parties { display: grid; grid-template-columns: 1fr 1fr 0.8fr; border-bottom: 1px solid #1f6fb2; }
.ib-parties > div { border-right: 1px solid #1f6fb2; }
.ib-parties > div:last-child { border-right: none; }
.ib-parties table { border: none; border-radius: 0; }
.ib table { width: 100%; border-collapse: collapse; background: transparent; border-radius: 0; box-shadow: none; overflow: visible; }
.ib th { text-transform: none; letter-spacing: 0; } .ib td, .ib th { vertical-align: top; } .ib tr:hover td { background: inherit; } .ib td a { font-weight: inherit; }
.ib-kv th { background: transparent; text-align: center; font-size: 11px; color: #111; border-bottom: 1px solid #1f6fb2; padding: 3px; }
.ib-kv td { border: none; padding: 2px 6px; font-size: 11.5px; }
.ib-kv td:first-child { font-weight: 600; width: 32%; }
.ib-exporter { display: flex; justify-content: space-between; gap: 20px; padding: 4px 6px; border-bottom: 1px solid #1f6fb2; }
.ib-exporter .k { font-weight: 600; font-size: 11px; display: inline-block; min-width: 48px; }
.ib-exporter .big { font-size: 14px; }
.ib-lines { border: none; }
.ib-lines th { background: transparent; color: #111; font-size: 11px; text-align: center; border: 1px solid #1f6fb2; border-top: 6px solid #fff; padding: 4px; }
.ib-lines td { border-left: 1px solid #1f6fb2; border-right: 1px solid #1f6fb2; border-bottom: none; padding: 2px 6px; font-size: 11.5px; }
.ib-lines td.b { font-weight: 700; } .ib-lines td.c { text-align: center; } .ib-lines td.r { text-align: right; }
.ib-lines tr td:last-child { background: #e8f2fb; }
.ib-lines tr.spacer td { height: 120px; }
.ib-lines tr.tot td { border-top: 1px solid #1f6fb2; border-bottom: 1px solid #1f6fb2; font-weight: 700; }
.ib-bottom { display: grid; grid-template-columns: 1.6fr 1fr; border-top: 6px solid #fff; }
.ib-bottom > div { border-top: 1px solid #1f6fb2; }
.ib-bottom > div:first-child { border-right: 1px solid #1f6fb2; }
.ib-sec { text-align: center; font-weight: 700; font-size: 11px; border-bottom: 1px solid #1f6fb2; padding: 3px; }
.ib-words { text-align: center; padding: 8px; border-bottom: 1px solid #1f6fb2; font-size: 11px; }
.ib-bank { border-bottom: 1px solid #1f6fb2; }
.ib-terms { padding: 4px 6px; font-size: 11px; }
.ib-total td { font-size: 13px; padding: 4px 6px; border: none; } .ib-total tr:first-child td { border-bottom: 1px solid #1f6fb2; }
.ib-cert { font-size: 10px; text-align: center; padding: 6px; border-top: 1px solid #1f6fb2; border-bottom: 1px solid #1f6fb2; margin-top: 6px; }
.ib-for { text-align: center; font-weight: 700; padding: 6px; }
.ib-sign { height: 90px; display: flex; align-items: center; justify-content: center; } .ib-sign img { max-height: 85px; max-width: 80%; }
.ib-auth { text-align: center; font-size: 10px; font-weight: 600; padding: 4px; border-top: 1px solid #1f6fb2; }
@media screen and (max-width: 700px) { .ib-parties, .ib-bottom { grid-template-columns: 1fr; } .ib-title { grid-template-columns: 1fr; text-align: center; } .ib-orig { text-align: center; } }
@media print { .ib { padding: 0; font-size: 11px; } .ib-lines tr.spacer td { height: 70px; } .ib-sign { height: 70px; } @page { size: A4; margin: 8mm; } }
.thumb { max-height: 48px; vertical-align: middle; margin: 4px 8px 4px 0; border: 1px solid var(--line); }

/* warehouse stock on the invoice form */
.stockbox { background:var(--brand-soft); border:1px solid #dfe3ff; border-radius:12px; padding:12px 14px; margin:14px 0 4px; }
.stockbox table { margin-top:8px; background:var(--card); }
.stockbox td { padding:8px 10px; }
input.from-stock { border-left:3px solid var(--brand); }
#items select.stock-pick { width:170px; }
#items [name=item_description] { min-width:190px; }
#items [name=item_hsn] { min-width:100px; }
#items [name=item_qty] { width:80px; } #items [name=item_unit] { width:64px; } #items [name=item_rate] { width:100px; }
