﻿/* ===== EProduction web-app – samme designsystem som DocMate ===== */
:root {
    /* Accentfarven (hed tidligere navy) – orange som lastbilen på login-billedet */
    --navy: #E8900C;
    --navy-dark: #C47508;
    --navy-light: #F5B94A;
    --ink: #0A1428;
    --muted: #5A6B85;
    --line: #ECE5DE;
    --bg: #FFFFFF;
    --bg-alt: #FAF7F4;
    --bg-soft: #FEF3DC;
    --green: #2E9E5B;
    --orange: #B7791F;
    --red: #D33A3A;
    --radius: 14px;
    --shadow-sm: 0 4px 18px rgba(10, 20, 40, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg-alt); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--navy); }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 15px; }
.brand-soft { color: var(--navy-light); font-weight: 700; }
.logo-img { height: 42px; width: auto; display: block; }
.login-brand .logo-img.logo-lg { height: auto; width: 100%; max-width: 320px; margin: 0 auto; }
@media (max-width: 820px) { .app .topbar { min-height: 76px; padding: 12px 18px; gap: 14px; } .topbar .logo-img { height: 32px; } .sidebar { top: 76px !important; } }
@media (max-width: 480px) { .topbar .logo-img { height: 24px; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1.5px solid transparent; font-family: inherit; transition: background .15s, transform .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-outline:hover { background: var(--bg-soft); }
.btn-ghost { color: var(--navy); background: transparent; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #B82E2E; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

/* ===== Login ===== */
/* Formular til venstre, billede til højre */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(460px, 42%) 1fr; gap: 24px; padding: 24px; background: radial-gradient(900px 400px at 20% -10%, #FDECC8 0%, var(--bg-alt) 60%); }
.login-side { display: grid; place-items: center; }
.login-visual { background: url("img/login.jpg") 30% center / cover no-repeat; border-radius: 20px; box-shadow: 0 20px 60px rgba(232,144,12,.10); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 38px 34px; box-shadow: 0 20px 60px rgba(232,144,12,.10); }
@media (max-width: 900px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-visual { display: none; }
}
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 24px; color: var(--navy); justify-content: center; margin-bottom: 24px; }
.login-brand .brand-mark { width: 38px; height: 38px; font-size: 19px; border-radius: 10px; }
.login-card h1 { font-size: 24px; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 26px; font-size: 15px; }
.login-card label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; margin-bottom: 16px; transition: border-color .15s; }
.login-card input:focus { outline: none; border-color: var(--navy); }
.login-error { color: var(--red); font-size: 14px; text-align: center; margin-top: 12px; min-height: 18px; }
.login-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.login-link { display: block; text-align: center; color: var(--navy-dark); font-weight: 600; font-size: 14px; margin-top: 18px; cursor: pointer; }
.login-link:hover { text-decoration: underline; }
.acc-email { font-size: 13.5px; color: var(--green); margin: -8px 0 14px; min-height: 0; }
.acc-email:empty { display: none; }
#acc_code { text-transform: uppercase; letter-spacing: 2px; font-family: ui-monospace, Consolas, monospace; }

/* ===== App shell ===== */
.topbar { flex-shrink: 0; min-height: 100px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 18px 36px; position: sticky; top: 0; z-index: 30; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--navy); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 22px; }

/* Global søgning i toppen */
.topsearch { position: relative; flex: 1; max-width: 460px; margin: 0 24px; }
.topsearch input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; }
.topsearch input:focus { outline: none; border-color: var(--navy); }
.search-dd { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 44px rgba(0,0,0,.16); max-height: 64vh; overflow: auto; z-index: 50; }
.search-dd .sd-group { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px 4px; }
.search-dd .sd-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; }
.search-dd .sd-item:hover { background: var(--bg-soft); }
.search-dd .sd-empty { padding: 16px 14px; color: var(--muted); font-size: 14px; }
.search-dd .sd-item .row-icon { width: 36px; height: 36px; font-size: 17px; }
.search-dd .sd-text { min-width: 0; flex: 1; }
.search-dd .sd-title { font-weight: 600; font-size: 14px; }
.search-dd .sd-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 820px) { .topsearch { display: none; } }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 42px; height: 42px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta > span:first-child { font-weight: 600; font-size: 14px; }
.user-company { font-size: 12px; color: var(--muted); }

.app:not(.hidden) { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.app-body { display: grid; grid-template-columns: 232px 1fr; flex: 1; min-height: 0; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; height: 100%; overflow-y: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; height: 100%; }
.sidebar-bottom { margin-top: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; }
.nav-item:hover { background: var(--bg-soft); color: var(--navy); }
.nav-item.active { background: var(--navy); color: #fff; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }

.content { padding: 32px; overflow-y: auto; }

/* Page header */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 34px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat-card.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat-card.clickable:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-icon { width: 56px; height: 56px; border-radius: 13px; background: var(--bg-soft); display: grid; place-items: center; font-size: 30px; margin-bottom: 14px; }
.stat-value { font-size: 32px; font-weight: 800; color: var(--ink); letter-spacing: -1px; }
.stat-value small { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.stat-icon .fas { font-size: 26px; }

/* pH-områder */
.zone-title { display: flex; align-items: center; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 4px 11px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.chip-empty { color: var(--muted); font-size: 13px; font-style: italic; }
.check-list { max-height: 260px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 10px; padding: 4px 12px; }
.check-list .check-row small { font-weight: 500; }
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
.user-form-grid .check-list { max-height: 230px; }
#zonePicker.disabled .check-list { opacity: .5; }
@media (max-width: 700px) { .user-form-grid { grid-template-columns: 1fr; } }

/* "Se som"-banner */
.imp-banner { flex-shrink: 0; position: relative; z-index: 29; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 9px 18px; background: #1F2A44; color: #fff; font-size: 14px; }
.imp-banner .fas { color: var(--navy); font-size: 17px; }
.imp-banner .btn { background: var(--navy); color: #fff; padding: 6px 14px; font-size: 13px; }
.imp-banner .btn:hover { background: var(--navy-dark); }

/* Glidende bånd med kort på overblikket */
.ticker { overflow: hidden; margin: -8px -8px 26px; padding: 8px; --card-w: 260px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%); }
.ticker-track { display: flex; gap: 18px; width: max-content; }
.ticker .stat-card { flex: 0 0 var(--card-w); width: var(--card-w); cursor: pointer; }
.ticker .stat-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker.running .ticker-track { animation: ticker-slide linear infinite; }
.ticker.running:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-slide { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 9px)); } }

/* Farvede bokse som Hubmates energi-dashboard (AdminLTE small-box) */
.small-box { position: relative; overflow: hidden; border-radius: var(--radius); color: #fff; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.small-box:hover { box-shadow: 0 8px 22px rgba(0,0,0,.18); transform: translateY(-1px); }
.small-box.dark { color: #1F2D3D; }
.small-box .inner { padding: 18px 20px 14px; position: relative; z-index: 1; flex: 1; }
.small-box h3 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 4px; white-space: nowrap; }
.small-box p { font-size: 15px; font-weight: 600; }
.small-box .sb-lines { font-size: 17px; font-weight: 800; line-height: 1.45; margin-bottom: 4px; }
.small-box .sb-lines span { opacity: .75; font-weight: 600; font-size: 14px; }
.small-box .sb-icon { position: absolute; top: 14px; right: 18px; font-size: 64px; color: rgba(0,0,0,.15); transition: transform .3s; }
.small-box:hover .sb-icon { transform: scale(1.08); }
.small-box .sb-footer { background: rgba(0,0,0,.1); text-align: center; padding: 6px; font-size: 13.5px; font-weight: 600; color: rgba(255,255,255,.9); }
.small-box.dark .sb-footer { color: rgba(31,45,61,.85); }
.small-box .sb-footer .fas { margin-left: 4px; }

/* Kort med farvet top, som Hubmates card-outline */
.panel.panel-outline { border-top: 3px solid var(--navy); }
.stat-label { color: var(--muted); font-size: 14px; }
.stat-change { font-size: 13px; font-weight: 700; margin-top: 6px; }
.up { color: var(--green); }
.down { color: var(--red); }

/* Lists / cards */
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.row-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.row-card.static { cursor: default; }
.row-card.static:hover { box-shadow: none; transform: none; }
.row-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--bg-soft); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 15px; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-value { font-weight: 800; font-size: 18px; color: var(--ink); white-space: nowrap; }
.row-value small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.row-tag { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.tag-green { background: #DCF3E4; color: var(--green); }
.tag-orange { background: #FBF0D2; color: var(--orange); }
.tag-red { background: #FBE0E0; color: var(--red); }
.tag-grey { background: #ECEEF2; color: #6B7688; }
.tag-blue { background: var(--bg-soft); color: var(--navy); }

.search-input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 11px; font-size: 15px; font-family: inherit; margin-bottom: 18px; transition: border-color .15s; }
.search-input:focus { outline: none; border-color: var(--navy); }

.count-pill { font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: var(--bg-soft); color: var(--navy); white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.loading { text-align: center; color: var(--muted); padding: 50px 20px; }
.placeholder { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 50px 20px; text-align: center; color: var(--muted); }
.placeholder h3 { color: var(--ink); margin-bottom: 6px; }
.placeholder p { margin-bottom: 16px; }

/* Breadcrumb */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; font-size: 14px; }
.crumbs a { color: var(--navy); font-weight: 600; cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--muted); }

/* Small buttons in rows */
.row-actions { display: flex; gap: 6px; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 17px; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--bg-soft); color: var(--navy); }

/* Faner */
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 24px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { border: none; background: none; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 9px 16px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--navy); background: var(--bg-soft); }
.tab.active { background: var(--navy); color: #fff; }

/* Paneler */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.panel-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--navy); display: inline-block; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel-grid .panel { margin-bottom: 0; }
.kv-group + .kv-group { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.kv-title { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14.5px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; white-space: nowrap; }
.kv .v.bad { color: var(--red); }

/* Filtre / værktøjslinje */
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .field { display: flex; flex-direction: column; gap: 5px; }
.toolbar label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.toolbar input, .toolbar select { padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); min-width: 140px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--navy); }
.toolbar .spacer { flex: 1; }
.date-nav { display: flex; align-items: center; gap: 6px; }
.updated-at { color: var(--muted); font-size: 13px; align-self: center; }
.date-nav input { min-width: 0; }

/* Tabeller */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-alt); position: sticky; top: 0; white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--bg-alt); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover td { background: var(--bg-soft); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table input { padding: 6px 9px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; width: 130px; text-align: right; }
.data-table input:focus { outline: none; border-color: var(--navy); }
.data-table tr.history-row td { background: #FFF9EE; font-size: 13px; }
.table-foot { color: var(--muted); font-size: 13px; padding: 10px 2px; }

/* Grafer */
.chart-box { position: relative; height: 340px; }
.chart-box.sm { height: 240px; }
.legend-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.legend-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; background: var(--bg-alt); font-size: 13px; font-weight: 600; }
.legend-pill i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Vælg flere målere */
.meter-picker { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.meter-picker input[type=search] { width: 100%; border: none; border-bottom: 1px solid var(--line); padding: 10px 12px; font-family: inherit; font-size: 14px; border-radius: 12px 12px 0 0; }
.meter-picker input[type=search]:focus { outline: none; }
.meter-picker-list { max-height: 230px; overflow-y: auto; padding: 6px; }
.meter-opt { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.meter-opt:hover { background: var(--bg-soft); }
.meter-opt input { width: 16px; height: 16px; accent-color: var(--navy); }
.meter-opt span { color: var(--muted); font-size: 12.5px; }
.picker-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.graph-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .graph-layout { grid-template-columns: 1fr; } }

/* Slope-badge */
.slope-big { text-align: center; padding: 18px; border-radius: 14px; background: var(--bg-alt); }
.slope-big .val { font-size: 38px; font-weight: 800; letter-spacing: -1px; }
.slope-big .lbl { font-weight: 700; margin-top: 2px; }
.slope-big .rng { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Kort */
#phMap { position: relative; z-index: 0; height: 520px; border-radius: var(--radius); border: 1px solid var(--line); }
.map-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }
@media (max-width: 1000px) { .map-layout { grid-template-columns: 1fr; } }
.map-list .row-card { padding: 11px 12px; }
.map-list .row-card.placing { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(232,144,12,.15); }
#phMap.placing { cursor: crosshair; }
#phMap.placing .leaflet-grab { cursor: crosshair; }

/* Forms */
.form label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 6px; }
.form input, .form select, .form textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; transition: border-color .15s; background: #fff; color: var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--navy); }
.form input[readonly] { background: var(--bg-alt); color: var(--muted); }
.form textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.form-error { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 18px; }
.form-hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.form-section { font-size: 13px; font-weight: 800; color: var(--navy); margin: 22px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.form-grid-4 { display: grid; grid-template-columns: 70px repeat(4, 1fr); gap: 0 10px; align-items: end; }
.form-grid-4 .buf { font-weight: 800; font-size: 14px; padding-bottom: 12px; }
@media (max-width: 620px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
    .form-grid-4 .buf { grid-column: 1 / -1; padding: 10px 0 0; }
}
.check-row { display: flex !important; align-items: center; gap: 10px; text-transform: none !important; letter-spacing: 0 !important; font-size: 14.5px !important; color: var(--ink) !important; font-weight: 500 !important; margin: 8px 0 !important; cursor: pointer; }
.check-row input { width: 18px !important; height: 18px; accent-color: var(--navy); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.preset { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; font-family: inherit; text-align: left; }
.preset:hover { border-color: var(--navy); background: var(--bg-soft); }
.preset b { display: block; font-size: 14.5px; margin-top: 4px; }
.preset span { color: var(--muted); font-size: 12.5px; }
.code-box { background: var(--ink); color: #E3E9F2; border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }

/* Detail rows */
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--bg-alt); font-size: 15px; }
.detail-row .k { color: var(--muted); }
.detail-row .v { font-weight: 600; text-align: right; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,20,40,.45); display: grid; place-items: center; z-index: 1500; padding: 20px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal.medium { max-width: 640px; }
.modal.wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 14px; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h2 { font-size: 20px; }
.modal-close { background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 0 24px 24px; }

/* Toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px; font-weight: 600; font-size: 14.5px; z-index: 1600; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Settings */
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; max-width: 760px; }
.settings-card h2 { font-size: 17px; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar { position: fixed; top: 84px; left: 0; bottom: 0; width: 232px; z-index: 25; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .user-meta { display: none; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .content { padding: 20px 16px; }
    .row-card { flex-wrap: wrap; }
}
