/* Sattar Petroleum — Customer Portal (DEMO) */
:root {
  --navy: #10213B; --navy-2: #172C4D; --navy-3: #22406B;
  --gold: #C9A24D; --gold-d: #8C6A24; --gold-light: #F6EEDC;
  --ink: #1B1F24; --muted: #5B6573; --bg: #F4F6F9; --card: #fff; --line: #E3E7ED;
  --ok: #1F9D55; --ok-bg: #E7F6EE; --warn: #B7791F; --warn-bg: #FDF3DC; --bad: #C62828; --bad-bg: #FDECEC; --info: #1565C0; --info-bg: #E8F0FB;
  --reg: #2B2F36; --mid: #1565C0; --prem: #C62828; --dsl: #2E7D32;
  --radius: 14px; --shadow: 0 6px 20px rgba(16,33,59,.07);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* Demo ribbon */
.demo-ribbon { position: fixed; z-index: 100; bottom: 14px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; border: 1px solid var(--gold); border-radius: 999px; padding: 6px 14px; font-size: .75rem; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 24px); }
@media (max-width: 560px) { .demo-ribbon { white-space: normal; text-align: center; border-radius: 12px; font-size: .7rem; bottom: 8px; } }
.demo-ribbon b { color: var(--gold); }
.demo-ribbon button { background: none; border: 0; color: #B9C7D9; text-decoration: underline; cursor: pointer; font-size: .72rem; margin-left: 6px; padding: 0; }

/* Buttons & form */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 11px 18px; font-weight: 700; border: 1.5px solid transparent; cursor: pointer; transition: .15s; text-decoration: none; font-size: .92rem; }
.btn svg { width: 18px; height: 18px; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #D6B25E; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-3); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy-3); }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
label.fl { display: block; font-size: .8rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; transition: .15s; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,77,.2); }
.field { margin-bottom: 16px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.err { font-size: .8rem; color: var(--bad); font-weight: 600; margin-top: 6px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #DCE6F2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 400px at 80% 10%, #22406B, transparent 65%), var(--navy);
}
.login-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, #000 20%, transparent); }
.login-art > * { position: relative; z-index: 1; }
.login-art img { height: 130px; width: auto; align-self: flex-start; object-fit: contain; }
.login-art h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.15; margin-bottom: 14px; }
.login-art h1 em { font-style: normal; color: var(--gold); }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li svg { width: 20px; height: 20px; color: var(--gold); flex: none; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 1.6rem; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 20px; font-size: .85rem; }
.login-row label { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.login-card .btn { width: 100%; padding: 13px; }
.login-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.staff-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; font-size: .85rem; color: var(--muted); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #B9C7D9; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand img { height: 72px; width: auto; max-width: 100%; display: block; object-fit: contain; }
.side-acct { margin: 14px 12px 6px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.side-acct b { display: block; color: #fff; font-size: .9rem; }
.side-acct span { font-size: .75rem; }
.nav { list-style: none; margin: 8px 0; padding: 0 10px; display: grid; gap: 2px; flex: 1; overflow-y: auto; align-content: start; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #B9C7D9; text-decoration: none; font-weight: 600; font-size: .9rem; transition: .15s; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(201,162,77,.16); color: var(--gold); }
.nav .badge { margin-left: auto; background: var(--gold); color: var(--navy); font-size: .68rem; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; }
.side-foot a { color: var(--gold); text-decoration: none; font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(244,246,249,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.25rem; flex: 1; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--navy); }
.menu-btn svg { width: 26px; height: 26px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: .85rem; font-weight: 600; cursor: pointer; position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--gold); font-weight: 800; font-size: .8rem; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; padding: 6px; display: none; }
.user-menu.open { display: block; }
.user-menu button, .user-menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); text-decoration: none; font-size: .88rem; }
.user-menu button:hover, .user-menu a:hover { background: var(--bg); }
.content { padding: 26px 28px 80px; max-width: 1440px; width: 100%; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 1rem; }
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); }
.mt { margin-top: 18px; }

.kpi { position: relative; overflow: hidden; }
.kpi small { color: var(--muted); font-weight: 600; font-size: .8rem; display: block; }
.kpi b { display: block; font-size: 1.6rem; color: var(--navy); margin: 4px 0 2px; letter-spacing: -.02em; }
.kpi .k-foot { font-size: .8rem; color: var(--muted); }
.kpi .k-ic { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-light); color: var(--gold-d); }
.kpi .k-ic svg { width: 20px; height: 20px; }
.kpi.dark { background: var(--navy); border-color: var(--navy); }
.kpi.dark small, .kpi.dark .k-foot { color: #B9C7D9; }
.kpi.dark b { color: var(--gold); }
.kpi.dark .k-ic { background: rgba(201,162,77,.18); color: var(--gold); }
.meter { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: inherit; }

/* Welcome banner */
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; background: linear-gradient(120deg, var(--navy), var(--navy-3)); color: #DCE6F2; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.welcome h2 { color: #fff; font-size: 1.35rem; }
.welcome p { margin: 4px 0 0; color: #B9C7D9; }

/* Tanks */
.tanks { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.tank { text-align: center; padding: 12px 8px; border-radius: 12px; background: var(--bg); }
.tank-vis { width: 54px; height: 74px; margin: 0 auto 8px; border-radius: 10px; border: 2.5px solid #9AA9BC; background: #fff; position: relative; overflow: hidden; }
.tank-vis i { position: absolute; left: 0; right: 0; bottom: 0; transition: height 1.2s cubic-bezier(.2,.8,.2,1); }
.tank-vis em { position: absolute; left: -2px; right: -2px; border-top: 2px dashed var(--gold); }
.tank b { display: block; font-size: .85rem; color: var(--navy); }
.tank span { font-size: .78rem; color: var(--muted); }
.tank.low .tank-vis { border-color: var(--gold); }
.tank.low span { color: var(--gold-d); font-weight: 700; }

/* Price list */
.prices { display: grid; gap: 8px; }
.price-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.price-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.price-row .name { flex: 1; font-weight: 600; font-size: .9rem; }
.price-row .val { font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.price-row .val small { font-weight: 600; color: var(--muted); font-size: .72rem; }
.placeholder-note { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--gold-d); background: var(--gold-light); border-radius: 10px; padding: 9px 11px; margin-top: 10px; }
.placeholder-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #FAFBFC; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.grades { display: flex; gap: 4px; flex-wrap: wrap; }
.gchip { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.gchip i { width: 8px; height: 8px; border-radius: 50%; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-requested { background: var(--info-bg); color: var(--info); }
.p-confirmed { background: #EEE8FB; color: #5E35B1; }
.p-scheduled { background: var(--warn-bg); color: var(--warn); }
.p-out { background: #FFF0E3; color: #D9640F; }
.p-delivered, .p-paid, .p-active { background: var(--ok-bg); color: var(--ok); }
.p-open { background: var(--warn-bg); color: var(--warn); }
.p-overdue { background: var(--bad-bg); color: var(--bad); }
.p-pending { background: var(--info-bg); color: var(--info); }
.p-expired { background: var(--bg); color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; padding: 8px 12px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: .82rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }

/* Upcoming deliveries */
.deliv { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.deliv:last-child { border-bottom: 0; }
.deliv .date { width: 52px; text-align: center; flex: none; border-radius: 10px; background: var(--gold-light); padding: 6px 0; }
.deliv .date b { display: block; font-size: 1.15rem; color: var(--navy); line-height: 1.1; }
.deliv .date span { font-size: .68rem; font-weight: 700; color: var(--gold-d); text-transform: uppercase; }
.deliv .info { flex: 1; min-width: 0; }
.deliv .info b { display: block; font-size: .9rem; }

/* Order form */
.grade-inputs { display: grid; gap: 10px; }
.gi { display: grid; grid-template-columns: 1fr 170px; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; border-left: 6px solid var(--g); transition: .15s; }
.gi.has { border-color: var(--g); background: #FCFDFE; }
.gi b { display: block; color: var(--navy); }
.gi span { font-size: .78rem; color: var(--muted); }
.gi .input { text-align: right; font-weight: 700; }
.windows { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.win { position: relative; }
.win input { position: absolute; opacity: 0; }
.win label { display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: center; transition: .15s; }
.win label b { display: block; color: var(--navy); font-size: .92rem; }
.win label span { font-size: .76rem; color: var(--muted); }
.win label svg { width: 22px; height: 22px; color: var(--gold-d); display: block; margin: 0 auto 4px; }
.win input:checked + label { border-color: var(--gold); background: var(--gold-light); box-shadow: 0 0 0 3px rgba(201,162,77,.18); }
.win input:focus-visible + label { outline: 2px solid var(--navy-3); }
.summary { position: sticky; top: 86px; }
.sum-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: .9rem; }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 800; color: var(--navy); font-size: 1rem; }
.min-bar { margin: 12px 0 4px; }
.min-bar .meter i { background: var(--ok); transition: width .3s; }
.min-bar .meter.short i { background: var(--gold); }
.toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--navy); }

/* Rate locks */
.lock-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.lock-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lock-top b { color: var(--navy); }
.lock-nums { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(16,33,59,.45); z-index: 50; opacity: 0; pointer-events: none; transition: .2s; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: #fff; z-index: 51; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; box-shadow: -20px 0 40px rgba(0,0,0,.15); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1.15rem; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.x-btn { background: none; border: 0; cursor: pointer; padding: 4px; color: var(--muted); }
.x-btn svg { width: 22px; height: 22px; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #D5DDE8; }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: #E6EBF2; }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--ok); }
.timeline li.now::before { background: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,77,.25); }
.timeline li b { display: block; color: var(--navy); }
.timeline li span { color: var(--muted); font-size: .8rem; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.doc-row .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bad-bg); color: var(--bad); flex: none; font-size: .68rem; font-weight: 800; }
.doc-row .meta { flex: 1; min-width: 0; }
.doc-row .meta b { display: block; font-size: .88rem; }
.doc-row .meta span { font-size: .78rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Toast */
.toast { position: fixed; z-index: 120; right: 22px; top: 22px; background: var(--navy); color: #fff; border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; transform: translateY(-20px); opacity: 0; transition: .25s; pointer-events: none; max-width: 340px; }
.toast.show { transform: none; opacity: 1; }

/* Account */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.check-row:last-child { border-bottom: 0; }
.check-row input { width: 18px; height: 18px; accent-color: var(--navy); }

/* Responsive */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; }
  .login-art ul { display: none; }
  .login-art h1 { font-size: 1.5rem; margin-top: 18px; }
  .login-art img { height: 84px; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 20px 0 40px rgba(0,0,0,.25); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 80px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .user-chip .uname { display: none; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi b { font-size: 1.25rem; }
  .kpi .k-ic { display: none; }
  .tanks { grid-template-columns: repeat(2, 1fr); }
  .gi { grid-template-columns: 1fr 120px; }
  .windows { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .tbl .hide-sm { display: none; }
}
