:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f9faf8;
  --ink: #111b1c;
  --muted: #667275;
  --line: #dde4e1;
  --line-strong: #c5d0cc;
  --brand: #0b514d;
  --brand-2: #0f746b;
  --gold: #b88a35;
  --green: #087443;
  --amber: #b54708;
  --blue: #246b9f;
  --red: #b42318;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 14px 38px rgba(17, 27, 28, 0.08);
  --font: Tahoma, "Segoe UI", "Noto Sans Arabic", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  direction: rtl;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbfbf8 0%, var(--bg) 240px),
    var(--bg);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); }
button, input, select, textarea { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px;
  background: #102b2d;
  color: #eef7f5;
  border-left: 1px solid rgba(255,255,255,.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255,255,255,.06);
}

.brand img,
.auth-logo img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 7px;
  background: #fff;
}

.brand-title { display: block; font-weight: 900; line-height: 1.2; }
.brand-subtitle { display: block; color: rgba(238,247,245,.68); font-size: 12px; }

.nav { display: grid; gap: 5px; }
.nav form { margin: 0; }
.nav-section {
  margin: 18px 10px 6px;
  color: rgba(238,247,245,.52);
  font-size: 11px;
  font-weight: 900;
}

.nav a,
.logout-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(238,247,245,.82);
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.nav a::before,
.logout-button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.26);
}

.nav a:hover,
.nav a.is-active,
.logout-button:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.12);
}

.nav a.is-active::before { background: var(--gold); }

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  padding: 12px 26px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.domain-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.container {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.page-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 850px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
}

.muted { color: var(--muted); }
.text-danger { color: var(--red); }

.actions,
.filter-actions,
.supplier-actions,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-danger { background: #fff6f4; border-color: #f1b5a8; color: var(--red); }
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.is-loading { opacity: .72; pointer-events: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card,
.ops-panel,
.profile-panel,
.filter-sidebar,
.supplier-card,
.page-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card,
.ops-panel,
.profile-panel,
.page-header { padding: 18px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title,
.panel-head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
  font-weight: 950;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric { min-height: 112px; }
.metric-value {
  margin: 6px 0;
  color: var(--brand);
  font-size: 34px;
  line-height: 1;
  font-weight: 950;
}
.metric-label { color: var(--muted); font-size: 13px; font-weight: 850; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-fresh { color: var(--green); background: #ecfdf3; border-color: #abefc6; }
.badge-review { color: var(--amber); background: #fff7e8; border-color: #f3ce91; }
.badge-outdated { color: var(--blue); background: #eef7ff; border-color: #b7d9f1; }
.badge-expired { color: var(--red); background: #fff1ed; border-color: #f1b5a8; }
.badge-muted { color: #596865; background: #eef2ef; border-color: #d9e2dd; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
select,
textarea,
.form-control,
.form-select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
textarea { min-height: 112px; resize: vertical; }
label { display: block; margin-bottom: 6px; color: #2a393a; font-size: 13px; font-weight: 900; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(15, 116, 107, .13);
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-row-full { grid-column: 1 / -1; }
.helptext { margin-top: 5px; color: var(--muted); font-size: 13px; }
.errorlist, .field-error { color: var(--red); font-size: 13px; margin: 6px 0 0; }

.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.message.success { color: var(--green); background: #effaf3; border-color: #abefc6; }
.message.error { color: var(--red); background: #fff1ed; border-color: #f1b5a8; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: var(--surface-2); color: #304345; font-size: 13px; font-weight: 950; }
tr:last-child td { border-bottom: 0; }

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolbar .wide { grid-column: span 2; }

.compact-list,
.work-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.compact-item,
.work-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.compact-item:last-child,
.work-row:last-child { border-bottom: 0; }
.work-main { display: grid; min-width: 0; }
.work-main small { color: var(--muted); overflow-wrap: anywhere; }
.score-chip { color: var(--brand); font-weight: 950; }

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.pagination { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span {
  min-width: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Login */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(16,43,45,.96), rgba(11,81,77,.9)),
    #102b2d;
}
.auth-layout {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: stretch;
}
.auth-card,
.auth-visual {
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
}
.auth-card { padding: 30px; background: #fff; }
.auth-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.auth-logo .page-title { font-size: 28px; }
.auth-link { font-weight: 900; }
.auth-visual {
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent),
    repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 1px, transparent 1px 24px);
  position: relative;
  overflow: hidden;
}
.visual-map, .visual-card, .visual-route { display: none; }

/* Dashboard */
.ops-header,
.directory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-strip article {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.kpi-strip span,
.kpi-strip small { color: var(--muted); font-size: 13px; font-weight: 850; }
.kpi-strip strong { display: block; margin: 6px 0; color: var(--brand); font-size: 34px; line-height: 1; }
.ops-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ops-panel-priority { border-top: 3px solid var(--gold); }

/* Directory */
.directory-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.directory-stats span {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.directory-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.filter-sidebar {
  position: sticky;
  top: 82px;
  padding: 14px;
}
.filter-sidebar form { display: grid; gap: 12px; }
.filter-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.city-quick-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.city-quick-strip a {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}
.city-quick-strip a.is-active,
.city-quick-strip a:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}
.supplier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.supplier-card {
  padding: 14px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.supplier-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.supplier-head {
  display: grid;
  grid-template-columns: 62px minmax(0,1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.supplier-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e9efec;
  color: var(--brand);
  font-size: 24px;
  font-weight: 950;
}
.supplier-logo img { width: 100%; height: 100%; object-fit: cover; }
.supplier-title { min-width: 0; }
.supplier-title a { display: block; color: var(--ink); font-size: 18px; font-weight: 950; line-height: 1.25; }
.supplier-title small { color: var(--muted); }
.supplier-status,
.supplier-contact {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.supplier-status strong,
.supplier-status small,
.supplier-contact span,
.supplier-contact small { display: block; color: var(--muted); font-size: 12px; }
.supplier-contact strong { display: block; }
.contact-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--green);
  background: #ecfdf3;
  border: 1px solid #abefc6;
  font-size: 12px;
  font-weight: 900;
}
.supplier-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.supplier-fields div,
.info-grid div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.supplier-fields span,
.info-grid dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.supplier-fields strong,
.info-grid dd {
  display: block;
  margin: 2px 0 0;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.info-grid dd { margin-inline-start: 0; }

/* Profile */
.profile-header {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) minmax(260px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.profile-media {
  width: 126px;
  height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e9efec;
  color: var(--brand);
  font-size: 42px;
  font-weight: 950;
}
.profile-media img { width: 100%; height: 100%; object-fit: cover; }
.profile-kicker { color: var(--muted); font-weight: 850; }
.profile-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.profile-actions { justify-content: flex-start; }
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: 16px;
  margin-bottom: 16px;
}
.profile-panel-accent { border-top: 3px solid var(--gold); }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 0; }
.info-grid .wide { grid-column: 1 / -1; }
.price-summary,
.rating-card {
  display: grid;
  gap: 8px;
}
.price-summary strong,
.rating-card strong { color: var(--brand); font-size: 24px; line-height: 1.2; }
.price-summary span,
.price-summary small,
.rating-card span,
.rating-card p { color: var(--muted); margin: 0; }
.contact-stack { display: grid; gap: 10px; }
.contact-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.contact-card small,
.contact-card span { display: block; color: var(--muted); }
.profile-lists { margin-top: 16px; }

.hotel-hero,
.hotel-card-grid,
.hotel-filter-panel,
.hotel-board-hero,
.hotel-image,
.placeholder-image,
.detail-list,
.hotel-card,
.hotel-data-list { /* legacy compatibility */ }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .nav-section { display: none; }
  .nav a, .logout-button, .nav form { flex: 0 0 auto; }
  .directory-layout,
  .profile-grid,
  .profile-header { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
  .supplier-grid,
  .ops-grid,
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .container, .topbar { padding: 16px; }
  .topbar,
  .page-header,
  .ops-header,
  .directory-header,
  .supplier-contact,
  .supplier-status,
  .contact-card,
  .compact-item,
  .work-row {
    align-items: stretch;
    flex-direction: column;
  }
  .auth-layout,
  .grid-2,
  .grid-3,
  .grid-4,
  .toolbar,
  .form-grid,
  .supplier-grid,
  .supplier-fields,
  .info-grid,
  .ops-grid,
  .kpi-strip,
  .filter-pair {
    grid-template-columns: 1fr;
  }
  .auth-visual { display: none; }
  .auth-card { padding: 24px; }
  .toolbar .wide { grid-column: auto; }
  .supplier-head { grid-template-columns: 54px minmax(0, 1fr); }
  .supplier-head > .badge { grid-column: 1 / -1; justify-self: start; }
  .profile-media { width: 100%; height: 160px; }
  .actions .btn,
  .filter-actions .btn,
  .supplier-actions .btn,
  .profile-actions .btn { flex: 1 1 auto; }
}
