:root {
  --paper: #f7f4ee;
  --paper-deep: #eeeae1;
  --ink: #202321;
  --ink-soft: #656862;
  --line: #dedbd2;
  --panel: #fffefa;
  --coral: #e7654e;
  --coral-dark: #b74332;
  --coral-pale: #fbe5df;
  --mint: #dbe9df;
  --mint-ink: #317052;
  --amber: #f4e5bf;
  --amber-ink: #8b641f;
  --blue-pale: #e2e9f2;
  --blue-ink: #496684;
  --shadow: 0 16px 50px rgba(47, 43, 34, .07);
  --radius: 8px;
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(231,101,78,.35); outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.mono { font-family: Consolas, "Courier New", monospace; letter-spacing: 0; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(440px, .85fr); }
.login-art { padding: clamp(28px, 5vw, 76px); display: flex; flex-direction: column; justify-content: space-between; background: #222522; color: #f9f6ee; position: relative; overflow: hidden; }
.login-art:before { content: ''; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; right: -180px; top: -160px; }
.login-art:after { content: ''; position: absolute; width: 220px; height: 220px; border: 1px solid rgba(231,101,78,.55); transform: rotate(27deg); right: 16%; bottom: 12%; }
.brand-mark { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .04em; position: relative; z-index: 1; }
.brand-square { width: 26px; height: 26px; background: var(--coral); display: grid; place-items: center; color: #fff; border-radius: 5px; font-size: 14px; }
.login-hero { max-width: 560px; position: relative; z-index: 1; }
.login-hero .eyebrow { color: #bfc6ba; }
.login-hero h1 { font-size: clamp(38px, 5vw, 72px); line-height: 1.06; margin: 18px 0; letter-spacing: -.06em; font-weight: 700; }
.login-hero p { max-width: 420px; color: #bbc0b8; line-height: 1.8; margin: 0; }
.login-note { color: #8e968d; font-size: 12px; position: relative; z-index: 1; }
.login-panel { display: grid; place-items: center; padding: 34px clamp(26px, 6vw, 90px); background: var(--paper); }
.login-card { width: min(100%, 430px); }
.login-card h2 { font-size: 28px; letter-spacing: -.04em; margin: 0 0 8px; }
.login-card .lead { color: var(--ink-soft); margin: 0 0 34px; font-size: 14px; }
.form-field { display: grid; gap: 8px; margin: 18px 0; }
.form-field label { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.form-field input, .form-field select, .search-input { border: 1px solid var(--line); background: var(--panel); min-height: 46px; padding: 0 14px; border-radius: 5px; color: var(--ink); width: 100%; }
.form-field input::placeholder { color: #a5a69e; }
.btn { border: 1px solid transparent; min-height: 42px; padding: 0 15px; border-radius: 5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .18s ease; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { color: #fff; background: var(--coral); }
.btn-primary:hover { background: var(--coral-dark); }
.btn-quiet { color: var(--ink); background: transparent; border-color: var(--line); }
.btn-quiet:hover { background: var(--paper-deep); }
.btn-danger { color: #a83527; background: var(--coral-pale); border-color: #f3c9c0; }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.full { width: 100%; }
.form-error { min-height: 18px; color: var(--coral-dark); font-size: 13px; margin: 10px 0; }
.auth-help { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 12px; margin-top: 18px; }
.dashboard { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); background: #f1eee6; padding: 25px 16px; display: flex; flex-direction: column; }
.sidebar .brand-mark { padding: 0 10px 34px; }
.nav-label { color: #92948c; font-size: 10px; letter-spacing: .15em; margin: 0 10px 9px; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.nav-item { border: 0; background: transparent; width: 100%; text-align: left; color: #656860; padding: 11px 12px; border-radius: 5px; display: flex; gap: 11px; align-items: center; font-size: 13px; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.62); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-icon { font-family: 'DM Mono'; font-size: 14px; width: 18px; text-align: center; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 10px 0; }
.server-status { font-size: 11px; color: var(--ink-soft); display: flex; gap: 7px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #55a36f; }
.user-chip { margin-top: 16px; display: flex; align-items: center; gap: 9px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; background: var(--coral); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.user-chip strong { font-size: 12px; display: block; }
.user-chip span { color: var(--ink-soft); font-size: 11px; }
.main { min-width: 0; }
.topbar { min-height: 74px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3.2vw, 48px); background: rgba(247,244,238,.85); }
.breadcrumb { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.breadcrumb small { color: #999b94; font-family: 'DM Mono'; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); width: 36px; height: 36px; border-radius: 5px; color: var(--ink-soft); display: grid; place-items: center; }
.content { padding: clamp(24px, 4vw, 52px); max-width: 1500px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 29px; }
.eyebrow { color: var(--coral-dark); font-family: 'DM Mono'; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.page-heading h1 { margin: 9px 0 0; font-size: clamp(27px, 3vw, 40px); letter-spacing: -.055em; line-height: 1.1; }
.page-heading p { color: var(--ink-soft); margin: 9px 0 0; font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 17px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); padding: 19px; border-radius: var(--radius); min-height: 134px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card.accent { background: var(--coral); color: #fff; border-color: var(--coral); }
.stat-label { font-size: 12px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.accent .stat-label { color: #ffeae4; }
.stat-value { font-size: 31px; font-weight: 800; letter-spacing: -.06em; }
.stat-foot { font-size: 11px; color: var(--ink-soft); }
.accent .stat-foot { color: #ffeae4; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .85fr); gap: 17px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 19px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.panel-body { padding: 20px; }
.activity-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 14px 0; border-bottom: 1px solid #ebe8e0; }
.activity-row:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); margin-top: 5px; }
.activity-title { font-size: 13px; font-weight: 600; }
.activity-meta { margin-top: 5px; color: var(--ink-soft); font-size: 11px; }
.activity-time { color: #9b9d95; font-size: 11px; white-space: nowrap; }
.quick-actions { display: grid; gap: 9px; }
.quick-action { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; text-align: left; padding: 13px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 12px; }
.quick-action:hover { border-color: var(--coral); color: var(--coral-dark); }
.quick-action span { color: var(--coral); font-size: 17px; }
.table-toolbar { padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.search-wrap { position: relative; width: min(280px, 100%); }
.search-wrap span { position: absolute; left: 13px; top: 12px; color: #a0a19a; }
.search-input { min-height: 38px; padding-left: 35px; font-size: 12px; }
.filter-select { border: 1px solid var(--line); background: var(--panel); min-height: 38px; padding: 0 11px; border-radius: 5px; font-size: 12px; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th { color: #90938b; font-size: 11px; font-weight: 600; text-align: left; padding: 13px 20px; background: #fcfaf5; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 15px 20px; border-bottom: 1px solid #ece9e1; font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fcfaf5; }
.check { width: 14px; height: 14px; accent-color: var(--coral); }
.key-value { font-family: 'DM Mono'; font-size: 11px; color: #454842; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--mint); color: var(--mint-ink); }
.badge-amber { background: var(--amber); color: var(--amber-ink); }
.badge-red { background: var(--coral-pale); color: var(--coral-dark); }
.badge-blue { background: var(--blue-pale); color: var(--blue-ink); }
.row-actions { display: flex; gap: 6px; }
.pagination { padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; color: var(--ink-soft); font-size: 11px; }
.page-buttons { display: flex; gap: 5px; }
.page-btn { min-width: 29px; height: 29px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.page-btn.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.empty-state { padding: 54px 20px; text-align: center; color: var(--ink-soft); }
.empty-icon { font-family: 'DM Mono'; color: var(--coral); font-size: 28px; margin-bottom: 12px; }
.empty-state strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 5px; }
.loading { padding: 48px 20px; text-align: center; color: var(--ink-soft); font-size: 13px; }
.loading:before { content: ''; width: 16px; height: 16px; display: block; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { margin: 20px; padding: 14px 16px; color: var(--coral-dark); background: var(--coral-pale); border: 1px solid #f3c9c0; border-radius: 5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(32,35,33,.38); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal { background: var(--panel); width: min(100%, 520px); border-radius: 8px; box-shadow: 0 24px 80px rgba(32,35,33,.24); }
.modal-head { padding: 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: start; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.generated-keys { width: 100%; min-height: 150px; resize: vertical; border: 1px solid var(--line); border-radius: 5px; background: #fcfaf5; color: var(--ink); padding: 12px; font: 12px/1.7 Consolas, "Courier New", monospace; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; border-left: 4px solid var(--coral); padding: 13px 16px; border-radius: 5px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.workflow-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.distribution-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 17px; align-items: start; }
.distribution-panel { min-width: 0; }
.distribution-form-body { padding-bottom: 8px; }
.upload-drop { border: 1px dashed #c8c3b8; background: #fcfaf5; border-radius: 6px; padding: 15px; }
.upload-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-label { min-height: 62px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.upload-label > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; flex: 1; }
.upload-label strong { font-size: 13px; }
.upload-label small { color: var(--ink-soft); font-size: 11px; }
.upload-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; color: var(--coral-dark); background: var(--coral-pale); font-size: 19px; font-weight: 800; }
.file-list { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 12px; color: var(--ink-soft); font-size: 11px; }
.file-pill { display: inline-flex; align-items: baseline; gap: 7px; max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.file-pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; font-size: 11px; }
.file-pill small { color: #90938b; white-space: nowrap; }
.form-section-title { padding-top: 18px; margin-bottom: -3px; color: var(--ink); font-size: 12px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 15px; }
.form-field textarea { border: 1px solid var(--line); background: var(--panel); padding: 11px 14px; border-radius: 5px; color: var(--ink); width: 100%; min-height: 46px; resize: vertical; line-height: 1.65; }
.form-field textarea::placeholder { color: #a5a69e; }
.field-hint { color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.check-field { min-height: 46px; display: flex; align-items: center; gap: 8px; margin: 18px 0; color: var(--ink-soft); font-size: 12px; }
.check-field input { width: 15px; height: 15px; accent-color: var(--coral); }
.distribution-actions { justify-content: space-between; }
.distribution-actions .btn-primary { min-width: 150px; }
.distribution-empty { min-height: 300px; padding: 34px 20px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--ink-soft); gap: 7px; }
.distribution-empty strong { color: var(--ink); font-size: 14px; }
.distribution-empty span:last-child { max-width: 34ch; font-size: 12px; line-height: 1.65; }
.distribution-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 19px; }
.distribution-stats > div { padding: 11px; background: #fcfaf5; border: 1px solid var(--line); border-radius: 5px; }
.distribution-stats span { display: block; color: var(--ink-soft); font-size: 10px; margin-bottom: 5px; }
.distribution-stats strong { display: block; font: 700 20px/1 Consolas, "Courier New", monospace; }
.reservation-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.reservation-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid #ebe8e0; font-size: 12px; }
.reservation-row span { color: var(--ink-soft); text-align: right; }
.notice { display: grid; gap: 5px; margin: 16px 0; padding: 11px 12px; border-radius: 5px; font-size: 11px; line-height: 1.45; }
.notice-warn { background: var(--amber); color: var(--amber-ink); }
.notice-warn strong { color: #6d4b13; }
.notice-ok { background: var(--mint); color: var(--mint-ink); }
.notice-ok strong { color: #245b42; }
.preview-block { margin-top: 18px; }
.preview-title { color: var(--ink-soft); font-size: 11px; margin-bottom: 8px; }
.sample-list { display: grid; gap: 4px; max-height: 235px; overflow: auto; padding: 10px; background: #222522; border-radius: 5px; }
.sample-list code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e8efe3; font: 11px/1.5 Consolas, "Courier New", monospace; }
.inline-note { color: var(--ink-soft); font-size: 11px; line-height: 1.55; margin-top: 14px; }
.download-success { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 20px 20px; padding: 12px; background: var(--mint); color: var(--mint-ink); border-radius: 5px; font-size: 12px; }
.download-success span { font: 11px Consolas, "Courier New", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-menu { display: none; }
@media (max-width: 960px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { min-height: 310px; }
  .login-art .login-note { margin-top: 45px; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 40px rgba(0,0,0,.12); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .panel-grid { grid-template-columns: 1fr; }
  .distribution-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .login-panel { padding: 35px 22px; }
  .topbar { padding: 0 18px; }
  .top-actions .btn-quiet { display: none; }
  .content { padding: 27px 16px; }
  .page-heading { align-items: start; flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .stat-card { min-height: 112px; padding: 14px; }
  .stat-value { font-size: 26px; }
  .panel-head, .table-toolbar { padding-left: 14px; padding-right: 14px; }
  .panel-body { padding: 14px; }
  .error-state { margin: 14px; flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .upload-label { align-items: flex-start; flex-wrap: wrap; }
  .upload-label .btn { margin-left: 46px; }
  .distribution-actions { align-items: stretch; flex-direction: column-reverse; }
  .distribution-actions .btn { width: 100%; }
  .distribution-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .distribution-stats strong { font-size: 17px; }
  .reservation-row { align-items: flex-start; flex-direction: column; gap: 4px; }
  .reservation-row span { text-align: left; }
  .download-success { margin-left: 14px; margin-right: 14px; align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
