/* ============================================================
   Bahia Client Portal — Stylesheet
   Palette  : harbour teal / saffron / ink on porcelain
   Type     : Space Grotesk (display) · Inter (body)
              IBM Plex Sans Arabic (RTL)
   Layout   : logical properties everywhere → RTL flips free
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* ---------------- Tokens ---------------- */
:root {
  --teal-900: #093a40;
  --teal-700: #0e5a63;
  --teal-500: #147884;
  --teal-100: #d9ecee;
  --saffron: #e0a133;
  --saffron-soft: #f7e8cd;
  --ink: #182a2e;
  --muted: #5d7175;
  --line: #dde7e8;
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --ok: #1e8e5a;
  --warn: #c07f16;
  --bad: #c04437;
  --ok-soft: #ddf2e7;
  --warn-soft: #f8ecd4;
  --bad-soft: #f9e2df;
  --shadow: 0 1px 2px rgba(9, 58, 64, .06), 0 8px 24px rgba(9, 58, 64, .07);
  --radius: 14px;
  --font-display: 'Space Grotesk', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'Inter', 'IBM Plex Sans Arabic', sans-serif;
}
[data-theme="dark"] {
  --teal-900: #061f23;
  --teal-700: #0e5a63;
  --teal-500: #2fa2ae;
  --teal-100: #123a40;
  --saffron: #e6ae4d;
  --saffron-soft: #3a2f18;
  --ink: #e6efef;
  --muted: #93a8ab;
  --line: #24393d;
  --bg: #0d1a1c;
  --surface: #142529;
  --surface-2: #1a3034;
  --ok: #4cc38f;
  --warn: #e0a133;
  --bad: #e2705f;
  --ok-soft: #123227;
  --warn-soft: #34290f;
  --bad-soft: #3a1c18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

/* Arabic gets Plex Arabic for everything */
[dir="rtl"] body { --font-display: 'IBM Plex Sans Arabic', sans-serif; --font-body: 'IBM Plex Sans Arabic', sans-serif; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0 0 .4em; }
a { color: var(--teal-700); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= LOGIN PAGE ================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.login-brand {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(224, 161, 51, .25), transparent 55%),
    linear-gradient(160deg, var(--teal-900), var(--teal-700));
  color: #f2f8f8;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::after {           /* harbour-line motif */
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -2px;
  height: 130px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, transparent 2px 46px);
  mask-image: linear-gradient(to top, black, transparent);
}
.brand-mark { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--saffron);
  color: var(--teal-900);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
}
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.brand-tag { font-size: 13px; opacity: .75; }
.login-hero h1 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.15; max-width: 16ch; }
.login-hero p { max-width: 44ch; opacity: .85; }
.login-foot { font-size: 12.5px; opacity: .6; }

.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(410px, 100%); }
.login-card h2 { font-size: 24px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal-500); outline: none; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.link-btn { background: none; border: 0; color: var(--teal-700); cursor: pointer; padding: 0; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal-700); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--teal-900); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 15px; display: none; }
.alert.show { display: block; }
.alert-err { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }

.demo-box {
  margin-top: 26px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.demo-box code { color: var(--teal-700); background: var(--teal-100); padding: 1px 6px; border-radius: 6px; }

.corner-controls { position: fixed; top: 14px; inset-inline-end: 16px; display: flex; gap: 8px; z-index: 50; }

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { min-height: 210px; padding-bottom: 60px; }
  .login-hero p { display: none; }
}

/* ================= PORTAL SHELL ================= */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-mark { padding: 4px 8px 18px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 0; background: none;
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: start; width: 100%;
  transition: background .12s, color .12s;
}
.scrim {
  display: none;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--teal-100); color: var(--teal-700); font-weight: 600; }
[data-theme="dark"] .nav-item.active { color: var(--teal-500); }
.nav-sep { flex: 1; }
.nav-item.danger { color: var(--bad); }
.nav-item.danger:hover { background: var(--bad-soft); }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(16px, 3vw, 30px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.hamburger { display: none; }

.searchbox { position: relative; flex: 1; max-width: 430px; }
.searchbox input {
  width: 100%;
  padding: 9px 14px;
  padding-inline-start: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit; font-size: 13.5px;
}
.searchbox > svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-pop {
  position: absolute; top: calc(100% + 8px); inset-inline: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  max-height: 330px; overflow: auto; display: none; z-index: 60;
}
.search-pop.open { display: block; }
.search-hit { display: flex; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; }
.search-hit:hover { background: var(--surface-2); }
.search-hit .k { font-size: 11px; font-weight: 600; color: var(--teal-700); background: var(--teal-100); border-radius: 6px; padding: 2px 7px; flex: none; }
.search-hit .txt { font-size: 13.5px; }
.search-empty { padding: 14px; color: var(--muted); font-size: 13.5px; }

/* ---- Season ribbon (signature element) ---- */
.season-ribbon {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(120deg, var(--teal-700), var(--teal-500));
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 7px 8px;
  padding-inline-start: 14px;
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.season-ribbon .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--saffron); box-shadow: 0 0 0 3px rgba(224,161,51,.3); }
.season-ribbon select {
  appearance: none; border: 0; background: rgba(255,255,255,.14);
  color: #fff; font: inherit; font-weight: 600;
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.season-ribbon select option { color: var(--ink); }

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.badge {
  position: absolute; top: -3px; inset-inline-end: -3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--bad); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
.badge:empty, .badge[data-n="0"] { display: none; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--saffron); color: var(--teal-900);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  flex: none;
}

/* ---- Content ---- */
.content { padding: clamp(16px, 3vw, 30px); display: grid; gap: 22px; align-content: start; width: 100%; max-width: 1260px; margin-inline: auto; }
.page { display: none; animation: fade .22s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 5px;
}
.stat .ico {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--teal-100); color: var(--teal-700);
  margin-bottom: 3px;
}
.stat.gold .ico { background: var(--saffron-soft); color: var(--saffron); }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-family: var(--font-display); font-size: 21px; font-weight: 700; }

/* Welcome banner */
.welcome {
  background:
    radial-gradient(700px 220px at 85% -40%, rgba(224,161,51,.28), transparent 60%),
    linear-gradient(135deg, var(--teal-900), var(--teal-700));
  color: #eef7f7;
  border-radius: var(--radius);
  padding: 24px 26px;
  display: flex; flex-wrap: wrap; gap: 18px;
  align-items: center; justify-content: space-between;
}
.welcome h1 { font-size: 23px; margin: 0 0 4px; color: #fff; }
.welcome .meta { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13px; opacity: .9; }
.welcome .meta b { font-weight: 600; }
.pill-ok { background: rgba(76,195,143,.2); color: #9ff0cd; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 560px; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.table-wrap td.td-wrap { white-space: normal; min-width: 200px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.mono { font-family: var(--font-display); font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-paid { background: var(--ok-soft); color: var(--ok); }
.chip-partial { background: var(--warn-soft); color: var(--warn); }
.chip-unpaid { background: var(--bad-soft); color: var(--bad); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Payments summary + chart */
.pay-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.bar-chart {
  display: flex; align-items: stretch; gap: 16px;
  height: 200px; padding: 10px 4px 0;
  overflow-x: auto;
}
.bar-col {
  flex: 1 0 70px; max-width: 120px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  gap: 6px; height: 100%;
}
.bar {
  width: 54px; min-height: 6px;
  background: linear-gradient(to top, var(--teal-700), var(--teal-500));
  border-radius: 7px 7px 3px 3px;
  transition: height .4s ease;
}
.bar-col .lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bar-col .val { font-size: 11.5px; font-weight: 700; white-space: nowrap; }

/* Product cards */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.prod {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.prod:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(9,58,64,.08), 0 14px 32px rgba(9,58,64,.12); }
.prod-img { aspect-ratio: 4/2.8; display: grid; place-items: center; overflow: hidden; }
.prod-img svg { width: 62px; height: 62px; opacity: .9; }
.prod-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.prod-cat { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-700); }
.prod h3 { font-size: 15.5px; margin: 0; }
.prod p { font-size: 13px; color: var(--muted); margin: 0; flex: 1; }
.prod-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.prod-price { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--teal-700); white-space: nowrap; }
[data-theme="dark"] .prod-price { color: var(--teal-500); }
.avail { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.avail::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.avail-inStock { color: var(--ok); }
.avail-limited { color: var(--warn); }
.avail-soon { color: var(--muted); }

/* Announcements */
.ann-list { display: grid; gap: 12px; }
.ann { display: flex; gap: 14px; }
.ann .tag { flex: none; margin-top: 2px; font-size: 11px; font-weight: 700; border-radius: 7px; padding: 3px 9px; height: fit-content; }
.tag-typeNews { background: var(--teal-100); color: var(--teal-700); }
.tag-typePromo { background: var(--saffron-soft); color: var(--warn); }
.tag-typeHoliday { background: var(--bad-soft); color: var(--bad); }
.tag-typeArrival { background: var(--ok-soft); color: var(--ok); }
.tag-typeInfo { background: var(--surface-2); color: var(--muted); }
.ann h3 { font-size: 14.5px; margin: 0 0 3px; }
.ann .when { font-size: 12px; color: var(--muted); }
.ann p { margin: 5px 0 0; font-size: 13.5px; color: var(--muted); }

/* Notifications */
.notif { display: flex; gap: 13px; padding: 13px 6px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--teal-100); color: var(--teal-700); }
.notif.unread { background: color-mix(in srgb, var(--teal-100) 35%, transparent); border-radius: 10px; }
.notif .txt { font-size: 13.5px; }
.notif .when { font-size: 12px; color: var(--muted); }

/* Documents */
.doc { display: flex; align-items: center; gap: 14px; padding: 13px 6px; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; flex: none; }
.doc .nm { font-weight: 600; font-size: 14px; }
.doc .meta { font-size: 12px; color: var(--muted); }
.doc .grow { flex: 1; min-width: 0; }

/* Profile / forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-line { display: flex; gap: 12px; align-items: center; padding: 9px 0; font-size: 14px; }
.contact-line .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-100); color: var(--teal-700); display: grid; place-items: center; flex: none; }
.map-frame { width: 100%; height: 240px; border: 0; border-radius: 12px; margin-top: 14px; filter: saturate(.9); }

/* Modal (invoice viewer) */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 30, 33, .55);
  display: none; place-items: center; padding: 18px;
}
.modal-back.open { display: grid; }
.modal {
  background: var(--surface); color: var(--ink);
  width: min(720px, 100%); max-height: 90vh; overflow: auto;
  border-radius: 16px; box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal-body { padding: 22px 26px; }

/* Invoice document look */
.inv-doc { font-size: 13.5px; }
.inv-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.inv-doc table { margin: 14px 0; }
.inv-totals { margin-inline-start: auto; width: min(280px, 100%); }
.inv-totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.inv-totals .grand { border-top: 2px solid var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 4px; padding-top: 9px; }
.inv-thanks { margin-top: 22px; color: var(--muted); font-size: 12.5px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s, bottom .25s;
}
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.show { opacity: 1; bottom: 32px; }

/* Empty states */
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty svg { display: block; margin: 0 auto 10px; opacity: .5; }

/* ---------------- Mobile ---------------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0;
    width: 250px; z-index: 90;
    transform: translateX(calc(-100% * var(--flip, 1)));
    transition: transform .22s ease;
    box-shadow: none;
  }
  [dir="rtl"] .sidebar { --flip: -1; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .hamburger { display: grid; }
  .searchbox { max-width: none; }
  .season-ribbon .season-label { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; display: none; }
  .scrim.show { display: block; }
}

/* Compact table action buttons */
.act-btn { width: 30px; height: 30px; border-radius: 8px; }
.row-actions { flex-wrap: nowrap; }

/* ================= ADMIN CONSOLE ================= */
.admin-shell { max-width: 1340px; margin: 0 auto; padding: 20px clamp(14px, 3vw, 30px) 60px; }
.admin-top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.admin-top .right { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  background: var(--saffron-soft); color: var(--warn);
  border-radius: 7px; padding: 3px 9px;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 7px 15px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.tab .n { opacity: .65; font-weight: 500; }

.admin-table td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.admin-table .row-actions { justify-content: flex-end; }

.bi-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .bi-pair { grid-template-columns: 1fr; } }
.bi-pair input[dir="rtl"], .bi-pair textarea[dir="rtl"] { font-family: 'IBM Plex Sans Arabic', sans-serif; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.items-editor { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1.3fr 1.3fr 70px 110px 34px; gap: 8px; align-items: center; }
.item-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; width: 100%; }
.item-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
@media (max-width: 720px) { .item-row { grid-template-columns: 1fr 1fr; } .item-row .del-item { grid-column: -2 / -1; justify-self: end; } .item-head { display: none; } }

.unsaved-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-inline-start: 6px; vertical-align: middle; }

/* Editor form: two columns on desktop, one on phones */
#editFields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
#editFields .field.full { grid-column: 1 / -1; }
@media (max-width: 680px) { #editFields { grid-template-columns: 1fr; } }

/* File upload (PDF / photo) */
.file-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--bg);
}
.file-box img { width: 74px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.file-box .fname { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-box input[type="file"] { font-size: 12.5px; max-width: 100%; }

/* Multi-client picker */
.multi-clients {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  max-height: 190px; overflow: auto; background: var(--bg);
}
.multi-clients .check { font-size: 13px; padding: 4px 2px; }
.multi-all { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; grid-column: 1 / -1; font-weight: 600; }

/* PDF viewer inside the invoice modal */
.pdf-embed { width: 100%; height: min(70vh, 640px); border: 0; border-radius: 10px; background: var(--surface-2); }

/* ---------------- Print (invoice) ---------------- */
@media print {
  body * { visibility: hidden; }
  .modal-back.open, .modal-back.open * { visibility: visible; }
  .modal-back.open { position: absolute; inset: 0; background: #fff; padding: 0; }
  .modal { box-shadow: none; border-radius: 0; max-height: none; width: 100%; }
  .modal-head .row-actions, .modal-head .icon-btn { display: none; }
}
