:root {
  /* Yüzeyler */
  --bg: #0e0e0e;
  --sidebar: #111111;
  --header: #121212;
  --panel: #1a1a1a;
  --surface-2: #212121;
  --line: #2c2c2c;
  --line-strong: #3a3a3a;
  --ink: #f5f5f5;
  --muted: #9a9a9a;
  --hover: rgba(255, 255, 255, 0.05);
  --chip: #1c1c1c;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);

  /* Marka ve durum renkleri */
  --accent: #e30613;
  --accent-hover: #c40511;
  --accent-soft: rgba(227, 6, 19, 0.14);
  --accent-ink: #ff4d58;
  --ok: #22a55a;
  --warn: #e5a500;

  /* Ölçüler */
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 248px;
  --topbar-h: 128px;
  --focus: 0 0 0 3px rgba(227, 6, 19, 0.35);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --device-id-ink: #ffffff;
  --nameplate-fill: #242220;
  --nameplate-edge: #a39e96;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f4f5;
  --sidebar: #ffffff;
  --header: #ffffff;
  --panel: #ffffff;
  --surface-2: #fafafa;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --ink: #18181b;
  --muted: #71717a;
  --hover: rgba(0, 0, 0, 0.04);
  --chip: #f4f4f5;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --accent-soft: rgba(227, 6, 19, 0.08);
  --accent-ink: #c40511;
  --device-id-ink: #000000;
  --nameplate-fill: #ece7df;
  --nameplate-edge: #a39e96;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; color: inherit; }

button { cursor: pointer; }

:where(a, button, select, input):focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app {
  display: flex;
  min-height: 100%;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 16px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.brand-logo {
  width: 176px;
  height: auto;
  display: block;
}

.brand-system {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  line-height: 1.35;
}

.hospital-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 12px 0;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.hospital-box-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.hospital-box-ico svg,
.hospital-switch svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hospital-box-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hospital-box-text b {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hospital-box-text small {
  color: var(--muted);
  font-size: 11.5px;
}

.hospital-switch {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.hospital-switch:hover { background: var(--hover); color: var(--ink); }

.hospital-switch[hidden] { display: none; }

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-group {
  margin: 14px 12px 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav a svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a:hover { background: var(--hover); color: var(--ink); }

.nav a.active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.nav a.active svg { color: var(--accent-ink); }

.nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  padding: 14px 4px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

.sidebar-status { flex: 1; }

.version {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* Üst bar */

.workspace {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--topbar-h);
  padding: 16px 28px;
  background: color-mix(in srgb, var(--header) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.title-block { min-width: 0; }

.crumb {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar h1 {
  margin-top: 4px;
  font-size: 32px;
  line-height: 1.15;
}

.topbar .top-actions { gap: 12px; }

.topbar .top-divider {
  height: 48px;
  margin: 0 8px;
}

.topbar .icon-btn {
  width: 72px;
  height: 72px;
  border-radius: 16px;
}

.topbar .icon-btn svg {
  width: 34px;
  height: 34px;
  stroke-width: 1.8;
}

.topbar .btn-dot {
  top: 14px;
  right: 16px;
  width: 12px;
  height: 12px;
}

.topbar .service-pill {
  padding: 10px 18px;
  font-size: 18px;
}

.topbar .user-btn {
  height: 80px;
  gap: 14px;
  padding: 0 16px 0 8px;
}

.topbar .avatar {
  width: 60px;
  height: 60px;
  font-size: 24px;
}

.topbar .user-name {
  max-width: 240px;
  font-size: 22px;
}

.topbar .user-btn .chev {
  width: 28px;
  height: 28px;
}

h1 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.top-divider {
  width: 1px;
  height: 24px;
  margin: 0 6px;
  background: var(--line);
}

.icon-btn,
.text-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.icon-btn { width: 36px; padding: 0; }

.text-btn { padding: 0 12px; font-size: 13px; font-weight: 500; }

.icon-btn:hover,
.text-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--hover);
  border-color: var(--line);
  color: var(--ink);
}

.icon-btn.active,
.text-btn.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.icon-btn svg,
.text-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--header);
  border-radius: 50%;
  background: var(--accent);
}

.btn-dot[hidden] { display: none; }

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
  background: var(--hover);
  border-color: var(--line);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.avatar-lg { width: 38px; height: 38px; font-size: 15px; }

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
}

.user-btn .chev {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s var(--ease);
}

.user-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Açılır menüler */

.pop-wrap { position: relative; }

.popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 30;
  animation: pop-in 0.14s var(--ease);
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.popover button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.popover button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popover button:hover,
.popover button[aria-checked="true"] { background: var(--hover); }

.popover button[aria-checked="true"] { color: var(--accent-ink); font-weight: 700; }

.popover-label {
  margin: 6px 10px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.popover-empty {
  margin: 0 10px 10px;
  color: var(--muted);
  font-size: 13px;
}

.popover-link {
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

#notify-menu { width: 340px; }

.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 4px;
}

.popover .notify-clear {
  width: auto;
  height: 26px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.popover .notify-clear:hover { color: var(--ink); }

.notify-list {
  max-height: 360px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.notify-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 4px 8px 8px;
  border-radius: var(--radius-sm);
}

.notify-item:hover { background: var(--hover); }

.notify-item.is-new { background: var(--hover); box-shadow: inset 2px 0 0 var(--accent); }

.notify-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--hover);
  color: var(--muted);
}

.notify-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notify-item.is-hata .notify-ico { background: var(--accent-soft); color: var(--accent-ink); }
.notify-item.is-servis .notify-ico { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.notify-item.is-temizlik .notify-ico { background: rgba(63, 182, 255, 0.16); color: #5cc2ff; }

.notify-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.4;
}

.notify-text time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.popover .notify-del {
  width: 26px;
  height: 26px;
  flex: none;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  opacity: 0.55;
}

.notify-item:hover .notify-del,
.popover .notify-del:focus-visible { opacity: 1; }

.popover .notify-del:hover { color: var(--accent-ink); }

.user-menu { min-width: 240px; }

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--line);
}

.user-menu-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.user-menu-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.popover .menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}

.popover .menu-link:hover { background: var(--hover); }

.popover .menu-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popover .menu-link[hidden] { display: none; }

.popover .menu-danger { color: var(--accent-ink); font-weight: 600; }

/* Servis modu */

.service-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.service-pill.is-on {
  background: var(--warn);
  color: #1a1400;
  animation: service-blink 1.6s ease-in-out infinite;
}

.service-pill[hidden] { display: none; }

@keyframes service-blink { 50% { opacity: 0.65; } }

@media (prefers-reduced-motion: reduce) {
  .service-pill.is-on { animation: none; }
}

.icon-btn.is-clean { background: rgba(63, 182, 255, 0.16); color: #5cc2ff; }

.service-pill.clean-pill {
  background: rgba(63, 182, 255, 0.18);
  color: #5cc2ff;
  animation: service-blink 1.6s ease-in-out infinite;
}

.icon-btn.is-service { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.status-dot.is-service {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent);
}

.service-menu { width: 300px; }

.service-now {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.service-now i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.service-now:not(.is-off) { color: var(--warn); }

.service-now:not(.is-off) i { background: var(--warn); }

.popover .service-opt {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  height: auto;
  padding: 9px 10px;
}

.popover .service-opt b { font-size: 13.5px; }

.popover .service-opt small { color: var(--muted); font-size: 12px; }

.popover .service-opt[aria-checked="true"] b { color: var(--warn); }

.popover .service-opt:disabled { cursor: default; opacity: 0.45; }

.popover .service-opt:disabled:hover { background: transparent; }

.popover .service-exit {
  justify-content: center;
  margin-bottom: 6px;
  background: var(--warn);
  color: #1a1400;
  font-weight: 800;
}

.clean-menu { width: 320px; max-height: calc(100vh - 90px); overflow-y: auto; }

.clean-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.clean-info i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #3fb6ff;
}

.clean-info b { color: var(--ink); }

.clean-info.is-warn { color: var(--warn); }

.clean-info.is-warn i { background: var(--warn); }

.clean-info a { color: var(--accent-ink); font-weight: 700; }

.clean-run {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 10px 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.clean-run b { color: var(--ink); font-size: 13.5px; }

.popover .clean-stop { background: #3fb6ff; color: #04121c; }

.popover .clean-stop:hover { background: #6fc8ff; }

.clean-sub {
  margin: 8px 10px 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.popover .clean-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  justify-content: stretch;
}

.clean-line b {
  padding: 2px 0;
  border-radius: 6px;
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.clean-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clean-line small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.popover .clean-line:disabled { cursor: default; opacity: 0.45; }

.popover .clean-line:disabled:hover { background: transparent; }

.popover .service-exit:hover { background: color-mix(in srgb, var(--warn) 85%, #fff); }

@media (max-width: 560px) {
  .service-pill { display: none; }
}

.popover .menu-danger:hover { background: var(--accent-soft); }

.menu-btn { display: none; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 30;
}

.content {
  flex: 1;
  padding: 24px 28px 40px;
}

/* Boş durumlar */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 420px;
  margin: 48px auto;
  padding: 36px 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.empty-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.empty-action {
  margin-top: 18px;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.empty-action:hover { background: var(--accent-hover); }

.ship-empty .empty-state {
  margin: 12px auto;
  padding: 24px 20px;
  border: 0;
}

.device-board {
  --device-gap: 10px;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: var(--device-gap);
  justify-content: start;
  align-items: stretch;
}

.device-card {
  box-sizing: border-box;
  width: min(338px, calc((100vw - 248px - 56px - 3 * var(--device-gap) - 16px) / 4));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 8px;
}

.device-type,
.device-name {
  margin: 0;
  align-self: center;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  line-height: 1.25;
  border: 2px solid var(--accent);
  border-radius: 9px;
  padding: 3px 8px;
}

.device-type {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.device-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.device-art {
  position: relative;
  width: 100%;
  overflow: hidden;
  min-height: 0;
}

.device-art svg {
  position: absolute;
  display: block;
  max-width: none;
  object-fit: fill;
}

/* Blower and valve use the diverter frame so the machines match that height. */
.blower-art,
.valf-art,
.diverter-art,
.tip3-art,
.tip4-art { aspect-ratio: 760 / 376; }

.tip5-art { aspect-ratio: 760 / 552; }

.blower-art svg {
  width: calc(100% * 480 / 419 * 344 / 760);
  height: calc(100% * 640 / 419 * 344 / 376);
  left: calc(50% - (100% * 240 / 419 * 344 / 760));
  top: calc(100% * 16 / 376 - (100% * 199 / 419 * 344 / 376));
}

.valf-art svg {
  width: calc(100% * 480 / 488 * 344 / 760);
  height: calc(100% * 640 / 488 * 344 / 376);
  left: calc(50% - (100% * 240 / 488 * 344 / 760));
  top: calc(100% * 16 / 376 - (100% * 138 / 488 * 344 / 376));
}

.diverter-art svg,
.tip3-art svg,
.tip4-art svg {
  width: 100%;
  height: calc(100% * 640 / 376);
  left: 0;
  top: calc(100% * -132 / 376);
}

.tip5-art svg {
  width: 100%;
  height: calc(100% * 640 / 552);
  left: 0;
  top: calc(100% * -44 / 552);
}

.tip6-art { aspect-ratio: 760 / 646; }

.tip6-art svg {
  width: 100%;
  height: calc(100% * 690 / 646);
  left: 0;
  top: calc(100% * -44 / 646);
}

.tup-art { aspect-ratio: 516 / 154; }

.damper-art { aspect-ratio: 280 / 760; }

.device-card .damper-art {
  width: calc(220px * 280 / 760);
  align-self: center;
}

.panel-device.is-damper {
  width: calc(220px * 280 / 760);
}

.panel-device.is-damper,
.panel-device.is-damper .damper-art {
  overflow: visible;
}

.panel-device.is-damper.is-yatay {
  width: 220px;
}

.panel-device.is-damper.is-yatay .damper-art {
  aspect-ratio: 760 / 280;
}

.panel-device.is-damper.is-yatay .damper-art svg {
  width: calc(220px * 280 / 760);
  height: 220px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.tup-art svg,
.damper-art svg {
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}

.device-controls {
  display: flex;
  gap: 6px;
}

.device-controls button {
  flex: 1;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.device-controls button:hover { background: var(--hover); }

.device-controls button.is-active,
.device-controls button.is-active:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.content.is-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.content.is-panel-2 .panel-floor-labels {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

/* Kat etiketi: katın ortasında, solda renkli şerit. */
.content.is-panel-2 .floor-kat {
  position: absolute;
  left: 10px;
  transform: translateY(-50%);
  padding: 7px 11px 7px 12px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.content.is-panel-2 .floor-kat.is-zemin { border-left-color: var(--ok); }

.content.is-panel-2 .floor-kat.is-bodrum { border-left-color: #7d868d; }

/* Kat bantları dünya katmanında: dönüşümlü zemin tonu ve taralı beton döşeme. */
.panel-floors {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.floor-band {
  position: absolute;
  left: -30000px;
  width: 60000px;
}

.floor-band.is-odd { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }

.floor-slab {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 14px;
  border-top: 2px solid color-mix(in srgb, var(--muted) 75%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 32%, transparent) 0 2px, transparent 2px 10px),
    color-mix(in srgb, var(--muted) 10%, var(--bg));
}

.panel-stage {
  position: relative;
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.panel-world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.panel-stage.is-panning,
.panel-stage.is-panning .panel-device {
  cursor: grabbing;
}

.panel-stage:not(.is-drawing) .panel-port,
.panel-stage:not(.is-drawing) .panel-elbow {
  visibility: hidden;
  pointer-events: none;
}

.panel-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  display: flex;
  gap: 6px;
}

.panel-zoom button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.panel-zoom button:hover { background: var(--hover); }

/* Boş panel ipucu */
.panel-empty {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  padding: 22px 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.panel-empty[hidden] { display: none; }

.panel-empty b { color: var(--ink); font-size: 16px; }

.panel-empty em { color: var(--ink); font-style: normal; font-weight: 600; }

.panel-empty-hint { font-size: 12px; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* Kısayol yardımı */
.shortcut-card {
  width: min(520px, calc(100% - 32px));
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 18px;
  margin: 14px 0 6px;
  font-size: 13.5px;
}

.shortcut-list dt {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.shortcut-list dt span { color: var(--muted); font-weight: 500; font-size: 12px; }

.shortcut-list dd { margin: 0; color: var(--muted); }

/* Menüde cihaz kodu sağda, gri */
.ctx-device small {
  margin-left: auto;
  padding-left: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ctx-device:disabled { cursor: default; opacity: 0.4; }

.ctx-device:disabled:hover,
.ctx-device:disabled:focus { background: transparent; color: var(--ink); }

/* Süre alanında birim */
.param-unit { display: flex; align-items: center; gap: 8px; }
.param-unit input { flex: 1; min-width: 0; }
.param-unit span { color: var(--muted); font-size: 12.5px; font-weight: 700; }

.panel-send {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 8;
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-send > button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.panel-send > button[data-send] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.panel-send > button:disabled { opacity: 0.65; }

/* Gönderici / Hedef / Gönder yalnızca simülasyon modunda (Ctrl+Shift+S). */
.panel-stage:not(.is-sim) .panel-send > button { display: none; }

.send-status {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.send-status[hidden] { display: none; }

.send-status.is-service {
  border-color: color-mix(in srgb, var(--warn) 55%, transparent);
  color: var(--warn);
}

.mode-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 8;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, #2f6bff 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #2f6bff 16%, var(--panel));
  color: #8fb3ff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transform: translateX(-50%);
  pointer-events: none;
}

.mode-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f6bff;
  box-shadow: 0 0 8px #2f6bff;
}

.panel-stage.is-sim .sim-badge,
.panel-stage.is-drawing .draw-badge { display: inline-flex; }

.draw-badge {
  border-color: color-mix(in srgb, #a970ff 55%, transparent);
  background: color-mix(in srgb, #a970ff 16%, var(--panel));
  color: #c8a6ff;
}

.draw-badge i { background: #a970ff; box-shadow: 0 0 8px #a970ff; }

/* Gönderimin geçtiği hat. */
.panel-pipes path.is-route {
  filter: drop-shadow(0 0 3px rgba(74, 222, 128, 0.85)) drop-shadow(0 0 8px rgba(34, 165, 90, 0.45));
}

/* Gönderen istasyonda mavi, varılan istasyonda yeşil halka. */
.panel-device.is-sending::after,
.panel-device.is-arrived::after {
  content: "";
  position: absolute;
  inset: -12px;
  border: 3px solid #22a55a;
  border-radius: 18px;
  pointer-events: none;
  animation: device-ring 1.6s ease-out forwards;
}

.panel-device.is-sending::after { border-color: #3fb6ff; }

@keyframes device-ring {
  0% { opacity: 1; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-device.is-sending::after,
  .panel-device.is-arrived::after { animation-duration: 0.01s; }
}

/* Temizlik: çalışan hat parlar, altta ilerleme kartı */

.panel-pipes path.is-clean {
  filter: drop-shadow(0 0 4px rgba(63, 182, 255, 0.95)) drop-shadow(0 0 10px rgba(63, 182, 255, 0.55));
  animation: clean-pulse 1.1s ease-in-out infinite;
}

.panel-pipes path.is-clean.is-blow {
  filter: drop-shadow(0 0 4px rgba(240, 138, 28, 0.95)) drop-shadow(0 0 10px rgba(240, 138, 28, 0.55));
}

@keyframes clean-pulse { 50% { opacity: 0.72; } }

/* Servis: ayarlanan yol, emme/üfleme başlamadan */
.panel-pipes path.is-route {
  filter: drop-shadow(0 0 4px rgba(34, 165, 90, 0.95)) drop-shadow(0 0 9px rgba(34, 165, 90, 0.5));
}

@media (prefers-reduced-motion: reduce) {
  .panel-pipes path.is-clean { animation: none; }
}

.clean-card {
  --clean: #3fb6ff;
  position: absolute;
  left: 50%;
  bottom: 60px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(460px, calc(100% - 32px));
  padding: 12px 12px 14px 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--clean) 50%, var(--line));
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.clean-card[hidden] { display: none; }

.clean-card.is-blow,
.clean-card.is-drop { --clean: #f08a1c; }

.clean-card.is-svc { --clean: var(--warn); }

.clean-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--clean);
  box-shadow: 0 0 10px var(--clean);
  animation: clean-pulse 1.1s ease-in-out infinite;
}

.clean-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clean-text b { font-size: 13.5px; }

.clean-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clean-step {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.clean-card button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.clean-card button:hover { background: var(--hover); }

.clean-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--hover);
}

.clean-bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--clean);
  transition: width 0.25s linear;
}

.addr-list {
  position: fixed;
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  scrollbar-color: var(--line) transparent;
}

.addr-list[hidden] { display: none; }

.addr-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.addr-list button span {
  color: var(--muted);
  font-size: 11px;
}

.addr-list button:hover,
.addr-list button.is-selected {
  background: var(--accent);
  color: #fff;
}

.addr-list button:hover span,
.addr-list button.is-selected span { color: #fff; }

.addr-empty {
  margin: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.panel-traveler {
  position: absolute;
  z-index: 7;
  pointer-events: none;
}

.panel-switch-front {
  position: absolute;
  z-index: 8;
  display: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.panel-switch-front svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hareket ederken tüpün arkasında kalan hava izi; tüp döndükçe iz de döner. */
.panel-traveler::before {
  content: "";
  position: absolute;
  top: 24%;
  bottom: 24%;
  right: 90%;
  width: 150%;
  border-radius: 999px;
  background: linear-gradient(to left, rgba(214, 228, 235, 0.5), rgba(214, 228, 235, 0));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.panel-traveler.is-moving::before { opacity: 1; }

.panel-traveler svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
}

.draw-lock-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.draw-lock-backdrop[hidden] { display: none; }

.draw-lock {
  width: 240px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.draw-lock-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
}

.draw-lock-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.draw-lock input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.param-note {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.draw-lock-error {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.draw-lock-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.draw-lock-actions button {
  flex: 1;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.draw-lock-actions button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.device-params {
  width: 380px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.param-table {
  width: 100%;
  border-collapse: collapse;
}

.param-table th,
.param-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  font-weight: 600;
}

.param-table th {
  width: 42%;
  color: var(--muted);
  font-weight: 700;
}

.param-table tr[hidden] { display: none; }

.param-table input,
.param-table select,
.id-pick-btn {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.id-pick {
  position: relative;
}

.id-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
}

.id-pick-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}

.id-pick-list {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 200px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  scrollbar-color: var(--line) transparent;
}

.id-pick-list[hidden] { display: none; }

.id-pick-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  font: inherit;
  font-weight: 600;
}

.id-pick-list button:hover,
.id-pick-list button.is-selected {
  background: var(--accent);
  color: #fff;
}

.id-pick-list button.is-taken,
.id-pick-list button:disabled {
  color: var(--muted);
  background: transparent;
  cursor: default;
}

.panel-device {
  position: absolute;
  width: 220px;
  z-index: 1;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.device-tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--header);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.device-tip[hidden] { display: none; }

.panel-stage.is-drawing .panel-device { cursor: grab; }

.panel-device.is-dragging {
  cursor: grabbing;
  z-index: 5;
}

.panel-device.is-out-arizali [data-housing] { fill: var(--accent); stroke: var(--accent); stroke-width: 3.2px; }
.panel-device.is-out-bakimda [data-housing] { fill: #e6c200; stroke: #e6c200; stroke-width: 3.2px; }
.panel-device.is-out-kullanidis [data-housing] { fill: #7a3ff2; stroke: #7a3ff2; stroke-width: 3.2px; }

.device-status {
  position: absolute;
  top: 0;
  left: calc(100% * 350 / 760);
  z-index: 4;
  transform: translate(-50%, -100%);
  pointer-events: none;
  padding: 8px 18px 10px;
  border-radius: 16px;
  color: #141414;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.15;
  white-space: nowrap;
}

.panel-device.is-out-arizali .device-status { background: var(--accent); color: #fff; }
.panel-device.is-out-bakimda .device-status { background: #e6c200; color: #1a1204; }
.panel-device.is-out-kullanidis .device-status { background: #7a3ff2; color: #fff; }

.device-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.device-id {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3a3a3a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.device-id.is-gecisli { background: #14c8c8; }
.device-id.is-son { background: #8ed96a; color: #163016; }

.device-badge.is-diverter {
  top: 4.63px;
  left: calc(100% * 350 / 760);
  transform: translate(-50%, -100%);
  flex-direction: column-reverse;
  gap: 2px;
}

.device-badge.is-side {
  top: calc(100% * 276 / 552);
  left: calc(100% * 140 / 760);
  transform: translate(calc(-100% - 6px), -50%);
  gap: 0;
}

.device-badge.is-side.is-tip6 {
  top: calc(100% * 276 / 646);
}

/* Ekipman etiketi: koyu grafit plaka, solda tür şeridi. */
.device-tag {
  --tag: #e30613;
  position: relative;
  box-sizing: border-box;
  min-width: 92px;
  padding: 6px 12px 7px 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: linear-gradient(180deg, #2c3035 0%, #181b1e 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  color: #f4f6f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.device-tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: var(--tag);
  box-shadow: 0 0 10px var(--tag);
}

.device-tag.is-gecisli { --tag: #14c8c8; }
.device-tag.is-son { --tag: #6fd24e; }

.device-tag b {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.device-tag small {
  margin-top: 4px;
  color: rgba(244, 246, 247, 0.62);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.device-addr {
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
}

.panel-grid {
  position: absolute;
  left: -9600px;
  top: -9600px;
  width: 28800px;
  height: 28800px;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.panel-grid[hidden] { display: none; }

.panel-grid .floor-col {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.28;
}

.panel-grid .floor-line {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.3;
}

.panel-grid .floor-sub {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.22;
}

.panel-pipes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.panel-pipe-caps {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.panel-pipes path[data-pipe] {
  pointer-events: stroke;
}

/* Cihaza özel seçenekler ve Otomatik Çiz ayrı bölümlerde. */
#ctx-params,
#ctx-auto-draw {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

#ctx-delete { color: var(--accent-ink); }

.ctx-floor-label {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.ctx-device.is-current {
  color: var(--accent);
}

.panel-port {
  position: absolute;
  z-index: 4;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #d5d0c8;
  background: rgba(20, 24, 27, 0.25);
  cursor: crosshair;
}

.panel-elbows {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.panel-elbow {
  position: absolute;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

/* Kaydırma tutamağı: dikey parça yatay, yatay parça dikey kayar; şekil yönü gösterir. */
.panel-elbow.is-x {
  width: 12px;
  height: 28px;
  border-radius: 6px;
  cursor: ew-resize;
}

.panel-elbow.is-y {
  width: 28px;
  height: 12px;
  border-radius: 6px;
  cursor: ns-resize;
}

/* Elle düzenlenmiş borunun tutamağı turuncu. */
.panel-elbow.is-manual { background: #f08a1c; }

.panel-elbow.is-dragging,
.panel-elbow:hover { box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.35); }

.ctx-menu {
  position: fixed;
  z-index: 80;
  min-width: 280px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tech-menu {
  min-width: 168px;
  z-index: 90;
  padding: 6px;
}

.ctx-label {
  margin: 2px 8px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ctx-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ctx-device {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

.ctx-device[hidden] { display: none; }

.ctx-device:hover,
.ctx-device:focus {
  background: var(--accent);
  color: #fff;
}

.placeholder {
  color: var(--muted);
  font-size: 14px;
}

.screen-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-height: 0;
}

.screen-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - var(--topbar-h) - 64px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.screen-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 6px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen-list-head em {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink);
  font-style: normal;
  letter-spacing: 0;
}

.screen-dev {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.screen-dev:hover { background: var(--hover); }

.screen-dev.is-on {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}

.screen-dev-addr {
  min-width: 46px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.screen-dev.is-on .screen-dev-addr { background: var(--accent); color: #fff; }

.screen-dev-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen-dev-text b {
  overflow: hidden;
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-dev-text small {
  color: var(--muted);
  font-size: 11.5px;
}

.screen-dev-state {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.screen-dev-state.is-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.screen-dev-state.is-fault { background: var(--accent-soft); color: var(--accent-ink); }
.screen-dev-state.is-maint { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.screen-dev-state.is-off { background: rgba(122, 63, 242, 0.16); color: #9c6bff; }
.screen-dev-state.is-busy { background: rgba(240, 120, 0, 0.16); color: #f08a1c; }

.screen-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.screen-spec {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 1180px) {
  .screen-page { grid-template-columns: minmax(0, 1fr); }

  .screen-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
  }

  .screen-list-head { display: none; }

  .screen-dev { width: auto; flex: none; }

  .screen-dev-state { display: none; }
}

.screen-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.screen-pick select,
.esp-lcd select {
  min-width: 220px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.esp-frame {
  width: min(100%, calc((100vh - 200px) * 1024 / 600));
  max-width: 100%;
  padding: 14px;
  border-radius: 26px;
  background: linear-gradient(160deg, #2a2a30 0%, #16161a 55%, #101013 100%);
  border: 1px solid #3a3a42;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.6),
    0 24px 48px rgba(0, 0, 0, 0.38);
}

.esp-lcd {
  position: relative;
  width: 100%;
  aspect-ratio: 1024 / 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: radial-gradient(120% 80% at 50% 0%, #17171c 0%, #0f0f13 70%);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 24px rgba(0, 0, 0, 0.6);
  color: #f5f5f5;
  container-type: inline-size;
  padding: 1.15cqi 1.25cqi 1cqi;
  gap: 0.85cqi;
}

.esp-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.2cqi;
  padding: 0.15cqi 0.4cqi 0.7cqi;
  border-bottom: 1px solid var(--accent);
  color: #f2f2f4;
  font-size: 1.85cqi;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.esp-brand-mark {
  display: block;
  width: 2.4cqi;
  height: 0.55cqi;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(227, 6, 19, 0.85);
  flex: 0 0 auto;
}

.esp-brand-name {
  display: inline-flex;
  align-items: center;
  gap: 0.75cqi;
  min-width: 0;
}

.esp-brand-tube {
  display: block;
  height: 2.15cqi;
  width: auto;
  flex: 0 0 auto;
}

.esp-brand b {
  color: #f5f5f5;
  font-size: 1.6cqi;
  font-weight: 700;
}

.esp-brand-side {
  display: inline-flex;
  align-items: center;
  gap: 0.7cqi;
  flex: 0 0 auto;
}

.esp-marks {
  display: inline-flex;
  align-items: center;
  gap: 0.4cqi;
}

.esp-mark {
  display: block;
  width: 2.15cqi;
  height: 2.15cqi;
  flex: 0 0 auto;
}

.esp-idline {
  display: inline-flex;
  align-items: center;
  gap: 0.8cqi;
  min-width: 0;
}

.esp-duty {
  display: inline-flex;
  align-items: center;
  gap: 0.45cqi;
  color: #d7d7d7;
  font-size: 1.6cqi;
  font-weight: 600;
  white-space: nowrap;
}

.esp-duty i {
  position: relative;
  display: inline-block;
  width: 1.5cqi;
  height: 1.5cqi;
  flex: 0 0 auto;
}

.esp-duty-devrede i {
  border-radius: 50%;
  background: #1f9d55;
}

.esp-ready-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28cqi 0.95cqi;
  border: 1px solid #1f9d55;
  border-radius: 8px;
  background: transparent;
  color: #1f9d55;
  font-size: 1.55cqi;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.esp-ready-chip.is-arizali { border-color: var(--accent); color: var(--accent); }
.esp-ready-chip.is-bakimda { border-color: #e6c200; color: #e6c200; }
.esp-ready-chip.is-kullanidis { border-color: #7a3ff2; color: #7a3ff2; }

.esp-duty-arizali i {
  color: var(--accent);
  font-style: normal;
  font-weight: 800;
  font-size: 1.8cqi;
  line-height: 1;
}

.esp-duty-arizali i::before { content: "!"; }

.esp-duty-bakimda i {
  width: 0;
  height: 0;
  border-right: 0.75cqi solid transparent;
  border-bottom: 1.35cqi solid #e39b2b;
  border-left: 0.75cqi solid transparent;
}

.esp-duty-kullanidis i {
  box-sizing: border-box;
  border: 0.2cqi solid #8a8a8a;
  border-radius: 50%;
}

.esp-duty-kullanidis i::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -0.15cqi;
  width: 1.6cqi;
  height: 0.2cqi;
  background: #8a8a8a;
  transform: translateY(-50%) rotate(-32deg);
}

.esp-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1.2cqi;
  padding: 0.9cqi 3.2cqi;
  border-bottom: 1px solid var(--accent);
  font-size: 2.4cqi;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.esp-id { justify-self: start; }

.esp-clock {
  position: relative;
  z-index: 1;
  font-size: 1.85cqi;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: #f5f5f7;
}

.esp-meta {
  justify-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.esp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.esp-work {
  position: relative;
  flex: 1;
  display: flex;
  gap: 1.2cqi;
  min-height: 0;
}

.esp-side {
  width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.esp-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7cqi;
}

.esp-page-head {
  display: flex;
  align-items: center;
  gap: 0.7cqi;
  min-height: 4.6cqi;
}

.esp-back {
  width: 3.6cqi;
  height: 3.6cqi;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #3a3a42;
  border-radius: 12px;
  background: #1a1a1f;
  color: #f4f4f6;
}

.esp-back svg { width: 1.7cqi; height: 1.7cqi; display: block; }

.esp-page-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12cqi;
}

.esp-page-titles b {
  color: #fff;
  font-size: 1.9cqi;
  font-weight: 700;
  line-height: 1.1;
}

.esp-page-titles span {
  color: #8d8d94;
  font-size: 1.25cqi;
  font-weight: 600;
}

.esp-pager,
.esp-live-badge,
.esp-yetkili {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35cqi;
  padding: 0.25cqi 0.55cqi;
  border: 1px solid #3a3a42;
  border-radius: 10px;
  background: #16161b;
  color: #d0d0d4;
  font-size: 1.15cqi;
  font-weight: 700;
}

.esp-pager button {
  width: 2.1cqi;
  height: 2.1cqi;
  padding: 0;
  border: 1px solid #3a3a42;
  border-radius: 7px;
  background: #222228;
  color: #fff;
  font-size: 1.3cqi;
}

.esp-addr-list,
.esp-queue-list,
.esp-info-list,
.esp-toggle-row span { flex: 1; }
.esp-toggle-row em { font-style: normal; color: #8b8b95; font-size: 1.4cqi; font-weight: 600; }
.esp-switch {
  position: relative;
  flex: 0 0 auto;
  width: 5.2cqi;
  height: 2.9cqi;
  border-radius: 99px;
  background: #3a3a42;
  transition: background 0.15s;
}
.esp-switch::after {
  content: "";
  position: absolute;
  top: 0.35cqi;
  left: 0.35cqi;
  width: 2.2cqi;
  height: 2.2cqi;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.esp-switch.is-on { background: #1f9d55; }
.esp-switch.is-on::after { transform: translateX(2.3cqi); }

.esp-menu-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45cqi;
}

.esp-addr-row,
.esp-info-row,
.esp-queue-row,
.esp-menu-list button,
.esp-menu-list p {
  display: flex;
  align-items: center;
  gap: 0.9cqi;
  min-height: 5cqi;
  margin: 0;
  padding: 0.7cqi 1.1cqi;
  font-size: 1.65cqi;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  background: #17171c;
  color: #f4f4f6;
  text-align: left;
}

.esp-addr-row b {
  min-width: 5.4cqi;
  padding: 0.3cqi 0.6cqi;
  border-radius: 8px;
  background: #26262d;
  font-size: 1.7cqi;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.esp-addr-row span { flex: 1; color: #e4e4e8; font-size: 1.7cqi; font-weight: 600; }
.esp-addr-row i { color: #8d8d94; font-size: 2.2cqi; font-style: normal; }

.esp-addr-row.is-on {
  border-color: var(--accent);
  background: linear-gradient(90deg, var(--accent) 0%, #5a1016 42%, #1a1a1f 100%);
  box-shadow: 0 0 12px rgba(227, 6, 19, 0.28);
}

.esp-addr-row.is-on b,
.esp-addr-row.is-on span,
.esp-addr-row.is-on i { color: #fff; }

.esp-addr-row.is-on b { background: rgba(0, 0, 0, 0.25); }

/* Sayfa başına 6 adres: satırlar listeyi eşit paylaşır. */
.esp-addr-list .esp-addr-row { flex: 0 0 calc((100% - 5 * 0.45cqi) / 6); }

.esp-hist-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55cqi;
}

.esp-hist-col {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4cqi;
  padding: 0.45cqi;
  border: 1px solid #2a2a30;
  border-radius: 14px;
  background: #141418;
}

.esp-hist-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0.25cqi 0.3cqi 0.4cqi;
  color: #fff;
  font-size: 1.35cqi;
  font-weight: 700;
}

.esp-hist-title em {
  min-width: 1.8cqi;
  padding: 0.1cqi 0.45cqi;
  border-radius: 8px;
  background: #2a2a30;
  color: #fff;
  font-style: normal;
  text-align: center;
}

.esp-hist-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4cqi;
  padding: 0.45cqi 0.55cqi;
  border-radius: 10px;
  background: #1c1c22;
}

.esp-hist-card b,
.esp-hist-card small { display: block; }
.esp-hist-card b { font-size: 1.3cqi; }
.esp-hist-card small { color: #9a9aa2; font-size: 1.1cqi; }
.esp-check { color: #1f9d55; font-style: normal; font-weight: 800; }

.esp-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9cqi;
  color: #8d8d94;
  font-size: 1.55cqi;
  font-weight: 600;
}

.esp-empty svg {
  width: 5.6cqi;
  height: 5.6cqi;
  padding: 1.2cqi;
  border-radius: 50%;
  background: #1c1c22;
  color: #6c6c74;
}

.esp-live-badge {
  border-color: #2450c8;
  color: #7eb0ff;
}

.esp-queue-row em {
  width: 2.2cqi;
  height: 2.2cqi;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #2a2a30;
  color: #fff;
  font-style: normal;
  font-weight: 700;
}

.esp-queue-row.is-active { border-color: #2f6bff; box-shadow: inset 0 0 0 1px #2f6bff; }
.esp-queue-row.is-active em { background: #2f6bff; }
.esp-queue-row span { flex: 1; min-width: 0; }
.esp-queue-row b,
.esp-queue-row small { display: block; }
.esp-queue-row small { color: #9a9aa2; font-size: 1.15cqi; }
.esp-queue-row button {
  flex: 0 0 auto;
  padding: 0.35cqi 0.7cqi;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  font-size: 1.2cqi;
  font-weight: 700;
}

.esp-info-row { justify-content: space-between; }
.esp-info-row span { color: #a8a8b0; font-size: 1.6cqi; font-weight: 600; }
.esp-info-row b { color: #fff; font-size: 1.65cqi; }
.esp-info-row b.is-live,
.esp-info-row b.is-wifi { color: #1f9d55; display: inline-flex; align-items: center; gap: 0.4cqi; }
.esp-info-row b.is-out { color: var(--accent); }

.esp-yetkili svg { width: 1.2cqi; height: 1.2cqi; }

.esp-svc-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.7cqi;
}

.esp-svc-grid button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1cqi 1.1cqi;
  border: 1px solid #2a2a30;
  border-radius: 16px;
  background: #1a1a1f;
  color: #fff;
  text-align: left;
}

.esp-entry-name {
  flex: 0 0 auto;
  color: #1f9d55;
  font-size: 1.55cqi;
  font-weight: 700;
}

.esp-nav {
  display: grid;
  flex: 1;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 0.9cqi;
  width: 100%;
}

.esp-nav button,
.esp-keys button,
.esp-list button {
  border: 1px solid #2c2c32;
  border-radius: 14px;
  background: #1c1c22;
  color: #f5f5f5;
  font-size: 1.7cqi;
  font-weight: 650;
}

.esp-nav button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55cqi;
  padding: 1.2cqi 1.3cqi 1.1cqi;
  border: 1px solid #2a2a30;
  border-radius: 16px;
  background: linear-gradient(180deg, #1e1e24 0%, #18181d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  line-height: 1.2;
  text-align: left;
  white-space: normal;
}

.esp-nav-text {
  display: flex;
  flex-direction: column;
  gap: 0.3cqi;
  min-width: 0;
}

.esp-nav-sub {
  color: #8d8d94;
  font-size: 1.3cqi;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esp-nav button.is-on .esp-nav-sub { color: #f2b8bc; }

.esp-ico {
  width: 4.6cqi;
  height: 4.6cqi;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #26262d;
  color: #c4c4cc;
  flex: 0 0 auto;
}

.esp-ico svg {
  width: 62%;
  height: 62%;
  display: block;
}

.esp-nav-label {
  color: #f4f4f6;
  font-size: 1.8cqi;
  font-weight: 700;
}

.esp-nav button.is-on {
  border-color: var(--accent);
  background: radial-gradient(130% 90% at 0% 0%, #4a1519 0%, #1a1a1f 58%);
  box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(227, 6, 19, 0.38);
  color: #fff;
}

.esp-nav button.is-on .esp-ico {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(227, 6, 19, 0.55);
}

.esp-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6cqi;
}

.esp-goal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.esp-goal span { color: #a3a3a3; font-size: 1.8cqi; }
.esp-goal b { font-size: 3.2cqi; letter-spacing: 0.04em; }

.esp-pad {
  width: 50%;
  display: flex;
  flex-direction: column;
  gap: 0.85cqi;
}

.esp-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8cqi;
  min-height: 5.4cqi;
  padding: 0.55cqi 0.9cqi 0.55cqi 1.15cqi;
  border: 1px solid #2a2a30;
  border-radius: 14px;
  background: #0b0b0e;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.55);
}

.esp-entry:has(.esp-entry-num) { border-color: #3a3a44; }

.esp-entry-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15cqi;
}

.esp-entry-ph {
  color: #8e8e96;
  font-size: 1.85cqi;
  font-weight: 600;
}

.esp-entry-num {
  color: #fff;
  font-size: 2.5cqi;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.esp-entry-sub {
  color: #c8c8cc;
  font-size: 1.35cqi;
  font-weight: 600;
}

.esp-entry-sub.is-err { color: var(--accent); }

.esp-entry-id {
  flex: 0 0 auto;
  padding: 0.25cqi 0.7cqi;
  border: 1px solid #3a3a42;
  border-radius: 8px;
  color: #d0d0d4;
  font-size: 1.25cqi;
  font-weight: 700;
}

.esp-mini {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 4.4cqi;
  padding: 0.25cqi 0.5cqi;
  border: 1px solid #333;
  border-radius: 6px;
  background: #161616;
  color: #f5f5f5;
  text-align: right;
}

.esp-mini-num {
  min-height: 2.2cqi;
  font-size: 2.4cqi;
  font-weight: 700;
}

.esp-mini-addr {
  min-height: 1.8cqi;
  color: #c8c8c8;
  font-size: 1.7cqi;
  font-weight: 600;
}

.esp-keys {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7cqi;
}

.esp-keys button {
  font-size: 3.15cqi;
  font-weight: 650;
  padding: 0.2cqi;
  border-radius: 16px;
  background: linear-gradient(180deg, #222229 0%, #1a1a20 100%);
  border: 1px solid #2c2c34;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 0 rgba(0, 0, 0, 0.35);
  color: #f7f7f8;
  font-variant-numeric: tabular-nums;
}

.esp-lcd button {
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.esp-lcd button:active {
  transform: scale(0.96);
  filter: brightness(1.25);
}

.esp-keys button:active { box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5); }

.esp-keys button.is-clear { color: var(--accent); }

.esp-keys button.is-ok {
  background: linear-gradient(180deg, #f0202c 0%, var(--accent) 60%, #c40511 100%);
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 18px rgba(227, 6, 19, 0.42);
  letter-spacing: 0.04em;
}

.esp-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45cqi;
}

.esp-list p,
.esp-list button {
  margin: 0;
  padding: 0.45cqi 0.7cqi;
  text-align: left;
  font-size: 1.7cqi;
}

.esp-list button[data-view="home"],
.esp-menu-name {
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(#3a1618, #241012);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.esp-menu-name {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.45cqi 0.7cqi;
  font-size: 1.7cqi;
  pointer-events: none;
}

.esp-pass-line {
  min-height: 4.2cqi;
  margin: 0;
  padding: 0.55cqi 0.8cqi;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  background: #141414;
  color: #fff;
  font-size: 2.4cqi;
  letter-spacing: 0.4cqi;
  text-align: center;
}

.esp-lock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1cqi;
  border: 1px solid #2a2a30;
  border-radius: 16px;
  background: radial-gradient(90% 70% at 50% 30%, #1d1d23 0%, #141418 100%);
}

.esp-lock-ico {
  display: grid;
  place-items: center;
  width: 6.4cqi;
  height: 6.4cqi;
  border-radius: 50%;
  background: rgba(227, 6, 19, 0.14);
  color: #ff4d58;
}

.esp-lock-ico svg { width: 55%; height: 55%; }

.esp-lock b { font-size: 2cqi; }

.esp-lock span { color: #8d8d94; font-size: 1.35cqi; font-weight: 600; }

.esp-lock .esp-pass-line {
  min-width: 55%;
  border-color: #33333b;
  background: #0b0b0e;
  color: #c8c8ce;
}

.esp-lock.is-err .esp-pass-line { border-color: var(--accent); }

.esp-lock .esp-pass-err { color: var(--accent); font-size: 1.45cqi; font-weight: 700; }

.esp-list .esp-pass-err {
  margin: 0;
  padding: 0.2cqi 0.4cqi;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.esp-svc-wrap {
  min-height: 0;
  overflow: hidden;
}

.esp-nav.esp-svc {
  grid-template-rows: 1fr 1fr;
  min-height: 0;
}

.esp-list .esp-nav.esp-svc button {
  padding: 0.7cqi 0.8cqi;
  text-align: center;
}

.esp-list button.esp-svc-back {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(#3a1618, #241012);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.esp-hist {
  min-height: 0;
  overflow: hidden;
}

.esp-list span { display: block; color: #a3a3a3; font-size: 1.4cqi; }

.esp-eta {
  margin: 0.35cqi 0 0.15cqi;
  min-width: 12cqi;
  padding: 0.35cqi 1.4cqi;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #141414;
  color: #f5f5f5;
  font-size: 2.2cqi;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.esp-line-state {
  margin: 0;
  padding: 0.55cqi 1.6cqi 0.8cqi;
  border-top: 1px solid var(--accent);
  font-size: 2cqi;
  font-weight: 700;
}

.esp-line-state.is-ready {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7cqi;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 0.85cqi 1.2cqi;
  background: #0e2418;
  color: #1f9d55;
  font-size: 1.7cqi;
  letter-spacing: 0.08em;
}

.esp-line-state.is-ready::before,
.esp-line-state.is-ready::after {
  content: none;
  display: none;
}

.esp-status-dot {
  width: 0.72cqi;
  height: 0.72cqi;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex: 0 0 auto;
}

.esp-ready-box {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.esp-line-state.is-ready.is-arizali { background: #2a1012; color: var(--accent); }
.esp-line-state.is-ready.is-bakimda { background: #2a2408; color: #e6c200; }
.esp-line-state.is-ready.is-kullanidis { background: #1b1230; color: #7a3ff2; }
.esp-line-state.is-ready.is-mesgul { background: #3a2410; color: #f07800; }
.esp-line-state.is-busy,
.esp-line-state.is-fault { color: var(--accent); }
.esp-line-state.is-maint { color: #e39b2b; }
.esp-line-state.is-off { color: #8a8a8a; }
.esp-line-state.is-metro {
  padding-top: 0.4cqi;
  padding-bottom: 0.5cqi;
}

.esp-line-state.is-metro .esp-metro-track { min-height: 11cqi; }

.esp-stop.is-diverter.is-wait .esp-dot {
  background: transparent;
}

.esp-stop b,
.esp-stop span { display: block; }

.esp-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: 2.4cqi;
}

.esp-line span { color: #a3a3a3; }

.esp-line b { font-size: 3.4cqi; letter-spacing: 0.04em; }

.esp-lcd select {
  min-width: 0;
  width: 58%;
  height: auto;
  font-size: 2.2cqi;
  padding: 0.6cqi 1cqi;
}

#esp-send {
  align-self: flex-start;
  min-width: 28%;
  border: 0;
  border-radius: 8px;
  padding: 1.1cqi 2.4cqi;
  background: var(--accent);
  color: #fff;
  font-size: 2.6cqi;
  font-weight: 700;
}

#esp-send:disabled {
  background: #3a3a3a;
  color: #8a8a8a;
  cursor: default;
}

.esp-reason {
  margin: 0;
  color: var(--accent);
  font-size: 2.1cqi;
}

.esp-lcd.is-shipping .esp-nav button {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7cqi;
  padding: 0.65cqi 0.85cqi;
}

.esp-lcd.is-shipping .esp-ico {
  width: 2.7cqi;
  height: 2.7cqi;
  border-radius: 8px;
}

.esp-lcd.is-shipping .esp-nav-label { font-size: 1.45cqi; }

.esp-metro {
  display: flex;
  flex-direction: column;
  gap: 0.35cqi;
  margin: 0;
  padding: 0.55cqi 0.7cqi 0.45cqi;
  border: 1px solid #2a2a32;
  border-radius: 14px;
  background: #141418;
  overflow: hidden;
}

.esp-run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6cqi;
}

.esp-run-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4cqi;
  color: #6eb0ff;
  font-size: 1.25cqi;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.esp-run-live i {
  width: 0.55cqi;
  height: 0.55cqi;
  border-radius: 50%;
  background: #3d7dff;
}

.esp-eta {
  display: inline-flex;
  align-items: center;
  gap: 0.35cqi;
  margin: 0;
  min-width: 0;
  padding: 0.22cqi 0.7cqi;
  border: 1px solid #35507a;
  border-radius: 999px;
  background: #1a2436;
  color: #d7e6ff;
  font-size: 1.25cqi;
  font-weight: 700;
}

.esp-eta i {
  width: 0.9cqi;
  height: 0.9cqi;
  border: 0.16cqi solid currentColor;
  border-radius: 50%;
}

.esp-metro.is-empty {
  color: #a3a3a3;
  font-size: 2.2cqi;
  font-weight: 700;
}

.esp-metro-track {
  position: relative;
  width: 100%;
  min-width: 100%;
  min-height: 7.4cqi;
}

.esp-rail {
  position: absolute;
  top: 1.55cqi;
  height: 0.28cqi;
  border-radius: 99px;
  background: #4a4a52;
  transform: translateY(-50%);
}

.esp-rail-done {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #3d7dff;
  transition: width 0.2s linear;
}

.esp-tube {
  position: absolute;
  top: 1.55cqi;
  z-index: 2;
  width: 2.1cqi;
  height: 1.15cqi;
  margin-left: -1.05cqi;
  border: 0.16cqi solid #fff;
  border-radius: 0.35cqi;
  background: var(--accent);
  transform: translateY(-50%);
  transition: left 0.2s linear;
}

.esp-stops {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1cqi;
}

.esp-stop {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  color: #d0d0d6;
  text-align: center;
}

.esp-cap {
  min-height: 1.15cqi;
  color: #8d8d94;
  font-size: 0.95cqi;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.esp-dot {
  width: 1.35cqi;
  height: 1.35cqi;
  box-sizing: border-box;
  border: 0.16cqi solid #8a8a92;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 0.85cqi;
  line-height: 1.35cqi;
  text-align: center;
}

.esp-stop b {
  margin-top: 0.35cqi;
  font-size: 1.2cqi;
  letter-spacing: 0.02em;
}

.esp-stop small {
  display: block;
  color: #9a9aa2;
  font-size: 1cqi;
}

.esp-stop.is-done .esp-dot,
.esp-stop.is-dest .esp-dot {
  border-color: #3d7dff;
  background: #3d7dff;
}

.esp-stop.is-done .esp-dot::after { content: "✓"; }

.esp-stop.is-diverter.is-wait .esp-dot {
  width: 0.95cqi;
  height: 0.95cqi;
  border-radius: 0.12cqi;
  transform: rotate(45deg);
}

.esp-status {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding-top: 1.6cqi;
  border-top: 1px solid #2a2a2a;
  color: #a3a3a3;
  font-size: 2.2cqi;
}

.esp-status span {
  color: #f5f5f5;
  font-weight: 700;
}

.screen-sim {
  position: fixed;
  left: -16000px;
  top: 0;
  width: 1280px;
  height: 800px;
  overflow: hidden;
  pointer-events: none;
}

.screen-sim .panel-stage {
  height: 800px;
  min-height: 800px;
}

.fault-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fault-list li {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--header);
}

.settings-page {
  display: grid;
  gap: 16px;
  max-width: 720px;
}

.settings-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.settings-head {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-head h2 { margin: 0; font-size: 16px; }

.settings-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.settings-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: rgba(63, 182, 255, 0.14);
  color: #5cc2ff;
}

.settings-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
  font-size: 13px;
  font-weight: 600;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-row .settings-field { max-width: none; }

.settings-field select,
.settings-unit input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.settings-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-unit input { width: 100%; }

.settings-unit span {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.settings-save {
  height: 36px;
  margin-top: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.settings-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

.settings-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.settings-card .empty-state { margin: 8px 0 0; max-width: none; }

.fault-list time {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.esp-svc-wrap > button,
.esp-svc-wrap > .esp-menu-name { flex: 0 0 auto; }

.esp-choice {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9cqi;
  min-height: 0;
}

.esp-list .esp-choice button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  background: linear-gradient(#2a2a2a, #161616);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  font-size: 2cqi;
}

.esp-list .esp-choice button.is-on {
  border-color: var(--accent);
  background: linear-gradient(#3a1618, #241012);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: #fff;
}

.esp-gate { min-height: 0; }

.esp-gate-cards {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55cqi;
}

.esp-gate-cards button {
  flex: 0 0 auto;
  min-height: 5.4cqi;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  background: linear-gradient(#2a2a2a, #161616);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: #f5f5f5;
  font-size: 2.1cqi;
  font-weight: 700;
  text-align: center;
}

.esp-gate-empty {
  margin: 0;
  color: #a3a3a3;
  font-size: 1.7cqi;
  font-weight: 700;
  text-align: center;
}

.esp-gate-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45cqi;
}

.esp-gate-tools button,
.esp-gate-back {
  min-height: 3.5cqi;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  background: #1c1c1c;
  color: #f5f5f5;
  font-size: 1.6cqi;
  font-weight: 700;
}

.esp-gate-back {
  border-color: var(--accent);
  background: linear-gradient(#3a1618, #241012);
}

.esp-gate-err,
.esp-mini-addr.esp-mini-err {
  color: var(--accent);
  font-weight: 700;
}

.esp-gate-err {
  margin: 0;
  font-size: 1.6cqi;
  text-align: center;
}

.esp-user-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.55cqi;
  padding: 1cqi 1.2cqi 0.8cqi;
  background: #0e0e0e;
  color: #f5f5f5;
}

.esp-user-head {
  display: flex;
  align-items: stretch;
  gap: 0.6cqi;
}

.esp-user-head .esp-menu-name { flex: 1; }

.esp-user-layer .esp-svc-back {
  flex: 0 0 auto;
  min-width: 12cqi;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(#3a1618, #241012);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: #fff;
  font-size: 1.6cqi;
  font-weight: 700;
  text-align: center;
}

.esp-user-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6cqi;
}

.esp-user-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15cqi;
  min-height: 6.4cqi;
  padding: 0.45cqi 0.7cqi;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  background: #161616;
  color: #f5f5f5;
  text-align: left;
}

.esp-user-field span {
  color: #a3a3a3;
  font-size: 1.45cqi;
  font-weight: 700;
}

.esp-user-field b {
  min-height: 2.3cqi;
  font-size: 2.2cqi;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.esp-user-field.is-on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.esp-user-msg {
  margin: 0;
  color: var(--accent);
  font-size: 1.5cqi;
  font-weight: 700;
  text-align: center;
}

.esp-letter-keys {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35cqi;
}

.esp-letter-row {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 0.3cqi;
}

.esp-letter-keys button,
.esp-user-actions button {
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: linear-gradient(#2a2a2a, #161616);
  color: #f5f5f5;
  font-size: 1.7cqi;
  font-weight: 700;
  padding: 0;
}

.esp-user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 0.4cqi;
  min-height: 4.2cqi;
}

.esp-user-actions button.is-ok {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.esp-user-actions button.is-on,
.esp-letter-keys button.is-on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.esp-gate .esp-letter-keys button { font-size: 1.35cqi; }

.ship-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ship-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ship-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ship-filters input {
  height: 36px;
  min-width: 180px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.ship-filters input:focus {
  outline: none;
  border-color: var(--accent);
}

.ship-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.ship-table {
  width: 100%;
  border-collapse: collapse;
}

.ship-table th,
.ship-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}

.ship-table th {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  border-bottom: 1px solid var(--accent);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.ship-empty {
  padding: 0 !important;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.user-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-modes button,
.user-form button,
.user-del {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.user-modes button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.user-modes button.is-on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.user-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-form input,
.user-form select,
.user-admin select {
  height: 36px;
  min-width: 180px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.user-form input:focus,
.user-form select:focus,
.user-admin select:focus {
  outline: none;
  border-color: var(--accent);
}

.user-form button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.user-del {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
}

.user-msg {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.user-msg.is-ok { color: #1f9d55; }

@media (max-width: 980px) {
  .device-card {
    width: min(338px, calc((100vw - 56px - 3 * var(--device-gap) - 16px) / 4));
  }

  .menu-btn { display: inline-flex; }

  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    height: auto;
    transform: translateX(-105%);
    transition: transform 0.22s var(--ease);
  }

  .sidebar.open { transform: none; box-shadow: var(--shadow); }

  .topbar { padding-inline: 12px; }

  .content { padding: 16px; }
}

@media (max-width: 560px) {
  .user-name,
  .user-btn .chev,
  .top-divider { display: none; }

  .user-btn { padding: 0 3px; }

  .settings-row { grid-template-columns: 1fr; }
}

.screen-lock {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
}

.screen-lock[hidden] { display: none !important; }

.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(60% 50% at 50% 0%, var(--accent-soft) 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  padding: 32px 28px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.login-brand img { width: 190px; height: auto; display: block; }

.login-brand span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.login-card h1 { margin: 0 0 4px; font-size: 20px; }

.login-card .login-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.login-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.login-card .field input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
}

.login-card .field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.login-card .primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.login-card .primary-btn:disabled { opacity: 0.6; }

.login-card .form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.login-foot {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.login-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(920px, 100%);
}

.osk {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 320;
  width: auto;
  margin: 0;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.28);
}

.osk-keys {
  width: min(980px, 100%);
  margin: 0 auto;
}

.osk[hidden] { display: none !important; }

.osk-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.osk-key {
  min-width: 48px;
  height: 52px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--header);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 650;
}

.osk-key-wide { min-width: 84px; font-size: 15px; }

.osk-key-space { flex: 1; max-width: 420px; }

.osk-key.is-on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.esp-boot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.4cqi;
  min-height: 0;
}

.esp-boot img {
  width: 46%;
  height: auto;
}

.esp-boot p {
  margin: 0;
  color: #d0d0d4;
  font-size: 2cqi;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.esp-boot-track {
  width: 46%;
  height: 1.15cqi;
  border-radius: 99px;
  background: #2a2a30;
  overflow: hidden;
}

.esp-boot-track i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.esp-info-row[data-hold-id] {
  cursor: pointer;
}

#param-card {
  width: 100%;
}

/* Santral cihazı hatta göremiyor (H/L/GND). */
.device-badge.is-offline .device-tag,
.device-badge.is-offline .device-id {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.device-offline {
  display: block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
}

/* Sunucuda santralden 15 sn'dir haber yok. */
.santral-alert {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 900;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: #2a1012;
  color: #ffd9dc;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.santral-alert::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.santral-alert b { color: #fff; }

/* İstasyon ilk açılış / ID ekranı: ortalı sütun (firmware ui.c show_intro ile aynı ölçüler) */
.esp-body.esp-intro {
  align-items: center;
  justify-content: center;
}

.esp-intro-col {
  width: 52cqi;
  display: flex;
  flex-direction: column;
  gap: 1.2cqi;
}

.esp-intro-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4cqi;
}

.esp-intro-head b {
  color: #fff;
  font-size: 1.9cqi;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.esp-intro-head .esp-back {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  padding: 0 1cqi;
}

.esp-intro-col .esp-pad { width: 100%; }
.esp-intro-col .esp-keys { grid-auto-rows: 6.6cqi; }

/* Cihazlar sayfası: santralin hattında görülen kartlar */
.bus-cards {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.bus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.bus-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 16px;
}

.bus-head h2 em {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--hover);
  font-size: 12px;
  font-style: normal;
}

.bus-head p { margin: 0; color: var(--muted); font-size: 13px; }
.bus-head p b { color: #f0a000; }

.bus-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bus-state i,
.bus-dot i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.bus-state.is-live { color: #1f9d55; }
.bus-state.is-live i,
.bus-dot.is-on i { background: #1f9d55; box-shadow: 0 0 6px #1f9d55; }

.bus-empty { margin: 8px 0 0; color: var(--muted); }

.bus-table-wrap { overflow-x: auto; }

.bus-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bus-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.bus-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.bus-table tr.is-new td { background: rgba(240, 160, 0, 0.07); }

/* Ekranı açılabilen satır (istasyon) */
.bus-table tr.is-pick { cursor: pointer; }
.bus-table tr.is-pick:hover td { background: var(--hover); }
.bus-table tr.is-on td { background: var(--accent-soft); }
.bus-table tr.is-on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.bus-where { display: inline-flex; align-items: center; gap: 8px; }
.bus-where b {
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  text-align: center;
}
.bus-table tr.is-on .bus-where b { background: var(--accent); color: #fff; }

.bus-uid { font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: 0.04em; }

.bus-id {
  display: inline-block;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--hover);
  text-align: center;
}

.bus-new {
  padding: 2px 8px;
  border: 1px solid #f0a000;
  border-radius: 8px;
  color: #f0a000;
  font-size: 12px;
  font-weight: 700;
}

.bus-wait { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.bus-dot { display: inline-flex; align-items: center; gap: 6px; }

.bus-assign { display: flex; gap: 6px; }

.bus-assign input {
  width: 70px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.bus-assign button,
.bus-identify {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hover);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
}

.bus-identify {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.bus-identify:disabled { opacity: 0.4; cursor: not-allowed; }

.bus-soft { min-width: 150px; }
.bus-ver { display: inline-block; min-width: 30px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bus-update {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid #1f9d55;
  border-radius: 8px;
  background: transparent;
  color: #1f9d55;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.bus-update:disabled { opacity: 0.4; cursor: not-allowed; }

.bus-ota {
  position: relative;
  display: inline-block;
  width: 130px;
  height: 20px;
  margin-left: 8px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--hover);
  vertical-align: middle;
}

.bus-ota i { position: absolute; inset: 0 auto 0 0; background: #1f9d55; }
.bus-ota b { position: relative; display: block; font-size: 11px; line-height: 20px; text-align: center; color: #fff; }
.bus-ota-done { margin-left: 8px; color: #1f9d55; font-weight: 700; }
.bus-ota-err { display: block; margin-top: 3px; color: var(--accent); font-weight: 700; white-space: normal; }

/* ---------- Ayarlar: ekran koruyucu ve yönlendirme ---------- */
.settings-ico.is-saver { background: rgba(160, 120, 255, 0.14); color: #b08cff; }
.settings-ico.is-route { background: rgba(227, 6, 19, 0.14); color: #ff4d58; }
.settings-unit .settings-save { margin-top: 0; height: 40px; }
.settings-field input[type="time"] {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  color-scheme: dark light;
}

.route-form { display: grid; gap: 14px; }
.route-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}
.route-pair .settings-field { max-width: none; }
.route-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 40px;
  color: var(--accent);
}
.route-arrow svg, .route-to svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.route-days { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.route-day {
  min-width: 46px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.route-day.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.route-quick { display: flex; flex-basis: 100%; gap: 6px; margin-top: 2px; }
.route-quick button {
  height: 30px;
  padding: 0 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.route-quick button:hover { color: var(--ink); border-color: var(--ink); }
.route-times { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.route-times .settings-field { max-width: 150px; }
.route-dash { padding-bottom: 10px; color: var(--muted); font-weight: 700; }
.route-add { margin: 0 0 0 auto; height: 40px; padding: 0 18px; }
.route-empty { margin: 16px 0 0; color: var(--muted); font-size: 13px; }

.route-groups { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.route-list-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; }
.route-list-title em {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--hover);
  font-size: 12px;
  font-style: normal;
}
.route-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
}
.route-group header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.route-group header b,
.route-to b {
  min-width: 40px;
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  text-align: center;
}
.route-rule {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.route-rule + .route-rule { border-top: 1px solid var(--line); }
.route-rule.is-live { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.route-when { display: flex; flex-direction: column; gap: 2px; }
.route-when small { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.route-to { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.route-to svg { flex: none; color: var(--accent); }
.route-to b { background: var(--accent); color: #fff; }
.route-live {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.route-rule > .route-live:only-of-type { grid-column: 3; }
.route-del {
  grid-column: 4;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent-ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.route-del:hover { border-color: var(--accent); }

@media (max-width: 640px) {
  .route-pair { grid-template-columns: minmax(0, 1fr); }
  .route-arrow { transform: rotate(90deg); justify-self: center; height: 24px; }
  .route-rule { grid-template-columns: minmax(0, 1fr) auto; }
  .route-to { grid-column: 1 / -1; grid-row: 2; }
  .route-del { grid-column: 2; grid-row: 1; }
}

/* ---------- Bekleyen Gönderimler ---------- */
.pend-head { margin-bottom: 14px; }
.pend-head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 16px; }
.pend-head h2 em {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-style: normal;
}
.pend-head p { margin: 0; color: var(--muted); font-size: 13px; }
.pend-table td small { color: var(--muted); font-size: 12px; }
.pend-table tr.is-run td { background: rgba(240, 120, 0, 0.08); }
.pend-no { width: 48px; font-weight: 700; color: var(--muted); }
.pend-prio {
  display: inline-block;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 7px;
  background: var(--hover);
  text-align: center;
}
.pend-prio.is-high { background: var(--accent); color: #fff; }
.pend-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.pend-state.is-run { color: #f08a1c; }
.pend-state.is-run i { width: 8px; height: 8px; border-radius: 50%; background: #f08a1c; box-shadow: 0 0 6px #f08a1c; }
.pend-at { margin-left: 4px; }
.pend-cancel {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent-ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Gönderim listesi: tarih kısayolları */
.ship-filters input[type="date"] { min-width: 150px; color-scheme: dark light; }
.ship-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 4px; }
.ship-quick button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.ship-quick button.is-on { border-color: var(--accent); background: var(--accent); color: #fff; }
.ship-count { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 700; }

/* Bağlantı yok: etiket kutunun üstünde (diverterdaki gibi), kırmızı çerçeve yanıp söner. */
.device-badge.is-side .device-offline {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin: 0 0 4px;
  transform: translateX(-50%);
}

.device-badge.is-offline .device-tag,
.device-badge.is-offline .device-id {
  animation: device-offline-blink 1s steps(1, end) infinite;
}

@keyframes device-offline-blink {
  0% { outline-color: var(--accent); }
  50% { outline-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .device-badge.is-offline .device-tag,
  .device-badge.is-offline .device-id { animation: none; }
}
