/* Renkler rootnix.com.tr paletinden: neon yeşil #39FF14, yeşil tonlu koyu zemin, sarı, kırmızı ve turuncu. */
:root {
  color-scheme: light dark;
  --neon: #39ff14;
  --bg: #f1f7f0;
  --surface: #ffffff;
  --sidebar: #080b08;
  --sidebar-text: #8a9e8a;
  --sidebar-active: rgb(57 255 20 / 0.14);
  --text: #0f1a0f;
  --muted: #5b6e5b;
  --border: #d5e3d3;
  --accent: #157a06;
  --accent-text: #ffffff;
  --accent-glow: 0 0 0 transparent;
  --good: #137a08;
  --good-bg: #dff7d9;
  --warn: #8a5a00;
  --warn-bg: #fff3c4;
  --bad: #c42b21;
  --bad-bg: #ffe3e0;
  --orange: #c4500a;
  --orange-bg: #ffe8d9;
  --chip-bg: #e8f0e7;
  --chip-text: #3d523d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b08;
    --surface: #0f160f;
    --sidebar: #0d120d;
    --text: #e8f0e8;
    --muted: #8a9e8a;
    --border: rgb(57 255 20 / 0.15);
    --accent: #39ff14;
    --accent-text: #061a03;
    --accent-glow: 0 0 18px rgb(57 255 20 / 0.35);
    --good: #39ff14;
    --good-bg: rgb(57 255 20 / 0.14);
    --warn: #ffd60a;
    --warn-bg: rgb(255 214 10 / 0.14);
    --bad: #ff453a;
    --bad-bg: rgb(255 69 58 / 0.16);
    --orange: #ff6b1a;
    --orange-bg: rgb(255 107 26 / 0.16);
    --chip-bg: rgb(255 255 255 / 0.07);
    --chip-text: #c3d3c3;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: break-word; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
p { margin: 0 0 8px; }

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

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { color: #fff; padding: 0 10px; flex-direction: column; gap: 8px; text-align: center; }
.sidebar .brand-logo { width: 72px; height: 72px; border-radius: 12px; }
.sidebar .portal-customer { text-align: center; margin-top: -10px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { color: var(--sidebar-text); padding: 7px 10px; border-radius: 6px; }
.sidebar { border-right: 1px solid rgb(57 255 20 / 0.12); }
.sidebar nav a:hover { background: rgb(57 255 20 / 0.07); color: #e8f0e8; text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active); color: var(--neon); font-weight: 600; box-shadow: inset 2px 0 0 var(--neon); }
.logout { padding: 0 10px; }
.logout .link { color: var(--sidebar-text); font-size: 12.5px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.brand:hover { text-decoration: none; }
/* İzleyici kutuları: renk durumu taşır, durum adı da kutunun içinde yazılıdır. */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-toggle a { padding: 6px 12px; color: var(--muted); font-weight: 550; font-size: 13px; }
.view-toggle a:hover { color: var(--text); text-decoration: none; }
.view-toggle a.active { background: var(--accent); color: var(--accent-text); }
.sensor-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 22px; }
.sensor-count { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.sensor-count strong { color: var(--text); font-variant-numeric: tabular-nums; }
.sensor-count .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip-text); }
.sensor-count.down .dot { background: var(--bad); }
.sensor-count.warn .dot { background: var(--warn); }
.sensor-count.up .dot { background: var(--good); }
.sensor-group .section-head h2 { display: flex; align-items: baseline; gap: 8px; }
.sensors { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.sensor {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--chip-text);
  background: var(--surface);
  color: var(--text);
}
.sensor:hover { text-decoration: none; outline: 1px solid var(--accent); }
.sensor.up { border-left-color: var(--good); }
.sensor.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.sensor.down {
  border-color: var(--bad);
  border-left-color: var(--bad);
  background: var(--bad-bg);
  box-shadow: 0 0 14px rgb(255 69 58 / 0.3);
}
.sensor.idle { opacity: 0.7; }
.sensor-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sensor-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensor-state { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; color: var(--muted); }
.sensor.up .sensor-state { color: var(--good); }
.sensor.warn .sensor-state { color: var(--warn); }
.sensor.down .sensor-state { color: var(--bad); }
.sensor-customer { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensor-target { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensor-error { font-size: 12px; color: var(--bad); font-weight: 600; }
.sensor-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.sensor-metrics span { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.sensor-metrics strong { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sensor-metrics small { font-size: 11px; font-weight: 500; color: var(--muted); }

/* Destek talepleri ve portal */
.nav-badge {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}
.thread { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.message { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); max-width: 88%; }
.message.mine { align-self: flex-end; border-color: var(--accent); background: var(--good-bg); }
.message-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.message-meta strong { color: var(--text); }
.reply-form { max-width: 860px; }
.service-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.service-state .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip-text); }
.service-state.up { color: var(--good); }
.service-state.up .dot { background: var(--good); }
.service-state.warn { color: var(--warn); }
.service-state.warn .dot { background: var(--warn); }
.service-state.down { color: var(--bad); }
.service-state.down .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.service-table tr.service-down td { background: var(--bad-bg); }
.service-table tr.service-down td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.service-table tr.service-warn td { background: var(--warn-bg); }
.portal-customer { color: #e8f0e8; font-weight: 600; padding: 0 10px; margin-top: -8px; font-size: 13px; }
.portal-open-tickets { margin-bottom: 18px; }
.portal-open-tickets ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

.brand-logo { width: 44px; height: 44px; border-radius: 8px; flex: none; }
.brand em { font-style: normal; color: var(--neon); }
.login-logo { width: 112px; height: auto; align-self: center; border-radius: 14px; }
.login-brand { justify-content: center; margin-top: -4px; }
.login-brand em { color: var(--accent); }

/* Grafik renkleri: doğrulanmış 8'li kategorik palet; koyu temada aynı tonların koyu yüzeye göre adımları. */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  .charts {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
.chart-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-filter label { font-weight: 600; }
.chart-filter .combobox, .chart-filter > select { flex: 0 1 300px; min-width: 220px; }
.donut { margin: 0; }
.donut figcaption h2 { margin-bottom: 12px; }
.donut-body { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut svg { width: 180px; height: 180px; flex: none; }
.donut .slice { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; transition: opacity 0.15s; }
.donut a:hover .slice, .donut a:focus-visible .slice { opacity: 0.8; }
.donut-empty { fill: none; stroke: var(--chip-bg); stroke-width: 36; }
.donut-total { text-anchor: middle; font-size: 30px; font-weight: 700; fill: var(--text); }
.donut-unit { text-anchor: middle; font-size: 13px; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 180px; display: grid; gap: 2px; }
.donut-legend a {
  display: grid;
  grid-template-columns: 12px 1fr auto 52px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
}
.donut-legend a:hover { background: var(--chip-bg); text-decoration: none; }
.donut-legend .zero a { color: var(--muted); }
.legend-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.legend-pct { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; }
.swatch { width: 12px; height: 12px; border-radius: 3px; }
.slice.s1, .swatch.s1 { fill: var(--s1); background: var(--s1); }
.slice.s2, .swatch.s2 { fill: var(--s2); background: var(--s2); }
.slice.s3, .swatch.s3 { fill: var(--s3); background: var(--s3); }
.slice.s4, .swatch.s4 { fill: var(--s4); background: var(--s4); }
.slice.s5, .swatch.s5 { fill: var(--s5); background: var(--s5); }
.slice.s6, .swatch.s6 { fill: var(--s6); background: var(--s6); }
.slice.s7, .swatch.s7 { fill: var(--s7); background: var(--s7); }
.slice.s8, .swatch.s8 { fill: var(--s8); background: var(--s8); }

.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 0 3px rgb(57 255 20 / 0.2), 0 0 12px rgb(57 255 20 / 0.6); }

main { padding: 26px 30px 48px; max-width: 1320px; width: 100%; }
main > section, .columns > section { margin-bottom: 26px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .muted { margin: 4px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

.card, .table-wrap, .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.card { padding: 16px 18px; }
.notes { margin-bottom: 22px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.done .task-title { color: var(--muted); text-decoration: line-through; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }
.error-text { color: var(--bad); font-size: 12.5px; margin: 2px 0 0; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--chip-bg);
  color: var(--chip-text);
  vertical-align: 1px;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips a {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.chips a span { color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chips a:hover { border-color: var(--accent); text-decoration: none; }
.chips a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: var(--accent-glow); }
.chips a.active span { color: inherit; opacity: 0.75; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { width: auto; min-width: 180px; }
.filters input { flex: 1 1 240px; width: auto; }

.kind {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--chip-bg);
  color: var(--chip-text);
}
.file-count { font-size: 12px; white-space: nowrap; }

/* Kullanım kılavuzu ve geçici şifre */
.guide { max-width: 860px; line-height: 1.6; }
.guide h3 { font-size: 16px; margin: 22px 0 6px; color: var(--accent); }
.guide h3:first-child { margin-top: 0; }
.guide ul { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.credentials { max-width: 620px; margin-bottom: 16px; }
.temp-password { font-size: 18px; font-weight: 700; letter-spacing: 0.06em; user-select: all; }
@media print {
  .sidebar, .page-head .button, .flash { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .guide { border: 0; max-width: none; }
}

/* Talepler kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban-column { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; min-height: 220px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.kanban-count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.kanban-cards { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 0 0 8px 8px; transition: background 0.15s; }
.kanban-cards.drop-target { background: var(--good-bg); outline: 2px dashed var(--accent); outline-offset: -4px; }
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--chip-text);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
}
.kanban-card.priority-high { border-left-color: var(--bad); }
.kanban-card.priority-normal { border-left-color: var(--accent); }
.kanban-card.dragging { opacity: 0.45; cursor: grabbing; }
.kanban-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.kanban-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.kanban-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kanban-move select { width: auto; padding: 2px 6px; font-size: 12px; }
.kanban-empty { text-align: center; margin: 12px 0; }
.kanban-more { text-align: center; }
.attached-files { margin-top: 18px; }
.attached-files .attachments { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attached-files .attachments li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sort-link { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.sort-link:hover { color: var(--text); text-decoration: none; }
.sort-link.active { color: var(--accent); }
.sort-arrow { font-size: 10px; opacity: 0.55; }
.sort-link.active .sort-arrow { opacity: 1; }
.kind { display: inline-flex; align-items: center; gap: 5px; }
.kind-icon {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chips a { display: inline-flex; align-items: center; gap: 5px; }
.chips a .kind-icon { width: 13px; height: 13px; }
.kind-computer, .kind-server { background: var(--good-bg); color: var(--good); }
.kind-phone, .kind-line { background: var(--warn-bg); color: var(--warn); }
.kind-e_signature, .kind-mobile_signature { background: var(--orange-bg); color: var(--orange); }
.kind-license { background: var(--chip-bg); color: var(--accent); }

.task-title { font-weight: 550; }
.resolution { margin-top: 4px; padding: 4px 8px; border-left: 2px solid var(--good); background: var(--good-bg); border-radius: 0 4px 4px 0; }
.resolution strong { color: var(--good); }
a.complete { font-weight: 600; }

.tabs { display: flex; gap: 4px; margin: -6px 0 20px; border-bottom: 1px solid var(--border); overflow: auto hidden; }
.tabs a {
  padding: 8px 14px;
  color: var(--muted);
  font-weight: 550;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }

.grade {
  display: inline-block;
  min-width: 26px;
  padding: 1px 6px;
  border-radius: 5px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--chip-bg);
  color: var(--chip-text);
}
.grade.good { background: var(--good-bg); color: var(--good); }
.grade.warn { background: var(--warn-bg); color: var(--warn); }
.grade.bad { background: var(--bad-bg); color: var(--bad); }
a.plain, a.plain:hover { color: inherit; text-decoration: none; }
.nowrap { white-space: nowrap; }
.title-code { font-size: inherit; }
.score-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.score-head p { margin: 0; flex: 1 1 260px; }
.score-grade .grade { font-size: 24px; min-width: 52px; padding: 6px 10px; }
.score-grade .muted { font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-text { font-size: 16px; line-height: 31px; }
.stat-of { font-size: 15px; font-weight: 500; color: var(--muted); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-good .stat-value { color: var(--good); }
.stat-warn .stat-value { color: var(--warn); }
.stat-good { border-color: rgb(57 255 20 / 0.35); }
.stat-warn { border-color: var(--warn); }
.stat-bad { border-color: var(--bad); box-shadow: 0 0 16px rgb(255 69 58 / 0.25); }
.stat-bad .stat-value { color: var(--bad); }

.strip { display: flex; gap: 2px; height: 34px; }
.strip span { flex: 1 1 0; max-width: 14px; min-width: 2px; border-radius: 2px; background: var(--good); }
.strip span.fail { background: var(--bad); }

.button {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
.button:hover { border-color: var(--muted); text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: var(--accent-glow); }
.button.primary:hover { filter: brightness(1.08); }
.button:not(.primary):hover { border-color: var(--accent); color: var(--accent); }
.button.danger { color: var(--bad); }
.button.small { padding: 3px 10px; font-size: 12.5px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--bad); }
.row-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; font-size: 12.5px; }
.page-head .row-actions { font-size: 14px; }
:is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.flash { padding: 9px 13px; border-radius: 6px; margin-bottom: 16px; background: var(--good-bg); color: var(--good); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash a { color: inherit; text-decoration: underline; }

.form { max-width: 620px; display: flex; flex-direction: column; gap: 14px; }
.field label:not(.check), .login-card label { display: block; font-weight: 550; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; }
input:not([type="checkbox"]), select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.has-error :is(input, select, textarea) { border-color: var(--bad); }
.field-link { display: inline-block; margin-top: 4px; }

.combobox { position: relative; }
.combobox input { padding-right: 30px; }
.combobox::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  pointer-events: none;
}
.combobox select {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.combobox ul {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
}
.combobox li { padding: 6px 9px; border-radius: 4px; cursor: pointer; }
.combobox li:hover, .combobox li.active { background: var(--chip-bg); }
.combobox li[aria-selected="true"] { font-weight: 600; }
.combobox li.combobox-empty { color: var(--muted); cursor: default; background: none; }
.help { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.req { color: var(--bad); }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 12px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login-card .flash { margin: 0; }
.login-card input { margin-top: 4px; }
.login-card .button { width: 100%; }

@media (max-width: 1000px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px; gap: 10px; }
  .sidebar .brand, .logout { padding: 0; }
  .sidebar .brand-logo { width: 52px; height: 52px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
  .sidebar nav a { white-space: nowrap; }
  main { padding: 18px 16px 36px; }
}

.editor { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.editor:focus-within { border-color: var(--accent); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); }
.editor-toolbar button {
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.editor-toolbar button:hover { background: var(--chip-bg); }
.editor-toolbar button:first-child { font-weight: 700; }
.editor-toolbar button:nth-child(2) { font-style: italic; }
.editor-toolbar button:nth-child(3) { text-decoration: underline; }
.editor-area { min-height: 140px; max-height: 480px; overflow-y: auto; padding: 8px 10px; outline: none; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor-status { margin: 0; padding: 0 10px 6px; font-size: 12.5px; color: var(--muted); }
.editor-status:empty { display: none; }
.editor-area img, .message-body.rich img { max-width: 100%; height: auto; border-radius: 4px; }
.message-body.rich p, .editor-area p { margin: 0 0 6px; }
.message-body.rich blockquote, .editor-area blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.message-body.rich ul, .message-body.rich ol { margin: 4px 0; padding-left: 22px; }
.attachments { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--border); display: grid; gap: 3px; font-size: 13px; }
.attachments a::before { content: "📎 "; }
.close-panel { max-width: 860px; margin-top: 14px; }
.close-panel summary { cursor: pointer; font-weight: 600; }
.close-panel[open] summary { margin-bottom: 10px; }

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

/* Telefon görünümü. Tablolar app.js'in eklediği başlık etiketleriyle (data-label) kart listesine döner;
   betik çalışmazsa tablo yatay kaydırmayla kullanılmaya devam eder. */
@media (max-width: 640px) {
  h1 { font-size: 19px; }
  main { padding: 14px 12px 32px; }
  .page-head { margin-bottom: 14px; gap: 10px; }
  .head-actions, .page-head > .button, .tab-toolbar .button { width: 100%; }
  .head-actions .button, .page-head > .button, .tab-toolbar .button { flex: 1; text-align: center; justify-content: center; }
  .button, .chips a, .sidebar nav a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .button.small { min-height: 34px; }
  /* 16 pikselden küçük yazıda iOS odaklanınca sayfayı yakınlaştırır. */
  input:not([type="checkbox"]), select, textarea, .editor-area { font-size: 16px; padding: 9px 10px; }
  input[type="checkbox"] { width: 20px; height: 20px; }
  .card { padding: 14px; }
  .form { max-width: none; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button { flex: 1 1 140px; }
  .filters > * { flex: 1 1 100%; }
  .filters select, .filters input { width: 100%; min-width: 0; }
  .filters .button { flex: 1 1 auto; }
  .stats { gap: 8px; }
  .section-head { flex-wrap: wrap; gap: 6px; }
  .kanban { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .kanban-column { min-height: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: 8px; }

  /* Üst bölüm: logo ve çıkış tek satırda, menü altında yatay kaydırılır. */
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 8px 12px; }
  .sidebar .brand { flex-direction: row; text-align: left; gap: 10px; grid-column: 1; grid-row: 1; }
  .sidebar .brand-logo { width: 36px; height: 36px; border-radius: 8px; }
  .sidebar .logout { grid-column: 2; grid-row: 1; }
  .sidebar .portal-customer { grid-column: 1 / -1; text-align: left; margin: 0; }
  .sidebar nav { grid-column: 1 / -1; margin: 0 -12px; padding: 0 12px; }

  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 3px 0; text-align: left; overflow-wrap: anywhere; }
  table.stack td[data-label] { position: relative; padding-left: 98px; min-height: 26px; }
  table.stack td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 90px; color: var(--muted); font-size: 12px; font-weight: 600; }
  table.stack td.empty { padding: 14px 0; text-align: center; }
  table.stack .row-actions { justify-content: flex-start; flex-wrap: wrap; font-size: 14px; padding-top: 4px; }
}

.otp-input { font-size: 22px !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
