@font-face {
    font-family: "FontAwesome";
    src: url("/assets/fonts/fontawesome-webfont.eot?v=4.7.0");
    src: url("/assets/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0") format("embedded-opentype"),
        url("/assets/fonts/fontawesome-webfont.woff2?v=4.7.0") format("woff2"),
        url("/assets/fonts/fontawesome-webfont.woff?v=4.7.0") format("woff"),
        url("/assets/fonts/fontawesome-webfont.ttf?v=4.7.0") format("truetype");
    font-weight: normal;
    font-style: normal;
}

:root {
    --page: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #4d5868;
    --heading: #243247;
    --muted: #8893a2;
    --line: #dde4ed;
    --line-strong: #cbd5e1;
    --header: #116e8d;
    --header-dark: #0f5c76;
    --sidebar: #1791ba;
    --sidebar-active: #1586ac;
    --primary: #1791ba;
    --primary-dark: #116e8d;
    --green: #17ba91;
    --red: #d9364f;
    --amber: #d89013;
    --radius: 5px;
    --shadow: 0 10px 24px rgba(36, 50, 71, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: var(--header-dark);
    color: var(--text);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.fa {
    display: inline-block;
    font: normal normal normal 14px/1 FontAwesome;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.fa-dashboard:before {
    content: "\f0e4";
}

.fa-phone:before {
    content: "\f095";
}

.fa-list-alt:before {
    content: "\f022";
}

.fa-play-circle:before {
    content: "\f144";
}

.fa-envelope:before {
    content: "\f0e0";
}

.fa-cog:before {
    content: "\f013";
}

.fa-code:before {
    content: "\f121";
}

.fa-shield:before {
    content: "\f132";
}

.fa-sign-out:before {
    content: "\f08b";
}

.fa-sign-in:before {
    content: "\f090";
}

.fa-user:before {
    content: "\f007";
}

.fa-lock:before {
    content: "\f023";
}

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

.sidebar {
    color: #dfeff5;
    background: var(--sidebar);
    padding: 0;
}

.brand {
    display: flex;
    align-items: center;
    min-height: 74px;
    gap: 12px;
    padding: 0 18px;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-weight: 800;
}

.brand strong {
    display: block;
    color: #fff;
    font-size: 17px;
}

.brand small {
    display: block;
    color: #c7e5ef;
    font-size: 12px;
}

.nav {
    display: grid;
    padding: 12px 0 22px;
}

.nav-section {
    padding: 14px 22px 8px;
    color: #c7e5ef;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 20px;
    color: #eaf7fb;
    border-left: 3px solid transparent;
    font-weight: 650;
}

.nav a .fa {
    width: 18px;
    color: #d3edf5;
    text-align: center;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: var(--sidebar-active);
    border-left-color: #fff;
}

.nav a.active .fa,
.nav a:hover .fa {
    color: #fff;
}

.main {
    min-width: 0;
    padding: 0 16px 24px;
    background: var(--page);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    gap: 16px;
    margin: 0 -16px 18px;
    padding: 0 22px;
    color: #d8eaf0;
    background: var(--header);
}

.topbar h1 {
    margin: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1.2;
}

.topbar p {
    margin: 4px 0 0;
    color: #c5e1eb;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    max-width: 100%;
    border-radius: 999px;
    padding: 3px 9px;
    background: #edf2f7;
    color: #536071;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.user-pill {
    color: #eaf7fb;
    background: rgba(255, 255, 255, 0.12);
}

.badge.ok {
    color: #0c6b52;
    background: #dff7ef;
}

.badge.danger {
    color: #a3172c;
    background: #fde5e9;
}

.badge.muted {
    color: #637082;
    background: #edf2f7;
}

.grid {
    display: grid;
    gap: 14px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.stat,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat {
    position: relative;
    min-height: 108px;
    padding: 16px;
    overflow: hidden;
}

.stat:before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    content: "";
}

.stat span,
label span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.stat strong {
    display: block;
    color: var(--heading);
    font-size: 28px;
    line-height: 1.12;
}

.stat small {
    color: var(--muted);
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.62fr);
    gap: 14px;
    margin-bottom: 14px;
}

.panel {
    padding: 16px;
    overflow: auto;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.panel h2 {
    margin: 0;
    color: var(--heading);
    font-size: 16px;
}

table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 9px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #6f7b8d;
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 800;
}

td strong {
    color: var(--heading);
}

tr:last-child td {
    border-bottom: 0;
}

audio {
    width: 220px;
    max-width: 100%;
    height: 32px;
}

.log-block {
    max-height: 420px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border-radius: var(--radius);
    background: #202938;
    color: #dbe7f3;
    font: 12px/1.5 "SFMono-Regular", Consolas, monospace;
}

.empty {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--surface-soft);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.form-stack {
    display: grid;
    gap: 13px;
}

.wide {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    min-height: 39px;
    border: 1px solid #cfd7e2;
    border-radius: var(--radius);
    padding: 8px 10px;
    background: #fff;
    color: var(--heading);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #57a0d2;
    outline: 0;
}

textarea {
    resize: vertical;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .fa {
    position: absolute;
    bottom: 12px;
    left: 12px;
    color: #8a96a7;
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 36px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 37px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 8px 13px;
    background: #fff;
    color: var(--heading);
    font-weight: 750;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover {
    color: var(--primary-dark);
    border-color: #9fc8d8;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    color: #fff;
    background: var(--primary-dark);
}

.button.ghost {
    color: #eaf7fb;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
}

.button.ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.kv {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0;
}

.kv dt {
    color: var(--muted);
}

.kv dd {
    min-width: 0;
    margin: 0;
    color: var(--heading);
    font-weight: 700;
    overflow-wrap: anywhere;
}

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

.flow span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--surface-soft);
    color: var(--heading);
    font-weight: 750;
}

.muted-text {
    color: var(--muted);
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 22px;
    background: var(--header-dark);
}

.login-panel {
    width: min(430px, 100%);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 18px 48px rgba(5, 30, 43, 0.32);
    overflow: hidden;
}

.login-brand {
    min-height: 86px;
    margin: 0 0 18px;
    color: #fff;
    background: var(--header);
}

.login-panel .form-stack,
.login-panel .alert {
    margin: 0 22px 22px;
}

.alert {
    margin-bottom: 12px;
    border-radius: var(--radius);
    padding: 10px 12px;
    font-weight: 650;
}

.alert.danger {
    background: #fde5e9;
    color: var(--red);
}

.alert.info {
    background: #e4f3fa;
    color: var(--primary-dark);
}

.alert.success {
    background: #dff7ef;
    color: #0c6b52;
}

.lead {
    max-width: 860px;
    margin: 0 0 12px;
    color: var(--muted);
}

.tabs-grid {
    display: grid;
    gap: 10px;
}

.config-file {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.config-file summary {
    cursor: pointer;
    padding: 10px 12px;
    color: var(--heading);
    font-weight: 800;
}

.config-file .log-block {
    border-radius: 0 0 var(--radius) var(--radius);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .brand {
        min-height: 64px;
    }

    .nav {
        display: flex;
        gap: 0;
        padding: 0 8px 10px;
        overflow-x: auto;
    }

    .nav-section {
        display: none;
    }

    .nav a {
        flex: 0 0 auto;
        border-left: 0;
        border-bottom: 3px solid transparent;
        border-radius: var(--radius);
        padding: 9px 12px;
    }

    .nav a.active,
    .nav a:hover {
        border-left-color: transparent;
        border-bottom-color: #fff;
    }

    .stats-grid,
    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .main {
        padding: 0 12px 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        margin: 0 -12px 14px;
        padding: 14px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .form-grid,
    .kv {
        grid-template-columns: 1fr;
    }

    .panel,
    .stat {
        padding: 14px;
    }
}
