/* Boiddo HMS - main stylesheet */
:root {
  --brand: #006a4e;
  --brand-600: #005a42;
  --brand-50: #e8f3ef;
  --brand-100: #cfe7de;
  --accent: #f42a41;
  --ink: #17221d;
  --ink-2: #44524b;
  --muted: #74837c;
  --line: #e2e8e5;
  --line-2: #eef2f0;
  --bg: #f4f7f5;
  --card: #ffffff;
  --green: #0f8a5f; --green-bg: #e3f5ec;
  --amber: #a86400; --amber-bg: #fff3dc;
  --red: #c0233a; --red-bg: #fde8eb;
  --blue: #1f5fb8; --blue-bg: #e6effc;
  --gray: #5f6b66; --gray-bg: #eef1f0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,34,26,.06), 0 1px 1px rgba(16,34,26,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", "Hind Siliguri", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
.ic { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- admin shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: #0f2a20; color: #cfe0d8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.side .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 700; position: relative; overflow: hidden; }
.side .brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.side .brand .logo:after { content: ""; position: absolute; right: 4px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.side .brand .logo.has-img:after { display: none; }
.side .brand b { display: block; font-size: 14px; line-height: 1.2; }
.side .brand small { color: #8fb3a3; font-size: 11.5px; }
.side nav { padding: 10px 10px 20px; flex: 1; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f9584; padding: 14px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #cfe0d8; font-size: 14px; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; }
.side .foot { padding: 12px 18px; font-size: 11.5px; color: #6f9584; border-top: 1px solid rgba(255,255,255,.07); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 58px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 20; }
.top .title { font-weight: 600; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }
.top .who { display: flex; align-items: center; gap: 10px; }
.top .who .name { text-align: right; line-height: 1.2; }
.top .who .name small { color: var(--muted); display: block; font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; }
.content { padding: 22px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; }
.card-b { padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > a.card + a.card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.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)); }
.span2 { grid-column: span 2; }
.stat { padding: 16px 18px; }
.stat .lbl { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.accent { border-left: 3px solid var(--brand); }
.stat.warn { border-left: 3px solid var(--amber); }
.stat.bad { border-left: 3px solid var(--red); }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafcfb; white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: #fafcfb; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tfoot td { font-weight: 700; background: #fafcfb; border-top: 1px solid var(--line); }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 4px; align-items: center; padding: 12px 18px; }
.pager a, .pager .cur { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); padding: 0 8px; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .muted { margin-left: 8px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=url], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid #cfd8d4; border-radius: 8px; background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,106,78,.14); }
input[readonly] { background: var(--line-2); }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filters .field { margin: 0; min-width: 150px; }
.filters input, .filters select { height: 36px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--brand); color: #fff; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-light { background: #fff; color: var(--ink); border-color: #cfd8d4; }
.btn-light:hover { background: var(--line-2); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a01d31; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.inline { display: inline; }

/* ---------- badges & alerts ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 14px; border: 1px solid; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--green-bg); border-color: #b9e3cf; color: #0b5e41; }
.alert-error { background: var(--red-bg); border-color: #f5c2ca; color: #8f1a2c; }
.alert-warn { background: var(--amber-bg); border-color: #f1d9a6; color: #7a4a00; }
.alert-info { background: var(--blue-bg); border-color: #c5d8f5; color: #174a8f; }
.notice-bar { padding: 10px 22px; font-size: 13.5px; border-bottom: 1px solid; display: flex; gap: 10px; align-items: center; }
.notice-bar.warn { background: var(--amber-bg); border-color: #f1d9a6; color: #7a4a00; }
.notice-bar.info { background: var(--blue-bg); border-color: #c5d8f5; color: #174a8f; }
.notice-bar.danger { background: var(--red-bg); border-color: #f5c2ca; color: #8f1a2c; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--brand); }

/* ---------- auth & install ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: linear-gradient(160deg, #003d2d, #006a4e 60%, #0b7d5c); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art:before { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: var(--accent); opacity: .9; right: -90px; top: -90px; }
.auth-art .mark { font-size: 26px; font-weight: 800; letter-spacing: -.02em; position: relative; }
.auth-art .mark span { color: #bfe4d5; font-weight: 500; font-size: 15px; display: block; letter-spacing: 0; }
.auth-art h2 { font-size: 30px; line-height: 1.2; max-width: 420px; position: relative; }
.auth-art p { color: #cbe8dc; max-width: 420px; position: relative; }
.auth-box { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13.5px; }
.wizard { max-width: 720px; margin: 40px auto; padding: 0 16px; }
.steps { display: flex; gap: 8px; margin: 18px 0; }
.steps div { flex: 1; padding: 9px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.steps div.on { border-color: var(--brand); color: var(--brand); font-weight: 600; background: var(--brand-50); }
.steps div.done { color: var(--green); }
.req { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ok { color: var(--green); font-weight: 600; } .bad { color: var(--red); font-weight: 600; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: .08em; background: var(--line-2); border: 1px dashed #b9c6c0; padding: 12px; border-radius: 8px; text-align: center; user-select: all; }

/* ---------- public site ---------- */
.pub-top { background: #fff; border-bottom: 1px solid var(--line); }
.pub-top .in { max-width: 1100px; margin: 0 auto; padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.pub-top .nm { font-weight: 700; font-size: 18px; flex: 1; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.hero { background: linear-gradient(135deg, #00513b, #006a4e); color: #fff; }
.hero .in { max-width: 1100px; margin: 0 auto; padding: 56px 18px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: 36px; letter-spacing: -.02em; }
.hero p { color: #d3ece2; font-size: 16px; }
.hero .phone-card { background: #fff; color: var(--ink); border-radius: 16px; padding: 22px; box-shadow: 0 20px 40px rgba(0,0,0,.18); }
.feat { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.feat .ic { color: var(--brand); margin-top: 2px; }
.section { max-width: 1100px; margin: 0 auto; padding: 36px 18px; }
.doc-card { padding: 16px; }
.doc-card b { display: block; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px; }

/* ---------- POS / billing ---------- */
.bill-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.picker { position: relative; }
.picker .results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(16,34,26,.12); max-height: 320px; overflow-y: auto; }
.picker .results button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 9px 12px; background: none; border: 0; border-bottom: 1px solid var(--line-2); text-align: left; font: inherit; cursor: pointer; }
.picker .results button:hover, .picker .results button.act { background: var(--brand-50); }
.totals { display: grid; gap: 8px; }
.totals .ln { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals .ln input { width: 130px; text-align: right; height: 36px; }
.totals .big { font-size: 20px; font-weight: 700; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.sync-pill.on { background: var(--green-bg); color: var(--green); }
.sync-pill.off { background: var(--red-bg); color: var(--red); }

/* ---------- print ---------- */
.print-page { background: #fff; max-width: 800px; margin: 20px auto; padding: 28px 32px; border: 1px solid var(--line); }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 14px; gap: 16px; }
.print-head h2 { margin: 0; color: var(--brand); font-size: 22px; }
.print-head .meta { text-align: right; font-size: 13px; }
.print-tools { max-width: 800px; margin: 16px auto 0; display: flex; gap: 8px; justify-content: flex-end; }
.access-slip { margin-top: 18px; border: 1px dashed var(--brand); border-radius: 8px; padding: 10px 14px; font-size: 13px; background: var(--brand-50); }
.result-table td, .result-table th { padding: 7px 10px; }
@media print {
  body { background: #fff; font-size: 12.5px; }
  .no-print, .side, .top, .notice-bar, .print-tools { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .print-page { border: 0; margin: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  a { color: inherit; }
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .bill-grid { grid-template-columns: 1fr; }
  .hero .in { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .top .menu-btn { display: block; }
  .top .who .name { display: none; }
  .content { padding: 14px; }
  .g2, .g3, .row-2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  dl.kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .stat .val { font-size: 20px; }
}

/* offline temporary receipt */
#offlineReceipt { display: none; }
@media print {
  body.print-offline > *:not(#offlineReceipt) { display: none !important; }
  body.print-offline #offlineReceipt { display: block; }
}
details.fix{display:inline-block;vertical-align:top}
details.fix[open]{display:block}
details.fix summary{list-style:none;cursor:pointer}
details.fix summary::-webkit-details-marker{display:none}
.fix-pop{margin-top:6px;background:var(--surface,#fff);border:1px solid var(--line);border-radius:8px;padding:8px;display:flex;gap:6px;min-width:250px;text-align:left}
.fix-pop input{flex:1;min-width:0}

/* grid items may shrink; wide tables scroll inside their card */
.grid > * { min-width: 0; }
