@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
    --bg: #0b0f14;
    --bg-soft: #111821;
    --panel: #141d28;
    --panel-2: #192433;
    --text: #eef4ff;
    --muted: #9fb0c6;
    --line: #263447;
    --accent: #18a0fb;
    --accent-2: #4cc3ff;
    --ok: #23c26b;
    --warn: #f5b23a;
    --err: #f25f6a;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Manrope, "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 600px at 10% -10%, #153251 0%, transparent 60%),
                radial-gradient(900px 450px at 100% 0%, #1b2b3c 0%, transparent 55%),
                var(--bg);
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, #0f1620 0%, #0c121a 100%);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-mark {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(24, 160, 251, 0.16);
    color: #8cd6ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.brand h1 { margin: 12px 0 6px; font-size: 34px; line-height: 1; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.nav {
    margin-top: 8px;
    display: grid;
    gap: 8px;
}
.nav a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #cad8e9;
    border: 1px solid transparent;
    transition: 0.2s ease;
}
.nav a:hover {
    background: #162232;
    border-color: #274361;
    color: #fff;
}
.nav a.active {
    background: linear-gradient(90deg, rgba(24,160,251,.22), rgba(24,160,251,.07));
    border-color: #2f6ea3;
    color: #fff;
}
.active-dot { color: #8cd6ff; font-weight: 800; }

.sidebar-foot {
    margin-top: auto;
    border: 1px solid var(--line);
    background: #0f1722;
    border-radius: 12px;
    padding: 12px;
}
.sidebar-foot .label {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}
.sidebar-foot .value { margin-top: 6px; font-weight: 700; }
.muted { color: var(--muted); }

.main { padding: 24px; }

.topbar {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(17, 24, 33, 0.8);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.topbar-title { font-size: 14px; font-weight: 700; color: #dbe9fa; }
.topbar-meta { display: flex; flex-wrap: wrap; gap: 8px; }

.hero {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, #152232 0%, #111a27 100%);
    padding: 22px;
}
.hero-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.hero-header-wrap { display: flex; align-items: center; gap: 10px; }
.eyebrow {
    margin: 0 0 8px;
    color: #9fd8ff;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
}
.hero h2 { margin: 0; font-size: 30px; line-height: 1.12; }
.hero p { color: #bed0e6; line-height: 1.6; margin: 12px 0 0; max-width: 720px; }
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.chip, .pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #1a2635;
    color: #d6e6f8;
    font-size: 12px;
    font-weight: 700;
}
.chip.status-on, .pill.status-submitted, .pill.status-opened { color: #78e5a8; border-color: #2f7f56; background: #173024; }
.chip.status-off, .pill.status-automation_failed, .pill.status-failed, .pill.status-rejected { color: #ff9ea5; border-color: #7b3138; background: #331b20; }
.pill.status-cooldown_blocked { color: #ffd48a; border-color: #7f6330; background: #2c2418; }
.pill.type-speed_up { color: #9cd8ff; border-color: #2a5f89; background: #152839; }
.pill.type-refill { color: #8de8b4; border-color: #2e7a58; background: #173126; }
.pill.type-cancel { color: #ff9ea5; border-color: #7b3138; background: #331b20; }

.metric-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.metric-card, .card, .list-item {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.metric-card { padding: 16px; }
.metric-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
}
.metric-value { margin-top: 8px; font-size: 30px; font-weight: 800; }
.metric-note { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.section { margin-top: 16px; }
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.card { padding: 16px; }
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.section-head h3 { margin: 0; font-size: 20px; }
.section-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.list { display: grid; gap: 10px; }
.list-item { padding: 14px; }
.item-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.item-title strong { font-size: 17px; }
.item-title div { margin-top: 3px; color: var(--muted); font-size: 13px; }
.meta-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.meta-block {
    border: 1px solid #223043;
    border-radius: 10px;
    background: var(--panel-2);
    padding: 10px;
}
.meta-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 10px;
    font-weight: 700;
}
.meta-value { margin-top: 5px; font-size: 13px; color: #e4eefb; word-break: break-word; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.form-grid .full { grid-column: 1 / -1; }
label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
input, textarea, select {
    width: 100%;
    border: 1px solid #2b3b50;
    border-radius: 10px;
    background: #0f1723;
    color: #e9f2fe;
    padding: 10px 11px;
    font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3c95d6;
    box-shadow: 0 0 0 3px rgba(24, 160, 251, 0.2);
}
textarea { min-height: 110px; resize: vertical; }

.checkbox-row {
    border: 1px solid #2a3a4f;
    border-radius: 10px;
    background: #101a28;
    padding: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.checkbox-row input { width: 16px; height: 16px; }

button, .btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: white;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
button.secondary {
    background: #233349;
    border: 1px solid #345273;
}
button.ghost {
    background: transparent;
    border: 1px solid #335070;
    color: #c7d9ee;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar { min-width: min(360px, 100%); }
.search-input { border-radius: 999px; background: #111c2a; }

.alert {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.alert-error { background: #331c20; border-color: #6d2e35; color: #ffb6bc; }
.alert-success { background: #173025; border-color: #2f7756; color: #aaf1c7; }
.alert-warning { background: #302515; border-color: #7d6230; color: #ffe0a8; }
.alert-info { background: #152738; border-color: #35628a; color: #b9e4ff; }

.logs-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0e1620;
}
.logs-head {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}
.logs { height: 560px; overflow-y: auto; padding: 12px 14px; font-family: Consolas, monospace; font-size: 12px; }
.log-line {
    margin-bottom: 6px;
    padding: 6px 8px;
    border-left: 2px solid transparent;
    background: #121b27;
    border-radius: 6px;
    color: #ceddf0;
}
.log-line.info { border-color: #4ab8ff; }
.log-line.warning { border-color: #ffc766; }
.log-line.error { border-color: #ff8f98; }

.empty {
    border: 1px dashed #31465f;
    border-radius: 10px;
    background: #111a26;
    color: var(--muted);
    padding: 20px;
    text-align: center;
}

.mobile-toggle {
    display: none;
    border: 1px solid #335170;
    background: #172333;
    color: #dcecff;
    border-radius: 8px;
    padding: 8px;
}
.hidden-item { display: none !important; }
.fade-in { animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.sidebar-overlay { display: none; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 280px;
        z-index: 50;
        transition: left .22s ease;
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 40;
    }
    .sidebar-overlay.open { display: block; }
    .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .main { padding: 14px; }
    .metric-grid { grid-template-columns: 1fr; }
    .meta-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar { min-width: 100%; width: 100%; }
}
