@font-face {
    font-family: "Nunito";
    src: url("/uploads/fonts/Nunito/static/Nunito-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Nunito";
    src: url("/uploads/fonts/Nunito/static/Nunito-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Nunito";
    src: url("/uploads/fonts/Nunito/static/Nunito-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --white: #ffffff;
    --black: #000000;
    --teal: #009ca7;
    --orange: #f05423;
    --page-bg: linear-gradient(135deg, #f5f6f7 0%, #dde1e5 100%);
    --text: #151719;
    --muted: #5f6670;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --surface-border: rgba(17, 19, 22, 0.14);
    --topbar-bg: rgba(16, 17, 19, 0.88);
    --nav-text: #f4f5f6;
    --button-bg: #1f2226;
    --button-hover: #000000;
    --link: #252a30;
    --link-hover: #009ca7;
    --shadow: 0 24px 70px rgba(16, 17, 19, 0.16);
    --grid-line: rgba(0, 0, 0, 0.045);
}

:root[data-theme="dark"] {
    --page-bg: linear-gradient(135deg, #08090a 0%, #121416 52%, #1d2024 100%);
    --text: #f0f2f4;
    --muted: #a2a9b2;
    --surface: rgba(18, 20, 22, 0.72);
    --surface-strong: rgba(29, 32, 36, 0.9);
    --surface-border: rgba(255, 255, 255, 0.1);
    --topbar-bg: rgba(4, 5, 6, 0.72);
    --nav-text: #f0f2f4;
    --button-bg: #f0f2f4;
    --button-hover: #cbd1d6;
    --link: #e2e6ea;
    --link-hover: #f05423;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    --grid-line: rgba(255, 255, 255, 0.045);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background: var(--page-bg);
    background-attachment: fixed;
    font-family: "Nunito", Arial, Helvetica, sans-serif;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 80%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 14px 24px;
    color: var(--nav-text);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--surface-border);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(18px) saturate(110%);
    -webkit-backdrop-filter: blur(18px) saturate(110%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--nav-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
}

.brand:hover {
    color: var(--orange);
}

.brand img {
    width: auto;
    height: 44px;
    max-width: 220px;
    object-fit: contain;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-left: auto;
}

.panic-form {
    margin: 0;
}

.panic-form button {
    min-height: 32px;
    padding: 5px 10px;
    color: var(--white);
    background: var(--orange);
    border: 1px solid transparent;
    font-size: 13px;
}

.panic-form button:hover {
    background: #b93612;
}

.topnav a {
    color: var(--nav-text);
    font-weight: 600;
    text-decoration: none;
}

.topnav a:hover {
    color: var(--orange);
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(110%);
    -webkit-backdrop-filter: blur(18px) saturate(110%);
}

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--text);
    font-family: "Nunito", Arial, Helvetica, sans-serif;
    font-weight: 700;
    letter-spacing: 0;
}

h1 {
    position: relative;
    padding-left: 14px;
    font-size: clamp(24px, 3vw, 34px);
}

h1::before {
    position: absolute;
    top: 0.18em;
    bottom: 0.18em;
    left: 0;
    width: 3px;
    content: "";
    background: var(--teal);
    border-radius: 999px;
}

h2 {
    font-size: 18px;
    font-weight: 700;
}

p {
    color: var(--muted);
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}

.stack {
    display: grid;
    gap: 16px;
    max-width: 420px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-weight: 700;
}

input,
button {
    min-height: 42px;
    border-radius: 6px;
    font: inherit;
}

input {
    width: 100%;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--surface-border);
    padding: 8px 10px;
}

input:focus {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

button {
    border: 0;
    padding: 8px 14px;
    color: var(--white);
    background: var(--button-bg);
    cursor: pointer;
    font-weight: 700;
}

:root[data-theme="dark"] button {
    color: var(--black);
}

button:hover {
    background: var(--button-hover);
}

.muted-button {
    color: var(--text);
    background: transparent;
    border: 1px solid var(--surface-border);
}

:root[data-theme="dark"] .muted-button {
    color: var(--text);
}

.muted-button:hover {
    color: var(--white);
    background: var(--orange);
    border-color: var(--orange);
}

.button-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 8px 14px;
    color: var(--white);
    background: var(--button-bg);
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
}

.button-link:hover {
    color: var(--white);
    background: var(--button-hover);
}

:root[data-theme="dark"] .button-link {
    color: var(--black);
}

.theme-toggle {
    min-width: 140px;
}

.settings-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
    padding: 18px;
    background: var(--surface-strong);
    border: 1px solid var(--surface-border);
    border-left: 3px solid var(--teal);
    border-radius: 8px;
}

.settings-panel-stack {
    display: grid;
    align-items: start;
}

.settings-panel p {
    margin-bottom: 0;
}

.detail-panel {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 20px;
    margin: 18px 0;
    padding: 18px;
    background: var(--surface-strong);
    border: 1px solid var(--surface-border);
    border-left: 3px solid var(--teal);
    border-radius: 8px;
}

.detail-panel-stack {
    display: block;
}

.detail-list {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 8px 14px;
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(320px, 1.2fr);
    gap: 12px;
    align-items: end;
    width: 100%;
}

.form-action {
    grid-column: 1 / -1;
}

.form-action button {
    width: auto;
}

.compact-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.compact-form input {
    min-width: 180px;
}

.password-generate-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-generate-row input {
    min-width: 220px;
}

.password-generate-row button,
.compact-form button,
.actions-cell button,
.actions-cell .button-link,
.details-toggle {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
    line-height: 1.2;
}

@media (max-width: 900px) {
    .inline-form,
    .detail-panel {
        grid-template-columns: 1fr;
    }

    .password-generate-row {
        align-items: stretch;
        flex-direction: column;
    }

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


.table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 16px 0 28px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
}

.table-tools {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin: 16px 0;
}

.table-tools label {
    min-width: 190px;
}

.table-tools select {
    min-height: 42px;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
    background: var(--surface-strong);
}

.sort-heading {
    min-height: 0;
    padding: 0;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.sort-heading:hover {
    color: var(--orange);
    background: transparent;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--surface-border);
}

.data-table th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

:root[data-theme="dark"] .data-table th,
:root[data-theme="dark"] .sort-heading {
    color: #d8dde3;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0 6px 6px 0;
    padding: 3px 8px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pill-ok {
    border-color: rgba(0, 156, 167, 0.45);
}

.pill-missing {
    border-color: rgba(240, 84, 35, 0.55);
    color: var(--orange);
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.actions-cell form {
    margin: 0;
}

.toggle-form {
    margin: 0;
}

.status-toggle {
    display: inline-grid;
    place-items: center;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.status-toggle:hover {
    background: transparent;
}

.details-toggle {
    min-height: 34px;
    padding: 6px 10px;
    color: var(--nav-text);
    background: var(--button-bg);
    border: 1px solid transparent;
}

:root[data-theme="dark"] .details-toggle {
    color: var(--black);
    background: transparent;
    background: var(--button-bg);
}

.details-toggle:hover {
    color: var(--white);
    background: var(--orange);
}

.status-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.status-ok {
    color: #33d6df;
}

.status-bad {
    color: #ff7b4f;
}

.details-action {
    margin-top: 16px;
}

.details-row td {
    background: rgba(0, 0, 0, 0.035);
}

:root[data-theme="dark"] .details-row td {
    background: rgba(255, 255, 255, 0.035);
}

.details-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
    gap: 24px;
}

.details-grid dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 12px;
    margin: 0;
}

.details-grid dt {
    color: var(--muted);
    font-weight: 700;
}

.details-grid dd {
    margin: 0;
}

.plugin-list {
    display: grid;
    gap: 6px;
    max-height: 260px;
    overflow: auto;
    margin: 0;
    padding-left: 18px;
}

.plugin-list span {
    color: var(--muted);
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
}

.alert-error {
    color: #7f1d1d;
    background: #fde8e8;
    border: 1px solid #f8b4b4;
}

.alert-success {
    color: #064e3b;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(420px, calc(100% - 36px));
    padding: 14px 16px;
    color: var(--white);
    background: rgba(20, 22, 24, 0.9);
    border: 1px solid var(--surface-border);
    border-top: 2px solid var(--orange);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(16px) saturate(110%);
    -webkit-backdrop-filter: blur(16px) saturate(110%);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
