:root {
  --wine: #5e062d;
  --berry: #a5124e;
  --pink: #f5d9e2;
  --blush: #fff7fa;
  --surface: #ffffff;
  --ink: #27141c;
  --muted: #79626d;
  --line: #f0dce4;
  --success: #167247;
  --warning: #a44b06;
  --danger: #b32940;
  --shadow: 0 16px 44px rgba(85, 15, 42, 0.10);
}

* { box-sizing: border-box; }
html { background: var(--blush); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--blush); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .table-scroll:focus-visible, a:focus-visible { outline: 3px solid rgba(165, 18, 78, .42); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 99; left: 16px; top: -52px; padding: 10px 14px; border-radius: 8px; color: #fff; background: var(--wine); transition: top .18s ease; }
.skip-link:focus { top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 0 0, rgba(236,72,153,.18), transparent 30%), radial-gradient(circle at 100% 100%, rgba(94,6,45,.20), transparent 33%), var(--blush); }
.login-card { width: min(440px, 100%); padding: clamp(30px, 6vw, 50px); border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,255,255,.94); box-shadow: 0 28px 80px rgba(85, 15, 42, .16); }
.login-card h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 48px); }
.login-copy, .login-note { color: var(--muted); }
.login-copy { margin-bottom: 28px; }
.login-note { margin: 20px 0 0; font-size: 12px; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: #59323f; font-weight: 750; }
.login-form input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #e1cbd4; border-radius: 9px; color: var(--ink); background: #fff; }
.form-message { min-height: 20px; margin: -4px 0 0; color: var(--danger); font-size: 13px; }
.login-submit { width: 100%; min-height: 50px; }
.logout-button { width: 100%; min-height: 38px; margin-top: 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; color: #fff; background: rgba(255,255,255,.08); font-weight: 700; }
.logout-button:hover { background: rgba(255,255,255,.16); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 30px 20px; color: #fcebf2; background: var(--wine); }
.brand { display: grid; gap: 4px; padding: 10px 12px 28px; color: inherit; text-decoration: none; }
.brand-kicker, .eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.brand strong { font-size: 18px; letter-spacing: .02em; }
.nav-list { display: grid; gap: 6px; }
.nav-item { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border: 0; border-radius: 10px; color: #f8d9e5; background: transparent; text-align: left; transition: background .18s ease, color .18s ease; }
.nav-item:hover, .nav-item:focus-visible { background: rgba(255,255,255,.12); }
.nav-item.active { color: var(--wine); background: #fff5f8; font-weight: 800; }
.nav-item span { display: inline-grid; min-width: 24px; height: 24px; place-items: center; border-radius: 99px; color: var(--wine); background: #f7bfd2; font-size: 12px; }
.sidebar-foot { margin-top: auto; padding: 16px 12px; border: 1px solid rgba(255,255,255,.17); border-radius: 12px; background: rgba(255,255,255,.06); }
.sidebar-foot p, .sidebar-foot small { margin: 0; color: #e8b9ca; }
.sidebar-foot strong { display: block; margin: 4px 0; color: #fff; }

.main-content { width: min(1440px, 100%); margin: 0 auto; padding: 44px clamp(24px, 4vw, 64px) 72px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 5px; color: var(--berry); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; line-height: 1.08; }
h2 { margin-bottom: 4px; font-size: 20px; letter-spacing: -.02em; }
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.button { min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { color: #fff; background: var(--berry); box-shadow: 0 8px 20px rgba(165,18,78,.22); }
.button.primary:hover { background: #8f0f43; }
.button.secondary { color: var(--berry); border-color: #e4b3c4; background: #fff; }
.button.secondary:hover { background: #fff2f6; }
.text-button { min-height: 40px; padding: 0 6px; border: 0; color: var(--berry); background: transparent; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric-card { min-height: 142px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 14px rgba(85, 15, 42, .04); }
.metric-card.highlighted { border-color: transparent; color: #fff; background: var(--wine); }
.metric-card p, .metric-card span { margin-bottom: 0; color: var(--muted); }
.metric-card.highlighted p, .metric-card.highlighted span { color: #f4c7d6; }
.metric-card strong { display: block; margin: 5px 0 7px; font-size: 32px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.metric-card span { font-size: 12px; }

.toolbar { display: flex; align-items: end; gap: 14px; padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.66); }
.search-field { flex: 1 1 260px; }
.search-field input, .select-field select, .form-grid input, .form-grid select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #e1cbd4; border-radius: 8px; color: var(--ink); background: #fff; }
.select-field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.select-field select { min-width: 132px; }

.order-panel, .inventory-panel { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.panel-heading p { margin-bottom: 0; color: var(--muted); }
.panel-note { max-width: 270px; padding: 8px 10px; border-radius: 6px; color: #754652 !important; background: #fff1f5; font-size: 12px; }
.table-scroll { overflow-x: auto; border: 1px solid #f1e1e7; border-radius: 10px; }
table { width: 100%; min-width: 900px; border-collapse: collapse; text-align: left; }
th { padding: 12px 14px; color: #7b5764; background: #fff7f9; font-size: 12px; letter-spacing: .02em; }
td { padding: 16px 14px; border-top: 1px solid #f3e6eb; vertical-align: middle; }
tr:hover td { background: #fffafb; }
.order-no { display: block; font-weight: 800; font-variant-numeric: tabular-nums; }
.date { color: var(--muted); font-size: 12px; }
.item-summary { max-width: 245px; font-weight: 700; }
.recipient { display: block; font-weight: 700; }
.recipient-address { display: block; max-width: 190px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.price { font-weight: 800; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status.waiting { color: var(--warning); background: #fff1dc; }
.status.ship { color: var(--berry); background: #fde5ee; }
.status.done { color: var(--success); background: #e1f5e9; }
.status.cancel { color: #79626d; background: #eee9eb; }
.row-action { min-height: 36px; min-width: 88px; padding: 0 10px; border: 1px solid #dfb3c4; border-radius: 7px; color: var(--berry); background: #fff; font-weight: 750; }
.row-action:hover { background: #fff0f5; }
.row-action[disabled] { color: #a89aa0; border-color: #eee7e9; background: #faf8f9; cursor: not-allowed; }
.empty-state { padding: 50px 24px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); }

.inventory-panel { margin-top: 22px; box-shadow: none; }
.inventory-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.inventory-card { min-height: 128px; padding: 16px; border: 1px solid #f0dbe3; border-radius: 10px; background: #fffafc; }
.inventory-card p { min-height: 42px; margin-bottom: 12px; font-weight: 750; }
.inventory-card strong { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.inventory-card span { color: var(--muted); font-size: 12px; }

.modal { width: min(620px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 28px 80px rgba(43, 6, 23, .32); }
.modal::backdrop { background: rgba(34, 10, 21, .55); }
.modal form { padding: 26px; }
.modal-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-heading h2 { margin-bottom: 0; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--wine); background: #fff; font-size: 26px; line-height: 1; }
.icon-button:hover { background: #fff1f5; }
.order-summary { padding: 14px; margin-bottom: 18px; border-radius: 10px; background: #fff5f8; }
.order-summary p { margin-bottom: 4px; color: var(--muted); }
.order-summary strong { font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 6px; color: #59323f; font-weight: 750; }
.form-grid small { color: var(--muted); font-size: 12px; font-weight: 500; }
.full-width { grid-column: 1 / -1; }
.notice { display: grid; gap: 4px; padding: 13px; margin-top: 18px; border-left: 3px solid var(--berry); color: #6e4553; background: #fff5f8; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 9px; color: #fff; background: #2a1620; box-shadow: 0 12px 28px rgba(0,0,0,.2); transform: translate(-50%, 80px); opacity: 0; transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } .inventory-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .app-shell { display: block; } .sidebar { position: static; height: auto; padding: 18px; } .brand { padding: 4px 6px 14px; } .nav-list { grid-template-columns: repeat(3, 1fr); } .nav-item { justify-content: center; padding: 8px; text-align: center; font-size: 12px; } .nav-item span { display: none; } .sidebar-foot { display: none; } .main-content { padding: 28px 16px 48px; } .topbar, .panel-heading { display: grid; } .topbar-actions { justify-content: stretch; } .topbar-actions .button { flex: 1 1 170px; } .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .metric-card { min-height: 118px; padding: 16px; } .metric-card strong { font-size: 26px; } .toolbar { display: grid; } .select-field select { min-width: 0; } .inventory-grid { grid-template-columns: 1fr 1fr; } .form-grid { grid-template-columns: 1fr; } .full-width { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
