/* ═══════════════════════════════════════════════════════════════════════
   price-intel  —  Design System  (Arabic RTL, self-contained, no CDN)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --text:      #0f172a;
  --muted:     #64748b;
  --line:      #e2e8f0;
  --accent:    #0d9488;
  --accent-hi: #0f766e;
  --success:   #059669;
  --warning:   #d97706;
  --danger:    #dc2626;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── top bar ───────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px clamp(16px, 4vw, 40px);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* ── nav ───────────────────────────────────────────────────────────── */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
}
.nav a:hover  { color: var(--text); background: var(--bg); }
.nav a.active { color: var(--accent-hi); background: #e6fffa; }

/* ── page ──────────────────────────────────────────────────────────── */

.page {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px);
}

/* ── panels / cards ────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel.narrow { max-width: 640px; margin-inline: auto; }
.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.panel p { color: var(--muted); margin: 0; }

/* ── stat grid ─────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  text-align: center;
  padding: 18px 12px;
}
.metric span {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-hi);
  line-height: 1.2;
}
.metric p { font-size: 13px; margin-top: 4px; }

/* ── buttons ───────────────────────────────────────────────────────── */

.button, button, .nav a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  gap: 6px;
}
.button:hover, button:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

.button.secondary {
  background: var(--surface);
  color: var(--accent);
}
.button.secondary:hover { background: #e6fffa; }

.button-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.button.danger:hover { background: #b91c1c; }

button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── forms ─────────────────────────────────────────────────────────── */

form { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.inline-form {
  grid-template-columns: minmax(200px, 1fr) minmax(160px, 240px) auto;
  align-items: end;
}

/* ── tables ────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  font-size: 13px;
}

thead th {
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 2px solid var(--line);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: #e6fffa; }

.url-cell {
  direction: ltr !important;
  text-align: left !important;
  word-break: break-all;
  max-width: 260px;
}

.price-cell {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

/* ── details list ──────────────────────────────────────────────────── */

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}
.details div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.details dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.details dd { margin: 4px 0 0; font-weight: 600; }

/* ── badges ────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-approved   { background: #d1fae5; color: #065f46; }
.badge-rejected   { background: #fee2e2; color: #991b1b; }
.badge-suspicious { background: #fee2e2; color: #dc2626; }
.badge-active     { background: #d1fae5; color: #065f46; }
.badge-inactive   { background: #f1f5f9; color: var(--muted); }

/* ── misc ──────────────────────────────────────────────────────────── */

.actions, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions-cell { white-space: nowrap; }
.inline-action { display: inline-block; }

.muted { color: var(--muted); }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-header h2 { margin: 0; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state p { font-size: 15px; }

.text-success { color: var(--success); font-weight: 700; }
.text-danger  { color: var(--danger);  font-weight: 700; }
.text-warning { color: var(--warning); font-weight: 700; }

.highlight-col { background: #f0fdfa !important; font-weight: 700; }

/* ── responsive ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .inline-form { grid-template-columns: 1fr; }
  .page { padding: 12px; }
  .panel { padding: 14px; }
  .metric span { font-size: 24px; }
}
