:root {
    --bg: #f5f7f8;
    --surface: #ffffff;
    --ink: #182026;
    --muted: #5d6b76;
    --line: #d7dee3;
    --accent: #0b6e99;
    --accent-strong: #085a7d;
    --success: #2f6b4f;
    --danger: #b42318;
    --focus: #2a90c2;
    --shadow: 0 1px 2px rgba(24, 32, 38, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

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

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.brand {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: 0;
}

.brand span {
    color: var(--accent);
}

.admin-link,
.query-link {
    font-weight: 600;
    text-decoration: none;
}

.tool {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tool-header {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--line);
}

.tool-header h1 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 650;
}

.tool-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.tool-body {
    padding: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.field {
    display: grid;
    gap: 7px;
}

.field label {
    font-size: 0.9rem;
    font-weight: 600;
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.field input:focus,
.field select:focus {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
    border-color: var(--focus);
}

button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

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

button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

button.secondary {
    background: #eef2f4;
    color: var(--ink);
    border-color: var(--line);
}

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

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.status {
    margin-top: 18px;
    min-height: 24px;
    color: var(--muted);
}

.status.error {
    color: var(--danger);
}

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

.code-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.code-item {
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfc;
}

.code-value {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0;
}

.code-meta {
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.code-meta strong {
    color: var(--ink);
    font-weight: 650;
}

.empty {
    padding: 24px 0;
    color: var(--muted);
    text-align: center;
}

.section {
    margin-bottom: 22px;
}

.section:last-child {
    margin-bottom: 0;
}

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

.section-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.inline-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.inline-row .field {
    flex: 1 1 180px;
}

.current-password {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #eef6f9;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

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

th {
    color: var(--muted);
    font-weight: 650;
}

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

.hidden {
    display: none !important;
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 1120px);
        padding-top: 18px;
    }

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

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

    .code-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .inline-row {
        align-items: stretch;
    }
}
