/* ----------------------------------------------------------
   Billing Entry CRM — UI styles
----------------------------------------------------------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6fb;
  color: #1e293b;
  font-size: 16px;
  line-height: 1.55;
}
a { text-decoration: none; color: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 256px; flex-shrink: 0;
  background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--seg, #2563eb), #6366f1);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.brand-text { font-size: 17px; color: #fff; font-weight: 500; letter-spacing: .2px; }
.brand-text strong { font-weight: 800; }

.seg-home-link {
  display: flex; align-items: center; gap: 11px; margin: 6px 0 14px;
  padding: 10px 12px; border-radius: 9px; font-weight: 600; color: #94a3b8;
  border: 1px dashed #334155; transition: .15s;
}
.seg-home-link:hover { background: #1e293b; color: #e2e8f0; border-color: #475569; }

.menu { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.menu-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 9px; font-weight: 600; font-size: 16px; color: #94a3b8; transition: .15s;
}
.menu-item .mi-icon { font-size: 17px; }
.menu-item:hover { background: #1e293b; color: #e2e8f0; }
.menu-item.active { background: var(--seg, #2563eb); color: #fff; }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #1e293b; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #334155; color: #fff; display: grid; place-items: center; font-weight: 700; }
.u-name { color: #e2e8f0; font-weight: 600; font-size: 16px; }
.u-role { color: #64748b; font-size: 16px; }
.logout { display: block; text-align: center; margin-top: 10px; padding: 10px; border-radius: 8px; background: #1e293b; color: #cbd5e1; font-weight: 600; font-size: 16px; }
.logout:hover { background: #ef4444; color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; }

/* Top segment tabs — large & brand-colored */
.seg-tabbar {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 28px 0; background: #fff; border-bottom: 1px solid #e8edf3;
  position: sticky; top: 0; z-index: 25;
}
.seg-tab {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 26px; border-radius: 12px 12px 0 0;
  font-size: 17px; font-weight: 800; letter-spacing: .2px;
  color: var(--pc); background: var(--ps);
  border: 1.5px solid transparent; border-bottom: none;
  position: relative; top: 1px; transition: .15s;
}
.seg-tab .seg-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 20%, transparent); }
.seg-tab .seg-tag { font-size: 16px; font-weight: 700; opacity: .65; }
.seg-tab:hover { filter: brightness(.97); transform: translateY(-1px); }
.seg-tab.active {
  color: #fff; background: var(--pc);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--pc) 35%, transparent);
}
.seg-tab.active .seg-dot { background: #fff; box-shadow: none; }
.seg-tab.active .seg-tag { color: #fff; opacity: .8; }
.seg-tab-all {
  margin-left: auto; top: 0; font-size: 16px; font-weight: 600;
  color: #64748b; background: #f1f5f9; border-radius: 9px; padding: 10px 16px;
}
.seg-tab-all:hover { background: #e2e8f0; color: #0f172a; filter: none; transform: none; }

/* Segment chooser landing cards */
.seg-landing { max-width: 1100px; margin: 0 auto; padding: 10px; }
.seg-landing .ll-head { text-align: center; margin: 18px 0 32px; }
.seg-landing .ll-head h1 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.seg-landing .ll-head p { color: #94a3b8; margin: 0; }
.seg-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.seg-card {
  background: #fff; border: 1px solid #e8edf3; border-radius: 18px; padding: 24px;
  cursor: pointer; transition: .18s; display: block; position: relative; overflow: hidden;
}
.seg-card:before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--cc); }
.seg-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(15,23,42,.12); border-color: var(--cc); }
.seg-card .sc-top { display: flex; align-items: center; gap: 14px; margin: 8px 0 20px; }
.seg-card .sc-mark { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; background: var(--cc); }
.seg-card .sc-name { font-size: 19px; font-weight: 800; }
.seg-card .sc-tag { font-size: 16px; color: #94a3b8; font-weight: 700; letter-spacing: 1px; }
.seg-card .sc-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.seg-card .sc-stat { background: #f8fafc; border-radius: 11px; padding: 12px; }
.seg-card .sc-stat .l { font-size: 16px; color: #94a3b8; font-weight: 600; }
.seg-card .sc-stat .v { font-size: 18px; font-weight: 800; margin-top: 3px; }
.seg-card .sc-enter { margin-top: 18px; text-align: right; font-weight: 700; color: var(--cc); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; background: #fff; border-bottom: 1px solid #e8edf3;
  position: sticky; top: 0; z-index: 20;
}
.page-title { margin: 0; font-size: 23px; font-weight: 800; }
.crumbs { font-size: 16px; color: #94a3b8; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.seg-chip { padding: 3px 11px; border-radius: 20px; font-weight: 700; font-size: 16px; }
.crumb-sep { color: #cbd5e1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 24px 28px; }

/* ---------- Buttons ---------- */
.btn-seg { background: var(--seg, #2563eb); border: none; color: #fff; }
.btn-seg:hover { filter: brightness(.92); color: #fff; }
.btn-soft { background: var(--seg-soft); color: var(--seg); border: none; font-weight: 600; }
.btn-soft:hover { filter: brightness(.96); color: var(--seg); }

/* ---------- Cards ---------- */
.card-soft { background: #fff; border: 1px solid #e8edf3; border-radius: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid #e8edf3; border-radius: 14px; padding: 18px;
  position: relative; overflow: hidden;
}
.stat .s-label { font-size: 16px; color: #64748b; font-weight: 600; }
.stat .s-value { font-size: 28px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.stat .s-sub { font-size: 16px; color: #94a3b8; margin-top: 4px; }
.stat .s-ico { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; }

.panel { background: #fff; border: 1px solid #e8edf3; border-radius: 14px; padding: 18px 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 17px; font-weight: 700; margin: 0; }
.panel-sub { font-size: 16px; color: #94a3b8; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl th { text-align: left; font-size: 16px; letter-spacing: .3px; color: #94a3b8; font-weight: 700; padding: 12px 14px; border-bottom: 1px solid #eef2f7; }
.tbl td { padding: 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .right { text-align: right; }

.badge-status { padding: 4px 12px; border-radius: 20px; font-size: 16px; font-weight: 700; display: inline-block; }
.person-chip { display: inline-flex; align-items: center; gap: 8px; }
.person-chip .pa { width: 30px; height: 30px; border-radius: 50%; background: var(--seg-soft); color: var(--seg); display: grid; place-items: center; font-weight: 700; font-size: 16px; }
.vendor-tag { color: #475569; }

.empty { text-align: center; padding: 40px; color: #94a3b8; }

/* Entry mode toggle + totals box (add-bill modal) */
.mode-toggle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.mode-opt {
  padding: 9px 16px; border: 1.5px solid #e8edf3; border-radius: 10px;
  font-weight: 700; cursor: pointer; color: #475569; user-select: none;
}
.mode-opt input { margin-right: 6px; }
.mode-opt.active { border-color: var(--seg); background: var(--seg-soft); color: var(--seg); }
.totals-box { background: #f8fafc; border: 1px solid #e8edf3; border-radius: 12px; padding: 12px 16px; }
.totals-box > div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals-box .tb-net { border-top: 1px dashed #cbd5e1; margin-top: 6px; padding-top: 8px; font-size: 19px; }
.totals-box .tb-net b { font-weight: 800; }

.item-pill { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 20px; background: var(--seg-soft); color: var(--seg); font-size: 16px; font-weight: 700; }
.exp-caret { display: inline-block; width: 16px; color: #94a3b8; font-size: 16px; }
.bill-row:hover { background: #f8fafc; }
.sub-tbl { margin: 6px 0; font-size: 16px; }
.sub-tbl th { padding: 8px 12px; font-size: 16px; }
.sub-tbl td { padding: 9px 12px; border-bottom: 1px dashed #e2e8f0; }
.sub-tbl tbody tr:hover { background: transparent; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .form-control, .filters .form-select { max-width: 200px; }

/* ---------- Report presets ---------- */
.rep-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.rep-chip {
  padding: 9px 18px; border-radius: 20px; border: 1px solid #e8edf3;
  background: #fff; font-weight: 600; font-size: 16px; color: #475569;
}
.rep-chip:hover { border-color: var(--seg); color: var(--seg); }
.rep-chip.active { background: var(--seg); border-color: var(--seg); color: #fff; }

/* ---------- Toast ---------- */
.toast-msg {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 999;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-msg.err { background: #b91c1c; }

/* ---------- Claim picker ---------- */
.person-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.person-tab {
  padding: 10px 16px; border-radius: 11px; border: 1px solid #e8edf3; background: #fff;
  cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.person-tab:hover { border-color: var(--seg); }
.person-tab.active { background: var(--seg); color: #fff; border-color: var(--seg); }
.person-tab .pt-amt { font-size: 16px; opacity: .8; }
.claim-bar {
  position: sticky; bottom: 0; background: #fff; border: 1px solid #e8edf3;
  border-radius: 14px; padding: 14px 20px; display: flex; align-items: center;
  justify-content: space-between; margin-top: 16px; box-shadow: 0 -6px 20px rgba(15,23,42,.05);
}
.claim-bar .cb-info b { font-size: 18px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 70% -10%, #1e293b, #0f172a); }
.login-card { background: #fff; width: 380px; border-radius: 18px; padding: 34px; box-shadow: 0 30px 70px rgba(0,0,0,.3); }
.login-card .lc-mark { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg,#2563eb,#6366f1); color:#fff; display:grid; place-items:center; font-size:26px; font-weight:800; margin-bottom: 16px; }
.login-card h2 { margin: 0 0 4px; font-weight: 800; }
.login-card .lc-sub { color: #94a3b8; font-size: 16px; margin-bottom: 22px; }
.login-card .hint { font-size: 16px; color: #94a3b8; text-align: center; margin-top: 16px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .seg-cards { grid-template-columns: 1fr; }
  .sidebar { width: 70px; }
  .brand-text, .seg-home-link span:last-child, .menu-item span:not(.mi-icon), .u-name, .u-role { display: none; }
}
