:root {
  --ink: #17231e;
  --ink-soft: #405048;
  --muted: #7f8983;
  --canvas: #f2f0e9;
  --surface: #fffdf8;
  --surface-soft: #f8f6f0;
  --forest: #123d31;
  --forest-2: #28604e;
  --sage: #dce8e0;
  --clay: #b76d42;
  --amber: #d89a3d;
  --red: #b5473b;
  --line: #ddd9cf;
  --shadow: 0 16px 50px rgba(28, 40, 34, .08);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Georgia, "Songti SC", serif; }
.hidden { display: none !important; }
.eyebrow { color: var(--clay); font-size: 9px; font-weight: 800; letter-spacing: 3px; }
.eyebrow.light { color: #e4b58f; }
.primary { border: 0; color: white; background: var(--forest); }
.primary:hover { background: var(--forest-2); }

.login-screen { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); min-height: 100vh; overflow: hidden; background: #102e26; }
.login-atmosphere { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-atmosphere span { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.login-atmosphere span:nth-child(1) { width: 620px; height: 620px; left: -190px; bottom: -310px; box-shadow: 0 0 0 90px rgba(255,255,255,.018); }
.login-atmosphere span:nth-child(2) { width: 360px; height: 360px; top: -140px; left: 43%; }
.login-atmosphere span:nth-child(3) { width: 120px; height: 120px; top: 19%; left: 12%; background: rgba(183,109,66,.14); }
.login-story { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; padding: 9vw; color: white; }
.login-story h1 { max-width: 720px; margin-top: 24px; font-size: clamp(40px, 5vw, 74px); font-weight: 500; line-height: 1.16; }
.login-story p { max-width: 580px; margin-top: 24px; color: rgba(255,255,255,.58); font-size: 15px; line-height: 1.8; }
.login-points { display: flex; gap: 10px; margin-top: 38px; }
.login-points span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: rgba(255,255,255,.72); font-size: 10px; }
.login-card { position: relative; z-index: 2; align-self: center; width: min(450px, calc(100% - 48px)); margin: auto; padding: 44px; border-radius: 30px; background: var(--surface); box-shadow: 0 35px 100px rgba(0,0,0,.25); }
.brand-seal { display: grid; width: 58px; height: 58px; margin-bottom: 24px; place-items: center; border-radius: 50%; color: white; font-family: Georgia, serif; font-size: 25px; background: linear-gradient(135deg, var(--forest), var(--clay)); }
.brand-seal.small { width: 43px; height: 43px; margin: 0; font-size: 18px; }
.login-card h2 { margin-top: 8px; font-size: 34px; }
.login-card > p { margin-top: 11px; color: var(--muted); font-size: 12px; }
label { display: flex; flex-direction: column; gap: 8px; color: #5f6963; font-size: 11px; }
.login-card label:first-of-type { margin-top: 28px; }
.login-card label + label { margin-top: 15px; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); outline: 0; background: white; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(40,96,78,.11); }
.wide-button { width: 100%; margin-top: 19px; padding: 14px; border-radius: 11px; }
.form-error { display: block; min-height: 18px; margin-top: 11px; color: var(--red); font-size: 11px; text-align: center; }

.admin-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 17px; color: white; background: linear-gradient(175deg, #0f3027, #1b483a 72%, #5f432f 145%); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 25px; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 14px; letter-spacing: 1.6px; }
.brand span { margin-top: 4px; color: rgba(255,255,255,.42); font-size: 8px; letter-spacing: 2.4px; }
.nav-scroll { overflow-y: auto; scrollbar-width: none; }
.nav-label { display: block; margin: 20px 12px 7px; color: rgba(255,255,255,.28); font-size: 8px; letter-spacing: 2px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; margin: 2px 0; padding: 12px 13px; border: 0; border-radius: 11px; color: rgba(255,255,255,.64); text-align: left; background: transparent; }
.nav-item i { width: 22px; color: rgba(255,255,255,.3); font-size: 9px; font-style: normal; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.nav-item.active i { color: #e9af7c; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 18px 9px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot span { color: rgba(255,255,255,.35); font-size: 8px; letter-spacing: 1.4px; }
.sidebar-foot button { border: 0; color: rgba(255,255,255,.72); font-size: 10px; background: transparent; }

.workspace { min-width: 0; padding: 0 34px 55px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 114px; padding: 20px 2px; }
.topbar h1 { margin-top: 5px; font-size: 31px; }
.topbar > div:first-child p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-action { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); font-size: 20px; background: var(--surface); }
.admin-profile { text-align: right; }
.admin-profile span, .admin-profile small { display: block; }
.admin-profile span { font-size: 12px; font-weight: 700; }
.admin-profile small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: white; font-family: Georgia, serif; background: var(--clay); }
.view-root { animation: reveal .3s ease both; }
.loading-card, .empty-state { display: grid; min-height: 280px; place-items: center; border-radius: 22px; color: var(--muted); font-size: 12px; background: var(--surface); box-shadow: var(--shadow); }

.hero-panel { position: relative; display: grid; grid-template-columns: 1.3fr .7fr; min-height: 230px; padding: 38px; overflow: hidden; border-radius: 27px; color: white; background: linear-gradient(130deg, #123d31, #326552 70%, #ae6d44 150%); box-shadow: var(--shadow); }
.hero-panel h2 { max-width: 650px; margin-top: 17px; font-size: clamp(28px, 3.3vw, 45px); font-weight: 500; line-height: 1.22; }
.hero-panel p { margin-top: 14px; color: rgba(255,255,255,.6); font-size: 12px; }
.hero-figure { align-self: end; justify-self: end; font-family: Georgia, serif; font-size: 74px; line-height: 1; }
.hero-figure small { display: block; margin-top: 8px; color: rgba(255,255,255,.48); font-family: inherit; font-size: 10px; letter-spacing: 2px; text-align: right; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-top: 15px; }
.metric-card { padding: 20px; border-radius: 18px; background: var(--surface); box-shadow: 0 7px 25px rgba(28,40,34,.05); }
.metric-card span, .metric-card small { display: block; }
.metric-card span { color: var(--muted); font-size: 10px; }
.metric-card strong { display: block; margin-top: 12px; font-family: Georgia, serif; font-size: 27px; }
.metric-card small { margin-top: 7px; color: #a3aaa5; font-size: 9px; }
.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 15px; margin-top: 15px; }
.panel { padding: 23px; border-radius: 20px; background: var(--surface); box-shadow: 0 7px 25px rgba(28,40,34,.05); }
.panel-head, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-head h3 { margin-top: 4px; font-size: 21px; }
.status-bars { display: grid; gap: 13px; margin-top: 22px; }
.status-row { display: grid; grid-template-columns: 72px 1fr 28px; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; }
.status-row i { display: block; height: 7px; overflow: hidden; border-radius: 999px; background: #e9e6de; }
.status-row i::before { display: block; width: var(--width); height: 100%; border-radius: inherit; content: ""; background: var(--forest-2); }
.task-list { display: grid; gap: 8px; margin-top: 18px; }
.task-item { display: flex; align-items: center; justify-content: space-between; padding: 13px; border: 1px solid #ebe7de; border-radius: 12px; background: var(--surface-soft); }
.task-item span { color: var(--muted); font-size: 10px; }
.task-item strong { font-size: 17px; }

.toolbar { margin-bottom: 15px; }
.toolbar-left, .toolbar-right, .filters { display: flex; align-items: center; gap: 9px; }
.toolbar h2 { font-size: 25px; }
.toolbar p { margin-top: 5px; color: var(--muted); font-size: 10px; }
.button { padding: 10px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 11px; background: var(--surface); }
.button.primary { border-color: var(--forest); color: white; background: var(--forest); }
.button.danger { border-color: #efd3ce; color: var(--red); background: #fff6f4; }
.filters { margin-bottom: 12px; padding: 12px; border-radius: 15px; background: rgba(255,255,255,.55); }
.filters input, .filters select { width: auto; min-width: 150px; padding: 9px 11px; font-size: 10px; }
.table-card { overflow: hidden; border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #ebe8df; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #8c948f; font-size: 9px; letter-spacing: 1px; background: var(--surface-soft); }
td { font-size: 11px; }
tbody tr:hover { background: #fbfaf6; }
.product-cell { display: flex; align-items: center; gap: 11px; min-width: 240px; }
.product-cell img { width: 47px; height: 59px; border-radius: 8px; object-fit: cover; background: #e4e1d9; }
.product-cell strong, .product-cell small { display: block; }
.product-cell small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.status { display: inline-flex; padding: 6px 9px; border-radius: 999px; color: #246148; font-size: 9px; background: #e2efe7; }
.status.warn { color: #8b5b1e; background: #f5ead5; }
.status.off { color: #915347; background: #f2e1dc; }
.status.info { color: #3e5c84; background: #e5ebf3; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); font-size: 9px; background: white; }
.row-actions button.accent { border-color: var(--forest); color: white; background: var(--forest); }
.row-actions button.danger { color: var(--red); }
.stock-low { color: var(--red); font-weight: 700; }
.table-empty { padding: 65px; color: var(--muted); text-align: center; }
.pagination-note { padding: 12px 16px; color: var(--muted); font-size: 9px; text-align: right; background: #faf8f3; }

.modal { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 25px; background: var(--surface); box-shadow: 0 35px 100px rgba(0,0,0,.3); }
.modal.wide { width: min(940px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(12,30,24,.68); backdrop-filter: blur(7px); }
#modal-form { max-height: calc(100vh - 30px); overflow-y: auto; }
.modal-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 27px 30px 18px; background: var(--surface); }
.modal-head h2 { margin-top: 5px; font-size: 28px; }
.close-button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); font-size: 22px; background: #efebe4; }
.modal-body { padding: 0 30px 28px; }
.modal-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 17px 30px 24px; border-top: 1px solid #eeeae1; background: var(--surface); }
.modal-actions button { padding: 11px 20px; border: 1px solid var(--line); border-radius: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 6px; padding-top: 17px; border-top: 1px solid #ece8df; }
.form-section h3 { font-size: 17px; }
.form-section p { margin-top: 5px; color: var(--muted); font-size: 9px; }
textarea { min-height: 92px; resize: vertical; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.check-item { flex-direction: row; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.check-item input { width: auto; }
.image-preview { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.image-preview article { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.image-preview img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.image-preview button { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.58); }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-list div { padding: 12px; border-radius: 10px; background: var(--surface-soft); }
.detail-list span, .detail-list strong { display: block; }
.detail-list span { color: var(--muted); font-size: 9px; }
.detail-list strong { margin-top: 5px; font-size: 11px; }
.toast { position: fixed; z-index: 300; right: 28px; bottom: 28px; max-width: 360px; padding: 13px 17px; border-radius: 11px; color: white; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .22s; background: var(--forest); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 1150px) {
  .admin-shell { grid-template-columns: 86px minmax(0, 1fr); }
  .sidebar { padding: 20px 11px; }
  .brand > div:last-child, .nav-label, .nav-item span, .sidebar-foot span { display: none; }
  .brand { justify-content: center; padding: 0 0 20px; }
  .nav-item { justify-content: center; padding: 12px 7px; }
  .nav-item i { width: auto; font-size: 10px; }
  .sidebar-foot { justify-content: center; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .login-screen { display: flex; align-items: center; justify-content: center; }
  .login-story { display: none; }
  .login-card { padding: 30px; }
  .admin-shell { display: block; }
  .sidebar { position: fixed; z-index: 80; top: auto; right: 9px; bottom: 9px; left: 9px; flex-direction: row; width: auto; height: 65px; padding: 7px; border-radius: 18px; }
  .brand, .sidebar-foot, .nav-label { display: none; }
  .nav-scroll { display: flex; width: 100%; overflow-x: auto; }
  .nav-item { min-width: 56px; margin: 0; }
  .workspace { padding: 0 13px 90px; }
  .topbar { min-height: 96px; }
  .admin-profile { display: none; }
  .hero-panel { grid-template-columns: 1fr; padding: 28px; }
  .hero-figure { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .toolbar, .filters { align-items: stretch; flex-direction: column; }
  .toolbar-left, .toolbar-right { justify-content: space-between; }
  .filters input, .filters select { width: 100%; }
  .form-grid, .detail-list { grid-template-columns: 1fr; }
  .form-grid .wide, .form-section { grid-column: auto; }
  .check-grid { grid-template-columns: 1fr; }
  .image-preview { grid-template-columns: repeat(3, 1fr); }
}
.sku-section { margin-top: 2px; }
.sku-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sku-section-head .button { flex: 0 0 auto; padding: 9px 14px; }
.sku-editor-head,
.sku-editor-row { display: grid; grid-template-columns: .8fr 1.1fr .85fr .7fr .7fr .8fr 38px; gap: 8px; align-items: center; }
.sku-editor-head { padding: 0 4px 7px; color: var(--muted); font-size: 9px; }
.sku-editor { display: grid; gap: 8px; }
.sku-editor-row { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.sku-editor-row input,
.sku-editor-row select { min-width: 0; padding: 10px; background: white; }
.sku-remove { width: 34px; height: 34px; padding: 0; border: 1px solid #ead4cf; border-radius: 9px; color: var(--red); font-size: 20px; background: #fff7f4; }
@media (max-width: 760px) {
  .sku-editor-head { display: none; }
  .sku-editor-row { grid-template-columns: 1fr 1fr; }
  .sku-editor-row .sku-remove { grid-column: 2; justify-self: end; }
}
