/* WeighStationPro web paneli
   Sade, düz yüzeyli, tek vurgu renkli tasarım. Açık ve koyu tema. */

:root {
    /* Cihaz ekranı (ThemeManager) koyu paleti */
    --bg: #1a1a2e;
    --surface: #1f2940;
    --surface-2: #16213e;
    --line: #2a3f5f;
    --line-soft: #243553;
    --text: #e8e8e8;
    --muted: #a0a0a0;
    --faint: #7b8798;
    --accent: #3282b8;
    --accent-soft: rgba(50, 130, 184, 0.18);
    --ok: #4caf50;
    --ok-soft: rgba(76, 175, 80, 0.16);
    --warn: #ff9800;
    --warn-soft: rgba(255, 152, 0, 0.16);
    --bad: #f44336;
    --bad-soft: rgba(244, 67, 54, 0.16);
    --brand: #6ea60f;
    --radius: 10px;
    --shadow: none;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
    color-scheme: dark;
}

[data-theme="light"] {
    /* Cihaz ekranı (ThemeManager) açık paleti */
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-2: #f8f9fa;
    --line: #d5d8dc;
    --line-soft: #e6e8ec;
    --text: #1a1a2e;
    --muted: #5c6370;
    --faint: #8a909c;
    --accent: #2874a6;
    --accent-soft: rgba(40, 116, 166, 0.12);
    --ok: #27ae60;
    --ok-soft: rgba(39, 174, 96, 0.12);
    --warn: #c77700;
    --warn-soft: rgba(243, 156, 18, 0.16);
    --bad: #e74c3c;
    --bad-soft: rgba(231, 76, 60, 0.12);
    --brand: #6ea60f;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Üst çubuk ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { width: 28px; height: 28px; flex: none; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: 0.1px; white-space: nowrap; }
.brand-by { font-size: 11px; color: var(--faint); letter-spacing: 1.2px; text-transform: uppercase; white-space: nowrap; }

.nav { display: flex; align-items: stretch; gap: 2px; height: 100%; margin-left: 8px; }
.nav a {
    display: flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none;
    font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.device-id {
    font-family: var(--mono); font-size: 12px; color: var(--muted);
    padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2);
}
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13.5px; min-width: 62px; text-align: right; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.seg button {
    background: transparent; border: 0; color: var(--muted); padding: 5px 10px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.seg button.active { background: var(--accent); color: #fff; }
.icon-btn {
    width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.conn {
    display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.conn.is-up { color: var(--ok); }
.conn.is-up .dot { background: var(--ok); }
.conn.is-down { color: var(--warn); }
.conn.is-down .dot { background: var(--warn); }

/* ---------- Sayfa iskeleti ---------- */
.page { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 20px 24px 12px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-content: start; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { font-size: 13px; font-weight: 650; color: var(--text); }
.card-sub { font-size: 12px; color: var(--faint); }

.hero { grid-column: span 5; display: flex; flex-direction: column; }
.last { grid-column: span 3; display: flex; flex-direction: column; }
.kpis { grid-column: span 4; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.chart-card { grid-column: span 8; }
.list-card { grid-column: span 4; }
.status-card { grid-column: span 12; }

/* ---------- Canlı ağırlık ---------- */
.hero-value { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 0; }
.hero-number {
    font-size: clamp(60px, 8vw, 112px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.hero-unit { font-size: clamp(20px, 2.6vw, 32px); color: var(--muted); font-weight: 500; }
.hero-sub { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.hero-grams { color: var(--muted); font-variant-numeric: tabular-nums; }
.tag {
    display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 3px 10px;
    border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.tag.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.tag.ok .dot { background: var(--ok); }
.tag.run { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag.run .dot { background: var(--accent); }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.trace-wrap { flex: 1; min-height: 110px; margin-top: 12px; position: relative; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.trace-wrap canvas { position: absolute; inset: 8px 0 0 0; width: 100%; height: calc(100% - 8px); }
.trace-cap { position: absolute; right: 0; top: 10px; font-size: 11px; color: var(--faint); z-index: 1; }

/* Tolerans */
.tol { padding-top: 14px; margin-top: 8px; border-top: 1px solid var(--line-soft); }
.tol-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tol-bar { position: relative; height: 10px; border-radius: 6px; background: var(--bad-soft); }
.tol-zone { position: absolute; left: 20%; right: 20%; top: 0; bottom: 0; background: var(--ok-soft); }
.tol-marker { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--text); left: 50%; transform: translateX(-50%); transition: left 0.25s; }
.tol-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tol-labels small { color: var(--faint); margin-right: 4px; }
.tol-labels b { color: var(--text); font-weight: 600; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 11.5px; font-weight: 650; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Son tartım ---------- */
.last-body { flex: 1; display: flex; align-items: center; }
.last-empty { color: var(--faint); }
.last-value { display: flex; align-items: baseline; gap: 8px; }
#last-number { font-size: clamp(34px, 4vw, 52px); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.last-unit { color: var(--muted); font-size: 18px; }
.last-meta { margin-top: 8px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sep { color: var(--faint); }
.diff { font-weight: 650; font-variant-numeric: tabular-nums; }
.diff.up { color: var(--warn); }
.diff.down { color: var(--accent); }
.diff.flat { color: var(--ok); }

.flash { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { border-color: var(--ok); background: var(--ok-soft); } 100% { border-color: var(--line); background: var(--surface); } }
.flash-bad { animation: flash-bad 1.1s ease-out; }
@keyframes flash-bad { 0% { border-color: var(--bad); background: var(--bad-soft); } 100% { border-color: var(--line); background: var(--surface); } }

/* ---------- KPI ---------- */
.kpi { padding: 13px 15px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.kpi-wide { grid-column: span 2; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.kpi-value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-value small { font-size: 13px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.kpi-text { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Grafik / tablo ---------- */
.chart-wrap { height: 300px; position: relative; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }

.table-wrap { max-height: 300px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    position: sticky; top: 0; background: var(--surface); text-align: left; padding: 7px 6px;
    font-size: 12px; font-weight: 600; color: var(--faint); border-bottom: 1px solid var(--line);
}
.table td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.table .num { text-align: right; }
.table tr.new td { animation: rowIn 1.4s ease-out; }
@keyframes rowIn { from { background: var(--accent-soft); } to { background: transparent; } }
.cell-up { color: var(--warn); }
.cell-down { color: var(--accent); }
.cell-flat { color: var(--ok); }
.empty { color: var(--faint); text-align: center; padding: 28px 0; }

/* ---------- Cihaz durumu ---------- */
.status-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.status-item {
    display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line-soft);
    border-radius: 8px; background: var(--surface-2);
}
.status-item .s-name { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status-item .s-val { font-size: 13.5px; font-weight: 600; color: var(--faint); }
.status-item.on .dot { background: var(--ok); }
.status-item.on .s-val { color: var(--text); }
.status-item.bad .dot { background: var(--bad); }
.status-item.bad .s-val { color: var(--bad); }
.status-item.run .dot { background: var(--accent); }

/* ---------- Alt çubuk ---------- */
.foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 24px 22px; max-width: 1480px; width: 100%; margin: 0 auto; color: var(--faint); font-size: 12px;
}

/* ---------- Veri indirme ---------- */
.narrow { max-width: 980px; display: grid; gap: 16px; grid-template-columns: 3fr 2fr; align-content: start; }
.form-group { margin-bottom: 18px; }
.form-group > label, .date-input-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 9px 11px; background: var(--surface-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.form-control:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.format-options { display: flex; gap: 8px; }
.radio-label { cursor: pointer; }
.radio-label input { position: absolute; opacity: 0; pointer-events: none; }
.radio-text {
    display: inline-block; padding: 7px 18px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px;
}
.radio-label input:checked + .radio-text { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
    padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-icon { width: 17px; height: 17px; }
.status-message { display: none; margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.status-message.success { background: var(--ok-soft); color: var(--ok); }
.status-message.error { background: var(--bad-soft); color: var(--bad); }
.status-message.info { background: var(--accent-soft); color: var(--accent); }
.preview-content p { margin: 0 0 6px; }
.preview-content strong { color: var(--muted); font-weight: 600; }
.preview-placeholder { color: var(--faint); }
.session-preview h3 { margin: 0 0 10px; font-size: 13px; font-weight: 650; }

/* ---------- Olaylar ---------- */
.login-card { max-width: 380px; margin: 60px auto; }
.login-card h2 { margin: 0 0 4px; font-size: 18px; }
.login-card p { margin: 0 0 16px; color: var(--muted); }
.login-card .btn { margin-top: 4px; }
.login-err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }

.ev-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.ev-tile { padding: 14px 16px; }
.ev-tile .t-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.ev-tile .t-value { font-size: 28px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ev-tile.crit .t-value { color: var(--bad); }
.ev-tile.warn .t-value { color: var(--warn); }
.ev-tile .t-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

.ev-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.ev-toolbar .grow { flex: 1; min-width: 160px; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
    color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.ev-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ev-table th { text-align: left; padding: 8px 10px; font-size: 12px; color: var(--faint); font-weight: 600; border-bottom: 1px solid var(--line); position: sticky; top: 56px; background: var(--surface); }
.ev-table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.ev-table tr.new td { animation: rowIn 1.6s ease-out; }
.ev-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev-time small { display: block; color: var(--faint); font-size: 11.5px; }
.ev-title { font-weight: 600; }
.ev-detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }
.sev { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 12px; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sev.critical { color: var(--bad); } .sev.critical::before { background: var(--bad); }
.sev.warning { color: var(--warn); } .sev.warning::before { background: var(--warn); }
.sev.info { color: var(--muted); } .sev.info::before { background: var(--accent); }
tr.row-critical td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.cat { font-size: 12px; color: var(--muted); }

/* ---------- Duyarlı ---------- */
@media (max-width: 1100px) {
    .hero { grid-column: span 7; }
    .last { grid-column: span 5; }
    .kpis { grid-column: span 12; grid-template-columns: repeat(4, 1fr); }
    .kpi-wide { grid-column: span 4; }
    .chart-card, .list-card { grid-column: span 12; }
    .status-grid { grid-template-columns: repeat(3, 1fr); }
    .ev-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .topbar { padding: 0 12px; gap: 10px; height: auto; flex-wrap: wrap; padding-top: 8px; }
    .brand-by, .clock, .device-id { display: none; }
    .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
    .page { padding: 12px 12px 4px; }
    .grid { gap: 12px; }
    .hero, .last { grid-column: span 12; }
    .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-wide { grid-column: span 2; }
    .status-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-wrap { height: 220px; }
    .foot { flex-direction: column; align-items: flex-start; padding: 12px; }
    .narrow { grid-template-columns: 1fr; }
    .date-range { grid-template-columns: 1fr; }
    .ev-table th { top: 0; }
    .ev-table .col-cat { display: none; }
}
@media (min-width: 1800px) {
    html { font-size: 17px; }
    .page, .foot { max-width: 1760px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================= v3: halka gösterge, dağılım, telefon düzeni, demo ================= */
.hero-main { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: center; flex: 1; min-height: 0; }
.hero-main .trace-wrap { margin-top: 0; border-top: 0; padding-top: 0; min-height: 190px; height: 100%; }
.hero-main .trace-wrap canvas { inset: 0; height: 100%; }
.hero-main .trace-cap { top: 0; }

.dial { position: relative; width: 250px; height: 250px; margin: 0 auto; }
.dial-svg { width: 100%; height: 100%; transform: rotate(135deg); }
.dial-track, .dial-fill { fill: none; stroke-width: 14; stroke-linecap: round; }
.dial-track { stroke: var(--line); stroke-dasharray: 443 590; }
.dial-fill { stroke: var(--accent); stroke-dasharray: 0 590; transition: stroke-dasharray 0.35s ease, stroke 0.3s; }
.dial.stable .dial-fill { stroke: var(--ok); }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 6px; }
.dial .hero-number { font-size: 52px; letter-spacing: -0.02em; }
.dial .hero-unit { font-size: 18px; }
.dial .hero-value { gap: 6px; }
.dial .hero-grams { font-size: 13px; margin-top: 2px; }
.dial-min, .dial-max { position: absolute; bottom: 18px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.dial-min { left: 40px; }
.dial-max { right: 34px; }

.hist-card { grid-column: span 4; }
.status-card { grid-column: span 8; }
.hist-wrap { height: 150px; position: relative; }
.hist-wrap canvas { width: 100%; height: 100%; display: block; }
.status-grid { grid-template-columns: repeat(3, 1fr); }
.kpis { grid-template-columns: repeat(2, 1fr); }

.tabbar { display: none; }

/* demo bandı */
.demo-banner {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: center; gap: 12px;
    background: #b7791f; color: #fff; padding: 7px 14px; font-size: 12.5px; font-weight: 650; letter-spacing: 0.2px; text-align: center;
}
.demo-banner button { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.45); border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 650; cursor: pointer; font-family: inherit; }
.demo-banner button:hover { background: rgba(255,255,255,0.32); }
body.is-demo .topbar { top: 33px; }

@media (max-width: 1100px) {
    .hero-main { grid-template-columns: 230px 1fr; }
    .hist-card { grid-column: span 12; }
    .status-card { grid-column: span 12; }
    .status-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Telefon ---------- */
@media (max-width: 760px) {
    body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); font-size: 15px; }
    .topbar { height: 52px; padding: 0 14px; flex-wrap: nowrap; gap: 8px; padding-top: env(safe-area-inset-top); }
    .brand-logo { width: 26px; height: 26px; }
    .brand-name { font-size: 15px; }
    .topbar .nav { display: none; }
    .topbar-right { gap: 8px; }
    .topbar-right .seg button { padding: 6px 9px; }
    .icon-btn { width: 34px; height: 32px; }
    .conn .conn-text { display: none; }
    .conn .dot { width: 10px; height: 10px; }
    body.is-demo .topbar { top: 33px; }

    .page { padding: 12px 12px 8px; }
    .grid { gap: 12px; }
    .card { padding: 14px 14px; border-radius: 14px; }
    .card-title { font-size: 13.5px; }

    .hero, .last { grid-column: span 12; }
    .hero-main { grid-template-columns: 1fr; gap: 6px; }
    .dial { width: min(78vw, 300px); height: min(78vw, 300px); }
    .dial .hero-number { font-size: clamp(46px, 15vw, 70px); }
    .dial .hero-unit { font-size: 20px; }
    .dial .hero-grams { font-size: 14px; }
    .dial-min { left: 14%; bottom: 8%; }
    .dial-max { right: 12%; bottom: 8%; }
    .hero-main .trace-wrap { min-height: 90px; height: 90px; }
    .hero .card-head { flex-direction: column; align-items: flex-start; gap: 8px; }

    .last-body { padding: 4px 0; }
    #last-number { font-size: 44px; }

    .kpis { grid-column: span 12; grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-wide { grid-column: span 2; }
    .kpi { padding: 12px 13px; }
    .kpi-big .kpi-value { font-size: 30px; }
    .kpi-value { font-size: 22px; }

    .chart-card, .list-card, .hist-card, .status-card { grid-column: span 12; }
    .chart-wrap { height: 210px; }
    .status-grid { grid-template-columns: repeat(2, 1fr); }

    /* tablo -> kart listesi */
    #wtable thead { display: none; }
    #wtable, #wtable tbody { display: block; }
    #wtable tr { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line-soft); }
    #wtable td { border: 0; padding: 0; }
    #wtable td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 19px; font-weight: 650; text-align: left; }
    #wtable td:nth-child(1) { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 12.5px; }
    #wtable td:nth-child(3) { grid-column: 2; grid-row: 1; font-weight: 650; text-align: right; align-self: center; }
    #wtable td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
    .table-wrap { max-height: none; }

    .foot { display: none; }
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        background: var(--surface); border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
    .tabbar a svg { width: 22px; height: 22px; }
    .tabbar a.active { color: var(--accent); }

    .ev-summary { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ev-toolbar .grow { min-width: 100%; order: 5; }
    .ev-table th { display: none; }
    .ev-table, .ev-table tbody { display: block; }
    .ev-table tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
    .ev-table td { border: 0; padding: 2px 0; }
    .ev-table td.ev-time { grid-column: 2; grid-row: 1; text-align: right; font-size: 12.5px; }
    .ev-table td:nth-child(2) { grid-column: 1; grid-row: 1; }
    .ev-table td:nth-child(3) { grid-column: 1 / span 2; grid-row: 2; }
    .ev-table tr.row-critical, .ev-table tr.row-warning { padding-left: 10px; }
    .ev-table tr.row-critical { box-shadow: inset 3px 0 0 var(--bad); }
    .ev-table tr.row-warning { box-shadow: inset 3px 0 0 var(--warn); }
    .ev-table tr.row-critical td:first-child, .ev-table tr.row-warning td:first-child { box-shadow: none; }
    .login-card { margin: 24px auto; }
    .narrow { grid-template-columns: 1fr; }
}
@media (min-width: 1800px) { .dial { width: 290px; height: 290px; } .hero-main { grid-template-columns: 290px 1fr; } .dial .hero-number { font-size: 60px; } }

/* ================= v4: uygulama hissi ve cila ================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; overscroll-behavior: none; }
body {
    -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
    -webkit-user-select: none; user-select: none; overscroll-behavior: none;
    min-height: 100vh; min-height: 100dvh;
    animation: pageIn 0.32s ease-out both;
}
input, textarea, select, .ev-detail, .ev-title { -webkit-user-select: text; user-select: text; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }   /* transform YOK: fixed alt çubuğu bozulmasın */
@view-transition { navigation: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* marka + cihaz seri numarası */
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-serial { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--accent); letter-spacing: 0.3px; min-height: 13px; }
.brand-serial:empty::before { content: "…"; color: var(--faint); }
.device-id { display: none !important; }
.brand-by { align-self: flex-start; margin-top: 3px; }

/* ikonlu göstergeler */
.kpi-label { display: flex; align-items: center; gap: 7px; }
.k-ico { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--faint); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* bildirim (bağlantı koptuğunda) */
.toast {
    position: fixed; left: 50%; transform: translateX(-50%); top: 14px; z-index: 60;
    background: var(--warn); color: #1a1205; font-weight: 650; font-size: 13px;
    padding: 9px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    animation: toastIn 0.25s ease-out;
}
body.is-demo .toast { top: 48px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ilk veri gelene kadar yumuşak yükleniyor görünümü */
body.loading .hero-number, body.loading .hero-grams, body.loading .kpi-value, body.loading #last-number,
body.loading .kpi-text { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.75; } }

/* dokunma geri bildirimi */
.btn, .tabbar a, .chip, .icon-btn, .seg button, .nav a { transition: transform 0.12s ease, background-color 0.15s, border-color 0.15s, color 0.15s, filter 0.15s; }
.btn:active, .tabbar a:active, .chip:active, .icon-btn:active { transform: scale(0.95); }
.card { transition: border-color 0.25s, background-color 0.25s; }

/* alt sekme çubuğu: etkin göstergesi */
.tabbar { backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.tabbar a { position: relative; }
.tabbar a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); }

@media (max-width: 760px) {
    .topbar { background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
    .brand-by { display: none; }
    .brand-name { font-size: 15px; }
    .brand-serial { font-size: 11px; }
    .brand-logo { width: 30px; height: 30px; }
    /* iOS odaklanınca yakınlaştırmasın: giriş alanları 16px */
    input, select, textarea, .form-control { font-size: 16px; }
    .form-control { padding: 12px 12px; }
    .btn { padding: 13px 20px; font-size: 15.5px; border-radius: 12px; }
    .chip { padding: 8px 14px; font-size: 13.5px; }
    .seg button { padding: 7px 11px; }
    .card { box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset; }
    .toast { top: calc(10px + env(safe-area-inset-top)); }
}
@media (display-mode: standalone) {
    body { padding-top: env(safe-area-inset-top); }
    .topbar { top: env(safe-area-inset-top); }
}


/* ================= v5: cihaz paleti, açılış ekranı, logolar ================= */
.brand-logo { width: 30px; height: 30px; border-radius: 50%; }
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: inline-block; }

/* açılış (splash) */
html.splash-on::before { content: ""; position: fixed; inset: 0; background: var(--bg); z-index: 9998; }
#splash {
    position: fixed; inset: 0; z-index: 9999; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.45s ease; padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
}
#splash.out { opacity: 0; pointer-events: none; }
.sp-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; width: min(78vw, 420px); }
.sp-takipsan { width: 100%; height: auto; animation: spLogo 0.9s cubic-bezier(.2,.7,.2,1) both; }
.sp-product { display: flex; align-items: center; gap: 12px; animation: spFade 0.7s ease 0.7s both; }
.sp-product img { width: 44px; height: 44px; }
.sp-product span { font-size: 21px; font-weight: 650; letter-spacing: 0.2px; color: var(--text); }
.sp-sub { font-size: 12px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--faint); animation: spFade 0.7s ease 1s both; margin-top: -10px; }
.sp-bar { width: 140px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; animation: spFade 0.4s ease 0.6s both; }
.sp-bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 3px; animation: spBar 1.5s cubic-bezier(.4,0,.2,1) 0.7s forwards; }
@keyframes spLogo { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes spFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spBar { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { #splash { transition: none; } .sp-takipsan, .sp-product, .sp-sub, .sp-bar, .sp-bar i { animation: none !important; } .sp-bar i { width: 100%; } }

/* emniyet: JS hata verse bile açılış örtüsü 4 sn sonra kalkar */
html.splash-on::before { animation: spGone 0.3s ease 4s forwards; }
@keyframes spGone { to { opacity: 0; visibility: hidden; pointer-events: none; } }


/* herkese açık bağlantı: yalnızca canlı panel */
.public-view .nav, .public-view .tabbar, .public-view .foot-link { display: none !important; }
.public-view body { padding-bottom: 0; }
