/* Enabley admin. RTL, menu on the right. No external dependencies: the server may have no internet.
   Colours from amitnet.co.il (Shahar-On): navy, red, and the warm beige of its page sections. */
:root {
  --bg: #f7f1e9;
  --surface: #ffffff;
  --text: #14203f;
  --muted: #6b6f80;
  --line: #e9e2d6;
  --side: #00194a;
  --side-text: #c4cce0;
  --side-hover: #0b2a66;
  --accent: #142664;
  --accent-soft: #e9edf7;
  --brand-red: #d51217;
  --link: #2448b0;
  --ok: #15803d;      --ok-bg: #e8f6ed;
  --fail: #c02626;    --fail-bg: #fdecec;
  --warn: #b45309;    --warn-bg: #fdf3e2;
  --run: #1d5fd1;     --run-bg: #e8effc;
  --dry: #6d3fc8;     --dry-bg: #f1ebfc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Assistant", Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }

/* Shell: in RTL the first flex child sits on the right. */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-red);
  color: #fff; font-weight: 700; font-size: 18px;
}
.brand strong { display: block; color: #fff; font-size: 15px; }
.brand small { display: block; font-size: 12px; color: #9aa8c8; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; letter-spacing: .04em; color: #7f8fb3; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--side-text);
  border-inline-start: 3px solid transparent;
}
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .09); color: #fff; border-inline-start-color: var(--brand-red); }
.sidebar svg, .btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid #13306b; font-size: 13px; }
.sidebar-foot .who { color: #fff; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sidebar-foot button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--side-text); font: inherit; display: inline-flex; gap: 6px; align-items: center;
}
.sidebar-foot button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--brand-red);
  position: sticky; top: 0; z-index: 5;
}
.topbar .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.page { padding: 24px 28px 48px; width: 100%; max-width: 1440px; }
.page > * + * { margin-top: 20px; }

/* Status chips and badges */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; white-space: nowrap; font-weight: 500;
}
.pill { padding: 4px 12px; font-size: 13px; background: #f1ebe1; color: var(--muted); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge { padding: 1px 9px; font-size: 12px; background: #f1ebe1; color: var(--muted); }
.ok   { background: var(--ok-bg);   color: var(--ok); }
.fail { background: var(--fail-bg); color: var(--fail); }
.warn { background: var(--warn-bg); color: var(--warn); }
.run  { background: var(--run-bg);  color: var(--run); }
.dry  { background: var(--dry-bg);  color: var(--dry); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card, .panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 16px 18px; }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 24px; font-weight: 600; margin: 4px 0 2px; }
.card .sub { color: var(--muted); font-size: 12px; }
.card.alert-card { border-inline-start: 4px solid var(--warn); }

/* Dashboard: which systems the integration talks to. Green = the real system, purple = a test one. */
.where { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.where-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px; border-inline-start: 6px solid var(--warn);
}
.where-card.live { border-inline-start-color: var(--ok); }
.where-card.test { border-inline-start-color: var(--dry); }
.where-card .label { color: var(--muted); font-size: 13px; }
.where-card .value { font-size: 22px; font-weight: 700; margin: 2px 0; }
.where-card.live .value { color: var(--ok); }
.where-card.test .value { color: var(--dry); }
.where-card.none .value { color: var(--warn); }
.where-card .sub { color: var(--muted); font-size: 12px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list .badge { font-size: 13px; padding: 3px 12px; }
.section-title { margin-top: 28px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-body { padding: 16px 18px; }
.panel-body > * + * { margin-top: 12px; }
.panel .table-wrap { overflow-x: auto; }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 9px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { background: #fbf8f3; color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.grid tbody tr:hover { background: #fdfbf7; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.num { font-variant-numeric: tabular-nums; }
.grid th.pick, .grid td.pick { width: 1%; padding-inline-end: 0; }
.grid .empty { text-align: center; color: var(--muted); padding: 28px; }
details summary { cursor: pointer; color: var(--link); }
details[open] summary { margin-bottom: 8px; }

pre.code {
  direction: ltr; text-align: left;
  margin: 0; padding: 10px 12px; border-radius: 8px;
  background: #0f172a; color: #e2e8f0;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap; word-break: break-word; max-width: 720px;
}
.grid pre.code { min-width: 320px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid transparent; }
.alert.ok   { border-color: #bfe5cb; }
.alert.fail { border-color: #f5c2c2; }
.alert.warn { border-color: #f3d6a8; }
.alert ul { margin: 6px 0 0; padding-inline-start: 18px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=date], textarea, select {
  width: 100%; padding: 8px 11px; border: 1px solid #cfd6e1; border-radius: 8px;
  font: inherit; color: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(20, 38, 100, .22); border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
input[type=number] { max-width: 160px; }

.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: #cdd5e0; position: relative; flex-shrink: 0; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { inset-inline-start: 21px; }
.switch strong { display: block; }
.switch span { color: var(--muted); font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.filters .field { min-width: 140px; }
.filters .field label { font-weight: 500; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex; gap: 6px; align-items: center; padding-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-light { background: #fff; color: var(--text); border-color: #cfd6e1; }
.btn-danger { background: #fff; color: var(--fail); border-color: #f0b9b9; }
.btn-sm { padding: 4px 10px; font-size: 13px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
form.inline { display: inline; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain > * + * { margin-top: 20px; }
fieldset:disabled input { opacity: .7; cursor: not-allowed; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.steps { margin: 0; padding-inline-start: 20px; }
.steps li + li { margin-top: 6px; }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 80% 10%, rgba(213, 18, 23, .35) 0, transparent 45%), var(--side);
}
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.login-card .brand { padding: 0 0 20px; }
.login-card .brand strong { color: var(--text); }
.login-card .field + .field { margin-top: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 10px; }

@media (max-width: 960px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; padding: 4px 12px 12px; }
  .nav-section { display: none; }
  .sidebar-foot { display: flex; justify-content: space-between; align-items: center; }
  .sidebar-foot .who { margin: 0; }
  .topbar, .page { padding-inline: 16px; }
  .topbar { position: static; }
}

/* Date fields: the calendar (flatpickr, wwwroot/admin/lib) in the admin colours, the date shown as dd/mm/yyyy. */
.date-shown { direction: ltr; max-width: 170px; cursor: pointer; }
/* Its stylesheet comes after this one, hence "body": Sunday on the right, the arrows turned to match. */
body .flatpickr-calendar { direction: rtl; font-family: inherit; }
body .flatpickr-calendar .flatpickr-months .flatpickr-prev-month { right: 0; left: auto; }
body .flatpickr-calendar .flatpickr-months .flatpickr-next-month { left: 0; right: auto; }
.flatpickr-calendar .flatpickr-prev-month svg, .flatpickr-calendar .flatpickr-next-month svg { transform: scaleX(-1); }
.flatpickr-calendar .flatpickr-day.selected, .flatpickr-calendar .flatpickr-day.selected:hover, .flatpickr-calendar .flatpickr-day.selected:focus { background: var(--accent); border-color: var(--accent); }
.flatpickr-calendar .flatpickr-day.today { border-color: var(--brand-red); }
