:root {
    color-scheme: light;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    color: #141413;
    background: #faf9f5;
    --paper: #faf9f5;
    --surface: #f4f2ec;
    --surface-bright: #fffdf9;
    --ink: #141413;
    --ink-secondary: #30302e;
    --muted: #73726c;
    --muted-light: #9c9a92;
    --line: #d1cfc5;
    --line-strong: #b0aea5;
    --clay: #d97757;
    --clay-dark: #c46849;
    --peach: #f0d5c7;
    --oat: #e3dacc;
    --green: #629987;
    --danger: #b53333;
    --radius-small: 8px;
    --radius: 12px;
    --radius-large: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--peach); color: var(--ink); }
:focus-visible { outline: 3px solid #6a9bcc; outline-offset: 2px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px 22px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 11px; width: fit-content; }
.brand-mark { position: relative; width: 30px; height: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; border-radius: 9px; background: var(--ink); }
.brand-mark i { display: block; border-radius: 50%; background: var(--peach); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--clay); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Songti SC", serif; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }

.side-nav { margin-top: 48px; display: grid; gap: 6px; }
.side-link { min-height: 42px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-small); color: var(--muted); font-size: 13px; font-weight: 500; transition: background .18s, color .18s; }
.side-link:hover { background: var(--surface-bright); color: var(--ink); }
.side-link.active { background: var(--ink); color: white; }
.nav-dot { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; }
.side-link.active .nav-dot { border-color: var(--clay); background: var(--clay); }
.side-group { margin-top: 26px; display: grid; gap: 5px; }
.side-group-title { min-height: 32px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-secondary); font-size: 12px; font-weight: 600; }
.side-group-title i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #6299871a; }
.side-child { padding-left: 29px; font-size: 12px; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-footer > span { display: block; margin-bottom: 10px; color: var(--muted-light); font-family: Consolas, monospace; font-size: 9px; }
.sidebar-footer button { width: 100%; padding: 8px 2px; display: flex; justify-content: space-between; border: 0; background: transparent; color: var(--muted); font-size: 12px; text-align: left; }
.sidebar-footer button:hover { color: var(--danger); }

.admin-workspace { min-width: 0; }
.topbar { min-height: 64px; padding: 0 clamp(24px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.breadcrumb { color: var(--muted); font-size: 11px; }
.topbar-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.live-dot, .inline-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--green); }
.inline-dot { margin-right: 8px; }
.inline-dot.waiting { background: var(--muted-light); }

.page-main { width: min(1180px, calc(100% - 72px)); margin: 0 auto; padding: 54px 0 72px; }
.notice { margin-bottom: 22px; padding: 12px 15px; border: 1px solid; border-radius: var(--radius-small); font-size: 12px; }
.notice.success { border-color: #bcd1ca; background: #edf4f1; color: #38695a; }
.notice.error { border-color: #ebcece; background: #fbefef; color: #932e2e; }

.page-header { margin-bottom: 54px; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.eyebrow, .section-index { color: var(--clay-dark); font-family: Consolas, "Microsoft YaHei", monospace; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.page-header h1 { margin: 10px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(34px, 4vw, 48px); font-weight: 400; line-height: 1.1; letter-spacing: -.035em; }
.page-header p { max-width: 600px; margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.refresh-note { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-small); color: var(--muted); font-size: 11px; white-space: nowrap; }
.refresh-note span { display: block; margin-bottom: 2px; color: var(--ink-secondary); font-weight: 600; }

.section-block { padding: 34px 0 48px; border-top: 1px solid var(--line); }
.section-heading { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading > div { display: flex; align-items: center; gap: 12px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 23px; font-weight: 400; letter-spacing: -.02em; }
.section-heading > span, .section-heading > a { color: var(--muted); font-size: 11px; }
.section-heading > a:hover { color: var(--clay-dark); }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-height: 150px; padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-bright); transition: border-color .18s, transform .18s; }
.metric-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.metric-card > span { color: var(--ink-secondary); font-size: 12px; font-weight: 600; }
.metric-card strong { margin: auto 0 8px; font-family: Georgia, serif; font-size: 38px; font-weight: 400; line-height: 1; }
.metric-card small { color: var(--muted-light); font-family: Consolas, monospace; font-size: 9px; text-transform: uppercase; }
.metric-card-accent { border-color: var(--clay); background: var(--clay); color: var(--ink); }
.metric-card-accent > span, .metric-card-accent small { color: var(--ink); }

.service-card { position: relative; padding: 24px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-large); background: var(--surface-bright); transition: border-color .2s, box-shadow .2s; }
.service-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--clay); }
.service-card:hover { border-color: var(--line-strong); box-shadow: 0 10px 28px #1414130a; }
.service-symbol { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 14px; background: var(--peach); color: var(--clay-dark); font-family: Georgia, serif; font-size: 20px; }
.service-title-row { display: flex; align-items: center; gap: 12px; }
.service-copy h3 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 400; }
.service-copy > p { margin: 5px 0 16px; color: var(--muted); font-size: 12px; }
.service-copy dl { margin: 0; display: flex; flex-wrap: wrap; gap: 26px; }
.service-copy dl div { display: flex; gap: 7px; font-size: 11px; }
.service-copy dt { color: var(--muted-light); }
.service-copy dd { margin: 0; color: var(--ink-secondary); }
.service-arrow { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; transition: transform .2s, background .2s; }
.service-card:hover .service-arrow { transform: translateX(3px); background: var(--surface); }
.status-chip { width: fit-content; padding: 6px 9px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; background: #e8f1ed; color: #38695a; font-size: 10px; font-weight: 600; }
.status-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.status-chip.waiting { background: #eceae4; color: var(--muted); }
.status-chip.waiting i { background: var(--muted-light); }

.status-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 14px; }
.status-list { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-bright); }
.status-list div { min-height: 58px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.status-list div:last-child { border-bottom: 0; }
.status-list dt { color: var(--muted); font-size: 11px; }
.status-list dd { margin: 0; color: var(--ink-secondary); font-size: 12px; font-weight: 600; }
.status-list code { padding: 4px 7px; border-radius: 5px; background: var(--surface); font-family: Consolas, monospace; font-size: 10px; }
.quota-panel { padding: 24px; display: flex; flex-direction: column; border-radius: var(--radius); background: var(--ink); color: white; }
.quota-panel > span { color: #ffffffa6; font-size: 11px; }
.quota-panel strong { margin: auto 0 0; font-family: Georgia, serif; font-size: 64px; font-weight: 400; line-height: 1; }
.quota-panel small { color: #ffffffb8; font-size: 10px; }
.quota-panel p { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid #ffffff26; color: #ffffff8f; font-size: 10px; }

.config-form { display: grid; gap: 18px; }
.form-section { padding: 26px; display: grid; grid-template-columns: minmax(190px, .35fr) minmax(0, 1fr); gap: 34px; border: 1px solid var(--line); border-radius: var(--radius-large); background: var(--surface-bright); }
.form-section-title { display: flex; align-items: flex-start; gap: 12px; }
.form-section-title > span { min-width: 28px; color: var(--clay-dark); font-family: Consolas, monospace; font-size: 10px; }
.form-section-title h2 { margin: -3px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 400; }
.form-section-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.form-fields { display: grid; gap: 18px; }
.form-fields.two-columns { grid-template-columns: 1fr 1fr; }
.form-fields .full { grid-column: 1 / -1; }
label { color: var(--ink-secondary); font-size: 11px; font-weight: 600; }
label small, .prompt-field > small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-small); outline: none; background: var(--paper); color: var(--ink); transition: border-color .18s, box-shadow .18s, background .18s; }
input, select { min-height: 43px; margin-top: 7px; padding: 9px 12px; }
textarea { padding: 15px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: #6a9bcc; box-shadow: 0 0 0 3px #6a9bcc20; background: white; }
.prompt-field { display: block; }
.prompt-field textarea { min-height: 430px; margin: 0; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 11px; font-weight: 400; line-height: 1.7; }
.option-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.option-row { min-height: 70px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--paper); }
.option-row + .option-row { border-top: 1px solid var(--line); }
.option-row span strong, .option-row span small { display: block; }
.option-row span strong { font-size: 11px; }
.option-row input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--clay-dark); }
.form-actions { padding: 18px 0 0; display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.form-actions > span { color: var(--muted); font-size: 10px; }

.button { min-height: 40px; padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-small); font-size: 11px; font-weight: 600; transition: background .18s, border-color .18s, transform .18s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: var(--clay-dark); }
.button-secondary { border-color: var(--line-strong); background: var(--surface-bright); color: var(--ink-secondary); }
.button-secondary:hover { background: var(--surface); }
.button-danger { border-color: #ebcece; background: #fff8f7; color: var(--danger); }
.button-danger:hover { border-color: var(--danger); }

.machine-count { display: flex; align-items: baseline; gap: 7px; }
.machine-count strong { font-family: Georgia, serif; font-size: 34px; font-weight: 400; }
.machine-count span { color: var(--muted); font-size: 10px; }
.machine-heading form { margin-left: auto; }
.machine-filters { margin-bottom: 14px; padding: 14px; display: grid; grid-template-columns: minmax(220px, 1fr) 190px auto; align-items: end; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.machine-filters label > span { display: block; }
.machine-filters input, .machine-filters select { margin-top: 5px; background: var(--surface-bright); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-bright); }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 14px 13px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7f5ef; }
th { color: var(--muted); font-family: Consolas, "Microsoft YaHei", monospace; font-size: 9px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
td code { color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.table-action { padding: 5px 0; border: 0; background: transparent; color: var(--clay-dark); font-size: 10px; }
.table-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.empty { padding: 42px; color: var(--muted); text-align: center; }
.quota-cell { display: inline-grid; grid-template-columns: 58px auto; align-items: center; gap: 8px; }
.quota-cell meter { width: 58px; height: 4px; border: 0; border-radius: 999px; background: var(--oat); }
.quota-cell meter::-webkit-meter-bar { border: 0; border-radius: 999px; background: var(--oat); }
.quota-cell meter::-webkit-meter-optimum-value { border-radius: 999px; background: var(--clay); }
.quota-cell meter::-moz-meter-bar { border-radius: 999px; background: var(--clay); }

.login-page { min-height: 100vh; background: var(--paper); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); }
.login-visual { position: relative; padding: clamp(34px, 5vw, 70px); display: flex; flex-direction: column; overflow: hidden; background: var(--oat); }
.login-visual::after { content: ""; position: absolute; right: -120px; bottom: -160px; width: 440px; height: 440px; border: 1px solid #14141320; border-radius: 50%; box-shadow: 0 0 0 70px #14141308, 0 0 0 140px #14141305; }
.login-brand { position: relative; z-index: 1; }
.login-copy { position: relative; z-index: 1; margin: auto 0; }
.login-copy h1 { margin: 17px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(46px, 6vw, 76px); font-weight: 400; line-height: 1.04; letter-spacing: -.045em; }
.login-copy p { max-width: 390px; margin: 20px 0 0; color: var(--ink-secondary); font-size: 14px; }
.login-preview { position: relative; z-index: 1; width: min(410px, 90%); height: 96px; padding: 18px; display: grid; gap: 9px; border: 1px solid #14141320; border-radius: var(--radius-large); background: #faf9f566; backdrop-filter: blur(6px); }
.login-preview span { height: 5px; border-radius: 999px; background: #14141328; }
.login-preview span:nth-child(1) { width: 55%; }
.login-preview span:nth-child(2) { width: 82%; }
.login-preview span:nth-child(3) { width: 68%; }
.login-preview i { position: absolute; right: 16px; bottom: 15px; width: 24px; height: 24px; border-radius: 50%; background: var(--clay); }
.login-panel { padding: 42px; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); }
.login-card-heading > span { color: var(--muted); font-family: Consolas, monospace; font-size: 9px; }
.login-card-heading h2 { margin: 14px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 34px; font-weight: 400; letter-spacing: -.03em; }
.login-card-heading p { margin: 8px 0 28px; color: var(--muted); font-size: 12px; }
.login-card form { display: grid; gap: 17px; }
.login-card input { margin-top: 7px; background: var(--surface-bright); }
.login-button { width: 100%; margin-top: 6px; }

@media (max-width: 940px) {
    .admin-shell { display: block; }
    .admin-sidebar { position: static; width: 100%; height: auto; padding: 18px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
    .side-nav { margin-top: 20px; display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: start; }
    .side-group { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .side-group-title { grid-column: 1 / -1; min-height: 26px; }
    .side-child { padding: 9px 10px; justify-content: center; text-align: center; }
    .sidebar-footer { position: absolute; top: 21px; right: 24px; margin: 0; padding: 0; border: 0; }
    .sidebar-footer > span { display: none; }
    .sidebar-footer button { gap: 8px; }
    .page-main { width: min(100% - 48px, 1180px); }
    .login-shell { grid-template-columns: 1fr 1fr; }
    .login-preview { display: none; }
}

@media (max-width: 760px) {
    .topbar { min-height: 56px; padding: 0 20px; }
    .topbar-meta { display: none; }
    .page-main { width: min(100% - 32px, 1180px); padding-top: 38px; }
    .page-header { margin-bottom: 40px; align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .service-card { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
    .service-arrow { display: none; }
    .service-copy dl { gap: 10px 18px; }
    .status-layout { grid-template-columns: 1fr; }
    .quota-panel { min-height: 220px; }
    .form-section { grid-template-columns: 1fr; gap: 22px; }
    .machine-heading { align-items: flex-start; flex-direction: column; }
    .machine-heading form { margin: 0; }
    .machine-filters { grid-template-columns: 1fr 1fr; }
    .machine-filters label:first-child { grid-column: 1 / -1; }
    .login-shell { display: block; }
    .login-visual { min-height: 260px; padding: 28px; }
    .login-copy { margin: 54px 0 0; }
    .login-copy h1 { font-size: 44px; }
    .login-copy p { margin-top: 12px; }
    .login-panel { padding: 44px 24px 64px; }
}

@media (max-width: 560px) {
    .admin-sidebar { padding: 16px; }
    .sidebar-footer { top: 18px; right: 16px; }
    .side-nav { grid-template-columns: 1fr; }
    .side-group { grid-template-columns: 1fr; }
    .side-child { justify-content: flex-start; padding-left: 28px; text-align: left; }
    .page-header h1 { font-size: 34px; }
    .refresh-note { width: 100%; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 130px; }
    .service-card { grid-template-columns: 1fr; }
    .service-symbol { width: 48px; height: 48px; }
    .service-title-row { align-items: flex-start; flex-direction: column; }
    .form-fields.two-columns { grid-template-columns: 1fr; }
    .form-fields .full { grid-column: auto; }
    .form-section { padding: 20px; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .button { width: 100%; }
    .machine-filters { grid-template-columns: 1fr; }
    .machine-filters label:first-child { grid-column: auto; }
    .machine-filters .button { width: 100%; }
}

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