:root {
  color-scheme: light;
  --navy-950: #071b2c;
  --navy-900: #0b2940;
  --navy-800: #123b57;
  --navy-700: #1d4b68;
  --gold: #d58a2d;
  --gold-dark: #b96f16;
  --gold-pale: #fff1dc;
  --cream: #f7f5f0;
  --surface: #ffffff;
  --line: #e4e9ed;
  --muted: #71808c;
  --text: #173144;
  --success: #217a59;
  --danger: #bb433d;
  --warning: #a96716;
  --shadow: 0 18px 48px rgba(7, 27, 44, .10);
  --radius: 16px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { color: var(--text); background: #edf1f3; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }
.mobile-only { display: none; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(390px, .85fr);
  background:
    radial-gradient(circle at 18% 22%, rgba(213, 138, 45, .20), transparent 28%),
    linear-gradient(135deg, #061827, #0c314a 56%, #15455f);
}
.login-brand { padding: clamp(48px, 8vw, 120px); display: flex; align-items: center; gap: 28px; color: white; }
.login-brand h1 { margin: 8px 0 14px; font-family: Georgia, "STSong", serif; font-size: clamp(38px, 5vw, 68px); font-weight: 600; letter-spacing: .04em; }
.login-brand p:last-child { margin: 0; color: #b8c9d4; font-size: 17px; }
.brand-seal { width: 84px; height: 104px; flex: none; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 42px 42px 12px 12px; background: linear-gradient(155deg, #dc9b48, #a75a14); box-shadow: 0 20px 50px rgba(0,0,0,.25); font-family: "STKaiti", serif; font-size: 46px; }
.brand-seal--small { width: 42px; height: 48px; border-radius: 22px 22px 8px 8px; font-size: 24px; }
.login-card { align-self: center; width: min(440px, calc(100% - 56px)); margin: 28px auto; padding: 44px; border-radius: 24px; background: rgba(255,255,255,.97); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card__head { margin-bottom: 28px; }
.login-card__head h2 { margin: 16px 0 8px; font-size: 28px; }
.login-card__head p, .login-note { margin: 0; color: var(--muted); line-height: 1.7; }
.pill { display: inline-flex; padding: 6px 10px; border-radius: 999px; color: var(--gold-dark); background: var(--gold-pale); font-size: 10px; font-weight: 800; letter-spacing: .12em; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { color: #526673; font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 11px 13px; border: 1px solid #d7e0e5; border-radius: 10px; outline: none; color: var(--text); background: #fbfcfc; transition: border .2s, box-shadow .2s;
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(213,138,45,.13); background: white; }
.field small { color: var(--muted); }
.field--wide { grid-column: 1 / -1; }
.checkbox-field { min-height: 44px; display: flex; align-items: center; gap: 9px; padding-top: 18px; font-size: 14px; font-weight: 700; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--gold); }

.btn { min-height: 38px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 700; transition: transform .15s, opacity .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn--primary { color: white; background: linear-gradient(135deg, #db9134, #bc6e19); box-shadow: 0 8px 18px rgba(190,111,25,.18); }
.btn--navy { color: white; background: var(--navy-900); }
.btn--ghost { border-color: #d9e1e5; background: white; }
.btn--danger { color: var(--danger); border-color: #f0cfcd; background: #fff6f5; }
.btn--small { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; min-height: 48px; margin-top: 6px; }
.login-note { margin-top: 20px; text-align: center; font-size: 12px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid #dbe2e6; border-radius: 10px; display: grid; place-items: center; background: white; cursor: pointer; font-size: 18px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 24px 16px; color: white; background: linear-gradient(180deg, #071c2d, #0a2a40 58%, #0c354d); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand strong { display: block; font-family: Georgia, "STSong", serif; font-size: 20px; letter-spacing: .08em; }
.sidebar-brand span { color: #8fa8b8; font-size: 11px; letter-spacing: .2em; }
.nav-list { display: grid; gap: 4px; padding: 18px 0; }
.nav-label { margin: 17px 12px 6px; color: #668498; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 0; border-radius: 10px; color: #b8cad5; background: transparent; cursor: pointer; text-align: left; font-size: 14px; }
.nav-item > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.07); font-family: "STKaiti", serif; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: white; background: linear-gradient(90deg, rgba(213,138,45,.30), rgba(213,138,45,.10)); box-shadow: inset 3px 0 var(--gold); }
.nav-item.is-active > span { color: #3c2108; background: var(--gold); }
.sidebar-foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255,255,255,.08); color: #7792a3; font-size: 11px; line-height: 1.7; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 88px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.admin-chip > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--navy-900); font-size: 13px; font-weight: 800; }
.admin-chip strong, .admin-chip small { display: block; white-space: nowrap; }
.admin-chip strong { font-size: 12px; }
.admin-chip small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.content { max-width: 1540px; margin: 0 auto; padding: 28px 30px 60px; outline: none; }

.loading-card, .empty-card { min-height: 360px; display: grid; place-items: center; align-content: center; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); background: white; }
.loader { width: 34px; height: 34px; border: 3px solid #e7ecef; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 142px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 7px 24px rgba(9,35,52,.04); }
.stat-card::after { content: ""; position: absolute; right: -22px; bottom: -38px; width: 100px; height: 100px; border-radius: 50%; background: var(--gold-pale); }
.stat-card--dark { color: white; border-color: transparent; background: linear-gradient(140deg, #092238, #174660); }
.stat-card--dark::after { background: rgba(255,255,255,.07); }
.stat-card__label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card--dark .stat-card__label { color: #b6c9d5; }
.stat-card__value { position: relative; z-index: 1; margin: 14px 0 5px; font-family: Georgia, serif; font-size: 32px; font-weight: 700; }
.stat-card__meta { position: relative; z-index: 1; color: var(--muted); font-size: 11px; }
.stat-card--dark .stat-card__meta { color: #91aaba; }

.dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 7px 24px rgba(9,35,52,.035); }
.panel-head { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 20px; border-bottom: 1px solid #edf0f2; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px 20px; }
.status-list { display: grid; gap: 14px; }
.status-row { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: 10px; font-size: 12px; }
.status-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f3; }
.status-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), #e7b66f); }
.status-count { text-align: right; font-weight: 800; }
.status-progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: #edf1f3; }
.status-progress::-webkit-progress-bar { border-radius: 99px; background: #edf1f3; }
.status-progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, var(--gold), #e7b66f); }
.status-progress::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, var(--gold), #e7b66f); }
.link-button { padding: 0; border: 0; color: var(--navy-700); background: transparent; cursor: pointer; font-weight: 800; }
.link-button:hover { color: var(--gold-dark); text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.7; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 9px; }
.search-input, .filter-select { height: 40px; border: 1px solid #dbe2e6; border-radius: 9px; outline: none; background: white; }
.search-input { width: min(320px, 45vw); padding: 0 13px; }
.filter-select { padding: 0 30px 0 11px; }
.search-input:focus, .filter-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(213,138,45,.1); }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #6d7d88; background: #f8fafb; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
td { font-size: 13px; }
tbody tr:hover { background: #fcfbf8; }
tbody tr:last-child td { border-bottom: 0; }
.cell-title { max-width: 280px; white-space: normal; }
.cell-title strong, .cell-title small { display: block; }
.cell-title small { margin-top: 4px; color: var(--muted); line-height: 1.45; }
.product-cell { display: flex; align-items: center; gap: 11px; }
.product-thumb { width: 44px; height: 44px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 10px; color: var(--navy-900); background: #edf1ef; font-size: 21px; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.actions { display: flex; gap: 6px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 99px; color: var(--success); background: #e9f6f0; font-size: 11px; font-weight: 800; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge--muted { color: #75838c; background: #eef1f3; }
.status-badge--warning { color: var(--warning); background: #fff3df; }
.status-badge--danger { color: var(--danger); background: #fff0ef; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid #edf0f2; color: var(--muted); font-size: 12px; }
.pagination-actions { display: flex; gap: 7px; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,20,32,.58); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(850px, 100%); max-height: calc(100vh - 48px); overflow: hidden; display: flex; flex-direction: column; border-radius: 20px; background: white; box-shadow: 0 30px 100px rgba(0,0,0,.34); }
.modal-panel--wide { width: min(1020px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-body { padding: 22px 24px 26px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.detail-item { padding: 13px; border-radius: 10px; background: #f6f8f9; }
.detail-item span, .detail-item strong { display: block; }
.detail-item span { color: var(--muted); font-size: 11px; }
.detail-item strong { margin-top: 5px; font-size: 13px; white-space: normal; word-break: break-word; }
.detail-section { margin: 18px 0; }
.detail-section h3 { margin: 0 0 10px; font-size: 14px; }
.item-list { display: grid; gap: 8px; }
.item-row { display: flex; justify-content: space-between; gap: 15px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.item-row small { display: block; margin-top: 4px; color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 7px; color: #486171; background: #edf2f4; font-size: 11px; }
.upload-row { display: flex; align-items: center; gap: 8px; }
.upload-row input[type="text"] { flex: 1; }
.upload-row input[type="file"] { max-width: 210px; font-size: 11px; }
.image-preview { width: 100%; max-height: 240px; margin-top: 8px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #f5f7f8; }
.settings-card { max-width: 640px; }
.settings-profile { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.settings-avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; color: white; background: var(--navy-900); font-size: 20px; font-weight: 800; }
.settings-profile h2 { margin: 0 0 5px; }
.settings-profile p { margin: 0; color: var(--muted); font-size: 12px; }

.toast { position: fixed; z-index: 300; left: 50%; top: 22px; max-width: min(480px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 10px; color: white; background: var(--navy-950); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, -16px); transition: opacity .2s, transform .2s; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #9d302c; }

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; align-content: center; padding: 30px 0; }
  .login-brand { padding: 20px 28px; justify-content: center; }
  .login-brand .brand-seal { width: 60px; height: 74px; font-size: 34px; }
  .login-brand h1 { font-size: 31px; }
  .login-brand p:last-child { font-size: 13px; }
  .login-card { padding: 30px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; z-index: 50; width: 248px; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 20px; }
  .topbar-actions .btn, .admin-chip div { display: none; }
  .content { padding: 20px 16px 44px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-group { width: 100%; }
  .search-input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .login-brand { align-items: flex-start; }
  .login-brand h1 { margin-top: 4px; font-size: 25px; }
  .login-brand p:last-child { display: none; }
  .login-card { width: calc(100% - 28px); padding: 25px 20px; }
  .stats-grid { grid-template-columns: 1fr; }
  .modal { padding: 0; place-items: end center; }
  .modal-panel { max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-body { padding: 18px 16px; }
  .admin-chip { display: none; }
}
