/* ============================================================
   REE Admin — Light-first Shell + Smart Typography
   Vercel-grade · 2026-05-16
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  /* Light tokens — warm white with subtle depth */
  --ree-bg: #fafbfc;
  --ree-surface: #ffffff;
  --ree-sb-bg: #ffffff;
  --ree-sb-border: #eef0f3;
  --ree-tb-bg: rgba(255, 255, 255, .85);
  --ree-tb-border: #eef0f3;

  --ree-ink: #0f172a;
  --ree-ink-2: #334155;
  --ree-link: #475569;
  --ree-link-hover: #0f172a;
  --ree-link-hover-bg: #f1f5f9;
  --ree-link-active: #0369a1;
  --ree-link-active-bg: #e0f2fe;

  --ree-group-label: #94a3b8;
  --ree-divider: #eef0f3;
  --ree-muted: #64748b;

  --ree-success: #10b981;
  --ree-warning: #f59e0b;
  --ree-danger: #ef4444;
  --ree-accent: #0ea5e9;

  --ree-font-en: 'Inter', system-ui, sans-serif;
  --ree-font-ar: 'Tajawal', system-ui, sans-serif;
  --ree-font-mono: 'JetBrains Mono', ui-monospace, monospace;
}
.dark {
  --ree-bg: #0a0f1c;
  --ree-surface: #0f172a;
  --ree-sb-bg: #0b1220;
  --ree-sb-border: #1e293b;
  --ree-tb-bg: rgba(11, 18, 32, .85);
  --ree-tb-border: #1e293b;

  --ree-ink: #f8fafc;
  --ree-ink-2: #cbd5e1;
  --ree-link: #94a3b8;
  --ree-link-hover: #f8fafc;
  --ree-link-hover-bg: rgba(255,255,255,.04);
  --ree-link-active: #38bdf8;
  --ree-link-active-bg: rgba(56, 189, 248, .12);

  --ree-group-label: #64748b;
  --ree-divider: #1e293b;
  --ree-muted: #64748b;
}

/* ===== Body — refined background + typography ===== */
body, .fi-body {
  background: var(--ree-bg) !important;
  color: var(--ree-ink);
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tabular numbers for tables */
.fi-ta-text, .fi-fo-text-input, .fi-ta-cell {
  font-variant-numeric: tabular-nums;
}

/* ===== Top Bar — minimal Vercel-style ===== */
.fi-topbar {
  background: var(--ree-tb-bg) !important;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--ree-tb-border);
  box-shadow: 0 1px 0 var(--ree-tb-border);
}
.fi-topbar a, .fi-topbar button {
  transition: opacity .15s ease, background-color .15s ease, color .15s ease;
}
.fi-topbar a:hover, .fi-topbar button:hover { opacity: .9; }

/* ===== Sidebar — Vercel-grade ===== */
.fi-sidebar {
  background: var(--ree-sb-bg) !important;
  border-inline-end: 1px solid var(--ree-sb-border);
}
.fi-sidebar-nav {
  padding: 8px 10px !important;
}

.fi-sidebar-group-label {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .09em !important;
  color: var(--ree-group-label) !important;
  padding: 14px 12px 6px !important;
  margin-bottom: 2px !important;
}

.fi-sidebar-item-button,
a.fi-sidebar-item-button,
button.fi-sidebar-item-button {
  height: 34px !important;
  padding: 0 10px !important;
  margin: 1px 0 !important;
  border-radius: 7px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: -.003em !important;
  color: var(--ree-link) !important;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color .12s ease, color .12s ease;
  position: relative;
}
.fi-sidebar-item-button:hover,
a.fi-sidebar-item-button:hover {
  background: var(--ree-link-hover-bg) !important;
  color: var(--ree-link-hover) !important;
}
.fi-sidebar-item-active .fi-sidebar-item-button,
a.fi-sidebar-item-button.fi-active,
.fi-active.fi-sidebar-item-button {
  background: var(--ree-link-active-bg) !important;
  color: var(--ree-link-active) !important;
  font-weight: 600 !important;
}
.fi-sidebar-item-active .fi-sidebar-item-button::before,
a.fi-sidebar-item-button.fi-active::before {
  content: "";
  position: absolute;
  inset-inline-start: -10px;
  top: 18%; bottom: 18%;
  width: 3px;
  background: var(--ree-link-active);
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .fi-sidebar-item-active .fi-sidebar-item-button::before {
  border-radius: 3px 0 0 3px;
}
.fi-sidebar-item-button svg, .fi-sidebar-item-icon {
  width: 17px !important;
  height: 17px !important;
  flex-shrink: 0;
  opacity: .8;
}
.fi-sidebar-item-active svg { opacity: 1; }

/* Sidebar collapsed */
.fi-sidebar-collapsed .fi-sidebar-item-button { justify-content: center; padding: 0 !important; }
.fi-sidebar-collapsed .fi-sidebar-item-active .fi-sidebar-item-button::before { display: none; }

/* Sidebar header */
.fi-sidebar-header {
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--ree-divider);
}

/* Scrollbar — refined */
.fi-sidebar-nav::-webkit-scrollbar { width: 5px; }
.fi-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.fi-sidebar-nav::-webkit-scrollbar-thumb { background: var(--ree-divider); border-radius: 3px; }
.fi-sidebar-nav::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ===== Page content ===== */
.fi-main {
  padding-block-start: 18px;
  background: var(--ree-bg) !important;
}
.fi-page-header { padding-block: 12px !important; }
.fi-header-heading {
  font-weight: 700 !important;
  letter-spacing: -.015em !important;
  color: var(--ree-ink);
}
.fi-section, .fi-fo-section, .fi-ta-table-container {
  background: var(--ree-surface) !important;
  border: 1px solid var(--ree-divider) !important;
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}

/* Headings hierarchy */
.fi-section-header-heading {
  font-weight: 600 !important;
  letter-spacing: -.01em !important;
}

/* ===== Tables — refined ===== */
.fi-ta-table th {
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: .05em !important;
  color: var(--ree-muted) !important;
  background: #fafbfc !important;
}
.fi-ta-table td {
  font-size: 13.5px !important;
  font-weight: 500 !important;
}

/* ===== Buttons — crisp ===== */
.fi-btn {
  font-weight: 600 !important;
  letter-spacing: -.005em !important;
}
.fi-btn-color-primary {
  box-shadow: 0 1px 2px rgba(2, 132, 199, .25);
}

/* ===== Form inputs — clean ===== */
.fi-input, .fi-fo-text-input input, .fi-fo-select-trigger {
  font-weight: 500 !important;
  font-size: 13.5px !important;
  background: var(--ree-surface) !important;
  border-color: var(--ree-divider) !important;
}
.fi-input:focus, .fi-fo-text-input input:focus {
  border-color: var(--ree-accent) !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .12) !important;
}

/* ===== Dropdowns ===== */
.fi-dropdown-panel {
  border-radius: 10px !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.08), 0 0 0 1px var(--ree-divider) !important;
  padding: 6px !important;
}
.fi-dropdown-list-item {
  border-radius: 6px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}
.fi-dropdown-list-item:hover { background: var(--ree-link-hover-bg) !important; }

/* ===== Avatar ===== */
.fi-avatar img {
  box-shadow: 0 0 0 2px var(--ree-link-active-bg);
  border-radius: 50%;
}

/* ===== Badges/Chips refined ===== */
.fi-badge {
  font-weight: 600 !important;
  letter-spacing: .01em !important;
}

/* ===== AR font override ===== */
[dir="rtl"] body, [dir="rtl"] .fi-body,
[dir="rtl"] .fi-sidebar-item-button,
[dir="rtl"] .fi-header-heading,
[dir="rtl"] .fi-section-header-heading {
  font-family: var(--ree-font-ar) !important;
}
[dir="rtl"] .fi-sidebar-item-button {
  font-size: 13.5px !important;
  letter-spacing: 0 !important;
}

/* ===== Mobile responsive polish ===== */
@media (max-width: 1023px) {
  .fi-sidebar { box-shadow: 0 0 32px rgba(0,0,0,.15); }
}

/* ===== Selection color — sky accent ===== */
::selection { background: rgba(14, 165, 233, .25); color: inherit; }
