/* ============================================================
   ရာဘာဒိုင် - Rubber Dealer App  |  UI Theme
   ============================================================ */
:root{
  --bg:#f6f4f1;
  --surface:#ffffff;
  --surface-2:#faf9f7;
  --line:#e8e4de;
  --line-soft:#efece7;
  --text:#211c17;
  --text-2:#6b6259;
  --text-3:#9a9188;

  --brand:#c2621c;          /* rubber amber-brown */
  --brand-dark:#9c4d14;
  --brand-soft:#fdf0e4;

  --sidebar:#1b1712;
  --sidebar-2:#241e18;
  --sidebar-text:#d9d2c8;
  --sidebar-mute:#8e857a;

  --green:#1f8a55;
  --green-soft:#e6f6ee;
  --amber:#b7791f;
  --amber-soft:#fdf4e3;
  --red:#c2413a;
  --red-soft:#fdeceb;
  --blue:#2b6cb0;
  --blue-soft:#e9f1fb;
  --purple:#6b46c1;
  --purple-soft:#f0ebfb;

  --radius:14px;
  --radius-sm:10px;
  --shadow:0 1px 2px rgba(28,22,15,.05), 0 8px 24px -16px rgba(28,22,15,.25);
  --shadow-lg:0 12px 40px -20px rgba(28,22,15,.45);
  --font:"Inter",-apple-system,Segoe UI,Roboto,"Padauk","Noto Sans Myanmar","Myanmar Text",sans-serif;
}

html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#081426;--surface:#0f1d33;--surface-2:#13233d;
  --line:#233754;--line-soft:#1b2d47;
  --text:#e7eef8;--text-2:#b0bfd3;--text-3:#8395ad;
  --brand:#4b9fff;--brand-dark:#78b5ff;--brand-soft:#142c4a;
  --sidebar:#050d1b;--sidebar-2:#0b1830;--sidebar-text:#d1dced;--sidebar-mute:#8394ac;
  --green:#5dd39e;--green-soft:#10352d;--amber:#ffc66d;--amber-soft:#392c18;
  --red:#ff8585;--red-soft:#3c2029;--blue:#72b2ff;--blue-soft:#142e4f;
  --purple:#b59cff;--purple-soft:#2b2446;
  --shadow:0 1px 2px rgba(0,0,0,.22),0 10px 28px -18px rgba(0,0,0,.6);
  --shadow-lg:0 14px 40px -20px rgba(0,0,0,.8);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:15px;
  line-height:1.85;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
img{max-width:100%}
::selection{background:var(--brand-soft);color:var(--brand-dark)}

/* ---------- App shell ---------- */
.app{display:grid;grid-template-columns:256px 1fr;min-height:100vh}
.scrim{display:none}

/* ---------- Sidebar ---------- */
.sidebar{
  background:linear-gradient(180deg,var(--sidebar) 0%,var(--sidebar-2) 100%);
  color:var(--sidebar-text);
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
  z-index:40;
}
.brand{display:flex;align-items:center;gap:12px;padding:20px 20px 18px;border-bottom:1px solid rgba(255,255,255,.07)}
.brand-mark{
  width:42px;height:42px;border-radius:12px;flex:none;
  background:linear-gradient(145deg,#e79447,var(--brand-dark));
  display:grid;place-items:center;font-weight:700;color:#fff;font-size:16px;
  box-shadow:0 6px 18px -8px rgba(194,98,28,.9);
}
.brand-name{font-size:17px;font-weight:700;color:#fff;line-height:1.4}
.brand-sub{font-size:12px;color:var(--sidebar-mute);line-height:1.4}

.nav{padding:14px 12px;overflow-y:auto;flex:1}
.nav-label{font-size:11px;letter-spacing:.14em;color:var(--sidebar-mute);padding:14px 12px 6px;text-transform:uppercase}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:9px 12px;border-radius:10px;color:var(--sidebar-text);
  font-size:14.5px;margin-bottom:2px;transition:.15s;
  border:1px solid transparent;
}
.nav-item svg{width:19px;height:19px;flex:none;opacity:.85}
.nav-item:hover{background:rgba(255,255,255,.06);color:#fff}
.nav-item.active{
  background:linear-gradient(90deg,rgba(194,98,28,.28),rgba(194,98,28,.08));
  border-color:rgba(231,148,71,.32);color:#fff;font-weight:600;
}
html[data-theme="dark"] .nav-item.active{background:linear-gradient(90deg,rgba(56,135,233,.28),rgba(56,135,233,.08));border-color:rgba(96,165,250,.32)}
.nav-item.active svg{opacity:1;color:#f0a45f}
html[data-theme="dark"] .nav-item.active svg{color:#80baff}
.nav-item .count{margin-left:auto;font-size:12px;background:rgba(255,255,255,.1);padding:0 8px;border-radius:99px;color:var(--sidebar-text)}
.sidebar-foot{padding:14px 18px;border-top:1px solid rgba(255,255,255,.07);font-size:12.5px;color:var(--sidebar-mute)}
.sidebar-foot .dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#3ddc84;margin-right:7px;box-shadow:0 0 0 3px rgba(61,220,132,.18)}

/* ---------- Main ---------- */
.main{display:flex;flex-direction:column;min-width:0}
.topbar>div:nth-child(2){min-width:0}
.topbar{
  position:sticky;
  isolation:isolate;
  top:0;z-index:30;
  background:rgba(246,244,241,.86);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:16px;
  padding:14px 26px;
}
html[data-theme="dark"] .topbar{background:rgba(8,20,38,.9)}
.menu-btn{display:none;background:var(--surface);border:1px solid var(--line);border-radius:10px;width:38px;height:38px;cursor:pointer;align-items:center;justify-content:center}
.menu-btn svg{width:20px;height:20px}
.page-title{font-size:19px;font-weight:700;line-height:1.5}
.page-sub{font-size:13px;color:var(--text-2);line-height:1.5}
.topbar-page-action{position:absolute;left:50%;transform:translateX(-50%)}
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:10px}
.logout-form{display:inline-flex}
.theme-btn{min-width:88px}
.current-time{display:block;font-size:11px;color:var(--text-3);line-height:1.4;overflow-wrap:anywhere}
.language-form{display:inline-flex}
.language-form select{height:38px;padding:0 22px 0 9px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--text);font:inherit;font-size:12px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.search{
  display:flex;align-items:center;gap:8px;background:var(--surface);
  border:1px solid var(--line);border-radius:10px;padding:7px 12px;min-width:230px;
}
.search svg{width:16px;height:16px;color:var(--text-3)}
.search input{border:0;outline:0;background:transparent;font:inherit;font-size:14px;width:100%;color:var(--text)}
.user-chip{display:flex;align-items:center;gap:9px;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:5px 12px 5px 6px;font-size:13.5px}
.avatar{width:30px;height:30px;border-radius:8px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700;font-size:13px}

.content{padding:24px 26px 40px;flex:1}
.content-wide{max-width:1400px}

/* ---------- Cards & stats ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.card + .card{margin-top:18px}
.card-head{display:flex;align-items:center;gap:12px;padding:15px 20px;border-bottom:1px solid var(--line-soft);flex-wrap:wrap}
.card-title{font-size:16px;font-weight:700}
.card-sub{font-size:13px;color:var(--text-2)}
.card-head .right{margin-left:auto;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.card-body{padding:20px}
.card-body.tight{padding:0}

.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(215px,1fr));gap:16px;margin-bottom:20px}
.stat{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:16px 18px;box-shadow:var(--shadow);position:relative;overflow:hidden;
}
.stat::after{content:"";position:absolute;inset:0 0 auto 0;height:3px;background:var(--accent,var(--brand))}
.stat-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.stat-label{font-size:13.5px;color:var(--text-2)}
.stat-icon{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;background:var(--icon-bg,var(--brand-soft));color:var(--accent,var(--brand))}
.stat-icon svg{width:19px;height:19px}
.stat-value{font-size:26px;font-weight:700;letter-spacing:-.5px;margin-top:8px;line-height:1.4}
.stat-value small{font-size:14px;font-weight:600;color:var(--text-2);margin-left:3px}
.stat-foot{font-size:12.5px;color:var(--text-3);margin-top:2px}
.stat-foot .up{color:var(--green);font-weight:600}
.stat-foot .down{color:var(--red);font-weight:600}

.grid-2{display:grid;grid-template-columns:1.6fr 1fr;gap:18px;align-items:start}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;align-items:start}
.dashboard-insights{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
.dashboard-insights>.card{display:flex;flex-direction:column;min-width:0}
.dashboard-insights>.card>.card-body{flex:1}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  border-radius:10px;padding:8px 15px;font-size:14px;font-weight:600;
  border:1px solid transparent;cursor:pointer;font-family:inherit;
  transition:.15s;white-space:nowrap;line-height:1.7;
}
.btn svg{width:17px;height:17px}
.btn-primary{background:var(--brand);color:#fff;box-shadow:0 8px 18px -12px rgba(56,135,233,.55)}
.btn-primary:hover{background:var(--brand-dark)}
.btn-ghost{background:var(--surface);border-color:var(--line);color:var(--text)}
.btn-ghost:hover{background:var(--surface-2);border-color:#dcd6cd}
html[data-theme="dark"] .btn-ghost:hover{border-color:var(--line)}
.btn-soft{background:var(--brand-soft);color:var(--brand-dark)}
.btn-soft:hover{background:#fbe6d2}
.btn-danger{background:var(--red-soft);color:var(--red)}
.btn-danger:hover{background:#f9dcda}
.btn-sm{padding:5px 11px;font-size:13px;border-radius:8px}
.btn-block{width:100%}
.btn:disabled{opacity:.55;cursor:not-allowed}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
table.table{width:100%;border-collapse:collapse;font-size:14.2px;min-width:640px}
.table thead th{
  background:var(--surface-2);text-align:left;font-size:12.5px;font-weight:700;
  color:var(--text-2);padding:11px 16px;border-bottom:1px solid var(--line);
  white-space:nowrap;letter-spacing:.02em;
}
.table tbody td{padding:12px 16px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.table tbody tr:last-child td{border-bottom:0}
.table tbody tr:hover{background:var(--surface-2)}
.table .num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.table .strong{font-weight:650}
.table .muted{color:var(--text-3);font-size:13px}
.table tfoot td{background:var(--surface-2);font-weight:700;padding:12px 16px;border-top:1px solid var(--line)}
.row-actions{display:flex;gap:6px;justify-content:flex-end}

/* ---------- Badges ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:2px 10px;border-radius:99px;font-size:12.5px;font-weight:650;line-height:1.9;white-space:nowrap}
.badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.85}
.badge-green{background:var(--green-soft);color:var(--green)}
.badge-amber{background:var(--amber-soft);color:var(--amber)}
.badge-red{background:var(--red-soft);color:var(--red)}
.badge-blue{background:var(--blue-soft);color:var(--blue)}
.badge-purple{background:var(--purple-soft);color:var(--purple)}
.badge-gray{background:#f0eeea;color:var(--text-2)}
html[data-theme="dark"] .badge-gray{background:#23334b;color:var(--text-2)}
.badge-solid{background:var(--brand);color:#fff}
.badge-solid::before{display:none}

/* ---------- Forms ---------- */
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:16px 18px}
.field{display:flex;flex-direction:column;gap:6px}
.field.full{grid-column:1/-1}
.field label{font-size:13.5px;font-weight:650;color:var(--text-2)}
.field label .req{color:var(--red);margin-left:2px}
.input,.select,.textarea{
  width:100%;font-family:inherit;font-size:15px;color:var(--text);
  background:var(--surface);border:1px solid var(--line);border-radius:10px;
  padding:9px 13px;outline:0;transition:.15s;line-height:1.7;
}
.input:focus,.select:focus,.textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(75,159,255,.18);background:var(--surface)}
.textarea{min-height:88px;resize:vertical}
.select{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a9188' stroke-width='2'><path d='M4 6l4 4 4-4'/></svg>");background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}
.input-lg{font-size:17px;font-weight:650;padding:11px 14px}
.hint{font-size:12.5px;color:var(--text-3)}
.form-actions{display:flex;gap:10px;justify-content:flex-end;align-items:center;padding-top:6px;flex-wrap:wrap}

.total-box{background:linear-gradient(135deg,var(--brand-soft),var(--surface-2));border:1px dashed var(--line);border-radius:var(--radius);padding:16px 18px}
.total-box .lbl{font-size:13.5px;color:var(--brand-dark);font-weight:650}
.total-box .val{font-size:30px;font-weight:700;color:var(--brand-dark);line-height:1.4;letter-spacing:-.5px}
.total-box .split{font-size:13px;color:var(--text-2);display:flex;justify-content:space-between;gap:10px;margin-top:6px;border-top:1px dashed var(--line);padding-top:6px}

/* ---------- Filters ---------- */
.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.filters .field{min-width:150px;gap:5px}
.filters .field label{font-size:12.5px}
.filters .grow{flex:1;min-width:200px}
.filter-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.filter-actions .btn{min-height:44px}

/* ---------- Charts ---------- */
.chart{display:flex;align-items:flex-end;gap:12px;height:210px;padding-top:10px}
.chart-col{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:8px;height:100%}
.chart-bar{
  width:100%;max-width:46px;border-radius:8px 8px 4px 4px;
  background:linear-gradient(180deg,#e79447,var(--brand));
  position:relative;min-height:4px;transition:.4s;
}
.chart-bar:hover{filter:brightness(1.06)}
.chart-bar .tip{
  position:absolute;top:-26px;left:50%;transform:translateX(-50%);
  font-size:11.5px;font-weight:700;color:var(--brand-dark);white-space:nowrap;
  background:var(--brand-soft);padding:1px 7px;border-radius:6px;
}
.chart-x{font-size:12.5px;color:var(--text-3);white-space:nowrap}

.legend{display:flex;gap:16px;flex-wrap:wrap;font-size:13px;color:var(--text-2)}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:6px;vertical-align:middle}

/* progress */
.progress{height:8px;background:#efece7;border-radius:99px;overflow:hidden;min-width:90px}
.progress span{display:block;height:100%;background:linear-gradient(90deg,#e79447,var(--brand));border-radius:99px}
.progress.green span{background:linear-gradient(90deg,#33b275,var(--green))}

/* ---------- Quick list (dashboard side) ---------- */
.qlist{display:flex;flex-direction:column}
.qitem{display:flex;align-items:center;gap:12px;padding:12px 20px;border-bottom:1px solid var(--line-soft)}
.qitem:last-child{border-bottom:0}
.qitem:hover{background:var(--surface-2)}
.qitem .qicon{width:36px;height:36px;border-radius:10px;display:grid;place-items:center;flex:none;background:var(--brand-soft);color:var(--brand)}
.qitem .qicon svg{width:17px;height:17px}
.qitem .qmain{flex:1;min-width:0}
.qitem .qtitle{font-weight:650;font-size:14.3px;line-height:1.6}
.qitem .qmeta{font-size:12.5px;color:var(--text-3);line-height:1.6}
.qitem .qright{text-align:right;font-size:14px;font-weight:700;white-space:nowrap}
.qitem .qright small{display:block;font-size:12px;font-weight:500;color:var(--text-3)}

/* ---------- Empty / misc ---------- */
.empty{text-align:center;padding:44px 20px;color:var(--text-3)}
.empty svg{width:44px;height:44px;opacity:.4;margin-bottom:10px}
.empty p{font-size:14.5px}
.alert{display:flex;gap:10px;align-items:flex-start;padding:12px 16px;border-radius:11px;font-size:14px;margin-bottom:18px;border:1px solid}
.alert svg{width:18px;height:18px;flex:none;margin-top:3px}
.alert-success{background:var(--green-soft);border-color:#c7ead9;color:#166b43}
.alert-error{background:var(--red-soft);border-color:#f6cdca;color:#a1332d}
.alert-info{background:var(--blue-soft);border-color:#d3e3f6;color:#22568e}
html[data-theme="dark"] .alert-success{background:#10352d;border-color:#205445;color:#8ee4bb}
html[data-theme="dark"] .alert-error{background:#3c2029;border-color:#69333a;color:#ffaaaa}
html[data-theme="dark"] .alert-info{background:#142e4f;border-color:#274e77;color:#a6d0ff}

.kv{display:flex;justify-content:space-between;gap:14px;padding:8px 0;border-bottom:1px dashed var(--line);font-size:14px}
.kv:last-child{border-bottom:0}
.kv .k{color:var(--text-2)}
.kv .v{font-weight:700}

.section-title{font-size:15px;font-weight:700;margin:26px 0 12px;display:flex;align-items:center;gap:9px}
.section-title::after{content:"";flex:1;height:1px;background:var(--line)}

.pill-tabs{display:flex;gap:6px;background:var(--surface-2);border:1px solid var(--line);padding:4px;border-radius:11px;flex-wrap:wrap}
.pill-tabs a{padding:5px 14px;border-radius:8px;font-size:13.5px;font-weight:600;color:var(--text-2)}
.pill-tabs a.active{background:var(--surface);color:var(--brand-dark);box-shadow:var(--shadow)}

/* ---------- Responsive ---------- */
@media (max-width:1080px){
  .grid-2,.grid-3{grid-template-columns:1fr}
  .topbar{flex-wrap:wrap}
  .topbar-page-action{position:static;order:3;width:100%;display:flex;justify-content:center;transform:none}
  .topbar-actions{order:4;width:100%;flex-wrap:wrap;justify-content:flex-end}
}
@media (max-width:900px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;width:264px;transform:translateX(-100%);transition:transform .25s ease;box-shadow:var(--shadow-lg)}
  .sidebar.open{transform:none}
  .menu-btn{display:flex}
  .scrim{display:none;position:fixed;inset:0;background:rgba(20,16,12,.45);z-index:35}
  .scrim.show{display:block}
  .content{padding:18px 15px 34px}
  .topbar{padding:12px 15px}
  .stat-value{font-size:23px}
  .btn,.menu-btn,.language-form select,.input,.select{min-height:44px}
}

/* ---------- Customer ledgers and authentication ---------- */
.customer-list-head{justify-content:space-between}
.customer-list-actions{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-left:auto}
.filters.customer-search{display:flex;flex:1 1 320px;flex-wrap:nowrap;align-items:stretch;min-width:0;margin-left:auto}
.filters.customer-search .field{flex:1 1 auto;min-width:0}
.customer-search .input,.customer-search>.btn{height:44px;min-height:44px}
.customer-search .input{padding-top:8px;padding-bottom:8px}
.customer-search .input::placeholder{color:var(--text-3);opacity:.8}
.customer-search>.btn{flex:0 0 auto}
.customer-dialog{width:min(560px,calc(100% - 28px));max-height:min(90vh,700px);padding:0;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:var(--text);box-shadow:var(--shadow-lg)}
.customer-dialog::backdrop{background:rgba(5,13,27,.62);backdrop-filter:blur(3px)}
.customer-dialog .card-head{justify-content:space-between}
.customer-dialog .card-body{max-height:calc(90vh - 64px);overflow-y:auto}
.customer-name{display:inline-block;font-weight:700;color:var(--brand-dark)}
.customer-edit-field{display:none}
.customer-row-save,.customer-row-cancel{display:none}
.customer-table tr.editing .customer-display-field,.customer-table tr.editing .customer-row-edit{display:none}
.customer-table tr.editing .customer-edit-field{display:block}
.customer-table tr.editing .customer-row-save,.customer-table tr.editing .customer-row-cancel{display:inline-flex}
.customer-edit-name{max-width:220px}
.customer-table{border:1px solid var(--line)}
.customer-table th,.customer-table td{border-right:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft)}
.customer-table th:last-child,.customer-table td:last-child{border-right:0}
.customer-table .row-number{width:52px;text-align:center;font-variant-numeric:tabular-nums}
.ledger-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:18px;flex-wrap:wrap}
.ledger-filter{margin-left:auto}
.balance-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
.ledger-forms{grid-template-columns:minmax(0,1.25fr) minmax(280px,.85fr);margin-bottom:18px}
.ledger-entry-form{display:grid;gap:14px}
.ledger-entry-form .form-actions{margin-top:0}
.stock-card{border-top:1px solid var(--line-soft)}
.stock-card .section-title{margin-top:0}
.ledger-records{display:grid;gap:18px}
.ledger-records .card{min-width:0}
.ledger-records .card-head{justify-content:space-between}
.ledger-table{min-width:760px!important}
.field[hidden]{display:none}
.auth-page{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(ellipse at top left,var(--brand-soft),transparent 48%),var(--bg)}
.auth-card{width:min(100%,440px);padding:34px;background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow-lg)}
.auth-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px;flex-wrap:wrap}
.auth-footer{margin-top:20px;text-align:center;color:var(--text-3);font-size:12px}
.auth-card>.brand-mark{margin-bottom:22px}
.auth-card h1{font-size:23px;line-height:1.55}
.auth-card .eyebrow{font-size:13px;font-weight:700;color:var(--brand-dark);margin-bottom:3px}
.auth-copy{color:var(--text-2);margin:5px 0 22px}
.auth-form{display:grid;gap:16px}
.auth-form .field>span{font-size:13.5px;font-weight:650;color:var(--text-2)}
.auth-form .btn{margin-top:4px}
.settings-grid{display:grid;gap:12px}
.settings-grid .card-head{padding:10px 16px}
.settings-grid .card-body{padding:14px 16px}
.settings-grid .section-title{margin:14px 0 8px}
.settings-grid .kv{padding:5px 0}
.settings-password-form{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;align-items:end}
.settings-password-form .btn{grid-column:1/-1;justify-self:start}
.settings-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start}
.settings-options .language-form select{min-height:40px}

@media (max-width:1080px){
  .ledger-forms{grid-template-columns:1fr}
  .grid-2,.grid-3{grid-template-columns:1fr}
}
@media (max-width:900px){
  .settings-password-form,.settings-options{grid-template-columns:1fr}
}
@media (max-width:900px){
  .customer-table{width:100%;min-width:0!important;border:0;border-collapse:separate;border-spacing:0 12px}
  .customer-table thead{display:none}
  .customer-table tbody{display:grid;gap:12px}
  .customer-table tbody tr{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    position:relative;overflow:hidden;background:var(--surface);
    border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow)
  }
  .customer-table tbody tr:hover{background:var(--surface)}
  .customer-table tbody td{
    display:flex;align-items:center;justify-content:space-between;gap:10px;
    min-width:0;padding:10px 12px;border-right:0;border-bottom:1px solid var(--line-soft);
    text-align:right;white-space:normal
  }
  .customer-table tbody tr:last-child td{border-bottom:1px solid var(--line-soft)}
  .customer-table tbody td::before{
    content:attr(data-label);flex:0 0 auto;color:var(--text-3);
    font-size:11px;font-weight:650;text-align:left
  }
  .customer-table tbody td.row-number{
    position:absolute;top:8px;left:10px;width:auto;padding:3px 7px;
    border:0;border-radius:7px;background:var(--surface-2);font-size:12px
  }
  .customer-table tbody td[data-label="Customer"]{
    grid-column:1/-1;justify-content:flex-start;min-height:54px;padding-left:48px;
    text-align:left;font-size:16px;font-weight:700
  }
  .customer-table tbody td.customer-actions,.customer-table tbody tr:last-child td.customer-actions{grid-column:1/-1;border-bottom:0}
  .customer-table tbody td.customer-actions::before{display:none}
  .customer-table .row-actions{width:100%;justify-content:flex-start;flex-wrap:wrap}
  .customer-table .row-actions form{display:flex}
  .customer-table .customer-edit-field{width:min(62%,240px);min-width:0;text-align:left}
  .customer-table tbody tr.editing td[data-label="Customer"]{align-items:flex-start}
}
@media (max-width:640px){
  body{font-size:14px}
  .app{min-width:0}
  .sidebar{width:min(84vw,300px)}
  .content{padding:14px 12px 28px}
  .topbar{gap:9px;padding:10px 12px;flex-wrap:wrap}
  .topbar>div:nth-child(2){flex:1 1 calc(100% - 52px)}
  .page-title{font-size:16px;overflow-wrap:anywhere}
  .page-sub{font-size:11.5px}
  .topbar-actions{width:100%;gap:6px;justify-content:flex-end;margin-left:0}
  .current-time{font-size:9px}
  .topbar-actions>.btn-primary{min-height:44px}
  .logout-form .btn{min-height:44px;padding:6px 9px;font-size:12px}
  .menu-btn{width:44px;height:44px;flex:none}
  .input,.select{min-height:44px}
  .stats,.balance-stats{grid-template-columns:1fr 1fr;gap:9px;margin-bottom:14px}
  .stat{padding:12px}
  .stat-value{font-size:20px;overflow-wrap:anywhere}
  .stat-value small{font-size:11px}
  .stat-label,.stat-foot{font-size:11px}
  .stat-icon{width:31px;height:31px}
  .grid-2,.grid-3{gap:12px}
  .card-head{padding:12px 14px}
  .card-body{padding:14px}
  .card-body.tight{padding:0}
  .form-grid{grid-template-columns:1fr;gap:12px}
  .field.full{grid-column:auto}
  .filters{width:100%;align-items:stretch}
  .filters .field,.filters .grow{min-width:0;flex:1 1 100%}
  .filters .btn{align-self:flex-end}
  .customer-list-head{align-items:stretch}
  .customer-list-actions{width:100%;align-items:stretch}
  .filters.customer-search{flex:1 1 100%;width:100%;margin:0}
  .filters.customer-search .field{flex:1 1 auto;min-width:0}
  .customer-list-actions>.btn{width:100%}
  .row-actions{flex-wrap:wrap}
  .ledger-toolbar{align-items:stretch}
  .ledger-filter{margin:0}
  .ledger-filter .field{min-width:0}
  .ledger-filter .field input{max-width:100%}
  .balance-stats .stat-value{font-size:16px}
  .ledger-entry-form .form-actions .btn{width:100%}
  .ledger-records{gap:12px}
  .chart{gap:6px;height:165px}
  .chart-x{font-size:10px}
  .legend{font-size:11.5px;gap:8px}
  .auth-page{padding:14px}
  .auth-card{padding:24px 20px}
}
@media (max-width:370px){
  .topbar{gap:6px}
  .page-sub{display:none}
  .stats,.balance-stats{grid-template-columns:1fr}
  .stat-value{font-size:23px}
}
