:root {
  color-scheme: light;
  --ink: #452218;
  --ink-soft: #72594c;
  --muted: #9b8173;
  --line: rgba(138, 74, 44, .14);
  --line-strong: #dcbda5;
  --paper: #fff9f1;
  --paper-deep: #f8ead9;
  --accent: #8a4a2c;
  --accent-dark: #4e2418;
  --gold: #c98b4b;
  --danger: #b54b38;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }
.login-view { display: grid; grid-template-columns: minmax(260px, 360px) minmax(320px, 480px); gap: 80px; align-items: center; justify-content: center; min-height: 100vh; padding: 48px 24px; background: var(--paper); }
.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-lockup.compact { gap: 11px; }
.brand-mark { position: relative; display: grid; width: 68px; height: 68px; place-items: center; border-radius: 22px; background: #f1dfca; }
.brand-mark span { width: 25px; height: 42px; border-radius: 55% 45% 55% 45%; transform: rotate(18deg); background: linear-gradient(140deg, #8a4a2c, #4e2418); }
.brand-mark i { position: absolute; width: 4px; height: 32px; margin: -1px 0 0 10px; border-radius: 50%; transform: rotate(35deg); background: #f6d6ac; }
.brand-name { font-family: "Songti SC", "STSong", serif; font-size: 32px; font-weight: 700; letter-spacing: 5px; }
.brand-caption { margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.login-view > .brand-lockup { align-self: center; }
.login-panel { padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .72); box-shadow: 0 24px 70px rgba(88, 45, 29, .08); }
.eyebrow { color: #a06a48; font-size: 11px; font-weight: 800; letter-spacing: 2px; }
h1, h2, p { margin: 0; }
.login-panel h1, .page-intro h1 { margin-top: 14px; font-family: "Songti SC", "STSong", serif; font-size: 33px; line-height: 1.3; }
.muted { color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.login-panel > .muted { margin-top: 10px; }
.stack-form { display: grid; gap: 17px; margin-top: 28px; }
label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
input, select { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; color: var(--ink); background: rgba(255, 255, 255, .78); transition: border-color .18s, box-shadow .18s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138, 74, 44, .12); }
.primary-button { min-height: 46px; padding: 0 20px; border: 0; border-radius: 10px; color: var(--paper); background: var(--accent-dark); font-size: 14px; font-weight: 700; box-shadow: 0 8px 18px rgba(78, 36, 24, .14); }
.primary-button:hover { background: var(--accent); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.message { min-height: 21px; margin-top: 14px; color: var(--danger); font-size: 13px; line-height: 1.6; }
.admin-view { min-height: 100vh; }
.topbar { display: flex; height: 78px; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 251, 246, .96); }
.topbar .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
.topbar .brand-mark span { width: 16px; height: 26px; }
.topbar .brand-mark i { width: 3px; height: 20px; margin-left: 6px; }
.topbar .brand-name { font-size: 22px; letter-spacing: 3px; }
.topbar .brand-caption { font-size: 9px; letter-spacing: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.admin-name { color: var(--ink-soft); font-size: 13px; }
.text-button { padding: 7px 0; border: 0; color: var(--accent); background: transparent; font-size: 13px; font-weight: 700; }
.content-wrap { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 80px; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-intro h1 { font-size: 42px; }
.page-intro .muted { margin-top: 10px; }
.rule-note { display: flex; align-items: center; gap: 9px; padding: 12px 15px; border: 1px solid rgba(201, 139, 75, .28); border-radius: 12px; color: #916442; background: var(--paper-deep); font-size: 12px; white-space: nowrap; }
.rule-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.search-bar { display: flex; align-items: flex-end; gap: 12px; margin-top: 36px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .6); }
.search-field { flex: 1; }
.search-button { min-width: 112px; }
.search-bar + .message { margin: 9px 4px 0; }
.results { display: grid; gap: 16px; margin-top: 26px; }
.redeem-section { margin-top: 26px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .75); box-shadow: 0 14px 40px rgba(88, 45, 29, .05); }
.redeem-section h2 { font-family: "Songti SC", "STSong", serif; font-size: 24px; }
.redeem-section > .muted { margin-top: 7px; }
.redeem-section .search-bar { margin-top: 18px; }
.redeem-section .message { margin-bottom: 0; }
.user-card { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 255, 255, .75); box-shadow: 0 14px 40px rgba(88, 45, 29, .05); }
.user-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.user-title { display: flex; align-items: center; gap: 13px; }
.user-avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: var(--accent); background: #f1dfca; font-family: "Songti SC", serif; font-size: 21px; font-weight: 700; }
.user-name { font-size: 17px; font-weight: 700; }
.user-meta { margin-top: 6px; color: var(--muted); font-size: 12px; }
.user-created { color: var(--muted); font-size: 12px; white-space: nowrap; }
.balance-grid { display: grid; grid-template-columns: .85fr .85fr 1.3fr; gap: 12px; margin-top: 20px; }
.balance-item { padding: 16px; border: 1px solid rgba(138, 74, 44, .1); border-radius: 13px; background: var(--paper); }
.time-balance { background: linear-gradient(135deg, #f7e6cf, #fff8ee); }
.balance-label { color: var(--ink-soft); font-size: 13px; }
.balance-number { margin-top: 7px; color: var(--accent); font-family: "Songti SC", serif; font-size: 29px; font-weight: 700; }
.balance-number small { margin-left: 4px; font-family: inherit; font-size: 13px; font-weight: 500; }
.time-number { font-size: 25px; }
.balance-caption { margin-top: 6px; color: var(--muted); font-size: 11px; }
.operation-tabs { display: flex; gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.operation-tab { min-width: 98px; padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink-soft); background: var(--paper); font-size: 13px; font-weight: 700; }
.operation-tab[aria-selected="true"] { border-color: var(--accent-dark); color: var(--paper); background: var(--accent-dark); }
.operation-panel { margin-top: 14px; }
.time-action-tabs { display: flex; gap: 8px; }
.time-action-tab { min-width: 98px; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink-soft); background: rgba(255, 249, 241, .7); font-size: 13px; font-weight: 700; }
.time-action-tab[aria-selected="true"] { border-color: var(--accent); color: var(--accent-dark); background: #f1dfca; }
.time-action-panel { margin-top: 12px; }
.time-action-panel .grant-form { max-width: 620px; }
.grant-form { display: grid; grid-template-columns: 1.15fr .7fr; gap: 12px; align-items: end; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 249, 241, .62); }
.form-heading { display: flex; grid-column: 1 / -1; align-items: baseline; justify-content: space-between; gap: 12px; }
.form-heading strong { color: var(--ink); font-size: 14px; }
.form-heading span { color: var(--muted); font-size: 11px; text-align: right; }
.grant-form label:nth-of-type(3) { grid-column: 1 / -1; }
.grant-time-form label:nth-of-type(2), .consume-time-form label:nth-of-type(2) { grid-column: 1 / -1; }
.grant-form .primary-button { min-width: 116px; }
.grant-form .primary-button { grid-column: 1 / -1; }
.secondary-button { color: var(--accent-dark); background: #ead2b6; box-shadow: none; }
.secondary-button:hover { color: var(--paper); }
.consume-button { background: var(--accent); }
.consume-button:hover { background: var(--accent-dark); }
.consumption-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.consumption-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.consumption-heading h3 { margin: 0; font-size: 15px; }
.consumption-count { color: var(--muted); font-size: 12px; font-weight: 500; }
.consumption-heading p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.consumption-toggle { flex: none; }
.consumption-panel { margin-top: 13px; }
.consumption-status { color: var(--muted); font-size: 13px; line-height: 1.6; }
.consumption-status:not(:empty) { padding: 14px 0; }
.consumption-list { border-top: 1px solid var(--line); }
.consumption-list:empty { border: 0; }
.consumption-item { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.consumption-detail, .consumption-side { display: grid; gap: 5px; }
.consumption-detail strong, .consumption-side strong { font-size: 13px; }
.consumption-detail span, .consumption-side time { color: var(--muted); font-size: 12px; line-height: 1.5; }
.consumption-side { flex: none; text-align: right; }
.consumption-side strong { color: var(--accent); }
.consumption-more { display: block; margin: 12px auto 0; }
.empty-state { margin-top: 48px; padding: 64px 24px; border: 1px dashed var(--line-strong); border-radius: 18px; text-align: center; }
.empty-glyph { display: grid; width: 54px; height: 54px; margin: 0 auto 15px; place-items: center; border-radius: 17px; color: var(--paper); background: var(--gold); font-size: 30px; }
.empty-state h2 { font-family: "Songti SC", "STSong", serif; font-size: 24px; }
.empty-state p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.no-results { padding: 40px 20px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 2; padding: 12px 16px; border-radius: 10px; color: var(--paper); background: var(--accent-dark); box-shadow: 0 12px 28px rgba(78, 36, 24, .2); font-size: 13px; }

@media (max-width: 760px) {
  .login-view { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 32px; padding: 32px 20px; }
  .login-view > .brand-lockup { align-self: flex-start; }
  .login-panel { padding: 28px 22px; }
  .topbar { height: 70px; padding: 0 20px; }
  .admin-name { display: none; }
  .content-wrap { width: calc(100% - 40px); padding-top: 32px; }
  .page-intro { display: block; }
  .page-intro h1 { font-size: 34px; }
  .rule-note { width: fit-content; margin-top: 20px; }
  .search-bar { display: block; padding: 16px; }
  .search-button { width: 100%; margin-top: 12px; }
  .user-card { padding: 18px; }
  .redeem-section { padding: 18px; }
  .user-card-head { display: block; }
  .user-created { display: block; margin-top: 11px; }
  .balance-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .time-balance { grid-column: 1 / -1; }
  .balance-item { padding: 12px 9px; }
  .balance-label { font-size: 12px; }
  .balance-number { font-size: 24px; }
  .grant-form { grid-template-columns: 1fr 1fr; }
  .grant-form .primary-button { width: 100%; }
  .consumption-heading { align-items: flex-start; }
  .consumption-item { gap: 10px; }
  .consumption-side { max-width: 45%; }
}
