:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --line: #d9dee7;
    --brand: #185c62;
    --brand-dark: #12464b;
    --danger: #b42318;
    --success: #1f7a4d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

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

.shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 248px;
    background: #102a2e;
    color: #fff;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand {
    font-weight: 700;
    font-size: 18px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar a {
    color: #d8f0f2;
    padding: 9px 10px;
    border-radius: 6px;
}

.sidebar a:hover {
    background: rgba(255,255,255,.08);
}

.main {
    flex: 1;
    padding: 28px;
    overflow-x: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

h1, h2 {
    margin: 0;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 17px;
    margin-bottom: 12px;
}

.panel, .auth-panel, .metric, .one-time-key {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    padding: 18px;
}

.panel.stack {
    margin-top: 18px;
}

.auth-panel {
    max-width: 430px;
    margin: 8vh auto;
    padding: 24px;
}

.auth-panel.wide {
    max-width: 860px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    padding: 16px;
}

.metric span {
    display: block;
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 30px;
}

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

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 14px;
}

legend {
    padding: 0 6px;
    font-weight: 700;
}

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

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
}

.check-row input {
    width: auto;
    margin-top: 3px;
}

button, .button, .ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--brand);
    border-radius: 6px;
    padding: 9px 13px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button, .button {
    background: var(--brand);
    color: #fff;
}

button:hover, .button:hover {
    background: var(--brand-dark);
}

.ghost {
    background: #fff;
    color: var(--brand);
}

.full {
    width: 100%;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

code {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.badge {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    background: #f9fafb;
}

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

.row-actions form {
    margin: 0;
}

.link-danger {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-weight: 400;
}

.link-danger:hover {
    background: transparent;
}

.alert {
    padding: 11px 13px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.alert.success {
    background: #eaf7f0;
    border: 1px solid #b7dec8;
    color: var(--success);
}

.alert.error {
    background: #fff0ed;
    border: 1px solid #f4c7c0;
    color: var(--danger);
}

.one-time-key {
    padding: 16px;
    margin-bottom: 18px;
    display: grid;
    gap: 6px;
    border-color: #e0b94f;
    background: #fff8e1;
}

.one-time-key strong {
    font-family: Consolas, Monaco, monospace;
    font-size: 21px;
}

.copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.copy-row strong,
.copy-row textarea {
    flex: 1;
}

.copy-row.align-start {
    align-items: flex-start;
}

.button.small,
button.small {
    padding: 8px 10px;
    font-size: 13px;
}

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

.truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-form {
    margin-top: 16px;
}

.wrap-token {
    overflow-wrap: anywhere;
}

.mono-block {
    min-height: 170px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

@media (max-width: 860px) {
    .shell {
        display: block;
    }

    .sidebar {
        width: auto;
    }

    .metrics, .grid-2 {
        grid-template-columns: 1fr;
    }

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

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

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