/* CBC Fueling Partner — styles.css */

:root {
  --or: #f97316;
  --or2: #ea580c;
  --or-lt: #fff7ed;
  --navy: #1e293b;
  --dark: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --bd: #e2e8f0;
  --bg: #f1f5f9;
  --white: #fff;
  --green: #16a34a;
  --green-lt: #dcfce7;
  --amber: #d97706;
  --amber-lt: #fef3c7;
  --red: #dc2626;
  --red-lt: #fee2e2;
  --blue: #2563eb;
  --blue-lt: #dbeafe;
  --shadow: 0 1px 3px rgba(0,0,0,.07),0 4px 16px rgba(0,0,0,.07);
  --shadow-md: 0 2px 8px rgba(0,0,0,.1),0 8px 32px rgba(0,0,0,.1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100vh; }
.hidden { display: none !important; }
.r { text-align: right; }
.w100 { width: 100%; }
.opt { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ── Inputs ── */
input, select, textarea {
  font: inherit; color: var(--dark); background: var(--white);
  border: 1.5px solid var(--bd); border-radius: 8px;
  padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--or);
  box-shadow: 0 0 0 3px rgba(249,115,22,.14);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--slate); margin-bottom: 5px; }
.form-row { margin-bottom: 14px; }

/* ── Buttons ── */
button { font: inherit; cursor: pointer; border: none; border-radius: 8px; transition: all .15s; }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--or); color: #fff; font-weight: 700;
  padding: 11px 20px; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px;
}
.btn-primary:hover:not(:disabled) { background: var(--or2); }

.btn-sec {
  background: var(--white); color: var(--slate); font-weight: 600;
  font-size: 13px; padding: 9px 14px;
  border: 1.5px solid var(--bd);
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-sec:hover:not(:disabled) { background: var(--bg); }
.btn-sec.sm { padding: 7px 10px; font-size: 12px; }

.btn-link {
  background: none; color: var(--muted); font-size: 13px;
  font-weight: 500; padding: 8px; width: 100%; text-align: center;
}
.btn-link:hover { color: var(--or); }

/* ═══════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(150deg, #0f172a 0%, #1e3a5f 60%, #1e293b 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%; max-width: 400px;
  background: var(--white);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,.28);
}

.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.logo-mark {
  width: 48px; height: 48px;
  background: var(--or-lt); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.logo-brand {
  display: block; font-size: 18px; font-weight: 800;
  color: var(--or); letter-spacing: .05em;
}
.logo-sub {
  display: block; font-size: 12px; color: var(--muted); font-weight: 500;
}
.login-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.login-hint { font-size: 13px; color: var(--muted); margin-bottom: 22px; line-height: 1.5; }

.mobile-input {
  display: flex; align-items: center;
  border: 1.5px solid var(--bd); border-radius: 8px; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.mobile-input:focus-within {
  border-color: var(--or);
  box-shadow: 0 0 0 3px rgba(249,115,22,.14);
}
.mobile-input .code {
  background: var(--bg); padding: 10px 12px; font-weight: 700;
  font-size: 13px; color: var(--slate); border-right: 1.5px solid var(--bd);
  flex-shrink: 0;
}
.mobile-input input {
  border: none; border-radius: 0; box-shadow: none !important;
}

.otp-section { margin-top: 16px; }
.otp-sent-badge {
  background: var(--green-lt); color: var(--green);
  font-size: 12px; font-weight: 700;
  padding: 8px 12px; border-radius: 8px;
  margin-bottom: 16px; text-align: center;
  letter-spacing: .01em;
}
.login-msg {
  min-height: 20px; font-size: 13px; font-weight: 500;
  margin-top: 12px; text-align: center;
  color: var(--red);
}
.login-msg.ok { color: var(--green); }
.login-msg.info { color: var(--muted); }

.login-footer {
  color: rgba(255,255,255,.25); font-size: 11px; margin-top: 20px;
}

/* ═══════════════════════════════════════════════
   APP HEADER
═══════════════════════════════════════════════ */
.app-header {
  background: var(--dark);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 54px;
  position: sticky; top: 0; z-index: 50;
}
.header-brand {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 800; font-size: 13px;
  letter-spacing: .02em; white-space: nowrap;
}
.hdr-dot { font-size: 16px; }
.header-ro { flex: 1; text-align: center; }
.ro-name-hdr {
  color: #fff; font-size: 13px; font-weight: 700; line-height: 1.2;
}
.rep-name-hdr { color: rgba(255,255,255,.45); font-size: 11px; }
.btn-logout {
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  font-size: 12px; font-weight: 600; padding: 6px 12px;
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ═══════════════════════════════════════════════
   ACCOUNT STATS BAR
═══════════════════════════════════════════════ */
.acct-bar {
  background: var(--navy);
  display: flex;
}
.acct-stat {
  flex: 1; padding: 10px 16px; text-align: center;
  border-right: 1px solid rgba(255,255,255,.06);
}
.acct-stat:last-child { border-right: none; }
.acct-stat span {
  display: block; font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.4); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 3px;
}
.acct-stat b { font-size: 16px; font-weight: 800; color: #fff; }
.acct-stat.warn b { color: #fbbf24; }
.acct-stat.good b { color: #4ade80; }

/* ═══════════════════════════════════════════════
   TAB NAV
═══════════════════════════════════════════════ */
.tab-nav {
  background: var(--white);
  display: flex; gap: 0;
  border-bottom: 1px solid var(--bd);
  padding: 0 16px;
}
.tab-btn {
  background: none; color: var(--muted);
  font-size: 13px; font-weight: 600;
  padding: 11px 16px; border-radius: 0;
  border-bottom: 2.5px solid transparent;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s;
}
.tab-btn:hover { color: var(--dark); }
.tab-btn.active { color: var(--or); border-bottom-color: var(--or); }
.badge {
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 1px 6px; border-radius: 999px; line-height: 1.5;
}

/* ═══════════════════════════════════════════════
   TAB CONTENT
═══════════════════════════════════════════════ */
.tab-content { padding: 16px; }

/* ─ Pending cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.slip-card {
  background: var(--white); border-radius: 12px;
  border: 1px solid var(--bd); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--bg);
}
.card-slipno { font-weight: 800; font-size: 13px; color: var(--dark); }
.card-date { font-size: 11px; color: var(--muted); }
.card-body { padding: 14px 16px; }
.card-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 13px;
}
.card-row:last-child { margin-bottom: 0; }
.card-icon { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.card-label { color: var(--muted); font-size: 11px; }
.card-val { font-weight: 600; }
.card-amounts {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin: 12px 16px;
}
.amt-box {
  background: var(--bg); border-radius: 8px; padding: 10px 12px; text-align: center;
}
.amt-box span { display: block; font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; margin-bottom: 3px; }
.amt-box b { font-size: 16px; font-weight: 800; color: var(--dark); }
.card-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--bg);
  background: #fafafa;
}
.card-foot .btn-primary { width: 100%; padding: 10px; font-size: 14px; }

/* Acknowledged card style */
.slip-card.acked .card-head { background: #f0fdf4; }
.slip-card.acked .card-slipno { color: var(--green); }

/* ─ Empty state ── */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { color: var(--muted); font-size: 14px; }

/* ─ History table ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.filter-input { width: 200px; font-size: 13px; padding: 8px 12px; }
.filter-select { width: 170px; font-size: 13px; padding: 8px 10px; }
.filter-date { width: 140px; font-size: 13px; padding: 8px 10px; }
.export-btns { display: flex; gap: 4px; margin-left: auto; }

.slip-table-wrap { overflow-x: auto; border-radius: 10px; box-shadow: var(--shadow); }
.slip-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); font-size: 13px;
}
.slip-table th {
  background: var(--bg); color: var(--muted);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--bd);
}
.slip-table td {
  padding: 10px 12px; border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}
.slip-table tbody tr:hover td { background: #fafafa; }
.slip-table tfoot td {
  background: var(--bg); font-weight: 700; border-top: 2px solid var(--bd);
  padding: 10px 12px;
}
.sno { font-weight: 700; font-size: 12px; color: var(--dark); }
.sdt { font-size: 11px; color: var(--muted); }
.sbold { font-weight: 600; }
.table-meta { font-size: 12px; color: var(--muted); text-align: right; margin-top: 8px; }

/* ─ Statement ── */
.stmt-controls {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap; background: var(--white);
  border: 1px solid var(--bd); border-radius: 10px;
  padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.stmt-period label { margin-bottom: 6px; }
.stmt-preview {
  background: var(--white); border: 1px solid var(--bd);
  border-radius: 10px; padding: 28px; box-shadow: var(--shadow);
}
.stmt-hdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--bd); }
.stmt-metrics {
  display: grid; grid-template-columns: repeat(5,1fr);
  gap: 10px; margin-bottom: 20px;
}
.smt-card {
  border: 1px solid var(--bd); border-radius: 8px;
  padding: 12px 14px; background: var(--bg);
}
.smt-card.hl { border-color: var(--or); background: var(--or-lt); }
.smt-card span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.smt-card b { font-size: 17px; font-weight: 800; }
.smt-card.hl b { color: var(--or2); }
.stmt-note { margin-top: 16px; font-size: 12px; color: var(--muted); font-style: italic; padding-top: 12px; border-top: 1px dashed var(--bd); }

/* ─ Status tags ── */
.tag {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 9px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   DIALOG
═══════════════════════════════════════════════ */
dialog {
  border: none; border-radius: 14px; padding: 0;
  width: 460px; max-width: calc(100vw - 24px);
  box-shadow: 0 8px 48px rgba(0,0,0,.22);
}
dialog::backdrop { background: rgba(15,23,42,.5); }

.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--bd);
}
.dlg-head h3 { font-size: 16px; font-weight: 700; }
.dlg-close {
  background: var(--bg); color: var(--muted);
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.dlg-close:hover { background: var(--bd); }

.dlg-meta {
  padding: 10px 22px; background: var(--bg);
  font-size: 13px; color: var(--slate);
  border-bottom: 1px solid var(--bd); line-height: 1.6;
}
#ackForm { padding: 18px 22px; }
.dlg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width:640px) {
  .login-card { padding: 28px 20px; }
  .acct-bar { overflow-x: auto; }
  .acct-stat { min-width: 90px; }
  .acct-stat b { font-size: 14px; }
  .tab-content { padding: 12px; }
  .cards-grid { grid-template-columns: 1fr; }
  .filter-bar { gap: 6px; }
  .filter-input,.filter-select { width: 100%; }
  .export-btns { margin-left: 0; }
  .stmt-metrics { grid-template-columns: 1fr 1fr; }
  .stmt-hdr { flex-direction: column; gap: 12px; }
  .dlg-row { grid-template-columns: 1fr; }
  .app-header { padding: 0 12px; }
  .header-brand span { display: none; }
}

/* ═══════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════ */
@media print {
  .login-wrap,.app-header,.acct-bar,.tab-nav,
  .stmt-controls,.filter-bar,button,dialog,
  #tabPending,#tabHistory { display: none !important; }
  #tabStatement,#stmtPreview { display: block !important; }
  .stmt-preview { border: none; box-shadow: none; padding: 0; }
}
