/* ============================================================
   admin_theme.css — Ortak PHE Admin CSS çekirdeği
   D fazı pilot, Codex onaylı 2026-05-14

   KAPSAM:
   - Ortak: token, body, shell, hero, panel, button, form, table, modal, scrollbar
   - DAHİL DEĞİL: Fluids/Plates özel pattern'ler (sortable, out-of-range, head-filter, row-select)
   - DAHİL DEĞİL: Index ana sayfa özel CSS (design-table, agent-chat, process-data hot/cold)

   KULLANIM:
   <link rel="stylesheet" href="/admin_theme.css?v=20260514_1">

   GOLD STATE KORUMA:
   admin_plates.html ve admin_fluids.html bu dosyayı YÜKLEMEZ.
   Onların inline CSS'leri intact kalır.
   ============================================================ */

/* ============================================================
   1) Token sistemi (modern + backward-compatible aliases)
   ============================================================ */
:root {
  --page-bg: #ffffff;
  --panel-bg: #ffffff;
  --text-color: #000000;
  --muted-color: #6f6f6f;
  --border-color: #e31937;
  --input-bg: #ffffff;
  --input-text: #000000;
  --hover-bg: #f0f0f0;
  --selected-bg: #d9d9d9;
  --selected-strong: #cfcfcf;
  --selected-accent: #e31937;
  --accent: #e31937;
  --shadow: none;
  --danger: #a32020;
  --danger-bg: #fff4f5;

  /* Backward-compatible aliases (eski sayfalar için) */
  --ink: var(--text-color);
  --muted: var(--muted-color);
  --paper: var(--page-bg);
  --panel: var(--panel-bg);
  --line: var(--border-color);
  --brand: var(--text-color);
  --accent-2: var(--accent);
}

body[data-admin-theme='dark'] {
  --page-bg: #000000;
  --panel-bg: #000000;
  --text-color: #ffffff;
  --muted-color: #bdbdbd;
  --hover-bg: #e5e5e5;
  --danger: #ff9999;
  --danger-bg: #5a1818;
}

body[data-admin-theme='light'] {
  --page-bg: #ffffff;
  --panel-bg: #ffffff;
  --text-color: #000000;
  --muted-color: #6f6f6f;
  --danger: #a32020;
  --danger-bg: #fff4f5;
}

/* ============================================================
   2) Body / base
   ============================================================ */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-color);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  background: var(--page-bg);
}

/* 8px kırmızı tepe bar (admin_shell.js'in border-top'undan farklı — alt yedek) */
body::before {
  content: '';
  display: block;
  height: 8px;
  background: #e31937;
}

/* ============================================================
   3) Shell / page layout
   ============================================================ */
.shell,
.page {
  width: min(1480px, calc(100% - 28px));
  margin: 14px auto 36px;
  padding: 0;
}

/* ============================================================
   4) Hero / eyebrow / h1
   ============================================================ */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
  padding: 14px 4px 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font: 800 12px "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-color);
}

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

/* ============================================================
   5) Button — theme flip + primary kırmızı + danger + hover
   ============================================================ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  border-radius: 0;
  padding: 6px 10px;
  font: 800 12px "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: none;
}

body[data-admin-theme='light'] .button,
body[data-admin-theme='light'] a.button,
body[data-admin-theme='light'] button.button {
  background: #000000;
  color: #ffffff;
  border: 1px solid #e31937;
}

body[data-admin-theme='dark'] .button,
body[data-admin-theme='dark'] a.button,
body[data-admin-theme='dark'] button.button {
  background: #ffffff;
  color: #111111;
  border: 1px solid #e31937;
}

.button.primary,
body[data-admin-theme='light'] .button.primary,
body[data-admin-theme='dark'] .button.primary {
  background: #e31937;
  color: #ffffff;
  border-color: #e31937;
}

.button.danger,
body[data-admin-theme='light'] .button.danger,
body[data-admin-theme='dark'] .button.danger {
  background: #a32020;
  color: #ffffff;
  border-color: #a32020;
}

/* Hover specificity-boost — Plates/Fluids'te öğrendiğimiz kural */
.button:hover,
.button.primary:hover,
body[data-admin-theme='light'] .button:hover,
body[data-admin-theme='light'] .button.primary:hover,
body[data-admin-theme='dark'] .button:hover,
body[data-admin-theme='dark'] .button.primary:hover {
  background: #c01530;
  border-color: #c01530;
  color: #ffffff;
}

.button.danger:hover,
body[data-admin-theme='light'] .button.danger:hover,
body[data-admin-theme='dark'] .button.danger:hover {
  background: #7a1010;
  border-color: #7a1010;
  color: #ffffff;
}

/* ============================================================
   6) Panel — 2px kırmızı border + header + title + copy
   ============================================================ */
.panel {
  border: 2px solid #e31937;
  border-radius: 0;
  background: var(--panel-bg);
  color: var(--text-color);
  overflow: hidden;
}

.panel-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

.panel-copy,
.status {
  color: var(--muted-color);
  font: 13px/1.45 "Trebuchet MS", Verdana, sans-serif;
}

.status {
  margin-top: 12px;
  padding: 0 4px;
}

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

/* ============================================================
   7) Form — label, input, textarea, select
   ============================================================ */
/* Owner 15.11, UC S2: the element rules below never reach the shell (nav bar,
   language select, login card), so the shell looks the same on every page,
   whether the page loads this file or not (as on the gold pages). :where()
   keeps each rule's specificity exactly as it was. */
form:where(:not(.admin-shell *)) {
  display: grid;
  gap: 14px;
  padding: 18px 22px 24px;
}

label:where(:not(.admin-shell *)) {
  display: grid;
  gap: 6px;
  color: var(--text-color);
  font: 800 11px "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input:where(:not(.admin-shell *)),
textarea:where(:not(.admin-shell *)),
select:where(:not(.admin-shell *)) {
  width: 100%;
  border-radius: 0;
  padding: 9px 10px;
  font: 700 14px "Trebuchet MS", Verdana, sans-serif;
}

body[data-admin-theme='light'] input:not([type="checkbox"]):not([type="file"]):where(:not(.admin-shell *)),
body[data-admin-theme='light'] textarea:where(:not(.admin-shell *)),
body[data-admin-theme='light'] select:where(:not(.admin-shell *)) {
  background: #ffffff;
  color: #000000;
  border: 1px solid rgba(23, 57, 92, 0.18);
}

body[data-admin-theme='dark'] input:not([type="checkbox"]):not([type="file"]):where(:not(.admin-shell *)),
body[data-admin-theme='dark'] textarea:where(:not(.admin-shell *)),
body[data-admin-theme='dark'] select:where(:not(.admin-shell *)) {
  background: #ffffff;
  color: #000000;
  border: 1px solid rgba(23, 57, 92, 0.18);
}

input[readonly]:where(:not(.admin-shell *)) {
  opacity: 0.85;
  cursor: not-allowed;
}

textarea:where(:not(.admin-shell *)) {
  min-height: 84px;
  resize: vertical;
}

/* Disabled inputs — uniform white bg + black text (kullanıcı talimatı) */
body input:disabled:where(:not(.admin-shell *)),
body select:disabled:where(:not(.admin-shell *)),
body textarea:disabled:where(:not(.admin-shell *)),
body[data-admin-theme] input:disabled:where(:not(.admin-shell *)),
body[data-admin-theme] select:disabled:where(:not(.admin-shell *)),
body[data-admin-theme] textarea:disabled:where(:not(.admin-shell *)) {
  background: #ffffff;
  color: #000000;
  opacity: 1;
  cursor: not-allowed;
}

/* Native <select> Chrome OS dark theme override — appearance:none + custom arrow */
select:where(:not(.admin-shell *)) {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  color: #000000;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' fill='none' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 28px;
}

select:where(:not(.admin-shell *)) option {
  background: #ffffff;
  color: #000000;
}

/* File input — native, theme-aware text */
input[type="file"]:where(:not(.admin-shell *)) {
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 6px 8px;
}

/* ============================================================
   8) Tabs — .tab, .tab.active (i18n parity)
   ============================================================ */
.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  overflow: auto;
}

.tab {
  border-radius: 0;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: none;
}

body[data-admin-theme='light'] .tab {
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
}

body[data-admin-theme='dark'] .tab {
  background: #ffffff;
  color: #111111;
  border: 1px solid #ffffff;
}

.tab.active,
body[data-admin-theme='light'] .tab.active,
body[data-admin-theme='dark'] .tab.active {
  background: #e31937;
  color: #ffffff;
  border-color: #e31937;
}

.tab:hover {
  background: #e31937;
  color: #ffffff;
  border-color: #e31937;
}

/* ============================================================
   9) Table — sticky thead theme-aware + row hover + satır ayraçları
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 8px;
  vertical-align: middle;
  font-size: 13px;
  color: var(--text-color);
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 800;
}

body[data-admin-theme='light'] th {
  background: #ffffff;
  color: #000000;
  border-bottom: 2px solid #000000;
  box-shadow: inset 0 -2px 0 #000000;
}

body[data-admin-theme='dark'] th {
  background: #000000;
  color: #ffffff;
  border-bottom: 2px solid #ffffff;
  box-shadow: inset 0 -2px 0 #ffffff;
}

/* Primary overview tables — kırmızı başlık kuralı (plate-selection dili).
   Sadece iki tablo: Customers (#customerTable) ve Monitoring (#pheTable).
   Diğer admin tabloları yukarıdaki tema rengini korur, yeniden renklendirilmez.

   Neden id gerekiyor: yukarıdaki `body[data-admin-theme='light'] th` kuralının
   specificity'si (0,1,2), bir sayfanın kendi inline `th { ... }` kuralından
   (0,0,1) daha güçlü. Bu yüzden admin_customers.html içindeki kırmızı kural
   hiçbir zaman kazanamıyordu ve başlık siyah/beyaz çiziliyordu. Buradaki
   id'li seçici (1,1,2) tema kuralını kesin olarak geçer.
   box-shadow da birlikte ezilmeli: tema onu inset siyah/beyaz olarak boyuyor
   ve aksi halde kırmızı border'ın üzerini kapatıyor. */
body[data-admin-theme='light'] #customerTable th,
body[data-admin-theme='dark'] #customerTable th,
body[data-admin-theme='light'] #pheTable th,
body[data-admin-theme='dark'] #pheTable th {
  border-bottom: 2px solid #e31937;
  box-shadow: inset 0 -2px 0 #e31937;
}

tbody tr {
  transition: background 140ms ease;
}

body[data-admin-theme='light'] tbody td {
  border-bottom: 1px solid rgba(23, 57, 92, 0.08);
}

body[data-admin-theme='dark'] tbody tr,
body[data-admin-theme='dark'] tbody td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.20);
  color: rgba(255, 255, 255, 0.85);
}

body[data-admin-theme='light'] tbody tr:hover td {
  background: #f0f0f0;
  color: #000000;
}

body[data-admin-theme='dark'] tbody tr:hover td {
  background: #e5e5e5;
  color: #111111;
}

/* ============================================================
   10) Modal — .modal, .modal-card, .warning-box, .modal-actions
   ============================================================ */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal-card {
  width: min(560px, 100%);
  border-radius: 0;
  background: var(--panel-bg);
  color: var(--text-color);
  border: 2px solid #e31937;
  box-shadow: none;
  padding: 22px;
}

.modal-card h3 {
  color: var(--text-color);
}

.warning-box {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--danger);
  border-radius: 0;
  background: var(--danger-bg);
  color: var(--danger);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ============================================================
   11) Basic row-button (calibration / catalog row Edit butonu)
   ============================================================ */
.row-button {
  border-radius: 0;
  padding: 4px 10px;
  cursor: pointer;
  font: 800 12px "Trebuchet MS", Verdana, sans-serif;
  transition: none;
}

body[data-admin-theme='light'] .row-button {
  background: #000000;
  color: #ffffff;
  border: 1px solid #e31937;
}

body[data-admin-theme='dark'] .row-button {
  background: #ffffff;
  color: #111111;
  border: 1px solid #e31937;
}

.row-button:hover {
  background: #c01530;
  color: #ffffff;
  border-color: #c01530;
}

/* ============================================================
   12) Scrollbar — Webkit + Firefox, light/dark
   ============================================================ */
body[data-admin-theme='dark'] {
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a #1a1a1a;
}

body[data-admin-theme='dark'] ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body[data-admin-theme='dark'] ::-webkit-scrollbar-track {
  background: #1a1a1a;
}

body[data-admin-theme='dark'] ::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border: 2px solid #1a1a1a;
}

body[data-admin-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: #6a6a6a;
}

body[data-admin-theme='light'] {
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #f0f0f0;
}

body[data-admin-theme='light'] ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body[data-admin-theme='light'] ::-webkit-scrollbar-track {
  background: #f0f0f0;
}

body[data-admin-theme='light'] ::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px solid #f0f0f0;
}

body[data-admin-theme='light'] ::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ============================================================
   13) Responsive
   ============================================================ */
@media (max-width: 920px) {
  .hero {
    display: block;
  }
  .actions {
    margin-top: 16px;
  }
}

/* ============================================================
   14) Admin style standard S1 (Owner 15.11, UC S1 decision)
   Opt-in only: every name below is new (--ux-* tokens, .ux-* classes),
   so a page renders exactly as before until it uses one of them.
   Sizes follow the login card (admin_shell.js) and the button window:
   red stays the brand line, blue is the primary action only.
   Left panel: 360px above 1100px, 320px from 760px to 1100px,
   stacked below 760px; 16px gutter.
   ============================================================ */
:root {
  --ux-left: 360px;
  --ux-gutter: 16px;
  --ux-brand: #e31937;
  --ux-primary: #2563eb;
  --ux-primary-hover: #1d4ed8;
  --ux-danger: #a32020;
  --ux-danger-hover: #7a1010;
  --ux-surface: #ffffff;
  --ux-text: #111827;
  --ux-muted: #6b7280;
  --ux-line: #e5e7eb;
  --ux-control-line: #cbd5e1;
  --ux-secondary-bg: #e5e7eb;
  --ux-secondary-hover: #d1d5db;
  --ux-focus: rgba(37, 99, 235, 0.35);
  --ux-radius-card: 12px;
  --ux-radius-control: 8px;
  --ux-pad-card: 16px;
  --ux-control-height: 40px;
  --ux-font: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  --ux-text-xs: 12px;
  --ux-text-sm: 14px;
  --ux-text-md: 16px;
  --ux-text-lg: 20px;
}

body[data-admin-theme='dark'] {
  --ux-surface: #111111;
  --ux-text: #f3f4f6;
  --ux-muted: #bdbdbd;
  --ux-line: #3a3a3a;
  --ux-control-line: #6b7280;
  --ux-secondary-bg: #2a2a2a;
  --ux-secondary-hover: #3a3a3a;
  --ux-focus: rgba(96, 165, 250, 0.55);
}

.ux-layout {
  display: grid;
  grid-template-columns: var(--ux-left) minmax(0, 1fr);
  gap: var(--ux-gutter);
  align-items: start;
}

.ux-left,
.ux-main {
  min-width: 0;
}

.ux-card {
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-card);
  padding: var(--ux-pad-card);
  background: var(--ux-surface);
  color: var(--ux-text);
  font: var(--ux-text-sm)/1.45 var(--ux-font);
}

.ux-card-title {
  margin: 0 0 12px;
  color: var(--ux-text);
  font: 700 var(--ux-text-lg)/1.2 var(--ux-font);
  letter-spacing: 0;
}

.ux-note {
  margin: 4px 0 0;
  color: var(--ux-muted);
  font: var(--ux-text-xs)/1.45 var(--ux-font);
}

.ux-field {
  display: grid;
  gap: 6px;
  color: var(--ux-text);
  font: 700 13px var(--ux-font);
  letter-spacing: 0;
  text-transform: none;
}

body[data-admin-theme] input.ux-input:not([type="checkbox"]):not([type="file"]),
body[data-admin-theme] select.ux-input,
body[data-admin-theme] textarea.ux-input {
  min-height: var(--ux-control-height);
  border: 1px solid var(--ux-control-line);
  border-radius: var(--ux-radius-control);
  padding: 8px 12px;
  background-color: #ffffff;
  color: #111827;
  font: 400 var(--ux-text-sm) var(--ux-font);
}

body[data-admin-theme] select.ux-input {
  padding-right: 32px;
}

.ux-input:focus {
  outline: none;
  border-color: var(--ux-primary);
  box-shadow: 0 0 0 3px var(--ux-focus);
}

.ux-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ux-control-height);
  border: 0;
  border-radius: var(--ux-radius-control);
  padding: 8px 16px;
  background: var(--ux-secondary-bg);
  color: var(--ux-text);
  font: 700 var(--ux-text-sm) var(--ux-font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ux-button:hover {
  background: var(--ux-secondary-hover);
}

.ux-button.ux-primary {
  background: var(--ux-primary);
  color: #ffffff;
}

.ux-button.ux-primary:hover {
  background: var(--ux-primary-hover);
}

.ux-button.ux-danger {
  background: var(--ux-danger);
  color: #ffffff;
}

.ux-button.ux-danger:hover {
  background: var(--ux-danger-hover);
}

.ux-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ux-focus);
}

.ux-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ux-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1100px) {
  :root {
    --ux-left: 320px;
  }
}

@media (max-width: 759.98px) {
  .ux-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================================================
   15) Admin style standard S2 (Owner 15.11, UC S2 decision)
   Applies only to pages whose <body> carries class "ux-page" (the 16
   non-gold admin pages). Gold pages (plates, fluids, index,
   customer_index) do not load this file, so nothing here reaches them.
   The shell's nav bar and login are left as they are: the login card
   is already the reference, and the nav bar also shows on gold pages,
   so it changes with S3, on every page at once.
   Selectors start "html body.ux-page[data-admin-theme]" so they outrank the page's own
   inline rules of the form body[data-admin-theme] .x by one element
   and one class.
   ============================================================ */
body.ux-page {
  --ux-page-heading: 28px;
}

/* Page frame and heading */
html body.ux-page:not(.ux-calc) .shell,
html body.ux-page:not(.ux-calc) .page {
  width: min(1480px, calc(100% - 2 * var(--ux-gutter)));
  margin: var(--ux-gutter) auto 36px;
}

html body.ux-page .hero {
  align-items: center;
  margin-bottom: var(--ux-gutter);
  padding: 8px 0 0;
}

html body.ux-page h1 {
  font: 700 var(--ux-page-heading)/1.2 var(--ux-font);
  letter-spacing: -0.01em;
}

html body.ux-page .eyebrow {
  margin-bottom: 4px;
  font: 700 var(--ux-text-xs) var(--ux-font);
  letter-spacing: 0.12em;
}

/* The one left panel: 360px, 320px from 760px to 1100px, stacked below 760px */
html body.ux-page .ux-layout {
  display: grid;
  grid-template-columns: var(--ux-left) minmax(0, 1fr);
  gap: var(--ux-gutter);
  align-items: start;
}

html body.ux-page .ux-layout > * {
  min-width: 0;
}

/* Inside the standard columns, fields and form grids shrink to the column
   instead of pushing past the card (the Customers registration form). */
html body.ux-page[data-admin-theme] .ux-layout :is(input, select, textarea):not(.admin-shell *, .datasheet-sheet *) {
  min-width: 0;
  max-width: 100%;
}

html body.ux-page[data-admin-theme] .ux-layout form:not(.admin-shell *, .datasheet-sheet *) {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 760px) {
  html body.ux-page[data-admin-theme] .ux-layout .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Cards */
html body.ux-page[data-admin-theme] .panel,
html body.ux-page[data-admin-theme] .customer-panel,
html body.ux-page[data-admin-theme] .modal-card {
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-card);
  background: var(--ux-surface);
  color: var(--ux-text);
  box-shadow: none;
}

html body.ux-page[data-admin-theme] .modal-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

html body.ux-page[data-admin-theme] .registration {
  background: var(--ux-surface);
}

html body.ux-page[data-admin-theme] .panel-header,
html body.ux-page[data-admin-theme] .panel-head {
  padding: var(--ux-pad-card);
  border-bottom: 1px solid var(--ux-line);
  background: transparent;
}

html body.ux-page[data-admin-theme] .panel-title {
  margin: 0 0 4px;
  font: 700 var(--ux-text-lg)/1.25 var(--ux-font);
  letter-spacing: 0;
}

html body.ux-page[data-admin-theme] .panel-copy {
  color: var(--ux-muted);
  font: var(--ux-text-sm)/1.45 var(--ux-font);
}

html body.ux-page[data-admin-theme] .import-card,
html body.ux-page[data-admin-theme] .template-result,
html body.ux-page[data-admin-theme] .confirm-block,
html body.ux-page[data-admin-theme] .rules-section,
html body.ux-page[data-admin-theme] .media-preview {
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-control);
}

html body.ux-page[data-admin-theme] form:not(.admin-shell *, .datasheet-sheet *) {
  padding: var(--ux-pad-card);
}

/* Fields: as in the login card */
html body.ux-page[data-admin-theme] label:not(.admin-shell *, .datasheet-sheet *) {
  font: 700 13px var(--ux-font);
  letter-spacing: 0;
  text-transform: none;
}

html body.ux-page[data-admin-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] select:not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] textarea:not(.admin-shell *, .datasheet-sheet *) {
  min-height: var(--ux-control-height);
  border: 1px solid var(--ux-control-line) !important;
  border-radius: var(--ux-radius-control);
  padding: 8px 12px;
  font: 400 var(--ux-text-sm) var(--ux-font);
}

html body.ux-page[data-admin-theme] select:not(.admin-shell *, .datasheet-sheet *) {
  padding-right: 32px;
}

html body.ux-page[data-admin-theme] textarea:not(.admin-shell *, .datasheet-sheet *) {
  min-height: 84px;
}

html body.ux-page[data-admin-theme] input:focus:not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] select:focus:not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] textarea:focus:not(.admin-shell *, .datasheet-sheet *) {
  outline: none;
  border-color: var(--ux-primary);
  box-shadow: 0 0 0 3px var(--ux-focus);
}

html body.ux-page[data-admin-theme] input[type="file"]:not(.admin-shell *, .datasheet-sheet *) {
  border: 1px solid var(--ux-control-line);
  border-radius: var(--ux-radius-control);
}

/* Buttons: secondary grey, primary blue, danger red-brown; red stays the brand line */
html body.ux-page[data-admin-theme] .button,
html body.ux-page[data-admin-theme] a.button,
html body.ux-page[data-admin-theme] button.button,
html body.ux-page[data-admin-theme] .row-button {
  min-height: 36px;
  border: 1px solid transparent !important;
  border-radius: var(--ux-radius-control);
  padding: 8px 14px;
  background: var(--ux-secondary-bg) !important;
  color: var(--ux-text) !important;
  font: 700 13px var(--ux-font);
}

html body.ux-page[data-admin-theme] .row-button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: var(--ux-text-xs);
}

html body.ux-page[data-admin-theme] .button:hover,
html body.ux-page[data-admin-theme] .row-button:hover {
  border-color: transparent !important;
  background: var(--ux-secondary-hover) !important;
  color: var(--ux-text) !important;
}

html body.ux-page[data-admin-theme] .button.primary {
  background: var(--ux-primary) !important;
  color: #ffffff !important;
}

html body.ux-page[data-admin-theme] .button.primary:hover {
  background: var(--ux-primary-hover) !important;
  color: #ffffff !important;
}

html body.ux-page[data-admin-theme] .button.danger {
  background: var(--ux-danger) !important;
  color: #ffffff !important;
}

html body.ux-page[data-admin-theme] .button.danger:hover {
  background: var(--ux-danger-hover) !important;
  color: #ffffff !important;
}

html body.ux-page[data-admin-theme] .button:focus-visible,
html body.ux-page[data-admin-theme] .row-button:focus-visible,
html body.ux-page[data-admin-theme] .tab:focus-visible,
html body.ux-page[data-admin-theme] .settings-nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ux-focus);
}

html body.ux-page[data-admin-theme] .button:disabled,
html body.ux-page[data-admin-theme] .row-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Pages that style bare <button>s (endusers, IP lists, monitoring, customers)
   get the same three kinds. Tab buttons and the shell are left alone; a
   button styled by id (the purge page's delete) keeps its own look. */
html body.ux-page[data-admin-theme] button:not([class]):not([role="tab"]):not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] button.secondary:not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] button.primary:not(.admin-shell *, .datasheet-sheet *) {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--ux-radius-control);
  padding: 8px 14px;
  background: var(--ux-secondary-bg);
  color: var(--ux-text);
  font: 700 13px var(--ux-font);
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

html body.ux-page[data-admin-theme] button:not([class]):not([role="tab"]):not(.admin-shell *, .datasheet-sheet *):hover,
html body.ux-page[data-admin-theme] button.secondary:not(.admin-shell *, .datasheet-sheet *):hover {
  background: var(--ux-secondary-hover);
}

html body.ux-page[data-admin-theme] button.primary:not(.admin-shell *, .datasheet-sheet *) {
  background: var(--ux-primary);
  color: #ffffff;
}

html body.ux-page[data-admin-theme] button.primary:not(.admin-shell *, .datasheet-sheet *):hover {
  background: var(--ux-primary-hover);
}

html body.ux-page[data-admin-theme] button:not([class]):not([role="tab"]):not(.admin-shell *, .datasheet-sheet *):focus-visible,
html body.ux-page[data-admin-theme] button.secondary:not(.admin-shell *, .datasheet-sheet *):focus-visible,
html body.ux-page[data-admin-theme] button.primary:not(.admin-shell *, .datasheet-sheet *):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ux-focus);
}

html body.ux-page[data-admin-theme] button:not([class]):not([role="tab"]):not(.admin-shell *, .datasheet-sheet *):disabled,
html body.ux-page[data-admin-theme] button.secondary:not(.admin-shell *, .datasheet-sheet *):disabled,
html body.ux-page[data-admin-theme] button.primary:not(.admin-shell *, .datasheet-sheet *):disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Tabs and the settings menu: rounded, the active one keeps the brand red */
html body.ux-page[data-admin-theme] .tabs {
  gap: 6px;
  border-bottom: 1px solid var(--ux-line);
}

html body.ux-page[data-admin-theme] .tab,
html body.ux-page[data-admin-theme] .settings-nav-item {
  border: 1px solid transparent !important;
  border-radius: var(--ux-radius-control);
  background: transparent !important;
  color: var(--ux-text) !important;
  font: 700 13px var(--ux-font);
}

html body.ux-page[data-admin-theme] .tab:hover,
html body.ux-page[data-admin-theme] .settings-nav-item:hover {
  border-color: transparent !important;
  background: var(--ux-secondary-bg) !important;
  color: var(--ux-text) !important;
}

html body.ux-page[data-admin-theme] .tab.active,
html body.ux-page[data-admin-theme] .settings-nav-item.is-active {
  border-color: var(--ux-brand) !important;
  background: var(--ux-brand) !important;
  color: #ffffff !important;
}

html body.ux-page[data-admin-theme] .settings-nav {
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-card);
  padding: 6px;
  background: var(--ux-surface);
}

/* Tables */
html body.ux-page[data-admin-theme] th:not(.admin-shell *, .datasheet-sheet *) {
  border-bottom: 1px solid var(--ux-line) !important;
  box-shadow: none !important;
  color: var(--ux-muted) !important;
  font: 700 11px var(--ux-font);
  letter-spacing: 0.04em;
}

/* The two primary overview tables keep their red header line (section 9). */
html body.ux-page[data-admin-theme] #customerTable th,
html body.ux-page[data-admin-theme] #pheTable th {
  border-bottom: 2px solid var(--ux-brand) !important;
}

html body.ux-page[data-admin-theme] tbody td:not(.admin-shell *, .datasheet-sheet *) {
  border-bottom: 1px solid var(--ux-line);
}

/* Status and notes */
html body.ux-page[data-admin-theme] .status,
html body.ux-page[data-admin-theme] .muted {
  color: var(--ux-muted);
  font-family: var(--ux-font);
}

@media (max-width: 759.98px) {
  html body.ux-page .ux-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  html body.ux-page h1 {
    font-size: 24px;
  }
}

/* ============================================================
   16) Admin style standard S3 (Owner 16.11, UC S3 decision)
   One standard for every program page: the same lines, colours,
   typeface and tones. Applies to pages whose <body> carries
   "ux-page"; after S3 that is every page in desktop_ui.
   - Geometry: the left panel is as wide as Process Data's at every
     width (30% of its 16px-inset container plus its 8px bleed, i.e.
     30% of the page container here plus 12.8px), one column at 920px
     and below, as Process Data. The page container keeps the 16px
     gutter and Process Data's 2200px cap.
   - Process Data and the customer home page (body class "ux-calc") keep
     their own frame and left panel: they are the reference geometry.
     Their data sheet (.datasheet-sheet) is a document and keeps its own
     print look; no standard rule reaches into it.
   - The shell (nav bar, login card) is the only top line: the base
     theme's 8px body bar is not drawn on these pages.
   - Text, labels, table cells and headings take --ux-text and the
     one typeface; code fields keep their monospace face; data colours
     with meaning (hot/cold, status, chart series) are not tokens and
     are left as they are.
   ============================================================ */
:root {
  --ux-cell: var(--ux-text);
  --ux-left: calc(30% + 12.8px);
  --ux-page-max: 2200px;
  --ux-heading-sm: 20px;
}

html body.ux-page {
  color: var(--ux-text);
  font-family: var(--ux-font);
}

/* The purge confirmation page is deliberately plain (YK3, 01.10): no shell, its own narrow frame.
   It takes the colours, typeface and fields of the standard, not the page frame. */
html body.ux-page:not(.ux-plain) {
  margin: 0;
}

html body.ux-page[data-admin-theme='light'] {
  background: var(--ux-surface);
}

/* Table cell text: the base theme's dark cell colour is the one every page already shows in dark. */
body[data-admin-theme='dark'] {
  --ux-cell: rgba(255, 255, 255, 0.85);
}

html body.ux-page::before {
  content: none;
  display: none;
}

html body.ux-page:not(.ux-plain):not(.ux-calc) .shell,
html body.ux-page:not(.ux-plain):not(.ux-calc) .page,
html body.ux-page:not(.ux-plain):not(.ux-calc) > main {
  width: min(var(--ux-page-max), calc(100% - 2 * var(--ux-gutter)));
  margin: var(--ux-gutter) auto 36px;
}

/* Headings: one page title, one section title */
html body.ux-page h1:not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-text);
  font: 700 var(--ux-page-heading)/1.2 var(--ux-font);
  letter-spacing: -0.01em;
}

html body.ux-page[data-admin-theme] :is(h2, h3, .panel-title):not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-text);
  font-family: var(--ux-font);
  font-weight: 700;
  letter-spacing: 0;
}

html body.ux-page[data-admin-theme] :is(h2, .panel-title):not(.admin-shell *, .datasheet-sheet *) {
  font-size: var(--ux-heading-sm);
  line-height: 1.25;
}

html body.ux-page[data-admin-theme] h3:not(.admin-shell *, .datasheet-sheet *) {
  font-size: var(--ux-text-md);
  line-height: 1.3;
}

html body.ux-page .eyebrow {
  color: var(--ux-brand);
}

/* Labels and fields */
html body.ux-page[data-admin-theme] label:not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-text);
}

/* Fields are white with dark text in both themes, as the login card and the S1 .ux-input. */
html body.ux-page[data-admin-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), select, textarea):not(.admin-shell *, .datasheet-sheet *) {
  background-color: #ffffff !important;
  color: #111827 !important;
}

html body.ux-page[data-admin-theme] :is(input, select, textarea, button):not(.admin-shell *, .datasheet-sheet *) {
  font-family: var(--ux-font);
}

/* Buttons: one weight for every kind */
html body.ux-page[data-admin-theme] :is(.button, .row-button, button.secondary, button.primary, button:not([class]):not([role="tab"])):not(.admin-shell *, .datasheet-sheet *) {
  font-weight: 700 !important;
}

/* Tabs: every tab row looks like .tab; every active tab is the brand red pill */
html body.ux-page[data-admin-theme] [role="tab"]:not(.tab):not(.admin-shell *, .datasheet-sheet *) {
  min-height: 34px;
  border: 1px solid transparent !important;
  border-radius: var(--ux-radius-control);
  padding: 6px 14px;
  background: transparent !important;
  color: var(--ux-text) !important;
  font: 700 13px var(--ux-font);
  cursor: pointer;
}

html body.ux-page[data-admin-theme] [role="tab"]:not(.tab):not([aria-selected="true"]):not(.admin-shell *, .datasheet-sheet *):hover {
  background: var(--ux-secondary-bg) !important;
}

html body.ux-page[data-admin-theme] :is(.tab.is-active, .tab[aria-selected="true"], [role="tab"][aria-selected="true"]):not(.admin-shell *, .datasheet-sheet *) {
  border-color: var(--ux-brand) !important;
  border-radius: var(--ux-radius-control);
  background: var(--ux-brand) !important;
  color: #ffffff !important;
  font: 700 13px var(--ux-font);
}

/* Tables: one header line and one cell line on every table */
html body.ux-page[data-admin-theme] th:not(.admin-shell *, .datasheet-sheet *),
html body.ux-page[data-admin-theme] #customerTable th,
html body.ux-page[data-admin-theme] #pheTable th {
  border-bottom: 1px solid var(--ux-line) !important;
  box-shadow: none !important;
  color: var(--ux-muted) !important;
  font: 700 11px var(--ux-font);
  letter-spacing: 0.04em;
}

html body.ux-page[data-admin-theme] tbody td:not(.admin-shell *, .datasheet-sheet *) {
  border-bottom: 1px solid var(--ux-line);
  font-family: var(--ux-font);
}

/* A cell with a class of its own (a zone status, a plate count, a row number, a code key) keeps its own
   colour and weight: those carry meaning. Plain cells take the standard text, at the lowest specificity, so
   row states (selected, hover) keep their own text colour. */
:where(html body.ux-page[data-admin-theme] tbody td:not([class])):not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-cell);
  font-size: 13px;
  font-weight: 400;
}

html body.ux-page[data-admin-theme] :is(code, kbd, pre, .mono, .code, td.key, .address-field input, .address-prefix, .credential-shown):not(.admin-shell *, .datasheet-sheet *) {
  font-family: Consolas, "Courier New", monospace;
}

/* Status and notes */
html body.ux-page[data-admin-theme] :is(.status, .muted, .hint, .panel-copy, .note):not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-muted);
  font-family: var(--ux-font);
}

@media (max-width: 920px) {
  html body.ux-page .ux-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* S3: the standard holds against a page's own !important look rules (Plates, Fluids, Process Data carry
   layers of them). Only look properties are pinned here: border line, radius, surface, text colour and
   type. Layout, sizes that scripts read, and data colours with meaning (warning and error banners,
   out-of-range marks, hot/cold) are not touched. */
html body.ux-page[data-admin-theme] :is(.panel, .customer-panel, .modal-card, .ux-card):not(.admin-shell *, .datasheet-sheet *) {
  border: 1px solid var(--ux-line) !important;
  border-radius: var(--ux-radius-card) !important;
  background-color: var(--ux-surface) !important;
  box-shadow: none !important;
  color: var(--ux-text);
}

html body.ux-page[data-admin-theme] .modal-card:not(.admin-shell *, .datasheet-sheet *) {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32) !important;
}

html body.ux-page[data-admin-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), select, textarea):not(.admin-shell *, .datasheet-sheet *) {
  border-radius: var(--ux-radius-control) !important;
  font-family: var(--ux-font) !important;
  font-size: var(--ux-text-sm) !important;
  font-weight: 400 !important;
}

html body.ux-page[data-admin-theme] :is(.button, .row-button, button.secondary, button.primary, button:not([class]):not([role="tab"])):not(.admin-shell *, .datasheet-sheet *) {
  border-radius: var(--ux-radius-control) !important;
  font-family: var(--ux-font) !important;
  font-size: 13px !important;
}

html body.ux-page[data-admin-theme] .row-button:not(.admin-shell *, .datasheet-sheet *) {
  font-size: var(--ux-text-xs) !important;
}

html body.ux-page[data-admin-theme] label:not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-text) !important;
  font-family: var(--ux-font) !important;
}

html body.ux-page[data-admin-theme] :is(h1, h2, h3, .panel-title):not(.admin-shell *, .datasheet-sheet *) {
  color: var(--ux-text) !important;
  font-family: var(--ux-font) !important;
}

html body.ux-page[data-admin-theme] th:not(.admin-shell *, .datasheet-sheet *) {
  font-family: var(--ux-font) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

html body.ux-page[data-admin-theme] tbody td:not(.admin-shell *, .datasheet-sheet *) {
  border-bottom-color: var(--ux-line) !important;
  font-family: var(--ux-font);
}

html body.ux-page[data-admin-theme='light']:not(.ux-plain) {
  color: var(--ux-text) !important;
}

/* S3: one select arrow on every page and in every browser (some pages drew the native one, some their own,
   some none once the base theme set the field background). */
html body.ux-page[data-admin-theme] select:not([multiple]):not([size]):not(.admin-shell *, .datasheet-sheet *) {
  -webkit-appearance: none !important;
  appearance: none !important;
  padding-right: 32px !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23111827' fill='none' stroke-width='2'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 11px !important;
}
