:root {
    --ink: #17252f;
    --muted: #65757f;
    --line: #cbd7dc;
    --surface: #ffffff;
    --canvas: #eaf0f2;
    --teal: #087985;
    --teal-dark: #065d66;
    --teal-soft: #dceff0;
    --amber: #c97818;
    --amber-soft: #fff0d9;
    --danger: #b23a3a;
    --danger-dark: #8e2929;
    --danger-soft: #fbe6e3;
    --shadow: 0 18px 48px rgba(27, 51, 62, 0.12);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    color-scheme: light;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(23, 37, 47, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 37, 47, 0.035) 1px, transparent 1px),
        var(--canvas);
    background-size: 26px 26px;
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.58;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(8, 121, 133, 0.24);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

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

.masthead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 0 4px 24px;
    border-bottom: 1px solid rgba(101, 117, 127, 0.3);
}

.masthead h1 {
    margin: 2px 0 0;
    font-family: "Songti SC", "STSong", serif;
    font-size: clamp(32px, 4vw, 52px);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.back-link {
    display: inline-block;
    padding: 12px 0;
    color: var(--teal-dark);
    font-size: 14px;
}

.eyebrow,
.section-kicker {
    margin: 0;
    color: var(--teal-dark);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.masthead-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

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

.session-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.session-status i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2d9d74;
    box-shadow: 0 0 0 4px rgba(45, 157, 116, 0.14);
}

.login-view {
    display: grid;
    min-height: 66vh;
    place-items: center;
}

.login-ticket {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
    gap: 44px;
    width: min(780px, 100%);
    padding: 48px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.login-ticket::before,
.login-ticket::after {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    content: "";
    background: radial-gradient(circle at center, var(--canvas) 5px, transparent 5.5px) center / 12px 24px repeat-y;
}

.login-ticket::before {
    left: -6px;
}

.login-ticket::after {
    right: -6px;
}

.ticket-mark {
    position: absolute;
    top: 18px;
    right: 22px;
    padding: 5px 8px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    border: 1px solid #b8dadd;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.login-copy {
    padding-right: 28px;
    border-right: 1px dashed var(--line);
}

.login-copy h2,
.panel-heading h2,
.result-heading h2,
.dialog-heading h2 {
    margin: 8px 0 0;
    font-family: "Songti SC", "STSong", serif;
    font-size: 26px;
    line-height: 1.25;
}

.login-copy > p:last-child {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.login-form {
    align-self: center;
}

.login-form label,
.field-group label {
    display: block;
    margin-bottom: 7px;
    color: #334650;
    font-size: 13px;
    font-weight: 700;
}

.login-form input,
.field-group input {
    width: 100%;
    min-height: 45px;
    padding: 10px 13px;
    color: var(--ink);
    background: #f8fbfc;
    border: 1px solid #b9c9cf;
    border-radius: 9px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-form input:hover,
.field-group input:hover {
    border-color: #8ca4ad;
}

.secret-field {
    position: relative;
}

.secret-field input {
    padding-right: 66px;
}

.field-button {
    position: absolute;
    top: 6px;
    right: 6px;
    height: 33px;
    padding: 0 10px;
    color: var(--teal-dark);
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.login-form .remember-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 0;
    cursor: pointer;
}

.login-form .remember-option input {
    width: 18px;
    min-height: 18px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--teal);
}

.remember-option span {
    display: grid;
    gap: 3px;
}

.remember-option strong {
    color: #334650;
    font-size: 13px;
}

.remember-option small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.primary-button,
.secondary-button,
.danger-button,
.quiet-button {
    border-radius: 9px;
    font-weight: 750;
    transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button,
.danger-button {
    min-height: 44px;
    padding: 10px 18px;
    color: #fff;
    border: 0;
}

.primary-button {
    background: var(--teal);
    box-shadow: 0 7px 16px rgba(8, 121, 133, 0.2);
}

.primary-button:hover {
    background: var(--teal-dark);
    transform: translateY(-1px);
}

.login-form .primary-button {
    width: 100%;
    margin-top: 18px;
}

.secondary-button,
.quiet-button {
    padding: 9px 14px;
    color: #40545e;
    background: transparent;
    border: 1px solid #b7c6cc;
}

.secondary-button:hover,
.quiet-button:hover {
    color: var(--ink);
    background: #fff;
    border-color: #879da6;
}

.danger-button {
    background: var(--danger);
    box-shadow: 0 7px 16px rgba(178, 58, 58, 0.18);
}

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

.form-message {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}

.form-message.success {
    color: #267557;
}

.console-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 24px;
    padding-top: 24px;
}

.workspace {
    min-width: 0;
}

.panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(27, 51, 62, 0.07);
}

.search-panel {
    padding: 28px;
}

.panel-heading,
.result-heading,
.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.search-rule {
    flex: none;
    padding: 6px 9px;
    color: var(--amber);
    background: var(--amber-soft);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    margin-top: 26px;
}

.field-group small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

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

.amount-field {
    max-width: 260px;
}

.money-input {
    position: relative;
}

.money-input span {
    position: absolute;
    top: 11px;
    left: 13px;
    color: var(--muted);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.money-input input {
    padding-left: 31px;
}

.search-actions {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-top: 20px;
}

.result-panel {
    padding-top: 30px;
}

.result-heading {
    align-items: flex-end;
    padding: 0 4px 16px;
    border-bottom: 1px solid rgba(101, 117, 127, 0.25);
}

.count-badge {
    padding: 5px 9px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    border-radius: 999px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    display: grid;
    justify-items: center;
    padding: 56px 24px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    margin-top: 8px;
    color: #41545e;
}

.empty-state p {
    max-width: 430px;
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.7;
}

.empty-symbol {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    color: var(--teal);
    background: var(--teal-soft);
    border-radius: 50%;
    font-size: 25px;
}

.order-results {
    display: grid;
    gap: 12px;
    padding-top: 14px;
}

.order-card {
    display: grid;
    grid-template-columns: minmax(180px, 0.75fr) minmax(320px, 1.6fr) auto;
    gap: 22px;
    align-items: center;
    padding: 21px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 7px 22px rgba(27, 51, 62, 0.06);
}

.account-block strong {
    display: block;
    overflow-wrap: anywhere;
    font-family: "Songti SC", "STSong", serif;
    font-size: 24px;
}

.account-block span {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
}

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

.detail-grid div {
    min-width: 0;
}

.detail-grid dt {
    color: var(--muted);
    font-size: 11px;
}

.detail-grid dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
    color: #31434c;
    font-size: 13px;
    font-weight: 700;
}

.detail-grid .mono {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
}

.reset-button {
    min-width: 116px;
    padding: 10px 13px;
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #efc1bb;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 750;
}

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

.audit-panel {
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.audit-heading {
    align-items: center;
    padding: 22px 22px 16px;
    border-bottom: 1px solid var(--line);
}

.audit-heading h2 {
    font-size: 22px;
}

.audit-list {
    max-height: calc(100vh - 160px);
    overflow: auto;
    padding: 4px 20px 20px;
}

.audit-item {
    position: relative;
    padding: 17px 0 17px 18px;
    border-bottom: 1px solid #e2e9ec;
}

.audit-item::before {
    position: absolute;
    top: 23px;
    left: 1px;
    width: 7px;
    height: 7px;
    content: "";
    background: var(--teal);
    border-radius: 50%;
}

.audit-item.password-reset::before {
    background: var(--amber);
}

.audit-item-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.audit-item strong {
    font-size: 13px;
}

.audit-item time {
    flex: none;
    color: #87969e;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 10px;
}

.audit-item p {
    margin: 7px 0 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.audit-item small {
    display: block;
    margin-top: 5px;
    color: #84939a;
    font-size: 10px;
}

.muted-copy {
    color: var(--muted);
    font-size: 13px;
}

.dialog-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(16, 30, 38, 0.62);
    backdrop-filter: blur(7px);
}

.dialog {
    width: min(520px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 26px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(5, 17, 23, 0.34);
}

.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--muted);
    background: #f1f5f6;
    border: 0;
    border-radius: 50%;
    font-size: 24px;
}

.target-account {
    display: grid;
    gap: 4px;
    margin: 22px 0;
    padding: 15px 16px;
    background: var(--danger-soft);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
}

.target-account span,
.target-account small {
    color: #815656;
    font-size: 12px;
}

.target-account strong {
    overflow-wrap: anywhere;
    font-size: 19px;
}

.reset-form {
    display: grid;
    gap: 15px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.toast {
    position: fixed;
    z-index: 30;
    right: 22px;
    bottom: 22px;
    max-width: min(380px, calc(100vw - 44px));
    padding: 13px 16px;
    color: #fff;
    background: #223740;
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 13px;
    line-height: 1.5;
}

.toast.error {
    background: var(--danger-dark);
}

@media (max-width: 1120px) {
    .console-view {
        grid-template-columns: 1fr;
    }

    .audit-panel {
        position: static;
        max-height: none;
    }

    .audit-list {
        max-height: 420px;
    }

    .order-card {
        grid-template-columns: minmax(170px, 0.7fr) minmax(0, 1.6fr);
    }

    .reset-button {
        grid-column: 1 / -1;
        justify-self: end;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 28px, 680px);
        padding-top: 18px;
    }

    .masthead {
        align-items: flex-start;
        padding-bottom: 18px;
    }

    .masthead h1 {
        font-size: 34px;
    }

    .masthead-note,
    .session-status {
        display: none;
    }

    .login-view {
        min-height: 72vh;
    }

    .login-ticket {
        grid-template-columns: 1fr;
        gap: 26px;
        padding: 38px 28px 32px;
    }

    .login-copy {
        padding: 0 0 22px;
        border-right: 0;
        border-bottom: 1px dashed var(--line);
    }

    .console-view {
        padding-top: 16px;
    }

    .search-panel {
        padding: 22px 18px;
    }

    .panel-heading {
        display: block;
    }

    .search-rule {
        display: inline-block;
        margin-top: 10px;
    }

    .search-form {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 20px;
    }

    .field-wide {
        grid-column: auto;
    }

    .amount-field {
        max-width: none;
    }

    .search-actions {
        padding-top: 4px;
    }

    .search-actions button {
        flex: 1;
    }

    .result-panel {
        padding-top: 24px;
    }

    .order-card {
        grid-template-columns: 1fr;
        gap: 17px;
        padding: 19px 17px;
    }

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

    .reset-button {
        grid-column: auto;
        justify-self: stretch;
    }

    .audit-heading {
        display: flex;
    }

    .dialog {
        padding: 22px 18px;
    }

    .dialog-actions button {
        flex: 1;
    }
}

@media (max-width: 420px) {
    .masthead h1 {
        font-size: 29px;
    }

    .quiet-button {
        padding-inline: 11px;
    }

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

    .search-actions,
    .dialog-actions {
        flex-direction: column-reverse;
    }

    .search-actions button,
    .dialog-actions button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
