:root {
  --font-100: 14px;
  --font-200: 16px;
  --font-300: 18px;

  --bg: #0f172a;
  --panel: rgba(30, 41, 59, 0.7); /* Glass effect */
  --panel-2: #1e293b;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --brand: #38bdf8;
  --brand-2: #818cf8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Modern Gradients */
  --grad-blue: linear-gradient(135deg, #1e40af, #3b82f6);
  --grad-purple: linear-gradient(135deg, #6d28d9, #a855f7);
  --grad-orange: linear-gradient(135deg, #b45309, #f59e0b);
  --grad-green: linear-gradient(135deg, #065f46, #10b981);
  --grad-dark: linear-gradient(180deg, rgba(255,255,255,0.05), transparent);

  /* --- Mobile-First Global Optimizations --- */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

/* ===== Light Theme ===== */
html[data-theme="light"]{
  --bg:#ffffff;
  --panel:#f9f9f9;
  --panel-2:#ffffff;
  --text:#111111;
  --muted:#666666;
  --brand:#0fa7d9;   /* primary accent for light */
  --brand-2:#60a5fa;
  --ok:#16a34a;
  --warn:#d97706;
  --danger:#dc2626;
  --border: rgba(0,0,0,.08);
}

html[data-theme="sunrise"]{
  --bg:#0e0d0c; --panel:#151311; --panel-2:#1b1916; --text:#fff3ea; --muted:#c9b8a8;
  --brand:#ff9d5c; --brand-2:#ffd1b0; --ok:#7bd88f; --warn:#ffb84d; --danger:#ff6b6b; --border:rgba(255,199,150,.18);
}
html[data-theme="sky"]{
  --bg:#061019; --panel:#0c1a27; --panel-2:#102233; --text:#eaf6ff; --muted:#a3c0d6;
  --brand:#66b6ff; --brand-2:#b3dbff; --ok:#78e3a0; --warn:#ffd166; --danger:#ff6b88; --border:rgba(102,182,255,.18);
}
html[data-theme="mint"]{
  --bg:#0a1311; --panel:#0f1b19; --panel-2:#142420; --text:#eafff8; --muted:#9fd4c4;
  --brand:#66f0c6; --brand-2:#b6ffea; --ok:#89ffb3; --warn:#ffe38f; --danger:#ff7f7f; --border:rgba(102,240,198,.16);
}
html[data-theme="slate"]{
  --bg:#0b0d10; --panel:#12151b; --panel-2:#171b22; --text:#e6edf3; --muted:#9aa6b2;
  --brand:#7aa2f7; --brand-2:#b7c6ff; --ok:#9ece6a; --warn:#e0af68; --danger:#f7768e; --border:rgba(122,162,247,.14);
}
html[data-theme="dark"]{
  --bg:#0a0a0a; --panel:#121212; --panel-2:#191919; --text:#f1f1f1; --muted:#b6b6b6;
  --brand:#8ab4f8; --brand-2:#bfd5ff; --ok:#34d399; --warn:#fbbf24; --danger:#f87171; --border:rgba(255,255,255,.1);
}

html[data-font="small"] { --fs: var(--font-100); }
html[data-font="medium"]{ --fs: var(--font-200); }
html[data-font="large"] { --fs: var(--font-300); }

/* --- Mobile Layout Optimization --- */
* { 
  box-sizing: border-box; /* Padding ကြောင့် width ကျော်မသွားအောင် တားခြင်း */
  -webkit-tap-highlight-color: transparent; /* ဖုန်းမှာနှိပ်ရင် မွဲပြာရောင်မထွက်စေရန် */
  touch-action: manipulation; /* Zoom Delay ကို တားဆီးရန် */
}

body {
  margin:0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: var(--fs, 16px); color:var(--text); background:linear-gradient(180deg, var(--bg), #000);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display:grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
@media (max-width: 920px){
  .app { grid-template-columns: 1fr; }
}

.sidebar {
  position: sticky; top:0; height: 100vh; overflow:auto; background:linear-gradient(180deg,var(--panel),var(--panel-2));
  border-right:1px solid var(--border);
}
.brand {
  display:flex; align-items:center; gap:10px; padding:16px; position: sticky; top:0; background:linear-gradient(180deg,var(--panel),transparent);
}
.brand .title { font-weight:800; letter-spacing:.3px; }

/* Universal logo style (login + sidebar) */
.logo{
  width:38px; height:38px; display:grid; place-items:center; border-radius:12px;
  background:linear-gradient(135deg,var(--brand),var(--brand-2)); box-shadow: var(--shadow);
  color:#0b0b0b;
}
.logo svg{ width:22px; height:22px; display:block; }
@media (hover:hover){
  .logo{ transition: transform .15s ease; }
  .logo:hover{ transform: translateY(-1px); }
}

.nav { padding:10px; display:grid; gap:4px; }
.nav .item {
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px; cursor:pointer;
  color:var(--text); border:1px solid transparent; transition:.2s ease;
}
.nav .item:hover { border-color:var(--border); background:rgba(255,255,255,.03); }
.nav .item.active { background:rgba(255,255,255,.06); border-color:var(--border); }

.topbar {
  position: sticky; top:0; z-index: 6;
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:12px 16px; background:linear-gradient(180deg,var(--panel),transparent);
  border-bottom:1px solid var(--border);
}
.search-inline{ display:flex; align-items:center; gap:8px; flex:1; max-width: 520px; position:relative; }
.input {
  background:var(--panel-2); color:var(--text); border:1px solid var(--border);
  border-radius:10px; padding:10px 12px; width:100%; outline:none; transition:.2s ease;
}
.input:focus{ border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.btn {
  appearance:none; border:none; border-radius:10px; padding:10px 12px; font-weight:600; cursor:pointer;
  background:var(--brand); color:#0a0a0a; box-shadow: var(--shadow); transition: transform .05s ease, opacity .2s ease;
}
.btn:hover{ opacity:.95; }
.btn:active{ transform: translateY(1px); }
.btn.ghost{ background:transparent; color:var(--text); border:1px solid var(--border); box-shadow:none; }
.btn.secondary{ background:linear-gradient(90deg,var(--brand),var(--brand-2)); color:#0b0b0b; }
.btn.danger{ background: var(--danger); color: #fff; }
.btn.ok{ background: var(--ok); color: #06210f; }

.main { padding:16px; display:grid; gap:12px; }
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, transparent), var(--panel-2));
  border:1px solid var(--border); border-radius:16px; box-shadow: var(--shadow);
}
.card-body { padding:14px; }
.card.clickable { cursor:pointer; }
.card.clickable:hover { outline:1px solid var(--border); transform: translateY(-1px); }

/* Grids */
.grid { display:grid; gap:12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width:920px){ .cols-4, .cols-3, .cols-2{ grid-template-columns: 1fr; } }

.table-wrap { overflow:auto; }
.table { width:100%; border-collapse: collapse; }
.table th, .table td { padding:10px 8px; border-bottom:1px solid var(--border); white-space: nowrap; }
.table thead th { text-align:left; color:var(--muted); font-weight:600; }
.table td.num, .table th.num { text-align: right; }
.table tr.low td { background: rgba(255, 166, 0, .06); }
.table tr.critical td { background: rgba(239, 68, 68, .08); }

/* Search highlight (background instead of border) */
.table tr.search-hit td {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
}

/* Totals */
.table tr.tr-total th, .table tr.tr-total td { font-weight:800; background:rgba(255,255,255,.03); }

tr.tr-total {
  background: #e2e99e8c;
  font-weight: 300;
  border-top: 1px solid rgba(240, 194, 6, 0.12);
}

/* Modal */
.modal-backdrop { display:none; position: fixed; inset:0; background:rgba(0,0,0,.6); z-index: 30; }
.modal { display:none; position: fixed; inset:0; z-index: 31; }
.modal.active + .modal-backdrop, .modal-backdrop.active { display:block; }
.modal.active { display:grid; place-items:center; padding:16px; }
.modal .dialog {
  width:min(980px, 96vw); background:var(--panel); border:1px solid var(--border); border-radius:14px; box-shadow: var(--shadow);
}
.modal .head, .modal .foot { padding:12px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal .foot { border-top:1px solid var(--border); border-bottom:none; }
.modal .body { padding:14px; }

/* Login */
.login-page { display:grid; place-items:center; min-height: 100vh; padding: 20px; }
.login-card { width:min(420px, 96vw); }
.login-grid { display:grid; gap:10px; }

/* Badges + chips */
.badge { display:inline-flex; gap:6px; align-items:center; padding:4px 8px; font-size:12px; border-radius:999px; background:rgba(255,255,255,.06); border:1px solid var(--border); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); border: 1px solid rgba(239, 68, 68, 0.2); padding: 4px 10px; border-radius: 8px; font-weight: 700; }

/* Footer social */
.footer { display:flex; gap:10px; align-items:center; justify-content:center; padding:12px; color:var(--muted); }

/* Smooth transitions */
:root, .btn, .input, .card, .sidebar, .topbar, .table, .modal .dialog {
  transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

/* Tiny helper for clickables inside tables */
.table .actions { display:flex; gap:6px; align-items:center; }

/* Quantity control */
.qty{ display:inline-flex; align-items:center; gap:8px; }
.qty .btn{ padding:4px 8px; line-height:1; }
.qty .qty-num{ min-width:36px; text-align:center; font-weight:800; }

/* Search dropdown */
.search-results {
  position:absolute; z-index: 10; background:var(--panel-2); border:1px solid var(--border); border-radius:10px; width:100%; max-height: 280px; overflow:auto;
  display:none;
}
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 5px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: none;
}
.search-results.active{ display:block; }
.search-results .row{ padding:8px 10px; border-bottom:1px solid var(--border); cursor:pointer; transition: background 0.2s;}
.search-results .row:hover{ background:rgba(255,255,255,.04); background: var(--panel-2);}
.search-results .row:last-child { border-bottom: none; }

/* Tiny notifications */
.notification {
  position: fixed; left:50%; transform:translateX(-50%); bottom:16px; padding:10px 12px; border-radius:12px;
  border:1px solid var(--border); background:var(--panel); color:var(--text); z-index: 100; display:none;
}
.notification.show{ display:block; }
.notification.ok{ border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.notification.warn{ border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.notification.danger{ border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* Task lane drop highlight */
.lane-row.drop { outline: 2px dashed color-mix(in srgb, var(--brand) 55%, transparent); border-radius: 12px; }
.lane-row.drop .lane-grid { background: rgba(255,255,255,.03); border-radius: 12px; }

/* Backdrop for mobile drawer */
.backdrop{
  position: fixed; inset:0;
  background:#000; opacity:0; pointer-events:none; z-index:1098;
  transition: opacity .25s ease;
}
.backdrop.active{ opacity:.6; pointer-events:auto; }

/* === Mobile drawer for sidebar + edge opener + mobile search === */
@media (max-width: 920px){
  .sidebar{
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .28s ease, box-shadow .28s ease;
    z-index: 1100;
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
    background: var(--panel); /* solid bg on phones */
  }
  body.sidebar-open .sidebar{ transform: translateX(0); }

  /* Hot zone for reopening the drawer from the left edge */
  #sidebarEdge{
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 12px;
    z-index: 1099;
  }

  /* Hide topbar search on phones; show in sidebar */
  .topbar .search-inline{ display: none !important; }
  .sidebar .search-wrap{ display: block !important; }
}

@media (min-width: 921px){
  #sidebarEdge{ display: none; }
}

/* === Image hover preview (no crop, 50% viewport) === */
.img-hover { text-decoration: underline dotted; text-underline-offset: 2px; cursor: zoom-in; }

#img-pop {
  position: fixed; z-index: 2500; display: none; pointer-events: none;
  max-width: 50vw; max-height: 50vh; /* roughly 50% as requested */
  box-shadow: var(--shadow); border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel-2); padding: 6px;
}
#img-pop img {
  display: block; max-width: 100%; max-height: 100%;
  object-fit: contain; /* no cropping */
  border-radius: 8px;
}

/* ===== Intro Tabs (Dashboard) ===== */
.tabs { display:block; }
.tabs .tab-headers{
  display:flex; gap:8px; border-bottom:1px solid var(--border); margin-bottom:8px;
}
.tabs .tab-headers label{
  padding:6px 12px; border-radius:10px 10px 0 0; cursor:pointer;
  background: var(--panel-2); color: var(--text);
  font-weight:600; border:2px solid var(--border); border-bottom:none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.tabs input#tab-en:checked ~ .tab-headers label[for="tab-en"],
.tabs input#tab-mm:checked ~ .tab-headers label[for="tab-mm"]{
  background: var(--brand);
  color: #0b0b0b; /* brand bg အပေါ်မှာ readable */
  border-color: color-mix(in srgb, var(--brand) 60%, var(--border));
}
.tabs .tab-panels{ padding-top:6px; }
.tabs .panel{ display:none; }
.tabs input#tab-en:checked ~ .tab-panels .panel-en{ display:block; }
.tabs input#tab-mm:checked ~ .tab-panels .panel-mm{ display:block; }

.tabs ul { margin:6px 0 0 18px; }
.tabs li { margin:4px 0; }

/* Card ကို Bento Style ပြောင်းလဲခြင်း */
.card {
  background: var(--panel);
  backdrop-filter: blur(12px); /* Glassmorphism */
  border: 1px solid var(--border);
  border-radius: 24px; /* ပိုဝိုင်းသော ထောင့်များ */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(56, 189, 248, 0.2);
  border-color: var(--brand);
}

/* Table Row Style */
.table tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

/* Badge များအတွက် Style အသစ် */
.badge-weather {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--glass);
  border: 1px solid var(--border);
}

/* Card တွေကို ပိုပြီး Glassmorphism ဆန်အောင် ပြင်ပါမယ် */
.card.modern {
  border: none;
  color: white;
  position: relative;
  overflow: hidden;
}

.card.modern .insight {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 5px;
  font-weight: 400;
}

.card.modern h2 {
  margin: 5px 0;
  font-size: 28px;
  font-weight: 800;
}

.card.modern {
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  transition: transform 0.3s ease;
}
.card.modern:hover { transform: translateY(-5px); }
.card.modern .insight-label { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.card.modern .insight-value { font-size: 24px; font-weight: 800; margin: 4px 0; }
.card.modern .insight-footer { font-size: 12px; opacity: 0.9; }

.insight-label { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.insight-value { font-size: 24px; font-weight: 800; margin: 4px 0; }
.insight-footer { font-size: 12px; opacity: 0.9; }

#reader { width: 100%; max-width: 400px; margin: 0 auto; border-radius: 12px; overflow: hidden; }

/* Sidebar ဘေးက Burger ခလုတ်အတွက် */
#burger { display: none; } /* Desktop မှာ ဖျောက်ထားမယ် */

@media (max-width: 920px) {
  #burger { 
    display: flex; /* ဖုန်းမှာပဲ ပြန်ပေါ်မယ် */
    align-items: center;
    justify-content: center;
  }
}

/* Modal ထဲက Barcode ခလုတ်အတွက် Design */
.input-group { display: flex; gap: 4px; }
.btn-inline-scan { 
  background: var(--brand); color: #000; border-radius: 8px; padding: 0 10px; border: none; cursor: pointer;
}

/* iPhone 15 Pro Centering & Layout Beauty Fix */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh; /* dynamic height for mobile */
  padding: 20px;
  background: radial-gradient(circle at center, var(--panel-2), var(--bg));
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Dashboard Grid Fix for Centering on Mobile */
@media (max-width: 920px) {
  .main {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .grid { width: 100%; }
  .card { width: 100%; max-width: 500px; margin: 0 auto; }
}

/* Barcode Input Group Beauty */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrapper .input {
  padding-right: 45px; /* space for icon */
}
.scan-trigger {
  position: absolute;
  right: 10px;
  background: var(--brand);
  border: none;
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
}

/* Scanner Container Beauty */
#modalScannerArea {
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--brand);
  background: #000;
  position: relative;
}

/* iPhone 15 Pro Center & Modern Look */
body {
  background: var(--bg);
  min-height: 100dvh;
}

.login-page {
  display: flex;
  flex-direction: column;
  justify-content: center; /* Vertical Center */
  align-items: center;     /* Horizontal Center */
  min-height: 100dvh;
  padding: 20px;
  background: radial-gradient(circle at center, #1e293b, #0f172a);
}

.login-card {
  width: 100%;
  max-width: 380px;
  border-radius: 30px; /* Apple Style Rounded */
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Dashboard Centering Fix */
.main {
  max-width: 1200px;
  margin: 0 auto; /* Desktop Center */
  width: 100%;
}

@media (max-width: 920px) {
  .main {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Mobile Center */
  }
  .card { width: 100%; }
}

/* Modal Styling */
.modal .dialog {
  border-radius: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
}

/* Password Peek Fix */
.pass-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.pass-wrapper .input { padding-right: 40px; }
.pass-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
}

/* iPhone 15 Pro & Modern Look */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 20px;
  background: radial-gradient(circle at center, #1e293b, #0f172a);
}
.login-card {
  width: 100%; max-width: 380px; border-radius: 28px;
  background: rgba(255, 255, 255, 0.04); backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1); padding: 30px;
}

/* Password Eye Icon */
.pass-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.pass-wrapper .input { padding-right: 45px; width: 100%; }
.pass-toggle {
  position: absolute; right: 12px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 20px; display: grid; place-items: center;
}

/* Barcode Scan Trigger inside Input */
.input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.input-wrapper .input { padding-right: 50px; }
.scan-trigger {
  position: absolute; right: 8px; width: 34px; height: 34px;
  background: var(--brand); color: #000; border: none; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; z-index: 5;
}

/* Scanner Area UI */
.scanner-container {
  display: none; margin-top: 15px; border-radius: 16px; 
  overflow: hidden; border: 2px solid var(--brand); background: #000;
}

/* Modal Body ကို Scroll ဆွဲလို့ရအောင်လုပ်ခြင်း */
.modal .body {
  max-height: 70dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scanner ပွင့်နေချိန်မှာ Input တွေကို ဖျောက်ထားမည့် Class */
.hide-inputs .grid { display: none; }
.hide-inputs .scanner-container { display: block; height: 350px; }

/* Modal Body အရွယ်အစားညှိခြင်း */
.modal .body {
  max-height: 80dvh;
  overflow-y: auto;
  position: relative;
}

/* Scanner ပွင့်ချိန်မှာ Input အကွက်တွေကို ဖျောက်ရန် */
.hide-inputs .grid { display: none !important; }
.hide-inputs .scanner-container { 
  display: block !important; 
  height: 400px; /* ကင်မရာအရွယ်အစားကို အကြီးကြီးလုပ်ခြင်း */
  margin-top: 0;
}

/* Scan ခလုတ်အလှအပ */
.input-wrapper { position: relative; width: 100%; }
.input-wrapper .input { padding-right: 50px; }
.scan-trigger {
  position: absolute; right: 5px; top: 5px; bottom: 5px;
  width: 40px; background: var(--brand); color: #000;
  border: none; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; z-index: 10;
}

/* Modal Body Scroll ပိုင်းကို ပိုကောင်းအောင်လုပ်ခြင်း */
.modal .body {
  max-height: 75dvh; /* iPhone screen နဲ့ တော်ရုံညှိထားခြင်း */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
  padding: 15px;
}

/* Scanner Area ကို အပေါ်ဆုံးမှာ ကပ်ထားပြီး အရွယ်အစားညှိခြင်း */
.scanner-container {
  width: 100%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--brand);
  margin-bottom: 15px;
  display: none; /* စဖွင့်ချင်း ဖျောက်ထားမယ် */
}

#addReader, #editReader {
  width: 100%;
  height: 250px; /* ကင်မရာ အရွယ်အစား */
}

/* Scan ခလုတ်ကို Input ထဲမှာ ထည့်ထားတဲ့ ပုံစံ */
.input-wrapper { position: relative; width: 100%; }
.scan-trigger {
  position: absolute; right: 5px; top: 5px; bottom: 5px;
  width: 40px; background: var(--brand); color: #000;
  border: none; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; z-index: 10;
}

/* Image Preview */
.img-preview { 
  width: 100%; height: 180px; object-fit: cover; 
  border-radius: 12px; border: 2px dashed var(--border); margin-bottom: 10px;
}
/* Activity Log List */
.log-item { 
  padding: 10px; border-bottom: 1px solid var(--border); font-size: 12px;
}
.log-item b { color: var(--brand); }
/* Chart Container */
.chart-container { height: 300px; width: 100%; }

/* Table Image Thumbnail */
.table-img {
  width: 40px; height: 40px; border-radius: 8px;
  object-fit: cover; cursor: zoom-in; border: 1px solid var(--border);
  transition: transform 0.2s;
}
.table-img:hover { transform: scale(1.1); }

/* Full Screen Image Zoom Overlay */
#image-zoom-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: none; place-items: center; z-index: 3000; cursor: zoom-out;
}
#image-zoom-overlay img {
  max-width: 90%; max-height: 90%; border-radius: 12px;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
#image-zoom-overlay.active { display: grid; }

/* --- Modern Premium Login Design --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
  /* Soft Mesh Gradient Background */
  background: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    #0b0f19;
  font-family: 'Inter', system-ui, sans-serif;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px); /* Glass Effect */
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 35px;
}

.login-header .logo {
  margin: 0 auto 15px;
  width: 54px; height: 54px;
  font-size: 24px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -0.5px;
}

.login-header p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  margin-top: 8px;
}

/* Styled Inputs */
.login-grid label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
  display: block;
}

.login-grid .input {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  height: 52px;
  border-radius: 16px;
  color: #fff !important;
  padding: 0 16px;
  font-size: 16px;
  transition: all 0.3s;
}

.login-grid .input:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
}

/* Sign In Button */
#btnLogin {
  background: var(--grad-blue) !important;
  color: #fff !important;
  height: 54px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 25px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#btnLogin:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

#btnLogin:active { transform: scale(0.98); }

/* Footer Links */
.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
}

.login-footer button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
}

.login-footer button:hover { color: var(--brand); }

/* --- Ultra Premium Aurora Background --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
  position: relative;
  overflow: hidden;
  /* အခြေခံအရောင် (Midnight Black) */
  background-color: #05070a; 
  font-family: 'Inter', system-ui, sans-serif;
}

/* လှုပ်ရှားနေသော အလင်းတန်းများ (Aurora Effect) */
.login-page::before, .login-page::after {
  content: "";
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.4;
}

/* ပထမ အလင်းတန်း (Indigo Blue) */
.login-page::before {
  background: radial-gradient(circle, #1e40af, #3b82f6, transparent);
  top: -200px;
  left: -200px;
  animation: auroraFlow 15s infinite alternate ease-in-out;
}

/* ဒုတိယ အလင်းတန်း (Deep Purple) */
.login-page::after {
  background: radial-gradient(circle, #581c87, #a855f7, transparent);
  bottom: -200px;
  right: -200px;
  animation: auroraFlow 18s infinite alternate-reverse ease-in-out;
}

@keyframes auroraFlow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(100px, 50px) scale(1.1); }
  100% { transform: translate(-50px, 150px) scale(0.9); }
}

/* Login Card ကို အလင်းတန်းတွေအပေါ်မှာ ပေါ်အောင်လုပ်ခြင်း */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  /* ပိုမိုကြည်လင်သော Glass Effect */
  background: rgba(15, 20, 30, 0.6); 
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  padding: 45px 40px;
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.6);
}

/* --- Modern Intro Tabs Design --- */
.intro-container {
  padding: 10px 5px;
}

.intro-title {
  font-size: 1.2rem;
  font-weight: 600; /* weight ကို လျှော့ချထားပါတယ် */
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.intro-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.feature-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.feature-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.feature-row i {
  color: var(--brand);
  font-size: 1.2rem;
  margin-top: 2px;
}

.feature-text b {
  display: block;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.feature-text span {
  font-size: 0.9rem;
  color: var(--muted);
}

.how-it-works {
  background: var(--panel-2);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  border: 1px dashed var(--border);
}

.how-it-works b { color: var(--brand); margin-right: 5px; }

/* Tabs Button Styling */
.tabs .tab-headers label {
  /* border: none !important; */
  background: transparent !important;
  opacity: 0.5;
  padding: 10px 20px !important;
  font-size: 14px;
  position: relative;
  transition: all 0.3s;
}

.tabs input:checked ~ .tab-headers label {
  opacity: 1;
  color: var(--brand) !important;
}

.tabs input:checked ~ .tab-headers label::after {
  content: "";
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--brand);
  border-radius: 10px;
}

/* Scanner Container ကို iPhone Screen နဲ့ အံကိုက်ဖြစ်အောင်လုပ်ခြင်း */
.scanner-container {
  width: 100%;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid var(--brand);
  margin-bottom: 20px;
  display: none;
  /* iPhone မှာ ရှည်ရှည်လေး မြင်ရအောင် Height ကို ညှိထားပါတယ် */
  aspect-ratio: 1 / 1; 
  max-height: 400px;
  position: relative;
}

#addReader, #editReader, #prodReader, #editProdReader {
  width: 100% !important;
  height: 100% !important;
}

/* Scanner ဗီဒီယိုကို အလယ်တည့်တည့် ရောက်စေရန် */
#addReader video, #editReader video {
  object-fit: cover !important;
}

/* Scan ခလုတ်အလှအပ */
.scan-trigger {
  position: absolute; right: 5px; top: 5px; bottom: 5px;
  width: 45px; background: var(--brand); color: #000;
  border: none; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; z-index: 10;
}

/* Stock ထည့်တဲ့နေရာကို အကျယ်သတ်မှတ်ပြီး ငြိမ်အောင်လုပ်ခြင်း */
.qty {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 110px; /* အကျယ်ကို ပုံသေထားလိုက်ပါ */
}

.qty-num {
  display: inline-block;
  min-width: 30px; /* ဂဏန်းအတွက် နေရာအလုံအလောက်ယူထားခြင်း */
  text-align: center;
  font-variant-numeric: tabular-nums; /* ဂဏန်းတိုင်း အကျယ်တူစေရန် */
}

/* Table Row တွေ rerender ဖြစ်တဲ့အခါ အရွယ်အစား မပြောင်းစေရန် */
.table td {
  height: 60px; /* row height ကို ပုံသေနီးပါး သတ်မှတ်ခြင်း */
  vertical-align: middle;
}

/* Card Hover Effect ကို လုံးဝ မလှုပ်အောင် ပြင်ဆင်ခြင်း */
.card {
  transition: border-color 0.2s, box-shadow 0.2s; /* transform ကို ဖြုတ်လိုက်ပါ */
}

.card:hover {
  transform: none !important; /* အပေါ်ကို ကြွတက်တာကို ပိတ်လိုက်ပါ */
  border-color: var(--brand); /* အနားသတ်အရောင်ပဲ လင်းလာမယ် */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2); /* အရိပ်ပဲ ပိုထွက်လာမယ် */
}

/* Table Row Hover လုပ်ရင်လည်း လှုပ်မသွားအောင် ထိန်းခြင်း */
.table tr {
  transition: background 0.2s;
}

.table tr:hover td {
  background: rgba(56, 189, 248, 0.03); /* အရောင်ပဲ ပြောင်းမယ်၊ size မပြောင်းစေရ */
}

/* ခလုတ်တွေ Hover လုပ်ရင်လည်း Size မပြောင်းအောင် ထိန်းခြင်း */
.btn:hover {
  transform: none !important;
  filter: brightness(1.1); /* အရောင်ပဲ ပိုလင်းလာစေမယ် */
}

.qty button:active {
  transform: scale(0.95); /* နှိပ်လိုက်တဲ့အချိန် (Click) မှသာ အနည်းငယ် ချုံ့မယ် */
}

/* --- Tasks & Settings Mobile Optimizations --- */
@media (max-width: 920px) {
  /* Task Lane များကို တစ်ခုချင်းစီ ခွဲခြားပေးခြင်း */
  .lane-row {
    margin-bottom: 20px !important;
    border-radius: 24px !important;
  }
  
  .lane-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 5px 0;
  }

  /* Task Card လေးများကို ပိုမိုလှပစေခြင်း */
  .task-card {
    background: var(--panel) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
  }

  /* Settings Page Grid ကို တစ်ကော်လံတည်း ပြောင်းခြင်း */
  .cols-2 {
    grid-template-columns: 1fr !important;
  }
  
  /* Settings က input များကို နေရာချန်ပေးခြင်း */
  .settings-card .input {
    margin-top: 5px;
    margin-bottom: 15px;
  }

  /* Team Management Table ကို Scroll ဆွဲလို့ရအောင်လုပ်ခြင်း */
  [data-section="users"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Task Status အရောင်များ */
.lane-title-todo { color: #f59e0b; }
.lane-title-progress { color: #3b82f6; }
.lane-title-done { color: #10b981; }

@media (max-width: 920px) {
  .main {
    padding: 12px !important; /* ဘေးဘောင်တွေကို လျှော့ချမယ် */
    width: 100% !important;
    overflow-x: hidden; /* ဘေးတိုက် scroll မဖြစ်အောင် တားမယ် */
  }

  .grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
  }

  .card {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 20px !important; /* iPhone Style အဝိုင်း */
  }

  /* Tasks Lane များကို အပြည့်ဖြစ်အောင်လုပ်ခြင်း */
  .lane-row {
    width: 100% !important;
    margin-bottom: 15px !important;
  }

  /* Table တွေ ညာဘက်မြုပ်နေတာကို ဖြေရှင်းခြင်း */
  .table-wrap {
    width: 100% !important;
    overflow-x: auto; /* Table က ကြီးနေရင် သူ့အကွက်ထဲသူ scroll ဖြစ်မယ် */
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  .table {
    min-width: 500px; /* Table content ကို မညှပ်စေဘဲ scroll လုပ်ခိုင်းမယ် */
  }
}

/* Appearance Card က Input တွေကို အပြည့်ဖြစ်စေရန် */
.settings-card .input, .settings-card select {
  width: 100% !important;
}

/* --- Global Width Fix (ညာဘက်မြုပ်နေတာကို ဖြေရှင်းရန်) --- */
html, body {
  width: 100%;
  overflow-x: hidden; /* ဘေးတိုက် ယိုင်တာကို တားဆီးရန် */
  margin: 0;
  padding: 0;
}

.main {
  width: 100%;
  max-width: 100vw;
  padding: 15px !important;
  box-sizing: border-box;
}

.grid {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 15px;
}

.card {
  width: 100% !important; /* အကျယ်ကို 100% ပေးခြင်း */
  max-width: 100% !important;
  box-sizing: border-box;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* --- Modal Centering Fix (အလယ်တည့်တည့် ရောက်စေရန်) --- */
.modal {
  display: none;
  position: fixed;
  inset: 0; /* top, bottom, left, right အကုန် 0 */
  z-index: 2000;
  align-items: center;
  justify-content: center; /* horizontal center */
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex; /* Active ဖြစ်ရင် Flex နဲ့ အလယ်ပို့မယ် */
}

.modal .dialog {
  width: 100%;
  max-width: 500px; /* Desktop အတွက် */
  background: var(--panel);
  border-radius: 28px;
  max-height: 90dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* --- Select Input Optimization (Option များ ကြီးအောင်လုပ်ခြင်း) --- */
select.input {
  font-size: 16px !important; /* iPhone မှာ auto zoom မဖြစ်အောင် 16px ထားရပါမယ် */
  padding: 12px !important;
  height: auto !important;
  appearance: auto !important; /* Mobile native dropdown ကို သုံးစေရန် */
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
}

/* Table Wrap Fix */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.actions button i {
  pointer-events: none; /* icon ကိုနှိပ်ရင် button ကိုနှိပ်သလိုပဲ ဖြစ်စေရန် */
}

.table td {
  padding: 12px 8px; /* row တစ်ခုချင်းစီကို နေရာပိုပေးခြင်း */
}

/* --- Dashboard Grid Fix --- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
  width: 100%;
}

/* Card တစ်ခုချင်းစီရဲ့ အလှအပ */
.card.modern {
  border: none;
  border-radius: 24px;
  color: white;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card.modern:hover {
  transform: translateY(-5px);
}

.card.modern i {
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 40px;
  opacity: 0.2;
}

.insight-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  opacity: 0.9;
}

.insight-value {
  font-size: 26px;
  font-weight: 800;
  margin: 5px 0;
}

.insight-footer {
  font-size: 12px;
  opacity: 0.8;
}

@media (max-width: 600px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr); /* ဖုန်းမှာ ၂ ကွက်ပြိုင်ပြမယ် */
    gap: 12px;
  }
  .insight-value { font-size: 20px; }
}

[data-go] {
  cursor: pointer !important;
}

.btn.ghost:hover {
  background: var(--panel-2);
  border-color: var(--brand);
  color: var(--brand);
}

/* --- Links & Contact Modern UI Fix --- */
.link-card-item {
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.link-info {
  margin-bottom: 12px;
}

.link-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.link-url {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  opacity: 0.8;
}

/* ခလုတ်များကို သေသပ်စွာ နေရာချခြင်း */
.link-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.link-actions .btn {
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

/* Contact Form Styling */
.contact-form .input {
  margin-bottom: 12px;
  background: var(--panel-2) !important;
  border: 1px solid var(--border) !important;
}

.contact-btn-group {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

/* --- Role Info Tooltip --- */
.role-info-container {
  position: relative;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

.role-info-icon {
  color: var(--brand);
  font-size: 18px;
  cursor: help;
  opacity: 0.8;
}

.role-tooltip {
  visibility: hidden;
  width: 250px;
  background-color: var(--panel-2);
  color: var(--text);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  position: absolute;
  z-index: 100;
  bottom: 125%; /* အပေါ်ဘက်မှာ ပေါ်စေရန် */
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  line-height: 1.6;
}

/* မြားပုံစံလေး ထည့်ခြင်း */
.role-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--border) transparent transparent transparent;
}

.role-info-container:hover .role-tooltip {
  visibility: visible;
  opacity: 1;
}

/* Mobile မှာ Hover မရှိလို့ နှိပ်ရင် ပေါ်အောင်လုပ်ခြင်း (Optional) */
@media (max-width: 920px) {
  .role-tooltip {
    left: auto;
    right: 0;
    transform: none;
    width: 200px;
  }
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* 📱 ဖုန်းမှာ စာရိုက်တဲ့အခါ Screen အလိုအလျောက် Zoom မဖြစ်အောင် ၁၆ ပစ်ဆယ်ထားခြင်း */
input, select, textarea {
  font-size: 16px !important; 
}

/* 📱 Mobile Table Scrolling - ဖုန်းမှာ ဇယားတွေ ညာဘက်မြုပ်မသွားအောင် */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS Smooth Scroll */
  margin-bottom: 15px;
  background: var(--panel);
  border-radius: 12px;
}

/* 📱 Tablet (iPad) View - Screen အကျယ် 600px - 1024px ကြား */
@media (min-width: 601px) and (max-width: 1024px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr) !important; /* iPad မှာ နှစ်ကွက်ပြိုင် */
  }
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 📱 Mobile Phone View - Screen 600px အောက် */
@media (max-width: 600px) {
  .topbar {
    padding: 0 10px;
    height: 60px;
  }
  
  .main {
    padding: 10px !important;
  }

  .card-body {
    padding: 15px !important;
  }

  /* ခလုတ်များကို လက်မဖြင့် နှိပ်ရလွယ်အောင် ကြီးပေးခြင်း */
  .btn {
    min-height: 44px; /* Apple UI Guideline အတိုင်း */
    padding: 8px 16px;
  }

  /* Table ထဲက Action ခလုတ်လေးတွေကို ဖုန်းမှာ နေရာချွေတာခြင်း */
  .actions {
    display: flex;
    gap: 5px;
  }
  
  /* Sidebar Drawer ကို iPhone Notch များအတွက် ညှိခြင်း */
  .sidebar {
    padding-top: calc(20px + var(--safe-top));
  }
}