
:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f5f6f8; color: #1c2229; color-scheme: light;
  --border: #e5e8ed; --muted: #606b79; --accent: #ffd940; --panel: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.topbar {
  min-height: 65px; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px clamp(16px,3.2vw,44px); background: #171c22; color: #fff;
}
.brand, .account { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  display: grid; place-items: center; width: 35px; height: 35px; color: #15181c; font-size: 1.35rem; font-weight: 800;
  border-radius: 9px; background: var(--accent);
}
.brand { min-width: 0; }
.brand-icon { flex: none; }
.brand strong { font-size: 1.05rem; font-weight: 740; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account { flex: none; font-size: .9rem; }
.account button { color: #fff; background: #282f38; border-color: #414853; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.25rem,3vw,1.7rem); letter-spacing: -.035em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.login-shell { margin: 0 auto; padding: clamp(45px,11vh,94px) 18px 30px; max-width: 430px; }
#login { display: grid; gap: 18px; padding: 30px; box-shadow: 0 16px 40px #1c25360c; }
#login h1 { margin-bottom: 5px; }
#login button { margin-top: 4px; }
.login-shell .error:empty, .error:empty, .list-hint:empty { display: none; }
.workspace { max-width: 1600px; margin: 0 auto; display: flex; min-height: calc(100dvh - 65px); }
.sidebar { flex: 0 0 206px; background: #fff; border-right: 1px solid var(--border); }
.sidebar nav { display: grid; gap: 6px; padding: 25px 14px; position: sticky; top: 65px; }
.sidebar button, .sidebar-link { display: flex; gap: 11px; align-items: center; text-align: left; border-color: transparent; padding: 11px 14px; font-weight: 650; }
.sidebar-link { color: inherit; text-decoration: none; border: 1px solid transparent; border-radius: 9px; white-space: nowrap; }
.sidebar-link:hover { background: #f4f5f7; }
.application-attachments { display: flex; gap: 18px; flex-wrap: wrap; }
.application-attachments figure { margin: 0; max-width: 100%; }
.application-attachments img { display: block; border-radius: 8px; width: 132px; height: 97px; object-fit: cover; }
.application-attachments audio { max-width: 100%; }
.application-attachments figcaption { color: var(--muted); font-size: .84rem; margin-top: 4px; }
#applications-more { margin: 12px; }
.sidebar span { min-width: 21px; font-size: 1.12rem; line-height: 1; }
.sidebar button[aria-current="page"] { background: #fff2b9; color: #342600; }
.content { flex: 1; min-width: 0; padding: 28px clamp(16px,3vw,40px) 48px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.dashboard-metrics { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 16px; }
.dashboard-card, .dashboard-trend { padding: clamp(16px,2.5vw,28px); border-radius: 14px; }
.dashboard-sales { background: #fff0df; color: #572c10; border: 1px solid #f2d5b6; }
.dashboard-members { background: #e5f2ff; color: #143f67; border: 1px solid #c9e0f6; }
.dashboard-caption { margin-top: 7px; font-size: .82rem; }
.sales-totals { display: flex; justify-content: space-between; gap: 10px; margin: 20px 0 0; }
.sales-totals dt { color: inherit; white-space: nowrap; }
.sales-totals dd { margin-top: 5px; white-space: nowrap; }
.sales-totals strong { font-size: clamp(1.35rem,3.2vw,2.4rem); font-variant-numeric: tabular-nums; }
.dashboard-trend { grid-column: 1/-1; }
.dashboard-timezone, .dashboard-trend .dashboard-caption { color: var(--muted); }
.registration-bars { list-style: none; max-width: 900px; margin: 18px 0 0; padding: 0; }
.registration-bars:empty { display: none; }
.registration-bars li {
  display: grid; grid-template-columns: 3.4em minmax(0,1fr) minmax(4.5em,auto); align-items: center;
  gap: 12px; margin: 0; padding: 7px 0; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.registration-bars time { color: var(--muted); }
.registration-bars strong { text-align: right; }
.registration-bars meter { display: block; width: 100%; height: 14px; background: #eef4fb; border: 0; border-radius: 5px; overflow: hidden; }
.registration-bars meter::-webkit-meter-bar { height: 14px; border: 0; border-radius: 5px; background: #eef4fb; }
.registration-bars meter::-webkit-meter-optimum-value { border-radius: 5px; background: #247acf; }
.registration-bars meter::-moz-meter-bar { border-radius: 5px; background: #247acf; }
@media (max-width: 850px) {
  .dashboard-metrics { grid-template-columns: minmax(0,1fr); }
}
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 16px 18px; margin-bottom: 17px; }
.toolbar label { flex: 0 1 165px; }
.toolbar .search-field { flex: 1 1 245px; max-width: 445px; }
label { display: grid; gap: 7px; color: #3d4652; font-size: .86rem; min-width: 0; }
input, textarea, select, button {
  font: inherit; padding: 9px 12px; border: 1px solid #dce1e7; border-radius: 8px; background: #fff; color: #1c2229;
  min-height: 39px; min-width: 0;
}
input, textarea, select { width: 100%; }
textarea { resize: vertical; min-height: 85px; }
input[readonly], select:disabled { background: #f3f5f7; color: #566171; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: #a67903; }
button { cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { filter: brightness(.97); }
button:disabled { opacity: .52; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #8a6500; outline-offset: 2px; }
.primary { background: var(--accent); border-color: #ebc538; font-weight: 680; }
.data-panel { overflow: hidden; }
.table { overflow: auto; padding: 0; }
table { width: 100%; min-width: 670px; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf0f2; text-align: left; }
th { background: #f8f9fb; color: #465263; white-space: nowrap; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
td { line-height: 1.4; }
td.mono { font: 600 .95rem/1.4 ui-monospace, monospace; white-space: nowrap; color: #344151; }
td.nowrap { white-space: nowrap; }
td button { font-size: .82rem; min-height: 32px; padding: 5px 11px; }
.order-table { min-width: 1110px; }
.order-summary { min-width: 104px; overflow-wrap: anywhere; }
.order-secondary { margin-top: 4px; color: var(--muted); font-size: .78rem; }
.order-actions { width: 1%; text-align: right; }
.order-action-buttons { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.clipboard-buffer { position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; min-height: 0; padding: 0; }
@media (min-width: 601px) {
  .order-table .order-actions { position: sticky; right: 0; background: var(--panel); box-shadow: -3px 0 0 #eef0f3; }
  .order-table th.order-actions { background: #f8f9fb; }
}
.catalog-actions button + button { margin-left: 6px; }
.state { display: inline-block; padding: 4px 8px; border-radius: 7px; white-space: nowrap; background: #eef1f6; color: #465263; font-size: .78rem; font-weight: 650; }
.state.awaiting_assignment, .state.pending_payment { background: #fff0c9; color: #815400; }
.state.assigned, .state.accepted, .state.in_service { background: #eaf1ff; color: #244b94; }
.state.completed, .state.online { background: #e2f3e8; color: #20593b; }
.list-hint { padding: 16px; color: var(--muted); text-align: center; font-size: .87rem; }
.more { display: block; margin: 14px auto; }
.error { color: #a52138; margin: 12px 0; font-size: .9rem; overflow-wrap: anywhere; }
dialog { width: min(660px,calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--border); border-radius: 16px; padding: 0 23px 24px; color: inherit; }
dialog::backdrop { background: #14191a82; }
#gift-grant-dialog { width: min(440px,calc(100% - 24px)); }
dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border); }
dialog > header { position: sticky; top: 0; z-index: 1; background: #fff; }
dl { display: grid; grid-template-columns: minmax(90px,1fr) 3fr; gap: 10px 18px; font-size: .9rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
#dispatch { display: flex; flex-wrap: wrap; gap: 9px; margin: 22px 0; }
#dispatch select { width: auto; max-width: 100%; }
li { margin: 8px 0; }
.editor-dialog { width: min(760px,calc(100% - 24px)); }
.editor-form { display: grid; gap: 14px; padding: 15px 0 20px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.fields .span { grid-column: 1/-1; }
.media-field { display: grid; gap: 7px; min-width: 0; }
.media-input-row { display: flex; gap: 8px; }
.media-input-row > input { flex: 1 1 0; }
.media-input-row > button { flex: none; }
.media-thumbnail {
  display: grid; place-items: center; flex: 0 0 clamp(55px,10vw,76px);
  height: 41px; padding: 2px; border: 1px solid var(--border); border-radius: 7px;
  overflow: hidden; background: #f5f6f8; color: var(--muted); font-size: .68rem; text-decoration: none;
}
.media-thumbnail img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.media-thumbnail:focus-visible { outline: 2px solid #8a6500; outline-offset: 2px; }
.media-message { color: #20593b; font-size: .8rem; overflow-wrap: anywhere; }
.media-message:empty { display: none; }
.media-message.failed { color: #a52138; }
.recording-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.recording-preview { display: block; width: min(100%, 420px); height: 44px; }
.check-label { display: flex; align-items: center; align-self: end; min-height: 39px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.form-actions .primary { min-width: 99px; }
.editor-list { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 16px; }
.editor-list h3 { margin-bottom: 9px; }
.editor-list table { min-width: 390px; }
.editor-tabs { display: flex; gap: 8px; padding: 12px 0 10px; border-bottom: 1px solid var(--border); }
.editor-tabs button { background: #f5f6f8; border-color: transparent; color: var(--muted); }
.editor-tabs button[aria-pressed="true"], .spec-choices button[aria-pressed="true"] {
  background: #fff2b9; border-color: #ead480; color: #342600; font-weight: 650;
}
.spec-product { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; font-weight: 650; }
.sku-option { display: grid; align-content: start; gap: 8px; min-width: 0; }
.spec-filters { display: grid; gap: 9px; margin-bottom: 16px; }
.spec-filters:empty { display: none; }
.spec-filter { min-width: 0; margin: 0; padding: 0; border: 0; }
.spec-filter legend { padding: 0 0 6px; color: var(--muted); font-size: .83rem; }
.spec-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.spec-choices button { min-height: 34px; padding: 5px 10px; font-size: .88rem; }
.editor-hint { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; gap: 16px; }
.settings-stack, .settings-card { display: grid; gap: 14px; }
.settings-card { min-width: 0; padding: 18px; }
.settings-card h2 { font-size: 1rem; }
.settings-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.category-setting { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.category-setting:last-child { border-bottom: 0; padding-bottom: 0; }
.category-setting > label { flex: 1 1 130px; }
.category-controls { display: flex; align-items: center; gap: 5px; }
.category-controls button { padding-inline: 9px; }
.settings-save { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.policy-editor { margin-top: 8px; }
.identity-records { margin-top: 24px; }
.policy-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.policy-toolbar label { flex: 1 1 165px; max-width: 300px; }
.policy-editor textarea { line-height: 1.65; }
.policy-editor .settings-save { padding-bottom: 0; }
#settings-status { font-size: .88rem; color: #20593b; }
#policy-status { font-size: .88rem; color: #20593b; }
@media (max-width: 950px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .workspace { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { position: static; display: flex; overflow: auto; padding: 8px 12px; }
  .sidebar button, .sidebar-link { flex: 1; justify-content: center; gap: 6px; padding: 8px 9px; font-size: .88rem; }
  .content { padding-top: 17px; }
  .toolbar label { flex: 1 1 100px; }
  .toolbar .search-field { max-width: none; flex: 1 1 100%; }
}
@media (max-width: 450px) {
  dialog { padding-inline: 13px; }
  .fields { gap: 10px; }
  .editor-list table { min-width: 0; }
  .editor-list th, .editor-list td { padding-inline: 5px; }
  .editor-list td button { padding-inline: 8px; }
  .editor-list .state { padding-inline: 6px; }
  th, td { padding: 10px; }
}
@media (max-width: 600px) {
  .data-panel table, .data-panel tbody { display: block; min-width: 0; }
  .data-panel thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .data-panel tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px 14px; padding: 14px; border-bottom: 1px solid var(--border); }
  .data-panel tbody tr:last-child { border-bottom: 0; }
  .data-panel td { display: block; padding: 0; border: 0; overflow-wrap: anywhere; }
  .data-panel td::before { display: block; margin-bottom: 3px; color: var(--muted); content: attr(data-label); font-size: .73rem; }
  .data-panel td:first-child, #order-rows td:nth-child(2) { grid-column: 1/-1; }
  .data-panel td.mono { white-space: normal; }
  .data-panel td:last-child::before, #catalog-rows td:first-child::before { display: none; }
  .data-panel td:last-child { align-self: end; }
  .order-table .order-summary { min-width: 0; }
  .order-table td.order-actions { grid-column: 1/-1; width: auto; }
}
