/* ============================================================
   Nhật ký Bán hàng Xăng dầu — Design System (Dashboard A)
   Nguồn: docs/ref/"Quan ly cua hang xang dau.zip" → styles.css
   Sạch · hiện đại · cho người non-tech · accent xanh dương
   ============================================================ */

:root {
  /* Brand / accent */
  --blue-50:  #eef4ff;
  --blue-100: #dbe7ff;
  --blue-200: #bcd2ff;
  --blue-500: #2f6bf0;
  --blue-600: #1f5be0;
  --blue-700: #1a4cc0;
  --navy:     #0f1d36;

  /* Neutrals */
  --bg:       #f4f7fb;
  --surface:  #ffffff;
  --surface-2:#f8fafd;
  --line:     #e6ecf4;
  --line-2:   #eef2f8;
  --ink:      #15233c;
  --ink-2:    #44546e;
  --muted:    #7387a3;
  --muted-2:  #9aa9c0;

  /* Status */
  --green-50:#e9f8ef;  --green-500:#1aa758;  --green-700:#137a40;
  --amber-50:#fef3e4;  --amber-500:#e08a14;  --amber-700:#b56a02;
  --red-50:  #fdecec;  --red-500:  #e0453f;  --red-700:  #b32d28;
  --slate-50:#eef2f8;  --slate-500:#64748b;

  /* Product colors */
  --p-ron95:#1f5be0;   /* RON 95 — xanh dương */
  --p-e5:   #1aa758;   /* E5 — xanh lá */
  --p-do:   #e08a14;   /* DO — cam */

  --radius:   16px;
  --radius-sm:11px;
  --radius-lg:22px;
  --shadow-sm: 0 1px 2px rgba(18,38,73,.05), 0 1px 3px rgba(18,38,73,.04);
  --shadow:    0 2px 6px rgba(18,38,73,.06), 0 8px 24px rgba(18,38,73,.06);
  --shadow-lg: 0 8px 30px rgba(18,38,73,.12);

  --font: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* numeric figures align nicely */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------- App chrome ---------- */
.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px;
  padding: 0 26px;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(150deg, var(--blue-500), var(--blue-700));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px rgba(31,91,224,.32);
}
.brand-name { font-weight: 700; font-size: 15.5px; line-height: 1.1; }
.brand-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; gap: 4px; margin-left: 14px; }
.nav a {
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  padding: 8px 14px; border-radius: 9px; font-weight: 500;
}
.nav a.active { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.nav-more { display: flex; align-items: center; }
.nav-more-btn { font-size: 18px; font-weight: 700; padding: 4px 10px; line-height: 1; color: var(--ink-2); }
.nav-more-btn.active { background: var(--blue-50); color: var(--blue-700); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.period-pill {
  display: flex; align-items: center; gap: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--ink);
}
.period-label { min-width: 100px; text-align: center; white-space: nowrap; padding: 0 4px; }
.period-arrow {
  color: var(--ink-3); padding: 6px 10px; text-decoration: none;
  line-height: 1; border-radius: 11px;
}
.period-arrow:hover { background: var(--border); color: var(--ink-1); }

.store-pill {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 14px 7px 11px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  color: var(--ink);
}
.store-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); flex-shrink: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--blue-100); color: var(--blue-700);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--line);
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: var(--ink-2);
  cursor: pointer; position: relative;
}

/* ---------- Layout ---------- */
.canvas-pad { padding: 26px 30px 34px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { font-size: 14px; color: var(--muted); margin-top: 5px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-title { font-size: 15.5px; font-weight: 700; }
.card-title .hint { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 2px; }
.card-action { margin-left: auto; font-size: 13px; color: var(--blue-600); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

/* ---------- Badge / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  line-height: 1.3; white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge-blue  { background: var(--blue-50);  color: var(--blue-700); }
.badge-green { background: var(--green-50); color: var(--green-700); }
.badge-amber { background: var(--amber-50); color: var(--amber-700); }
.badge-red   { background: var(--red-50);   color: var(--red-700); }
.badge-gray  { background: var(--slate-50); color: var(--slate-500); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 11px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; letter-spacing: -0.01em;
  text-decoration: none;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 3px 10px rgba(31,91,224,.28); }
.btn-ghost   { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-soft    { background: var(--blue-50); color: var(--blue-700); }
.btn-danger  { background: var(--red-500); color: #fff; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 18px 20px; }
.kpi-ic {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 14px;
}
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -0.025em; margin-top: 3px; line-height: 1.1; }
.kpi-value .unit { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-left: 3px; }
.kpi-delta { font-size: 12.5px; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.delta-up { color: var(--green-700); }
.delta-down { color: var(--red-700); }
.delta-flat { color: var(--muted); }

/* ---------- Tank gauge ---------- */
.tank { display: flex; align-items: center; gap: 16px; padding: 14px 0; }
.tank + .tank { border-top: 1px solid var(--line-2); }
.tank-vessel {
  position: relative; width: 46px; height: 60px; border-radius: 9px;
  background: var(--surface-2); border: 1.5px solid var(--line);
  overflow: hidden; flex-shrink: 0;
}
.tank-fill { position: absolute; left: 0; right: 0; bottom: 0; }
.tank-fill.danger {
  background: repeating-linear-gradient(135deg, #e96a65 0 7px, #ec8c88 7px 14px) !important;
}
.tank-meta { flex: 1; min-width: 0; }
.tank-name { font-size: 14.5px; font-weight: 600; }
.tank-prod { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tank-fig { text-align: right; }
.tank-pct { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.tank-liters { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; padding: 0 14px 11px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 13px 14px; font-size: 14px; border-bottom: 1px solid var(--line-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* ---------- Alert item ---------- */
.alert {
  display: flex; gap: 13px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.alert + .alert { margin-top: 10px; }
.alert-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.alert-amber { border-color: #f6e2c2; background: #fffaf2; }
.alert-amber .alert-ic { background: var(--amber-50); color: var(--amber-700); }
.alert-red { border-color: #f5d2d0; background: #fff7f6; }
.alert-red .alert-ic { background: var(--red-50); color: var(--red-700); }
.alert-green { border-color: #c6ead3; background: #f4fbf6; }
.alert-green .alert-ic { background: var(--green-50); color: var(--green-700); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 14px; font-weight: 600; }
.alert-desc { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.alert-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); margin: 0; border: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; }
.kv + .kv { border-top: 1px dashed var(--line); }
.kv-k { font-size: 13.5px; color: var(--ink-2); }
.kv-v { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.prod-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }
.prod-swatch { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- Form fields (shift detail) ---------- */
.field {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: 14.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink); min-width: 0;
}
.field-num { justify-content: flex-end; width: 100%; }
.field.filled { border-color: var(--blue-200); background: var(--blue-50); color: var(--blue-700); }
.field.empty {
  border-style: dashed; border-color: #f0c98a; background: #fffaf2; color: var(--amber-700);
  justify-content: center; font-weight: 600;
}
.field.locked { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.field input {
  border: 0; background: transparent; padding: 0; font: inherit; color: inherit;
  text-align: right; width: 100%; min-width: 0; outline: none;
}

.input-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* meter table */
.meter-tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.meter-tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; padding: 0 12px 12px;
}
.meter-tbl th.num { text-align: right; }
.meter-tbl td { padding: 8px 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.meter-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.meter-tbl tr:first-child td { border-top: 0; }

/* reconciliation rows */
.recon-row { display: flex; align-items: center; padding: 12px 0; }
.recon-row + .recon-row { border-top: 1px solid var(--line-2); }
.recon-op { width: 26px; font-size: 17px; font-weight: 700; color: var(--muted-2); text-align: center; flex-shrink: 0; }
.recon-label { font-size: 14.5px; color: var(--ink); }
.recon-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.recon-val { margin-left: auto; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recon-total { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-top: 8px; }

/* segmented tabs */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a {
  border: 0; background: none; font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--ink-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on, .seg a.on { background: #fff; color: var(--blue-700); box-shadow: var(--shadow-sm); }

.txn-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; }
.txn-row + .txn-row { margin-top: 9px; }
.txn-ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }

.justify-box { border: 1.5px dashed var(--amber-500); background: #fffaf2; border-radius: 12px; padding: 14px 16px; }

/* ============================================================
   Portal addendum — phần bổ sung ngoài mockup (form, messages,
   modal, grid trang, alias class cũ, responsive)
   ============================================================ */

/* ----- Page grids (thay inline style của mockup JSX) ----- */
.grid-hero { display: grid; grid-template-columns: 1.62fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.grid-main { display: grid; grid-template-columns: 1.62fr 1fr; gap: 18px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 18px; }

/* ----- ShiftHero accent ----- */
.hero-accent { width: 6px; background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); flex-shrink: 0; border-radius: var(--radius) 0 0 var(--radius); }

/* ----- Forms ----- */
label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 5px; }
input, select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 9px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-200); box-shadow: 0 0 0 3px var(--blue-50);
}
input[type="number"], input.meter { text-align: right; font-variant-numeric: tabular-nums; }
input.meter { width: 9.5rem; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.form-row > div { min-width: 0; }
form.inline { display: inline; }

/* ----- Messages (Django messages framework) ----- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 8px;
  font-size: 14px; font-weight: 500; border: 1px solid var(--line);
}
.messages .success { background: var(--green-50); color: var(--green-700); border-color: #c6ead3; }
.messages .error   { background: var(--red-50);   color: var(--red-700);   border-color: #f5d2d0; }
.messages .warning { background: var(--amber-50); color: var(--amber-700); border-color: #f6e2c2; }
.messages .info    { background: var(--blue-50);  color: var(--blue-700);  border-color: var(--blue-100); }

/* ----- Modal (store_settings) ----- */
.modal {
  display: none; position: fixed; inset: 0; z-index: 100; overflow: auto;
  background: rgba(15, 29, 54, .45); backdrop-filter: blur(2px);
}
.modal-content {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 24px 26px; width: min(600px, calc(100vw - 40px));
  margin: 6vh auto; animation: modalFadeIn .22s ease;
}
.modal-content.wide { width: min(820px, calc(100vw - 40px)); }
@keyframes modalFadeIn { from { transform: translateY(-24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content h3 { margin: 0 0 16px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal .close {
  float: right; font-size: 22px; font-weight: 700; line-height: 1;
  color: var(--muted-2); cursor: pointer; margin: -4px -4px 0 0;
}
.modal .close:hover { color: var(--ink); }

/* ----- Tabs (store_settings) ----- */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab-link {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: none; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 10px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-link:hover { color: var(--blue-600); }
.tab-link.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ----- Form group (store_settings) ----- */
.form-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { margin-bottom: 0; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-row .form-group { flex: 1; margin-bottom: 0; }
.form-row { margin-bottom: 14px; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.scrollable-table-container {
  max-height: 300px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 10px;
}

/* ----- Helpers kế thừa ----- */
.muted { color: var(--muted); font-size: .9em; }

/* ----- Misc helpers ----- */
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
h2, h3 { letter-spacing: -0.02em; }
a { color: var(--blue-600); }
.nav a, .btn, .card-action { color: inherit; }
.nav a { color: var(--ink-2); }
.card-action { color: var(--blue-600); }
.btn-primary, .btn-danger { color: #fff; }
.btn-soft { color: var(--blue-700); }
.btn-ghost { color: var(--ink); }

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .canvas-pad { padding: 18px 16px 26px; }
  .grid-hero, .grid-main, .grid-2 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; gap: 10px; }
}

/* ── Modal dialog ─────────────────────────────────────────────────── */
#bb-modal::backdrop { background: rgba(0,0,0,.45); }
#bb-modal .modal-head { display:flex; align-items:center; gap:10px; margin-bottom:20px; }
#bb-modal .modal-head .card-title { font-size:16px; font-weight:600; }
#bb-modal .modal-close { margin-left:auto; background:none; border:none; cursor:pointer; color:var(--ink-2); padding:4px; }
#bb-modal .modal-close:hover { color:var(--ink-1); }
#bb-modal .modal-actions { display:flex; gap:8px; margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }

/* ── Dropdown biên bản ────────────────────────────────────────────── */
.bb-dropdown { position:relative; display:inline-block; }
.bb-dropdown-menu { position:absolute; top:calc(100% + 4px); left:0; background:var(--surface); border:1px solid var(--border); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,.1); min-width:220px; z-index:100; padding:6px 0; display:none; }
.bb-dropdown-menu.open { display:block; }
.bb-dropdown-menu a { display:flex; align-items:center; gap:9px; padding:9px 14px; color:var(--ink-1); text-decoration:none; font-size:13.5px; white-space:nowrap; }
.bb-dropdown-menu a:hover { background:var(--surface-2); }
