:root {
    color-scheme: dark;
    --bg: #131920;
    --surface: #1b232d;
    --muted: #a5b2c0;
    --ink: #edf2f6;
    --line: #374451;
    --accent: #7db5d1;
    --bad: #ed9d9d;
    --good: #9cd4b1;
    font-family: "Segoe UI",system-ui,sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.45;
}

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

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none!important;
}

.site-header {
    border-bottom: 1px solid var(--line);
    padding: 13px clamp(16px,4vw,45px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #19212b;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand strong {
    font-size: 22px;
    letter-spacing: 2px;
}

.brand span {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1.6px;
    border-left: 1px solid var(--line);
    padding-left: 14px;
}

.header-right,.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-right>span {
    color: var(--muted);
    font-size: 12px;
}

main {
    max-width: 1180px;
    margin: auto;
    padding: 23px 24px 50px;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px;
}

.page-title h1 {
    font-size: 25px;
    line-height: 1.2;
    letter-spacing: -.4px;
    margin: 0 0 4px;
}

.page-title p,.section-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.version {
    color: var(--muted);
    font-size: 12px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 17px 19px;
    margin: 0 0 14px;
    border-radius: 2px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 13px;
}

.section-head h2,.section-head h3,h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.section-head span {
    font-size: 11px;
    color: var(--muted);
}

.account-head {
    margin: 17px 0 11px;
}

.account-head h2 {
    font-size: 17px;
}

.form-grid,.password-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.form-actions {
    grid-column: 1/-1;
    display: flex;
    gap: 16px;
    align-items: center;
}

label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

input,select {
    display: block;
    width: 100%;
    height: 35px;
    margin-top: 5px;
    padding: 7px 10px;
    font: inherit;
    color: var(--ink);
    border: 1px solid #4d5c6e;
    border-radius: 2px;
    background: #111820;
}

input:focus,select:focus {
    outline: 1px solid var(--accent);
}

button {
    height: 35px;
    background: #47758c;
    border: 1px solid #5787a0;
    border-radius: 2px;
    color: #f9fbfc;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0 14px;
    white-space: nowrap;
}

button:hover {
    background: #5587a1;
}

button:disabled {
    opacity: .5;
    cursor: default;
}

button.secondary {
    background: #263442;
    border-color: #4a5a6b;
}

button.secondary:hover {
    background: #334657;
}

.hint,.muted {
    font-size: 11px;
    color: var(--muted);
}

.hint {
    margin: 13px 0 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    border: 1px solid var(--line);
    margin-bottom: 14px;
    background: var(--surface);
}

.stat {
    padding: 13px 18px;
    border-right: 1px solid var(--line);
}

.stat:last-child {
    border-right: 0;
}

.stat small {
    color: var(--muted);
    display: block;
    font-size: 11px;
}

.stat strong {
    font-size: 23px;
    display: block;
    font-weight: 650;
    margin-top: 2px;
}

.two-up {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.two-up>.panel {
    min-width: 0;
}

.entry,.health-row {
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
}

.entry:first-child,.health-row:first-child {
    border-top: 0;
}

.entry strong,.health-row strong {
    display: block;
    font-weight: 600;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.entry small,.health-row small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.entry-badge,.health-state {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.health-state.ready {
    color: var(--good);
}

.health-state.error {
    color: var(--bad);
}

.health-state.planned,.health-state.disabled {
    color: var(--muted);
}

.inline-form {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.inline-form>div {
    display: flex;
    gap: 8px;
    align-items: end;
}

.inline-form button {
    margin-top: 5px;
}

.source-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 11px;
}

.source-toolbar select {
    margin: 0;
    max-width: 350px;
}

.password-panel p {
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 11px;
}

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

.notice {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--good);
    white-space: pre-wrap;
}

.notice.error {
    border-left-color: var(--bad);
    color: var(--bad);
}

footer {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin: 23px 0;
    color: var(--muted);
    font-size: 11px;
}

@media (max-width:760px) {
    main {
        padding: 17px 13px;
    }
    .site-header {
        padding: 12px 14px;
    }
    .form-grid,.password-form,.two-up {
        grid-template-columns: 1fr;
    }
    .stats {
        grid-template-columns: 1fr;
    }
    .stat {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .stat:last-child {
        border-bottom: 0;
    }
    .form-actions,.source-toolbar,.section-head {
        flex-wrap: wrap;
    }
    .panel {
        padding: 14px;
    }
}

/* Compact navigation and straightforward administration controls. No oversized cards. */
.site-header nav {
    display: flex;
    gap: 17px;
    flex-wrap: wrap;
    align-items: center;
}

.site-header nav a {
    font-size: 12px;
    color: var(--muted);
}

.site-header nav a:hover,.site-header nav a.current {
    color: var(--ink);
}

.narrow {
    max-width: 620px;
}

.narrow .panel label+label {
    margin-top: 12px;
}

.account-entry>div:first-child {
    min-width: 0;
}

.account-entry .actions {
    justify-content: flex-end;
}

.account-entry button {
    height: 30px;
    padding: 0 9px;
    font-size: 11px;
}

.check-inline {
    width: auto;
    height: auto;
    display: inline-block;
    vertical-align: middle;
    margin: 0 5px 0 0;
}

.inline-form#user-form {
    display: grid;
    grid-template-columns: minmax(240px,1fr) auto auto;
    align-items: end;
    gap: 16px;
    margin: 0;
    padding: 0;
    border: 0;
}

.inline-form#user-form>label:nth-child(2) {
    margin-bottom: 8px;
}

.inline-form#user-form>button {
    margin-bottom: 0;
}

#invite-result input {
    margin: 10px 0;
}

#invite-result p {
    font-size: 12px;
    color: var(--muted);
}

@media (max-width:800px) {
    .account-entry {
        align-items: flex-start;
        flex-direction: column;
    }
    .account-entry .actions {
        justify-content: flex-start;
    }
    #user-form.inline-form {
        grid-template-columns: 1fr;
    }
    .site-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

/* Detailed filesystem diagnostics appear only for authenticated administrators. */
.details-list {
    margin: 0;
}

.details-list > div {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.details-list dt {
    color: var(--muted);
    font-size: 12px;
}

.details-list dd {
    margin: 0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.brand-name {
    color: var(--ink);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 2px;
}

.test-log {
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 12px;
    min-height: 160px;
}

@media (max-width: 760px) {
    .details-list > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }
}

/* Backup Explorer: flat table layout that stays usable on narrow screens. */
.explorer-controls {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(270px, 2fr);
    gap: 14px;
}

.key-row {
    margin-top: 16px;
}

.key-row .source-toolbar input {
    flex: 1 1 300px;
}

.file-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.file-toolbar input[type="search"] {
    margin-left: auto;
    width: min(260px, 100%);
}

.breadcrumb {
    font-family: Consolas, monospace;
    color: var(--muted);
    overflow-wrap: anywhere;
}

button.compact {
    height: 28px;
    padding: 0 8px;
}

.preview-content pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: Consolas, monospace;
}

.preview-image {
    max-width: 100%;
    max-height: 550px;
    object-fit: contain;
}

@media (max-width: 720px) {
    .explorer-controls {
        grid-template-columns: 1fr;
    }

    .file-toolbar {
        flex-wrap: wrap;
    }
}

/* Compact piece-availability map inspired by classic P2P clients. */
.piece-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12px, 1fr));
    gap: 2px;
    max-height: 220px;
    overflow: auto;
    padding: 6px 0;
}
.piece { display: inline-block; height: 12px; min-width: 12px; border-radius: 1px; background: #64748b; }
.piece.verified { background: #3b82f6; }
.piece.pending { background: #eab308; }
.piece.missing { background: #ef4444; }
.piece-legend { display:flex; gap:16px; flex-wrap:wrap; font-size:12px; color:var(--muted); }
.piece-legend span { display:inline-flex; gap:5px; align-items:center; }
.piece-legend .piece { width:12px; }
.quota-form { display:flex; gap:12px; flex-wrap:wrap; align-items:end; }
.quota-form label { display:flex; flex-direction:column; gap:5px; }
.quota-form input { width:150px; }

.version-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 9px 2px;
    flex-wrap: wrap;
}

.version-entry span {
    flex: 1;
    min-width: 190px;
}

.quota-utilization {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.quota-utilization progress {
    flex: 1;
    height: 10px;
    accent-color: var(--accent);
}


/* Role pickers and compact management selects should not stretch to full panels. */
.account-entry .actions select,
#new-role {
    width: auto;
    min-width: 145px;
    max-width: min(290px, 78vw);
    height: 30px;
    padding: 4px 8px;
    margin-top: 0;
    font-size: 12px;
}

/* ARK 0.2.10 — compact, non-destructive management controls. */
.entry > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}
.entry-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}
.entry-actions .compact-button {
    padding: 4px 9px;
    min-height: 27px;
    font-size: 11px;
    width: auto;
    margin: 0;
}
@media (max-width: 700px) {
    .entry { flex-wrap: wrap; }
    .entry-actions { width: 100%; justify-content: flex-start; }
}

/* Super Administrator: compact quota/replica-policy editors in the overview. */
.family-vault-row .entry-actions { flex-wrap: wrap; }
.family-vault-row select {
    width: auto; height: 29px; min-width: 110px; max-width: 195px;
    margin: 0; padding: 3px 7px; font-size: 12px;
}
.family-vault-row .entry-actions button { width: auto; }
@media (max-width: 650px) {
    .family-vault-row .entry-actions { justify-content: flex-start; width: 100%; }
}
