:root {
    --ink: #14263b;
    --ink-soft: #607086;
    --navy: #18324c;
    --navy-deep: #10263b;
    --aqua: #21b8ad;
    --aqua-dark: #118e87;
    --aqua-soft: #e9f8f6;
    --blue-soft: #edf4fb;
    --surface: #ffffff;
    --background: #f3f6f8;
    --line: #dfe6ec;
    --line-strong: #cad5df;
    --success: #168466;
    --success-soft: #e8f7f1;
    --danger: #b8424d;
    --danger-soft: #fcecef;
    --warning: #966521;
    --shadow: 0 16px 40px rgba(23, 48, 72, 0.08);
    --radius: 18px;
    color: var(--ink);
    background: var(--background);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 92% 0, rgba(33, 184, 173, 0.08), transparent 28rem),
        var(--background);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.35rem;
    color: var(--navy-deep);
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    letter-spacing: -0.045em;
    line-height: 1.08;
}

h2 {
    margin-bottom: 0;
    color: var(--navy);
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

small {
    color: var(--ink-soft);
    font-size: 0.76rem;
}

code,
.mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
}

.topbar {
    position: sticky;
    z-index: 5;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 4vw;
    border-bottom: 1px solid rgba(223, 230, 236, 0.88);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    color: var(--navy);
    text-decoration: none;
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand strong {
    font-size: 1.04rem;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 0.18rem;
    font-size: 0.67rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-mark {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, var(--aqua), var(--navy));
    box-shadow: 0 8px 20px rgba(20, 127, 127, 0.23);
    font-weight: 800;
}

.brand-mark-large {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    font-size: 1.35rem;
}

.admin-menu,
.admin-menu form {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.admin-name {
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.page {
    width: min(1440px, 92vw);
    margin: 0 auto;
    padding: 3.5rem 0 2rem;
}

.hero {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.6rem;
}

.hero .muted {
    max-width: 760px;
    margin-bottom: 0;
}

.eyebrow {
    margin-bottom: 0.35rem;
    color: var(--aqua-dark);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.muted {
    color: var(--ink-soft);
}

.status-pill,
.status,
.tag,
.count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 0.73rem;
    font-weight: 750;
}

.status-pill {
    gap: 0.45rem;
    padding: 0.48rem 0.78rem;
    color: var(--success);
    border: 1px solid #bfe7d8;
    background: var(--success-soft);
}

.status-pill span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22, 132, 102, 0.12);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 1rem;
    min-height: 112px;
    padding: 1.2rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 24px rgba(23, 48, 72, 0.04);
}

.stat span {
    align-self: end;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 650;
}

.stat strong {
    grid-row: span 2;
    align-self: center;
    color: var(--navy);
    font-size: 2.1rem;
    letter-spacing: -0.05em;
}

.stat small {
    align-self: start;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-registration {
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
    margin-bottom: 1rem;
}

.panel {
    overflow: hidden;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.section-panel {
    margin-bottom: 1rem;
}

.panel-heading {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.tag,
.count {
    padding: 0.35rem 0.65rem;
    color: #3f5e79;
    background: var(--blue-soft);
}

.tag-secure {
    color: var(--success);
    background: var(--success-soft);
}

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

.span-2 {
    grid-column: span 2;
}

label,
.stack {
    display: grid;
    gap: 0.42rem;
}

label > span {
    color: #344b61;
    font-size: 0.76rem;
    font-weight: 750;
}

input {
    width: 100%;
    min-height: 42px;
    padding: 0.64rem 0.72rem;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: 0;
    background: #fbfcfd;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus {
    border-color: var(--aqua);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(33, 184, 173, 0.13);
}

input::placeholder {
    color: #9aa8b5;
}

.number-input {
    min-width: 76px;
    max-width: 110px;
}

.input-unit {
    display: flex;
    gap: 0.38rem;
    align-items: center;
}

.input-unit span {
    color: var(--ink-soft);
    font-size: 0.78rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.2rem;
}

.fineprint {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.76rem;
}

.firmware-upload {
    margin-top: 1.15rem;
}

.file-control {
    padding: 0.9rem;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: #f9fbfc;
}

.file-control input {
    min-height: 0;
    padding: 0.5rem;
    background: #fff;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.62rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.79rem;
    font-weight: 760;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--aqua), var(--aqua-dark));
    box-shadow: 0 8px 18px rgba(17, 142, 135, 0.2);
}

.button-secondary {
    color: #fff;
    background: var(--navy);
}

.button-quiet {
    color: #40566b;
    border-color: var(--line);
    background: #f7f9fa;
}

.button-danger {
    color: var(--danger);
    border-color: #f1cbd0;
    background: var(--danger-soft);
}

.button-small {
    min-height: 34px;
    padding: 0.42rem 0.65rem;
    font-size: 0.7rem;
}

.button-wide {
    width: 100%;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 650;
}

.alert-success {
    color: var(--success);
    border-color: #bfe7d8;
    background: var(--success-soft);
}

.alert-error {
    color: var(--danger);
    border-color: #f0c5cb;
    background: var(--danger-soft);
}

.table-wrap {
    overflow-x: auto;
    margin: 0 -1.35rem -1.35rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.85rem 0.7rem;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th:first-child,
td:first-child {
    padding-left: 1.35rem;
}

th:last-child,
td:last-child {
    padding-right: 1.35rem;
}

th {
    color: #6d7d8d;
    background: #fafbfc;
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

td {
    font-size: 0.78rem;
}

td > small {
    display: block;
    margin-top: 0.25rem;
}

td input {
    min-height: 36px;
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
}

.row-muted {
    opacity: 0.68;
    background: #fafbfc;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.status {
    padding: 0.3rem 0.55rem;
}

.status-active {
    color: var(--success);
    background: var(--success-soft);
}

.status-off {
    color: #687787;
    background: #eef1f3;
}

.empty {
    padding: 2.2rem 1rem;
    text-align: center;
}

.empty strong {
    color: var(--navy);
}

.empty p {
    max-width: 520px;
    margin: 0.35rem auto 0;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.release-list {
    display: grid;
    margin: 0 -1.35rem -1.35rem;
}

.release {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.3fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.95rem 1.35rem;
    border-top: 1px solid var(--line);
}

.release-disabled {
    opacity: 0.62;
    background: #fafbfc;
}

.release-version,
.release-action,
.release-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.release-version > div {
    display: grid;
}

.release-version small {
    margin-top: 0.15rem;
}

.firmware-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    color: var(--aqua-dark);
    background: var(--aqua-soft);
    font-weight: 900;
}

.release-meta {
    flex-wrap: wrap;
    color: var(--ink-soft);
    font-size: 0.74rem;
}

.release-action {
    justify-content: flex-end;
}

.hash {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1.25rem 0;
    color: #718091;
    font-size: 0.72rem;
}

.footer code {
    color: #466078;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    padding: 2rem;
    place-items: center;
}

.login-card {
    width: min(440px, 100%);
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(23, 48, 72, 0.13);
}

.login-brand {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 1rem;
}

.login-brand h1 {
    font-size: 1.75rem;
}

.login-brand .eyebrow {
    margin-bottom: 0.25rem;
}

.login-card .stack {
    gap: 0.95rem;
    margin-top: 1.25rem;
}

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

    .release {
        grid-template-columns: 1fr auto;
    }

    .release-meta {
        grid-column: 1;
        grid-row: 2;
    }

    .release-action {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding: 0 1rem;
    }

    .admin-name {
        display: none;
    }

    .page {
        width: min(94vw, 680px);
        padding-top: 2.2rem;
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

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

    .stat {
        min-height: 92px;
    }

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

    .span-2 {
        grid-column: span 1;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions .button {
        width: 100%;
    }

    .table-wrap {
        overflow: visible;
        margin: 0;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 0.9rem;
        padding: 0.9rem;
        border: 1px solid var(--line);
        border-radius: 12px;
    }

    td,
    td:first-child,
    td:last-child {
        display: grid;
        grid-template-columns: 106px minmax(0, 1fr);
        align-items: center;
        padding: 0.45rem 0;
        border: 0;
    }

    td::before {
        content: attr(data-label);
        color: #718091;
        font-size: 0.67rem;
        font-weight: 800;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    td > small {
        grid-column: 2;
    }

    td input {
        max-width: none;
    }

    .row-actions {
        grid-column: 2;
    }

    .release {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .release-meta,
    .release-action {
        grid-column: 1;
        grid-row: auto;
        justify-content: flex-start;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer code {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 430px) {
    .login-shell {
        padding: 1rem;
    }

    .login-card {
        padding: 1.35rem;
    }

    .brand small {
        display: none;
    }

    .panel {
        padding: 1rem;
    }

    td,
    td:first-child,
    td:last-child {
        grid-template-columns: 88px minmax(0, 1fr);
    }
}

