:root {
    --ink: #26241f;
    --muted: #747269;
    --line: #d9d2c5;
    --paper: #f3efe6;
    --white: #fffdf8;
    --navy: #202722;
    --navy-2: #2b342e;
    --cyan: #3c756d;
    --cyan-deep: #28554f;
    --gold: #b1874a;
    --danger: #984943;
    --success: #35705a;
    --shadow: 0 10px 26px rgba(38, 36, 31, 0.07);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    line-height: 1.55;
}

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

a:hover {
    text-decoration: underline;
}

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

h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

h2 {
    margin-bottom: 8px;
    font-size: 23px;
    line-height: 1.25;
}

h3 {
    margin-bottom: 6px;
    font-size: 18px;
}

h1,
h2,
h3,
.brand strong {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-weight: 700;
}

code,
.token-link {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
}

input,
select,
textarea,
button {
    font: inherit;
}

label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 14px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--white);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(14, 165, 183, 0.14);
}

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

.eyebrow {
    margin-bottom: 10px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 16px;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.button:hover {
    text-decoration: none;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.button-primary {
    color: #ffffff;
    background: var(--cyan-deep);
}

.button-secondary {
    color: var(--navy);
    border-color: #cad5e2;
    background: #ffffff;
}

.button-danger-soft {
    color: #9f243b;
    border-color: #f1c8d1;
    background: #fff5f7;
}

.button-quiet {
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.button-small {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 13px;
}

.boss-access {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    border-bottom: 1px solid #e7e1d7;
    padding: 14px 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.boss-access a {
    margin-left: auto;
    font-weight: 700;
}

.user-agent-cell {
    max-width: 520px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 12px;
}

.user-agent-cell > strong {
    color: var(--ink);
    font-size: 13px;
}

.client-device-badge {
    display: inline-flex;
    margin-left: 7px;
    border-radius: 999px;
    padding: 2px 7px;
    color: #40536a;
    background: #eaf0f5;
    font-size: 11px;
    font-weight: 750;
}

.client-device-badge.is-apple {
    color: #185c48;
    background: #e6f6ef;
}

.client-device-badge.is-android {
    color: #315e37;
    background: #edf6e9;
}

.client-device-badge.is-desktop {
    color: #4e4d69;
    background: #eeedf6;
}

.ua-details {
    margin-top: 5px;
}

.ua-details summary {
    width: fit-content;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
}

.ua-details code {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.button-wide {
    width: 100%;
}

.inline-form,
.inline-form-row {
    display: inline-flex;
    align-items: end;
    gap: 12px;
    margin: 0;
}

.inline-form-row {
    display: flex;
    width: 100%;
}

.grow {
    flex: 1;
}

.link-button,
.text-link {
    border: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font-weight: 650;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 700;
}

.alert {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    border: 1px solid;
    border-radius: 12px;
    margin: 16px 0;
    padding: 12px 14px;
}

.alert-success {
    color: #0f684b;
    border-color: #bce4d3;
    background: #effbf5;
}

.alert-error {
    color: #93243d;
    border-color: #f0c4ce;
    background: #fff4f6;
}

.badge,
.count-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.badge-neutral,
.count-chip {
    color: #506075;
    background: #edf2f7;
}

.badge-question {
    color: #9d263d;
    background: #ffe8ed;
}

.badge-viewed {
    color: #0e6b4d;
    background: #e7f8f0;
}

.badge-category {
    color: #155e75;
    background: #e0f2fe;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 22px;
    padding: clamp(18px, 3vw, 28px);
    background: var(--white);
    box-shadow: 0 4px 14px rgba(38, 36, 31, 0.04);
}

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

.storage-strip {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr);
    gap: 18px;
    align-items: center;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 10px;
    margin-bottom: 22px;
    padding: 16px 18px;
    background: var(--white);
}

.storage-primary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-width: 0;
}

.storage-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.storage-path {
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 12px;
}

.storage-metrics {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--muted);
    font-size: 13px;
}

.storage-metrics strong {
    color: var(--ink);
}

.storage-location-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.storage-location-form .checkbox-line {
    margin: 0 0 8px;
    align-self: center;
}

.storage-path-input {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #334155;
    font-size: 14px;
    font-weight: 650;
}

.storage-path-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.storage-path-picker input {
    min-width: 0;
}

.storage-path-picker .button {
    flex: 0 0 auto;
}

.cleanup-panel {
    padding-top: 20px;
    padding-bottom: 22px;
}

.cleanup-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    border-radius: 9px;
    padding: 12px 14px;
    color: var(--muted);
    background: #f7f3ea;
    font-size: 13px;
}

.cleanup-summary strong {
    color: var(--ink);
}

.cleanup-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 12px;
    margin-top: 14px;
}

.cleanup-settings-form,
.cleanup-now-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
}

.cleanup-settings-form .checkbox-line {
    margin: 0;
}

.cleanup-days-field {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.cleanup-days-field input {
    width: 86px;
    min-height: 38px;
    padding: 7px 9px;
}

.cleanup-now-form {
    border-color: #dfcbc7;
    background: #fbf5f3;
}

.folder-picker {
    width: min(680px, calc(100% - 28px));
    max-height: min(82vh, 760px);
    border: 1px solid #d8d2c6;
    border-radius: 14px;
    padding: 0;
    color: var(--ink);
    background: #fbf8f1;
    box-shadow: 0 18px 48px rgba(43, 50, 47, 0.18);
}

.folder-picker::backdrop {
    background: rgba(35, 42, 39, 0.35);
}

.folder-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding: 20px 22px 15px;
}

.folder-picker-header h2 {
    margin: 0;
}

.folder-picker-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: #f0ece3;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.folder-picker-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 14px 22px 0;
}

.folder-picker-shortcut {
    border: 1px solid #d7d0c3;
    border-radius: 999px;
    padding: 6px 11px;
    color: var(--cyan-deep);
    background: #f5f1e8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.folder-picker-location {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px 8px;
}

.folder-picker-location code {
    overflow-wrap: anywhere;
    min-width: 0;
    color: var(--ink);
    font-size: 12px;
}

.folder-picker-list {
    display: grid;
    gap: 3px;
    overflow-y: auto;
    max-height: 340px;
    margin: 0 22px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px;
    background: #fffdf8;
}

.folder-picker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    padding: 7px 9px;
    color: var(--ink);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.folder-picker-item::before {
    content: "▸";
    color: var(--cyan);
    font-size: 11px;
}

.folder-picker-item:hover {
    background: #eef3f1;
}

.folder-picker-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-picker-status {
    min-height: 19px;
    margin: 8px 22px 0;
    color: var(--muted);
    font-size: 12px;
}

.folder-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding: 14px 22px 18px;
}

.boss-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-storage {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 18px;
}

.empty-state,
.empty-inline {
    color: var(--muted);
    text-align: center;
}

.empty-state {
    padding: 32px;
}

.tiny-note {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* Landing and authentication */

.landing-body,
.auth-body {
    display: grid;
    min-height: 100vh;
    color: #eee9de;
    background-color: #1d2420;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
    background-size: 32px 32px;
}

.landing,
.auth-shell {
    position: relative;
    display: grid;
    place-items: center;
    width: min(1100px, calc(100% - 36px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 48px 0;
}

.landing::before,
.auth-shell::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: min(42vh, 420px);
    background: url("/static/ink-ridge.svg") center bottom / cover no-repeat;
    opacity: .5;
    pointer-events: none;
}

.landing-glow {
    display: none;
}

.landing-card,
.auth-card {
    position: relative;
    width: min(720px, 100%);
    border: 1px solid rgba(239, 231, 216, 0.18);
    border-radius: 16px;
    padding: clamp(30px, 6vw, 66px);
    background: #202823;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    z-index: 1;
}

.landing-card h1,
.auth-card h1 {
    color: #ffffff;
}

.landing-copy,
.auth-card .muted {
    max-width: 58ch;
    color: #b9b9ad;
    font-size: 16px;
}

.landing-actions {
    margin: 30px 0 20px;
}

.landing-footnote {
    margin: 0;
    color: #93988f;
    font-size: 13px;
}

.compact-card {
    max-width: 580px;
}

.auth-card {
    width: min(480px, 100%);
}

.auth-card .back-link {
    color: #aab4a9;
}

.auth-card label {
    color: #d8e3ef;
}

.auth-card input {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
}

.auth-card .button {
    width: 100%;
    margin-top: 6px;
}

.auth-card .tiny-note {
    color: #93988f;
}

.auth-secondary-action {
    margin: 18px 0 0;
    text-align: center;
}

.auth-secondary-action a {
    color: #9edce2;
    font-size: 13px;
}

.auth-card code {
    color: #c8d6e6;
}

.stack-form {
    display: grid;
    gap: 16px;
    margin-top: 28px;
}

/* Admin */

.admin-body {
    min-height: 100vh;
    background-color: var(--paper);
    background-image: linear-gradient(rgba(66, 59, 47, 0.035) 1px, transparent 1px);
    background-size: 100% 34px;
}

.admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
    padding: 12px max(24px, calc((100vw - 1380px) / 2));
    color: #eee9df;
    background: var(--navy);
    box-shadow: 0 3px 12px rgba(25, 31, 27, 0.16);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff8eb;
    background: #8f443b;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #aab0a7;
    font-size: 11px;
    letter-spacing: 0.1em;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
}

.admin-nav a,
.admin-nav .link-button {
    color: #d3d5ce;
}

.admin-shell {
    width: min(1380px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 76px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-heading h1 {
    color: var(--navy);
}

.heading-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.boss-panel {
    padding: 0;
    overflow: hidden;
}

.boss-heading {
    margin: 0;
    padding: 24px 28px 20px;
    background: #fbf8f1;
}

.boss-panel > *:not(.boss-heading) {
    margin-left: 28px;
    margin-right: 28px;
}

.token-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px dashed #c9c0b1;
    border-radius: 12px;
    margin-top: 20px;
    padding: 14px 16px;
    background: #f8f4eb;
}

.token-box.token-box-links {
    display: block;
    padding: 0;
}

.token-link-stack {
    display: grid;
}

.token-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
}

.token-link-row > div {
    flex: 1 1 auto;
    min-width: 0;
}

.token-link-row .button {
    flex: 0 0 auto;
}

.token-link-row + .token-link-row {
    border-top: 1px dashed #d7cfc0;
}

.token-link-row-secondary {
    background: rgba(255, 255, 255, 0.28);
}

.field-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.token-link {
    display: block;
    overflow-wrap: anywhere;
    color: #385f58;
    font-size: 13px;
}

.account-list {
    display: grid;
    gap: 18px;
    margin-top: 22px;
}

.account-block {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
}

.account-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.account-index {
    color: var(--cyan-deep);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.account-heading h3 {
    margin: 0;
}

.account-login-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.account-credentials-editor {
    margin: -2px 0 16px;
}

.account-credentials-editor summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    border-radius: 7px;
    padding: 5px 8px;
    color: var(--muted);
    background: #f3eee4;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.account-credentials-editor summary::-webkit-details-marker {
    display: none;
}

.account-credentials-editor summary::before {
    content: "+";
    color: var(--cyan-deep);
    font-size: 14px;
    line-height: 1;
}

.account-credentials-editor[open] summary::before {
    content: "\2212";
}

.account-credentials-editor[open] summary {
    margin-bottom: 8px;
}

.credentials-edit-hint {
    color: var(--cyan-deep);
    font-weight: 700;
}

.account-create-disclosure {
    margin-top: 20px;
}

.account-create-disclosure summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    border-radius: 7px;
    padding: 6px 9px;
    color: var(--cyan-deep);
    background: #eef4ef;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
}

.account-create-disclosure summary::-webkit-details-marker {
    display: none;
}

.account-create-disclosure summary::before {
    content: "+";
    font-size: 14px;
    line-height: 1;
}

.account-create-disclosure[open] summary::before {
    content: "\2212";
}

.account-create-disclosure .account-create-form {
    margin-top: 10px;
}

.account-credentials-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto;
    align-items: end;
    gap: 10px;
    border: 1px solid #e1dbcf;
    border-radius: 10px;
    margin-bottom: 16px;
    padding: 12px;
    background: #fbf8f1;
}

.account-create-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
    gap: 10px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e6edf4;
    text-align: left;
    vertical-align: top;
}

th {
    color: #64748b;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.table-actions {
    white-space: nowrap;
}

.table-actions a {
    margin-right: 12px;
    font-weight: 700;
}

.character-form {
    display: grid;
    grid-template-columns: 1.3fr 1fr 0.8fr auto;
    align-items: end;
    gap: 10px;
    border-top: 1px dashed #dce5ee;
    margin-top: 16px;
    padding-top: 16px;
}

.sub-form {
    border-top: 1px dashed #dce5ee;
    margin-top: 22px !important;
    margin-bottom: 28px !important;
    padding-top: 20px;
}

.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 22px;
}

.upload-form {
    padding: 0;
    overflow: hidden;
}

.form-section {
    padding: 24px 28px;
    border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
    border-bottom: 0;
}

#upload-categories {
    scroll-margin-top: 16px;
}

.select-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dropzone {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 190px;
    border: 2px dashed #b8c9d8;
    border-radius: 16px;
    margin-top: 14px;
    padding: 24px;
    text-align: center;
    background: #fbfaf6;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone.is-dragging {
    border-color: var(--cyan);
    background: #eefbfc;
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.category-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.category-picker label {
    display: block;
    position: relative;
    cursor: pointer;
}

.category-picker label[hidden] {
    display: none;
}

.category-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.category-picker span {
    display: grid;
    place-items: center;
    min-height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: #334155;
    background: #ffffff;
    font-weight: 750;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.category-picker input:checked + span {
    color: #ffffff;
    border-color: var(--cyan);
    background: var(--cyan-deep);
    box-shadow: none;
}

.category-picker input:focus-visible + span {
    outline: 3px solid rgba(14, 165, 183, 0.22);
}

.category-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.category-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 4px 11px;
    color: var(--muted);
    background: var(--white);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
}

.category-page-button.is-active {
    color: #ffffff;
    border-color: var(--cyan-deep);
    background: var(--cyan-deep);
}

.category-page-button:hover {
    text-decoration: none;
}

.category-admin-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.category-admin-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

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

.category-delete {
    color: var(--danger);
    font-size: 12px;
}

.dropzone-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: var(--cyan-deep);
    background: #ddf5f7;
    font-size: 31px;
    font-weight: 300;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.preview-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 0;
    background: #fff;
}

.preview-card img {
    display: block;
    width: 100%;
    height: 76px;
    object-fit: cover;
}

.preview-card figcaption {
    overflow: hidden;
    padding: 6px 8px;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-extra {
    align-self: center;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.batch-toolbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: var(--white);
}

.batch-toolbar label {
    min-width: 180px;
}

.batch-items {
    display: grid;
    gap: 14px;
}

.batch-item {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 14px;
    background: var(--white);
}

.batch-preview {
    display: block;
    align-self: start;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 9px;
    background: #182022;
}

.batch-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.batch-item-body {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
}

.batch-filename {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ocr-result,
.batch-suggestions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 9px;
}

.batch-suggestions .field-label {
    width: 100%;
    margin: 0;
}

.batch-item-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.3fr);
    gap: 10px;
}

.batch-submit-bar {
    margin-top: 18px;
}

.batch-discard-form {
    margin: 14px 0 30px;
}

.batch-discard-form .link-button {
    color: var(--danger);
    font-size: 12px;
}

.upload-form > .button-wide {
    width: calc(100% - 56px);
    margin: 22px 28px 0;
}

.upload-form > .tiny-note {
    margin: 12px 28px 28px;
}

.result-list {
    padding: 0 28px;
}

.upload-help {
    position: sticky;
    top: 22px;
}

.clean-list {
    display: grid;
    gap: 10px;
    margin: 16px 0 0;
    padding-left: 18px;
    color: #475569;
    font-size: 14px;
}

.filter-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-form label {
    min-width: 160px;
}

.timeline {
    display: grid;
    gap: 16px;
}

.timeline-item {
    display: grid;
    grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
    gap: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: #fff;
}

.shot-link {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 11px;
    background: #dfe8f0;
}

.shot-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.shot-link:hover .shot-thumb {
    transform: scale(1.025);
}

.shot-open {
    position: absolute;
    right: 10px;
    bottom: 10px;
    border-radius: 999px;
    padding: 5px 10px;
    color: #fff;
    background: rgba(10, 20, 33, 0.75);
    font-size: 11px;
    font-weight: 700;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 6px 4px 0;
}

.timeline-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--muted);
    font-size: 13px;
}

.description-form {
    display: grid;
    gap: 8px;
}

.description-form .button {
    width: fit-content;
}

.hash-line {
    overflow: hidden;
    margin: auto 0 0;
    color: #94a3b8;
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    background: #fff;
}

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

.metric-card strong {
    font-size: 42px;
    line-height: 1;
}

.metric-success {
    border-color: #bde3d3;
    background: #f3fcf8;
}

.metric-danger {
    border-color: #f0c5cf;
    background: #fff6f8;
}

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

.settings-list {
    display: grid;
    gap: 10px;
    margin: 20px 0;
}

.settings-list > div {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #f8fbfd;
}

.settings-list dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.settings-list dd {
    margin: 0;
}

.config-snippet {
    overflow-x: auto;
    border: 1px solid #d9e4ee;
    border-radius: 12px;
    padding: 14px;
    color: #dff8fb;
    background: var(--navy);
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 13px;
}

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

.tunnel-option {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    background: #fbfdfe;
}

.tunnel-option h3 {
    margin-top: 12px;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.link-grid a {
    display: grid;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    color: var(--ink);
    background: #f8fbfd;
}

.link-grid a:hover {
    border-color: #9fd0d7;
    text-decoration: none;
}

.link-grid span {
    color: var(--muted);
    font-size: 12px;
}

.checkbox-line {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.checkbox-line input,
td input[type="radio"] {
    width: 18px;
    min-height: 18px;
    margin-top: 3px;
}

.tunnel-state {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #d8e1eb;
    border-radius: 14px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #f7f9fb;
}

.tunnel-state > div {
    display: grid;
    gap: 2px;
}

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

.tunnel-state .text-link {
    margin-left: auto;
    color: var(--cyan-deep);
    font-size: 13px;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 5px rgba(148, 163, 184, 0.12);
    flex: 0 0 auto;
}

.tunnel-state.is-running {
    border-color: #b7e2cf;
    background: #f1fbf6;
}

.tunnel-state.is-running .status-dot {
    background: #16a36a;
    box-shadow: 0 0 0 5px rgba(22, 163, 106, 0.14);
}

.tunnel-stop-form {
    margin: 0 0 18px;
}

/* Boss portal */

.portal-body {
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--paper);
    background-image: linear-gradient(rgba(66, 59, 47, 0.035) 1px, transparent 1px);
    background-size: 100% 34px;
}

.portal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: max(34px, 6vw) max(20px, calc((100vw - 1180px) / 2)) 26px;
    position: relative;
    overflow: hidden;
}

.portal-header::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -50px;
    width: min(620px, 60vw);
    height: 240px;
    background: url("/static/ink-ridge.svg") center bottom / contain no-repeat;
    opacity: .24;
    pointer-events: none;
}

.portal-header > * {
    position: relative;
    z-index: 1;
}

.portal-header h1 {
    color: var(--ink);
}

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

.portal-header .back-link {
    color: var(--cyan-deep);
}

.portal-header .button-quiet {
    color: var(--ink);
    border-color: var(--line);
    background: var(--white);
}

.portal-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-toggle {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 11px;
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.theme-toggle:hover {
    border-color: var(--cyan);
}

.view-switch {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--white);
}

.view-switch a {
    padding: 7px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.view-switch a:hover {
    color: var(--cyan-deep);
    text-decoration: none;
}

.view-switch a.is-active {
    color: #ffffff;
    background: var(--cyan-deep);
}

.account-scope {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0;
    border: 1px solid #c8d6cf;
    border-radius: 999px;
    padding: 6px 12px;
    color: var(--muted);
    background: #f4f8f5;
    font-size: 12px;
}

.account-scope strong {
    color: var(--ink);
}

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

.token-entry-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 28px 16px;
}

.token-entry-card {
    width: min(470px, 100%);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(24px, 5vw, 38px);
    background: var(--white);
    box-shadow: var(--shadow);
}

.token-entry-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 28px;
    color: var(--ink);
}

.token-entry-brand strong,
.token-entry-brand small {
    display: block;
}

.token-entry-brand strong {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 18px;
}

.token-entry-brand small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .08em;
}

.token-entry-card h1 {
    color: var(--ink);
    font-size: clamp(28px, 6vw, 38px);
}

.token-entry-card .muted {
    color: var(--muted);
}

.token-entry-card input {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 13px;
}

.entry-section-title {
    margin: 26px 0 0;
    font-size: 18px;
}

.entry-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.entry-divider::before,
.entry-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 18px;
}

.character-selector-panel {
    margin-bottom: 22px;
}

.character-selector-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.character-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 0 9px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.character-choice {
    display: flex;
    flex: 0 0 215px;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px 10px;
    color: var(--ink);
    background: var(--white);
    scroll-snap-align: start;
}

.character-choice:hover {
    border-color: #9ebdb2;
    text-decoration: none;
}

.character-choice.is-active {
    border-color: var(--cyan-deep);
    background: #f0f6f2;
}

.character-choice-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.character-choice-top strong {
    overflow: hidden;
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-choice-count {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
}

.character-choice-meta {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-choice-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 7px;
    min-height: 20px;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.character-choice-foot time {
    white-space: nowrap;
}

.today-uploaded {
    border-radius: 999px;
    padding: 2px 7px;
    color: #0d6b4d;
    background: #e5f7ef;
    font-size: 11px;
    font-weight: 800;
}

.selection-hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.owner-gallery {
    display: grid;
    gap: 26px;
    padding-bottom: 18px;
}

.owner-day-group + .owner-day-group {
    margin-top: 14px;
}

.owner-day-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px 10px;
    margin: 18px 0 10px;
}

.owner-day-title {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.owner-day-count {
    border-radius: 999px;
    padding: 2px 8px;
    color: var(--cyan-deep);
    background: #edf5f1;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.owner-day-line {
    flex: 1 1 60px;
    min-width: 30px;
    height: 1px;
    background: linear-gradient(90deg, var(--line), transparent);
}

.owner-gallery-character {
    min-width: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
}

.owner-gallery-character:last-child {
    border-bottom: 0;
}

.owner-gallery-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 13px;
}

.owner-gallery-heading h2 {
    margin: 2px 0 3px;
    color: var(--ink);
    font-size: 30px;
}

.owner-gallery-heading p {
    margin: 0;
}

.owner-gallery-heading .text-link {
    flex: 0 0 auto;
    padding-bottom: 4px;
    color: var(--cyan-deep);
    font-size: 13px;
    font-weight: 700;
}

.owner-gallery-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.owner-gallery-thumb {
    flex: 0 0 auto;
    max-width: 260px;
    min-width: 0;
    color: var(--ink);
    scroll-snap-align: start;
}

.owner-gallery-thumb:hover {
    text-decoration: none;
}

.owner-gallery-image {
    display: block;
    line-height: 0;
}

.owner-gallery-thumb:hover .owner-gallery-image {
    opacity: 0.88;
}

.owner-gallery-category,
.owner-photo-category {
    display: flex;
    align-items: center;
    min-height: 24px;
    margin-bottom: 5px;
}

.owner-photo-category {
    max-width: 360px;
}

.owner-gallery-image img {
    display: block;
    width: auto;
    height: auto;
    max-width: 250px;
    max-height: 150px;
    border-radius: 7px;
}

.owner-gallery-caption {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    margin-top: 7px;
}

.owner-gallery-caption time {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.owner-gallery-description {
    display: block;
    overflow: hidden;
    max-width: 250px;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 3px;
    vertical-align: 1px;
    background: #9aa2a8;
}

.day-dot.is-today {
    background: #17a36a;
    box-shadow: 0 0 0 3px rgba(23, 163, 106, 0.12);
}

.day-dot.is-past {
    background: #9aa2a8;
}

.character-card {
    display: flex;
    flex-direction: column;
    min-height: 230px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    color: var(--ink);
    background: var(--white);
    box-shadow: 0 3px 12px rgba(38, 36, 31, 0.045);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.character-card:hover {
    border-color: #a9c5ba;
    text-decoration: none;
    background: #fffefa;
}

.character-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.school-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid #b7d3c8;
    border-radius: 8px;
    color: var(--cyan-deep);
    background: #edf5f1;
    font-size: 21px;
    font-weight: 900;
}

.character-card h2 {
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 26px;
}

.character-card p {
    color: var(--muted);
}

.character-card .count-chip {
    color: var(--cyan-deep);
    background: #edf5f1;
}

.character-card-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 22px;
    color: var(--muted);
    font-size: 12px;
}

.portal-filter {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 22px;
    padding: 16px;
    background: var(--white);
}

.portal-date-filter {
    margin-bottom: 10px;
}

.portal-date-filter > summary {
    width: fit-content;
    border-radius: 6px;
    padding: 4px 7px;
    color: var(--cyan-deep);
    background: #eef4ef;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
}

.portal-date-filter > summary::-webkit-details-marker {
    display: none;
}

.portal-date-filter > summary::before {
    content: "▸ ";
}

.portal-date-filter[open] > summary::before {
    content: "▾ ";
}

.portal-date-filter[open] > summary {
    margin-bottom: 7px;
}

.portal-filter label {
    min-width: 150px;
    color: var(--ink);
}

.portal-filter input {
    color: var(--ink);
    border-color: #c9c2b5;
    background: #fffefa;
}

.portal-filter .text-link {
    padding: 8px 4px;
    color: var(--cyan-deep);
}

.category-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 0 22px;
    padding: 2px 0 8px;
    scrollbar-width: thin;
}

.category-filter a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 13px;
    color: var(--ink);
    background: var(--white);
    font-size: 13px;
    white-space: nowrap;
}

.category-filter a:hover {
    border-color: #a9c5ba;
    text-decoration: none;
}

.category-filter a.is-active {
    color: #ffffff;
    border-color: var(--cyan-deep);
    background: var(--cyan-deep);
}

.category-filter a span {
    min-width: 18px;
    border-radius: 999px;
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.09);
    text-align: center;
    font-size: 11px;
}

.portal-timeline {
    display: grid;
    gap: 13px;
}

.portal-shot {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 3px 12px rgba(38, 36, 31, 0.045);
}

.portal-shot-image {
    display: block;
    aspect-ratio: 4 / 3;
    min-height: 0;
    background: #182022;
}

.portal-shot-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
}

.owner-photo-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 2px 0 18px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.owner-photo-row > .portal-empty {
    flex: 1 0 100%;
}

.owner-photo-card {
    flex: 0 0 auto;
    max-width: 380px;
    scroll-snap-align: start;
}

.owner-photo-image {
    display: block;
    line-height: 0;
}

.owner-photo-image img {
    display: block;
    width: auto;
    height: auto;
    max-width: 360px;
    max-height: 220px;
    border-radius: 8px;
}

.owner-photo-meta {
    display: grid;
    gap: 8px;
    max-width: 360px;
    padding: 8px 1px 0;
}

.owner-photo-time {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.owner-photo-time time {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.owner-photo-meta p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.owner-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.owner-photo-actions form {
    margin: 0;
}

.admin-shot-editor {
    border-top: 1px dashed #dce5ee;
    padding-top: 10px;
}

.admin-shot-editor summary {
    width: fit-content;
    color: var(--cyan-deep);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.admin-shot-editor[open] summary {
    margin-bottom: 10px;
}

.admin-shot-editor .description-form {
    max-width: 620px;
}

.admin-shot-delete {
    margin-top: 10px;
}

.portal-shot-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
}

.portal-shot .timeline-meta {
    color: var(--muted);
    font-size: 14px;
}

.portal-shot time {
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.shot-description {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.65;
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.review-actions form {
    margin: 0;
}

.portal-shot .button-secondary {
    color: var(--ink);
    border-color: var(--line);
    background: var(--white);
}

.portal-shot .button-danger-soft {
    color: var(--danger);
    border-color: #e5c7c5;
    background: #fff6f5;
}

.portal-empty {
    border: 1px dashed #cfc7b9;
    border-radius: 10px;
    padding: 46px 20px;
    text-align: center;
    color: var(--muted);
    background: var(--white);
}

.portal-lock-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.portal-lock-card {
    width: min(480px, 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 34px 30px;
    background: var(--white);
    box-shadow: var(--shadow);
    text-align: center;
}

.portal-lock-card .button {
    margin-top: 12px;
}

@media (max-width: 960px) {
    .upload-layout {
        grid-template-columns: 1fr;
    }

    .upload-help {
        position: static;
    }

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

    .character-form .button {
        grid-column: span 2;
    }

    .portal-shot {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .owner-gallery-thumb {
        max-width: 220px;
    }

    .owner-gallery-image img {
        max-width: 210px;
        max-height: 135px;
    }

    .owner-gallery-description {
        max-width: 210px;
    }

    .owner-photo-card {
        max-width: 320px;
    }

    .owner-photo-image img,
    .owner-photo-meta {
        max-width: 300px;
    }

    .owner-photo-image img {
        max-height: 195px;
    }
}

@media (max-width: 720px) {
    .admin-bar,
    .page-heading,
    .portal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-bar {
        padding: 16px 20px;
    }

    .admin-nav {
        width: 100%;
        justify-content: space-between;
    }

    .admin-shell {
        width: min(100% - 24px, 1380px);
        padding-top: 24px;
    }

    .page-heading {
        gap: 16px;
    }

    .heading-actions {
        justify-content: flex-start;
    }

    .select-grid,
    .character-form,
    .account-credentials-form,
    .account-create-form,
    .metric-grid,
    .tunnel-grid,
    .tunnel-options {
        grid-template-columns: 1fr;
    }

    .character-form .button {
        grid-column: auto;
    }

    .boss-heading,
    .form-section {
        padding-left: 18px;
        padding-right: 18px;
    }

    .boss-panel > *:not(.boss-heading) {
        margin-left: 18px;
        margin-right: 18px;
    }

    .token-box {
        align-items: stretch;
        flex-direction: column;
    }

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

    .token-link-row .button {
        width: 100%;
    }

    .upload-form > .button-wide {
        width: calc(100% - 36px);
        margin-left: 18px;
        margin-right: 18px;
    }

    .upload-form > .tiny-note,
    .result-list {
        margin-left: 18px;
        margin-right: 18px;
        padding-left: 0;
        padding-right: 0;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .portal-header {
        padding: 28px 18px 20px;
    }

    .portal-header-actions {
        width: 100%;
        justify-content: space-between;
    }

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

    .portal-shell {
        width: calc(100% - 24px);
    }

    .portal-filter label {
        flex: 1 1 130px;
    }

    .portal-shot-body {
        gap: 10px;
        padding: 16px;
    }

    .landing-card,
    .auth-card {
        padding: 28px 22px;
    }
}

@media (max-width: 760px) {
    .admin-nav {
        align-items: center;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .admin-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-nav a,
    .admin-nav .inline-form {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .admin-shell {
        width: calc(100% - 20px);
        padding: 20px 0 48px;
    }

    .panel {
        margin-bottom: 14px;
        padding: 16px;
    }

    .storage-strip,
    .compact-storage {
        grid-template-columns: 1fr;
    }

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

    .storage-path-picker {
        align-items: stretch;
        flex-direction: column;
    }

    .storage-path-picker .button {
        width: 100%;
    }

    .storage-location-form .checkbox-line {
        margin: 0;
    }

    .cleanup-actions {
        grid-template-columns: 1fr;
    }

    .cleanup-settings-form,
    .cleanup-now-form {
        align-items: stretch;
        flex-direction: column;
    }

    .cleanup-days-field {
        width: 100%;
    }

    .cleanup-days-field input {
        flex: 1 1 auto;
        width: auto;
    }

    .folder-picker {
        width: calc(100% - 18px);
        max-height: 88vh;
    }

    .folder-picker-header,
    .folder-picker-shortcuts,
    .folder-picker-location {
        padding-left: 16px;
        padding-right: 16px;
    }

    .folder-picker-list {
        margin: 0 16px;
    }

    .folder-picker-status {
        margin-left: 16px;
        margin-right: 16px;
    }

    .folder-picker-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

    .folder-picker-actions .button {
        flex: 1 1 0;
    }

    .storage-metrics {
        justify-content: flex-start;
    }

    .page-heading h1 {
        font-size: 29px;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1 1 130px;
    }

    .boss-panel {
        padding: 0;
    }

    .boss-heading {
        padding: 18px 14px 16px;
    }

    .boss-panel > *:not(.boss-heading) {
        margin-left: 14px;
        margin-right: 14px;
    }

    .boss-access a {
        width: 100%;
        margin-left: 0;
    }

    .boss-admin-actions {
        width: 100%;
    }

    .boss-admin-actions .button {
        flex: 1 1 140px;
    }

    .token-box {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-list > div {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .settings-list dt {
        grid-column: 1 / -1;
    }

    .tunnel-state {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .tunnel-state .text-link {
        margin-left: 26px;
    }

    .category-filter {
        margin-right: -12px;
        padding-right: 12px;
        scroll-snap-type: x proximity;
    }

    .category-filter a {
        min-height: 42px;
        scroll-snap-align: start;
    }

    .portal-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-filter .button,
    .portal-filter .text-link {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .portal-shot-body {
        gap: 8px;
        padding: 14px;
    }

    .portal-shot {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .portal-shot time {
        font-size: 17px;
    }

    .owner-gallery-heading {
        align-items: flex-start;
    }

    .owner-gallery-heading h2 {
        font-size: 26px;
    }

    .owner-day-title {
        font-size: 21px;
    }

    .character-choice {
        flex-basis: 182px;
        padding: 10px 12px;
    }

    .owner-gallery-thumb {
        max-width: 178px;
    }

    .owner-gallery-image img {
        max-width: 170px;
        max-height: 120px;
    }

    .owner-gallery-description {
        max-width: 170px;
    }

    .owner-photo-card {
        max-width: 240px;
    }

    .owner-photo-image img,
    .owner-photo-meta {
        max-width: 225px;
    }

    .owner-photo-image img {
        max-height: 165px;
    }

    .shot-description {
        font-size: 14px;
        line-height: 1.5;
    }

    .review-actions .button {
        min-height: 42px;
    }

    .batch-item {
        grid-template-columns: 1fr;
    }

    .batch-item-row {
        grid-template-columns: 1fr;
    }

    .batch-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
}

html[data-device="mobile"] .admin-nav {
    overflow-x: auto;
}

html[data-device="mobile"] .category-filter {
    overflow-x: auto;
}

body[data-theme="calm"] {
    --paper: #f3f4ef;
    --white: #faf9f5;
    --ink: #34383b;
    --muted: #717a7e;
    --line: #d6dddd;
    --cyan: #6e9b97;
    --cyan-deep: #507c78;
    --gold: #d2ac68;
    --danger: #ad6c67;
    --success: #648b78;
    --shadow: 0 3px 10px rgba(53, 63, 66, 0.05);
}

body[data-theme="calm"].portal-body {
    color: var(--ink);
    background-color: var(--paper);
    background-image: linear-gradient(135deg, #f7f3ea 0%, #eef3f4 100%);
}

body[data-theme="calm"] .portal-header::after {
    opacity: 0.14;
}

body[data-theme="calm"] .theme-toggle,
body[data-theme="calm"] .portal-header .button-quiet,
body[data-theme="calm"] .character-choice,
body[data-theme="calm"] .portal-filter,
body[data-theme="calm"] .portal-empty {
    border-color: var(--line);
    background: var(--white);
    box-shadow: none;
}

body[data-theme="calm"] .character-choice {
    background: #f8f8f3;
}

body[data-theme="calm"] .character-choice.is-active {
    border-color: #739b97;
    background: #edf3f2;
}

body[data-theme="calm"] .today-uploaded {
    color: #796948;
    background: #f1e9d6;
}

body[data-theme="calm"] .day-dot.is-today {
    background: #6d9480;
    box-shadow: 0 0 0 3px rgba(109, 148, 128, 0.12);
}

body[data-theme="calm"] .day-dot.is-past {
    background: #a7afb2;
}

body[data-theme="calm"] .owner-day-count {
    color: #507c78;
    background: #e9f0ee;
}

body[data-theme="calm"] .category-filter a {
    border-color: var(--line);
    background: #f8f8f3;
}

body[data-theme="calm"] .category-filter a.is-active {
    color: #f8f8f4;
    border-color: #5c8883;
    background: #5c8883;
}

body[data-theme="calm"] .badge-category {
    color: #4f706e;
    background: #e8efee;
}

body[data-theme="calm"] .badge-viewed {
    color: #587868;
    background: #edf2ea;
}

body[data-theme="calm"] .badge-question,
body[data-theme="calm"] .button-danger-soft {
    color: #965f5b;
    border-color: #dfc9c6;
    background: #f4eae8;
}

body[data-theme="calm"] .button-primary {
    color: #f8f8f4;
    background: #557f7a;
}

body[data-theme="calm"] .button-secondary {
    color: #3f474a;
    border-color: #ccd8d7;
    background: #f7f8f4;
}

body[data-theme="calm"] .portal-filter input {
    border-color: #ccd8d7;
    background: #f9faf6;
}

body[data-theme="calm"] .panel {
    box-shadow: 0 2px 8px rgba(53, 63, 66, 0.04);
}

