/* =====================================================================
   superadmin/superadmin.css - Self-contained stylesheet for Super Admin
   Matches the Al Marhoon Office clean editorial / financial UI/UX
   ===================================================================== */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --line: #D9DEE6;
  --fg: #17202B;
  --muted: #5B6776;
  --accent: #2A5A8C;
  --accent-fg: #FFFFFF;
  --overdue: #B42318;
  --overdue-bg: #FDE9E7;
  --due: #8A5A00;
  --due-bg: #FFF1D6;
  --paid: #1B6E45;
  --paid-bg: #E2F3EA;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
  --font-num: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45;
  margin: 0; padding: 20px 16px 40px;
}
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; letter-spacing: 0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.det { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
code { font-family: var(--font-num); font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.brandmark { height: 40px; width: auto; display: block; }
.co { font-size: 22px; font-weight: 700; }
.userbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: flex-end; font-size: 12.5px; color: var(--muted); }
.rolepill { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--paid); background: var(--paid-bg); color: var(--paid); border-radius: 10px; padding: 2px 8px; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tile .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; margin-top: 4px; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.ok { background: var(--paid-bg); border-color: var(--paid); }
.tile.ok .v, .tile.ok .k { color: var(--paid); }
.tile.over { background: var(--overdue-bg); border-color: var(--overdue); }
.tile.over .v, .tile.over .k { color: var(--overdue); }

.navbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
.nav-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; font-weight: 500;
  border-radius: 4px; border: 1px solid transparent; background: transparent; color: var(--fg); cursor: pointer; text-decoration: none;
}
.nav-btn:hover { background: var(--bg); border-color: var(--line); }
.nav-btn.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.panel > .hd { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }

label.lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: 7px 9px; min-width: 0; width: 100%;
}
button, .btn {
  font: inherit; font-weight: 500; cursor: pointer; border-radius: 4px; padding: 7px 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 6px; font-size: 12.5px; }
button.link:hover { text-decoration: underline; }

.form { display: grid; gap: 10px; padding: 12px 14px; }
.form .f, .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.chk input { width: auto; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th.r, td.r { text-align: right; }
tr:last-child td { border-bottom: 0; }

.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill.overdue { background: var(--overdue-bg); color: var(--overdue); }
.pill.due { background: var(--due-bg); color: var(--due); }
.pill.paid { background: var(--paid-bg); color: var(--paid); }

.od-ov { position: fixed; inset: 0; z-index: 60; background: rgba(20,24,32,0.78); overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-wrap { min-height: 90vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.loginbox { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 4px 18px rgba(0,0,0,0.06); }
.err { color: var(--overdue); font-size: 12.5px; min-height: 16px; }

/* Enhanced Modal & Branding Controls */
.modal-box { width: 100%; max-width: 860px; max-height: 92vh; overflow-y: auto; padding: 22px; background: var(--surface); border-radius: 8px; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.25); display: flex; flex-direction: column; gap: 14px; }
.modal-sec { padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); display: grid; gap: 10px; }
.modal-sec-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 4px; }
.logo-uploader { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: 6px; }
.logo-thumb { width: 72px; height: 72px; border-radius: 6px; border: 1px solid var(--line); background: #ffffff; object-fit: contain; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); padding: 4px; flex-shrink: 0; }
.seller-cred-box { background: #ECFDF5; border: 1px solid #10B981; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.seller-cred-box h3 { color: #065F46; margin: 0 0 6px; font-size: 15px; }
.cred-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 10px 0; font-size: 13px; }
.cred-item { background: #ffffff; padding: 8px 10px; border-radius: 4px; border: 1px solid rgba(16,185,129,0.3); }

@media (max-width: 960px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-direction: column; align-items: flex-start; }
  .userbar { justify-content: flex-start; }
}
@media (max-width: 640px) {
  body { padding: 12px 8px 30px; }
  .modal-box { padding: 16px 12px; max-height: 96vh; }
  .logo-uploader { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .summary { grid-template-columns: 1fr; }
  .nav-group { width: 100%; }
  .nav-btn { width: 100%; justify-content: center; }
}
