:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ec;
  --canvas: #f4f6fa;
  --surface: #ffffff;
  --forest: #1d4ed8;
  --forest-2: #2563eb;
  --gold: #f59e0b;
  --danger: #c2414b;
  --danger-soft: #fff1f2;
  --success: #0f766e;
  --success-soft: #ecfdf5;
  --warning: #a16207;
  --warning-soft: #fffbeb;
  --blue-soft: #eff6ff;
  --sidebar: #111827;
  --sidebar-hover: #1f2937;
  --radius: 8px;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}
a { color: var(--forest-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }
button, .button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--forest);
  border-radius: var(--radius);
  padding: 8px 15px;
  color: #fff;
  background: var(--forest);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
  cursor: pointer;
  font-weight: 700;
}
button:hover, .button:hover { background: #1e40af; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: .55; background: #98a2b3; border-color: #98a2b3; box-shadow: none; }
button.secondary, .button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { background: #f8fafc; border-color: #b8c5d8; }
button.danger { color: var(--danger); background: #fff; border-color: #fecdd3; }
button.small, .button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-size: 18px; font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.public-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.public-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 0; padding: 14px max(16px, calc((100% - 1180px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.header-admin-link, .admin-site-link { min-height: 34px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 5px 11px; color: #344054; background: #fff; font-size: 12px; font-weight: 700; }
.header-admin-link:hover, .admin-site-link:hover { border-color: #b8c5d8; background: #f8fafc; text-decoration: none; }
.public-main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; display: grid; align-items: start; padding: 30px 0 64px; }
.public-footer { color: var(--muted); background: #fff; text-align: center; padding: 22px; border-top: 1px solid var(--line); }
.public-announcement-list { width: 100%; display: grid; gap: 8px; margin-bottom: 14px; }
.public-announcement { min-width: 0; display: grid; grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr); align-items: center; gap: 18px; border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 11px 14px; background: var(--blue-soft); }
.public-announcement.success { border-color: #a7f3d0; background: var(--success-soft); }
.public-announcement.warning { border-color: #fde68a; background: var(--warning-soft); }
.public-announcement div { min-width: 0; display: flex; align-items: center; gap: 9px; }
.public-announcement div > span { flex: 0 0 auto; border-radius: 4px; padding: 1px 6px; color: #1e40af; background: #dbeafe; font-size: 10px; font-weight: 700; }
.public-announcement h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.public-announcement p { min-width: 0; margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.extract-tool { width: min(580px, 100%); margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.extract-tool__head { padding: 30px 32px 21px; border-bottom: 1px solid var(--line); }
.extract-tool__body { padding: 28px 32px 32px; }
.extract-tool h1 { margin: 0 0 7px; font-size: 26px; line-height: 1.3; }
.extract-tool p { margin: 0; color: var(--muted); }
.card-entry { display: grid; gap: 14px; }
.card-entry input { height: 54px; font-family: Consolas, monospace; font-size: 18px; text-transform: uppercase; text-align: center; }
.card-entry button { height: 48px; }
.fine-print { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

.redeem-center { width: 100%; min-height: 610px; align-self: start; display: grid; grid-template-columns: minmax(380px, 430px) minmax(0, 1fr); border: 1px solid var(--line); border-top: 3px solid var(--forest-2); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.redeem-entry-panel { min-width: 0; display: flex; flex-direction: column; padding: 32px; border-right: 1px solid var(--line); background: #f8faff; }
.redeem-heading { margin-bottom: 25px; }
.redeem-heading h1 { margin: 4px 0 8px; font-size: 27px; line-height: 1.3; }
.redeem-heading p { margin: 0; color: var(--muted); }
.redeem-availability { width: fit-content; display: inline-flex; align-items: baseline; gap: 7px; margin-top: 16px; padding: 9px 12px; border: 1px solid #a7f3d0; border-radius: 6px; color: #166534; background: var(--success-soft); }
.redeem-availability span, .redeem-availability small { font-size: 11px; font-weight: 700; }
.redeem-availability strong { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.redeem-kicker, .queue-eyebrow { display: block; color: var(--forest-2); font-size: 11px; font-weight: 800; }
.batch-card-entry { display: grid; gap: 13px; }
.batch-card-entry .field > span { font-weight: 700; }
.batch-card-entry textarea { height: 218px; min-height: 180px; max-height: 420px; padding: 14px 15px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 15px; line-height: 1.75; text-transform: uppercase; }
.batch-card-entry textarea::placeholder { color: #98a2b3; }
.entry-counter { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.entry-counter span:first-child { color: var(--forest-2); font-weight: 700; }
.redeem-submit { width: 100%; min-height: 46px; }
.redeem-limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: auto 0 0; padding-top: 26px; border-bottom: 1px solid var(--line); }
.redeem-limits div { min-width: 0; padding: 13px 10px; border-right: 1px solid var(--line); }
.redeem-limits div:first-child { padding-left: 0; }
.redeem-limits div:last-child { padding-right: 0; border-right: 0; }
.redeem-limits dt { color: var(--muted); font-size: 11px; }
.redeem-limits dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }
.download-queue { min-width: 0; display: flex; flex-direction: column; padding: 30px 32px 34px; background: #fff; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.queue-head h2 { margin: 3px 0 0; font-size: 22px; line-height: 1.25; }
.queue-head form { margin: 0; }
.queue-summary { display: grid; grid-template-columns: repeat(3, minmax(72px, .55fr)) minmax(190px, 1.45fr); align-items: stretch; border-bottom: 1px solid var(--line); }
.queue-summary > div { min-width: 0; padding: 15px 13px; border-right: 1px solid var(--line); }
.queue-summary > div:first-child { padding-left: 0; }
.queue-summary strong { display: block; font-size: 18px; line-height: 1.2; }
.queue-summary span { color: var(--muted); font-size: 11px; }
.queue-summary form { display: flex; align-items: center; justify-content: flex-end; margin: 0; padding: 11px 0 11px 14px; }
.queue-summary form button { width: 100%; min-height: 40px; white-space: normal; }
.queue-summary .button-hint { border-radius: 4px; padding: 1px 5px; color: #713f12; background: #fcd34d; font-size: 10px; }
.queue-list { min-width: 0; }
.queue-item { min-width: 0; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.queue-state { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 13px; font-weight: 800; }
.queue-item.is-error .queue-state { background: var(--danger); }
.queue-item-main { min-width: 0; }
.queue-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.queue-code-row code { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.queue-status { border-radius: 4px; padding: 1px 6px; color: var(--success); background: var(--success-soft); font-size: 10px; font-weight: 700; }
.is-error .queue-status { color: var(--danger); background: var(--danger-soft); }
.queue-item h3 { margin: 5px 0 4px; overflow-wrap: anywhere; font-size: 15px; line-height: 1.35; }
.queue-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; color: var(--muted); font-size: 11px; }
.queue-meta strong { color: var(--ink); }
.queue-error-message { margin: 6px 0 0; color: var(--danger); font-size: 12px; }
.queue-actions { padding-left: 8px; }
.queue-actions form { margin: 0; }
.queue-empty { flex: 1; min-height: 360px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.queue-empty > span { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid #bfdbfe; border-radius: 50%; color: var(--forest-2); background: var(--blue-soft); font-size: 22px; }
.queue-empty strong { color: var(--ink); font-size: 16px; }
.queue-empty p { margin: 4px 0 0; }

.resource-view { width: 100%; align-self: start; }
.resource-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.resource-top h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.3; }
.resource-top p { margin: 0; color: var(--muted); }
.resource-back { display: inline-block; margin-bottom: 10px; font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 22px 0 30px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.metric { min-width: 0; padding: 16px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; overflow-wrap: anywhere; margin-top: 3px; font-size: 16px; }
.content-section { margin: 0 0 34px; }
.section-title { margin: 0 0 14px; font-size: 17px; }
.extracted-content { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--blue-soft); border-left: 4px solid var(--forest-2); padding: 20px 22px; }
.file-list { border-top: 1px solid var(--line); }
.file-row { min-height: 74px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.file-name { min-width: 0; }
.file-name strong { display: block; overflow-wrap: anywhere; }
.file-name span, .file-meta { color: var(--muted); font-size: 12px; }
.file-row form { margin: 0; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 700; }
.field small { color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid #b8c5d8;
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); outline: 0; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input, select { min-height: 40px; }
textarea { min-height: 104px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bulk-import-grid { display: grid; grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(130px, .75fr)); gap: 14px; align-items: end; }
.bulk-file-field { grid-column: 1 / -1; }
.bulk-file-field input[type=file] { min-height: 48px; padding: 7px; background: #f8fafc; }
.bulk-file-field input[type=file]::file-selector-button { min-height: 32px; margin-right: 12px; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; color: var(--ink); background: #fff; cursor: pointer; font-weight: 700; }
.bulk-file-field input[type=file]::file-selector-button:hover { background: var(--blue-soft); }
.field.full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }

.flash-stack { position: fixed; z-index: 10; top: 18px; left: 50%; width: min(500px, calc(100% - 32px)); transform: translateX(-50%); }
.flash { margin-bottom: 8px; border: 1px solid; border-radius: var(--radius); padding: 11px 14px; box-shadow: var(--shadow); background: #fff; }
.flash.error { color: var(--danger); background: var(--danger-soft); border-color: #fecdd3; }
.flash.success { color: var(--success); background: var(--success-soft); border-color: #a7f3d0; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--sidebar); }
.auth-panel { width: min(410px, 100%); border-top: 4px solid var(--forest-2); border-radius: var(--radius); background: #fff; box-shadow: 0 20px 52px rgba(0, 0, 0, 0.28); padding: 32px; }
.auth-panel .brand { margin-bottom: 28px; }
.auth-panel h1 { margin: 0 0 4px; font-size: 23px; }
.auth-panel > p { margin: 0 0 24px; color: var(--muted); }
.auth-panel form { display: grid; gap: 15px; }
.auth-panel button { margin-top: 5px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; color: #cbd5e1; background: var(--sidebar); box-shadow: 5px 0 20px rgba(15,23,42,.08); }
.sidebar .brand { color: #fff; margin: 0 8px 28px; }
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav a { position: relative; min-height: 44px; display: flex; align-items: center; gap: 8px; border-radius: 6px; padding: 9px 11px; color: #cbd5e1; font-weight: 600; }
.sidebar-nav a:hover { color: #fff; background: var(--sidebar-hover); text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: var(--forest-2); box-shadow: 0 5px 14px rgba(37,99,235,.24); text-decoration: none; }
.nav-badge { min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; margin-left: auto; border-radius: 10px; padding: 0 5px; color: #422006; background: #fbbf24; font-size: 10px; line-height: 1; }
.sidebar-user { margin-top: auto; border-top: 1px solid #344054; padding: 17px 8px 0; }
.sidebar-user span { display: block; margin-bottom: 9px; color: #98a2b3; font-size: 12px; }
.sidebar-user button { min-height: 32px; width: 100%; border-color: #475467; background: transparent; box-shadow: none; }
.sidebar-user button:hover { border-color: #64748b; background: var(--sidebar-hover); }
.admin-main { min-width: 0; background: var(--canvas); }
.admin-header { position: sticky; z-index: 5; top: 0; height: 72px; display: grid; grid-template-columns: minmax(130px, auto) minmax(260px, 520px) auto; align-items: center; gap: 18px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.admin-header h1 { margin: 0; font-size: 20px; }
.admin-global-search { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: 0 auto; }
.admin-global-search input { min-height: 36px; padding-top: 6px; padding-bottom: 6px; background: #f8fafc; }
.admin-global-search button { min-height: 36px; }
.admin-header-actions { display: flex; justify-content: flex-end; }
.admin-content { width: min(1400px, 100%); padding: 28px 30px 54px; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-actions p { margin: 0; color: var(--muted); }
.panel { margin-bottom: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px; }
.resource-summary, .batch-summary, .card-summary, .card-detail-summary, .notification-summary, .announcement-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.resource-summary div, .batch-summary div, .card-summary div, .card-detail-summary div, .notification-summary div, .announcement-summary div { min-width: 0; padding: 13px 18px; border-right: 1px solid var(--line); }
.resource-summary div:first-child, .batch-summary div:first-child, .card-summary div:first-child, .card-detail-summary div:first-child, .notification-summary div:first-child, .announcement-summary div:first-child { padding-left: 18px; }
.resource-summary div:last-child, .batch-summary div:last-child, .card-summary div:last-child, .card-detail-summary div:last-child, .notification-summary div:last-child, .announcement-summary div:last-child { padding-right: 18px; border-right: 0; }
.resource-summary dt, .batch-summary dt, .card-summary dt, .card-detail-summary dt, .notification-summary dt, .announcement-summary dt { color: var(--muted); font-size: 11px; }
.resource-summary dd, .batch-summary dd, .card-summary dd, .card-detail-summary dd, .notification-summary dd, .announcement-summary dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; line-height: 1.2; }
.resource-compose { margin-bottom: 22px; }
.resource-tabs { display: flex; gap: 22px; min-height: 45px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.resource-tabs button { min-height: 45px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 8px 2px 5px; color: var(--muted); background: transparent; font-size: 13px; }
.resource-tabs button:hover { color: var(--ink); background: transparent; }
.resource-tabs button[aria-selected="true"] { color: var(--forest-2); border-bottom-color: var(--forest-2); }
.resource-tab-panel[hidden] { display: none; }
.manual-resource-grid textarea { min-height: 126px; }
.resource-list-panel td:first-child { min-width: 240px; }
.resource-list-panel td.select-column { min-width: 44px; }
.resource-bulk-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.resource-selection-summary, .resource-bulk-controls, .resource-row-actions { display: flex; align-items: center; gap: 7px; }
.resource-selection-summary { flex-wrap: wrap; }
.resource-selection-summary strong { min-width: 82px; font-size: 12px; }
.resource-bulk-controls select { width: auto; min-width: 210px; }
.resource-bulk-controls button { flex: 0 0 auto; }
.select-column { width: 44px; min-width: 44px; padding-left: 13px; padding-right: 8px; text-align: center; }
.table-checkbox { width: 18px; height: 18px; min-height: 0; display: inline-block; margin: 0; padding: 0; accent-color: var(--forest-2); vertical-align: middle; cursor: pointer; }
.resource-list-panel tr.is-selected td { background: var(--blue-soft); }
.resource-row-actions { white-space: nowrap; }
.batch-compose { margin-bottom: 22px; }
.batch-create-grid { display: grid; grid-template-columns: minmax(220px, 1.3fr) minmax(200px, 1.2fr) repeat(4, minmax(125px, .7fr)); gap: 14px; align-items: end; }
.batch-list-panel td:first-child { min-width: 220px; }
.batch-list-panel td:nth-child(2) { min-width: 170px; }
.batch-card-cell { min-width: 250px; }
.batch-card-total { display: flex; align-items: baseline; gap: 4px; line-height: 1.2; }
.batch-card-total strong { font-size: 16px; }
.batch-card-total span { color: var(--muted); font-size: 11px; }
.batch-meter { height: 5px; display: flex; overflow: hidden; margin: 7px 0 6px; border-radius: 3px; background: #e5e7eb; }
.batch-meter span { display: block; height: 100%; }
.batch-meter .unused { background: #94a3b8; }
.batch-meter .active { background: var(--forest-2); }
.batch-meter .closed { background: var(--gold); }
.batch-breakdown { display: flex; flex-wrap: wrap; gap: 3px 12px; color: var(--muted); font-size: 11px; }
.batch-breakdown span::before { content: ''; width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; vertical-align: 1px; }
.batch-breakdown .unused::before { background: #94a3b8; }
.batch-breakdown .active::before { background: var(--forest-2); }
.batch-breakdown .closed::before { background: var(--gold); }
.batch-rule { min-width: 165px; }
.batch-rule strong, .batch-rule span { display: block; }
.batch-row-actions { display: flex; align-items: center; gap: 7px; }
.batch-row-actions form { margin: 0; }
.import-group-filter-body { display: grid; gap: 12px; }
.import-group-filter { display: grid; grid-template-columns: minmax(300px, 1fr) auto; gap: 10px; align-items: end; }
.import-group-filter-actions { display: flex; align-items: center; gap: 7px; }
.import-group-current { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--blue-soft); color: var(--ink); font-size: 13px; }
.import-group-panel tr.is-selected td { background: var(--blue-soft); }
.import-group-panel td:first-child { min-width: 230px; }
.import-group-actions { min-width: 280px; flex-wrap: wrap; }
.import-group-actions form { margin: 0; }
.import-group-meter .active { background: var(--forest-2); }
.batch-breakdown a { color: inherit; text-decoration: none; }
.batch-breakdown a:hover { text-decoration: underline; }
.card-query-panel { margin-bottom: 22px; }
.card-exact-form { max-width: 720px; display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 10px; align-items: end; }
.code-input { font-family: Consolas, "SFMono-Regular", monospace; text-transform: uppercase; }
.card-query-divider { margin: 18px 0 15px; border-top: 1px solid var(--line); padding-top: 13px; color: var(--muted); font-size: 12px; font-weight: 700; }
.card-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.card-filter-actions { display: flex; align-items: center; gap: 7px; }
.card-bulk-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.card-selection-summary, .card-bulk-controls { display: flex; align-items: center; gap: 7px; }
.card-selection-summary { flex-wrap: wrap; }
.card-selection-summary strong { min-width: 82px; font-size: 12px; }
.card-bulk-controls select { width: auto; min-width: 210px; }
.card-list-panel td:nth-child(2) { min-width: 230px; }
.card-list-panel tr.is-selected td { background: var(--blue-soft); }
.pagination { min-height: 54px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: #f8fafc; }
.pagination > :first-child { justify-self: start; }
.pagination > :last-child { justify-self: end; }
.pagination strong { font-size: 12px; color: var(--muted); }
.card-code-cell strong, .card-code-cell span { display: block; }
.card-code-cell span { margin-top: 2px; color: var(--muted); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; font-size: 11px; }
.card-usage-cell { min-width: 150px; }
.card-usage-cell div { display: flex; align-items: baseline; gap: 4px; line-height: 1.2; }
.card-usage-cell div strong { font-size: 16px; }
.card-usage-cell div span, .card-usage-cell small { color: var(--muted); font-size: 11px; }
.card-usage-cell progress { width: 130px; height: 5px; display: block; overflow: hidden; margin: 7px 0 5px; border: 0; border-radius: 3px; background: #e5e7eb; appearance: none; }
.card-usage-cell progress::-webkit-progress-bar { background: #e5e7eb; }
.card-usage-cell progress::-webkit-progress-value { background: var(--forest-2); }
.card-usage-cell progress::-moz-progress-bar { background: var(--forest-2); }
.card-date-cell { min-width: 190px; }
.card-date-cell span { display: block; }
.card-date-cell span + span { margin-top: 2px; color: var(--muted); }
.card-row-actions, .card-detail-actions { display: flex; align-items: center; gap: 7px; }
.card-row-actions form, .card-detail-actions form { margin: 0; }
.card-detail-heading { margin-bottom: 20px; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
.card-detail-heading h2 { margin: 3px 0 5px; overflow-wrap: anywhere; font-size: 22px; line-height: 1.3; }
.card-detail-heading p { margin: 0; color: var(--muted); }
.card-detail-summary .date-value { font-size: 14px; line-height: 1.5; }
.card-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 28px; margin: 0; }
.card-info-grid div { min-width: 0; }
.card-info-grid dt { color: var(--muted); font-size: 11px; }
.card-info-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 700; }
.notification-filter-panel { margin-bottom: 22px; }
.notification-filter-grid { max-width: 760px; display: grid; grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto; gap: 10px; align-items: end; }
.notification-filter-actions, .notification-head-actions, .notification-selection-summary, .notification-bulk-controls, .notification-row-actions { display: flex; align-items: center; gap: 7px; }
.notification-head-actions form { margin: 0; }
.notification-bulk-toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.notification-selection-summary { flex-wrap: wrap; }
.notification-selection-summary strong { min-width: 82px; font-size: 12px; }
.notification-bulk-controls select { width: auto; min-width: 190px; }
.notification-content-cell { min-width: 360px; white-space: normal; }
.notification-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.notification-title-line small { border-radius: 4px; padding: 1px 5px; color: var(--muted); background: #eef2f6; font-size: 10px; }
.notification-content-cell p { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.notification-severity { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #94a3b8; }
.notification-severity.success { background: var(--success); }
.notification-severity.warning { background: var(--gold); }
.notification-severity.error { background: var(--danger); }
.notification-category, .notification-read-state { display: inline-block; border-radius: 4px; padding: 2px 7px; font-size: 11px; }
.notification-category { color: #1e40af; background: #dbeafe; }
.notification-category.security { color: #92400e; background: #fef3c7; }
.notification-category.system { color: #475467; background: #eef2f6; }
.notification-read-state.unread { color: var(--success); background: var(--success-soft); }
.notification-read-state.read { color: var(--muted); background: #eef2f6; }
.notification-list-panel tr.is-unread td { background: #f8fbff; }
.notification-list-panel tr.is-selected td { background: var(--blue-soft); }
.notification-row-actions { white-space: nowrap; }
.notification-page-actions, .announcement-row-actions { display: flex; align-items: center; gap: 8px; }
.announcement-row-actions form { margin: 0; }
.announcement-compose { margin-bottom: 22px; }
.announcement-form-grid { display: grid; grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(135px, .7fr)); gap: 14px; align-items: end; }
.announcement-content-field { grid-column: 1 / -1; }
.announcement-content-field textarea { min-height: 98px; }
.announcement-list-panel td:first-child { min-width: 320px; }
.announcement-level, .announcement-state { display: inline-block; border-radius: 4px; padding: 2px 7px; font-size: 11px; }
.announcement-level { color: #1e40af; background: #dbeafe; }
.announcement-level.success, .announcement-state.active { color: var(--success); background: var(--success-soft); }
.announcement-level.warning, .announcement-state.scheduled { color: #92400e; background: #fef3c7; }
.announcement-state.draft, .announcement-state.ended { color: var(--muted); background: #eef2f6; }
.announcement-content-cell span { display: inline-block; max-width: 520px; }
.dashboard-command-bar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; border: 1px solid var(--line); border-left: 3px solid var(--forest-2); border-radius: var(--radius); padding: 10px 14px; background: #fff; }
.dashboard-quick-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.dashboard-quick-actions .button { min-height: 34px; }
.dashboard-operation-summary { display: flex; align-items: center; margin: 0; }
.dashboard-operation-summary div { min-width: 100px; border-left: 1px solid var(--line); padding: 0 14px; }
.dashboard-operation-summary dt { color: var(--muted); font-size: 10px; }
.dashboard-operation-summary dd { margin: 1px 0 0; font-size: 13px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { min-width: 0; border: 1px solid var(--line); border-top: 3px solid var(--forest-2); border-radius: var(--radius); padding: 15px 16px; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.stat:nth-child(2) { border-top-color: var(--success); }
.stat:nth-child(3) { border-top-color: var(--gold); }
.stat:nth-child(4) { border-top-color: #e85d75; }
.stat:nth-child(5) { border-top-color: #64748b; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 5px; font-size: 24px; line-height: 1.2; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 18px; align-items: stretch; }
.dashboard-grid .panel { min-width: 0; margin-bottom: 0; }
.activity-legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.activity-legend span::before { content: ''; width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 2px; }
.activity-legend .redemption::before { background: var(--forest-2); }
.activity-legend .download::before { background: var(--success); }
.activity-chart { height: 244px; display: grid; grid-template-columns: repeat(7, minmax(48px, 1fr)); align-items: end; gap: 8px; padding: 18px 20px 14px; }
.activity-day { min-width: 0; display: grid; grid-template-rows: 20px 160px 20px; gap: 4px; align-items: end; text-align: center; }
.activity-values { display: flex; justify-content: center; gap: 12px; font-size: 10px; font-weight: 700; }
.activity-values span:first-child { color: var(--forest-2); }
.activity-values span:last-child { color: var(--success); }
.activity-bars { height: 160px; display: flex; align-items: flex-end; justify-content: center; gap: 5px; border-bottom: 1px solid var(--line); }
.activity-bars span { width: min(14px, 28%); min-height: 0; display: block; border-radius: 3px 3px 0 0; }
.activity-bars .redemption { background: var(--forest-2); }
.activity-bars .download { background: var(--success); }
.activity-day time { color: var(--muted); font-size: 10px; }
.dashboard-attention-list { display: grid; }
.dashboard-attention-list a { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 16px; color: var(--ink); }
.dashboard-attention-list a:last-child { border-bottom: 0; }
.dashboard-attention-list a:hover { background: #f8fbff; text-decoration: none; }
.dashboard-attention-list strong { min-width: 28px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; padding: 0 7px; color: #1e40af; background: #dbeafe; font-size: 12px; }
.dashboard-attention-list strong.warning { color: #92400e; background: #fef3c7; }
.dashboard-attention-list strong.danger { color: var(--danger); background: var(--danger-soft); }
.dashboard-attention-list strong.clear { color: var(--success); background: var(--success-soft); }
.dashboard-notification-list { margin: 0; padding: 0; list-style: none; }
.dashboard-notification-list li { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 15px; }
.dashboard-notification-list li:last-child { border-bottom: 0; }
.dashboard-notification-list li.is-unread { background: #f8fbff; }
.dashboard-notification-list a { min-width: 0; color: var(--ink); }
.dashboard-notification-list a:hover { text-decoration: none; }
.dashboard-notification-list strong, .dashboard-notification-list span { display: block; overflow-wrap: anywhere; }
.dashboard-notification-list strong { font-size: 12px; }
.dashboard-notification-list span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.search-command { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; border: 1px solid var(--line); border-top: 3px solid var(--forest-2); border-radius: var(--radius); padding: 16px 18px; background: #fff; }
.search-command form { width: min(720px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.search-command > strong { flex: 0 0 auto; color: var(--forest-2); }
.search-empty { min-height: 260px; display: grid; place-items: center; color: var(--muted); }
.search-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.search-result-grid .panel { min-width: 0; margin-bottom: 0; }
.search-result-panel-wide { grid-column: 1 / -1; }
.search-result-list { margin: 0; padding: 0; list-style: none; }
.search-result-list li { min-height: 66px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.search-result-list li:last-child { border-bottom: 0; }
.search-result-list a { min-width: 0; color: var(--ink); }
.search-result-list a:hover { text-decoration: none; }
.search-result-list a strong, .search-result-list a span { display: block; overflow-wrap: anywhere; }
.search-result-list a span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.search-result-list li:hover { background: #f8fbff; }
.search-result-list li.search-result-empty { display: grid; place-items: center; color: var(--muted); }
.search-card-results li { grid-template-columns: minmax(0, 1fr) auto auto; }
.search-card-usage { color: var(--muted); font-size: 11px; }
.system-page-actions > div { display: flex; align-items: center; gap: 8px; }
.system-summary, .admin-account-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.system-summary div, .admin-account-summary div { min-width: 0; border-right: 1px solid var(--line); padding: 13px 18px; }
.system-summary div:last-child, .admin-account-summary div:last-child { border-right: 0; }
.system-summary dt, .admin-account-summary dt { color: var(--muted); font-size: 11px; }
.system-summary dd, .admin-account-summary dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; line-height: 1.2; }
.system-summary div.ok { border-top: 3px solid var(--success); }
.system-summary div.warning { border-top: 3px solid var(--gold); }
.system-summary div.danger { border-top: 3px solid var(--danger); }
.system-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 18px; align-items: start; }
.system-grid .panel { min-width: 0; }
.system-check-list { display: grid; }
.system-check-list > div { min-width: 0; display: grid; grid-template-columns: 10px minmax(120px, .55fr) auto minmax(180px, 1.45fr); align-items: center; gap: 9px 12px; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.system-check-list > div:last-child { border-bottom: 0; }
.system-check-list p { min-width: 0; margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.health-indicator { width: 9px; height: 9px; border-radius: 50%; background: var(--success); }
.health-indicator.warning { background: var(--gold); }
.health-indicator.danger { background: var(--danger); }
.health-state { display: inline-block; border-radius: 4px; padding: 2px 7px; color: var(--success); background: var(--success-soft); font-size: 11px; white-space: nowrap; }
.health-state.warning { color: #92400e; background: #fef3c7; }
.health-state.danger { color: var(--danger); background: var(--danger-soft); }
.system-info-list { margin: 0; }
.system-info-list div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; border-bottom: 1px solid var(--line); padding: 11px 16px; }
.system-info-list div:last-child { border-bottom: 0; }
.system-info-list dt { color: var(--muted); }
.system-info-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.integrity-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--line); }
.integrity-summary div { min-width: 0; border-right: 1px solid var(--line); padding: 13px 16px; }
.integrity-summary div:last-child { border-right: 0; }
.integrity-summary dt { color: var(--muted); font-size: 11px; }
.integrity-summary dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; }
.system-clear-state { margin: 0; padding: 26px 18px; color: var(--success); text-align: center; }
.system-truncated { margin: 0; border-top: 1px solid var(--line); padding: 9px 14px; color: var(--muted); }
.maintenance-body { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; }
.maintenance-body dl { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.maintenance-body dl div { min-width: 0; border-right: 1px solid var(--line); padding: 0 16px; }
.maintenance-body dl div:first-child { padding-left: 0; }
.maintenance-body dl div:last-child { border-right: 0; }
.maintenance-body dt { color: var(--muted); font-size: 11px; }
.maintenance-body dd { margin: 2px 0 0; font-weight: 800; }
.maintenance-body form { flex: 0 0 auto; margin: 0; }
.admin-account-compose { margin-bottom: 22px; }
.admin-create-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; gap: 14px; align-items: end; }
.admin-account-list td:first-child { min-width: 180px; }
.current-admin-label { display: inline-block; margin-left: 7px; border-radius: 4px; padding: 1px 5px; color: #1e40af; background: #dbeafe; font-size: 10px; }
.admin-account-actions { display: flex; align-items: flex-start; gap: 7px; }
.admin-account-actions > form { margin: 0; }
.admin-account-actions details { min-width: 90px; }
.admin-account-actions summary { min-height: 32px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px; color: var(--ink); background: #fff; cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.admin-account-actions summary::-webkit-details-marker { display: none; }
.admin-account-actions details[open] { min-width: 220px; }
.admin-account-actions details form { display: grid; gap: 7px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #f8fafc; }
.admin-account-actions details input { min-width: 190px; min-height: 34px; padding: 6px 8px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #475467; background: #f8fafc; font-size: 12px; font-weight: 700; }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover td { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.status { display: inline-block; border-radius: 999px; padding: 2px 8px; color: var(--success); background: var(--success-soft); font-size: 12px; }
.status.disabled, .status.expired { color: var(--danger); background: var(--danger-soft); }
.status.unused { color: #475467; background: #eef2f6; }
.status.exhausted { color: var(--warning); background: #fef3c7; }
.inline-form { display: inline; margin: 0; }
.filter-bar { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 10px; align-items: end; }
.split { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(0, 1.4fr); gap: 22px; align-items: start; }
.code { font-family: Consolas, monospace; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger); }
.upload-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px dashed #94a3b8; border-radius: var(--radius); padding: 16px; background: #f8fafc; }
.upload-box input[type=file] { padding: 6px; }
.log-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.log-tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 3px solid transparent; }
.log-tabs a.active { color: var(--ink); border-color: var(--forest-2); font-weight: 700; text-decoration: none; }
.error-page { width: min(520px, calc(100% - 32px)); margin: 15vh auto 0; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-align: center; }
.error-page h1 { margin: 0 0 8px; }
.error-page p { color: var(--muted); }

.installer-shell { min-height: 100vh; padding: 42px 18px; background: #eef2f7; }
.installer-panel { width: min(820px, 100%); margin: 0 auto; border: 1px solid var(--line); border-top: 4px solid var(--forest-2); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.install-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.install-head > span { color: var(--muted); font-size: 12px; }
.install-intro { padding: 28px 28px 8px; }
.install-intro h1 { margin: 0 0 5px; font-size: 25px; }
.install-intro p { margin: 0; color: var(--muted); }
.install-error { margin: 16px 28px 0; border: 1px solid #fecdd3; border-radius: var(--radius); padding: 11px 14px; color: var(--danger); background: var(--danger-soft); }
.install-warning { margin: 16px 28px 0; border: 1px solid #fde68a; border-radius: var(--radius); padding: 11px 14px; color: #92400e; background: var(--warning-soft); }
.install-section { padding: 24px 28px; border-bottom: 1px solid var(--line); }
.install-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.install-section-head h2 { margin: 0; font-size: 16px; }
.install-section-head span { color: var(--success); font-size: 12px; }
.requirement-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.requirement-row { min-height: 43px; display: grid; grid-template-columns: 24px minmax(170px, .8fr) minmax(0, 1.2fr); align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.requirement-row:last-child { border-bottom: 0; }
.requirement-row > span:last-child { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.requirement-state { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 12px; font-weight: 800; }
.requirement-state.bad { background: var(--danger); }
.check-field { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); }
.check-field input[type="checkbox"] { flex: 0 0 auto; width: 17px; height: 17px; min-height: 0; margin: 3px 0 0; accent-color: var(--forest); }
.install-submit { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 28px 28px; }
.install-submit p { margin: 0; color: var(--muted); }
.install-result { padding: 58px 28px 64px; text-align: center; }
.install-result h1 { margin: 16px 0 7px; font-size: 27px; }
.install-result > p { max-width: 540px; margin: 0 auto 24px; color: var(--muted); }
.result-mark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto; border-radius: 50%; color: #fff; background: var(--success); font-size: 28px; font-weight: 800; }
.result-mark.locked { background: var(--sidebar); }
.result-details { width: min(500px, 100%); margin: 0 auto 24px; border-top: 1px solid var(--line); }
.result-details div { display: grid; grid-template-columns: 120px minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; }
.result-details dt { color: var(--muted); }
.result-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .bulk-import-grid, .batch-create-grid, .announcement-form-grid, .admin-create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .dashboard-command-bar { align-items: stretch; flex-direction: column; }
  .dashboard-operation-summary div:first-child { border-left: 0; padding-left: 0; }
  .dashboard-grid, .search-result-grid, .system-grid { grid-template-columns: 1fr; }
  .search-result-panel-wide { grid-column: auto; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .redeem-center { grid-template-columns: minmax(330px, 390px) minmax(0, 1fr); }
  .redeem-entry-panel { padding: 28px 24px; }
  .download-queue { padding: 26px 24px 30px; }
  .queue-summary { grid-template-columns: repeat(3, minmax(68px, 1fr)); }
  .queue-summary form { grid-column: 1 / -1; padding: 12px 0; border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 13px 16px; }
  .sidebar .brand { margin: 0 0 12px; }
  .sidebar-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .sidebar-nav a { min-width: 0; justify-content: center; padding: 8px 6px; text-align: center; }
  .sidebar-nav a.active { padding-left: 6px; }
  .sidebar-nav .nav-badge { position: absolute; top: 3px; right: 4px; margin-left: 0; }
  .sidebar-user { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 10px 0 0; }
  .sidebar-user span { margin: 0; }
  .sidebar-user button { width: auto; }
  .admin-header { min-height: 58px; height: auto; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 18px; }
  .admin-global-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .admin-content { padding: 20px 16px 42px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-operation-summary { width: 100%; }
  .dashboard-operation-summary div { min-width: 0; flex: 1; }
  .activity-chart { height: 214px; grid-template-columns: repeat(7, minmax(32px, 1fr)); gap: 4px; padding: 14px 10px 10px; }
  .activity-day { grid-template-rows: 20px 130px 20px; }
  .activity-bars { height: 130px; }
  .resource-summary, .batch-summary, .card-summary, .card-detail-summary, .notification-summary, .announcement-summary, .system-summary, .admin-account-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-summary div, .resource-summary div:first-child, .resource-summary div:last-child,
  .batch-summary div, .batch-summary div:first-child, .batch-summary div:last-child,
  .card-summary div, .card-summary div:first-child, .card-summary div:last-child,
  .card-detail-summary div, .card-detail-summary div:first-child, .card-detail-summary div:last-child,
  .notification-summary div, .notification-summary div:first-child, .notification-summary div:last-child,
  .announcement-summary div, .announcement-summary div:first-child, .announcement-summary div:last-child,
  .system-summary div, .admin-account-summary div { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .resource-summary div:nth-child(2n), .batch-summary div:nth-child(2n), .card-summary div:nth-child(2n), .card-detail-summary div:nth-child(2n), .notification-summary div:nth-child(2n), .announcement-summary div:nth-child(2n), .system-summary div:nth-child(2n), .admin-account-summary div:nth-child(2n) { border-right: 0; }
  .resource-summary div:nth-last-child(-n+2), .batch-summary div:nth-last-child(-n+2), .card-summary div:nth-last-child(-n+2), .card-detail-summary div:nth-last-child(-n+2), .notification-summary div:nth-last-child(-n+2), .announcement-summary div:nth-last-child(-n+2), .system-summary div:nth-last-child(-n+2), .admin-account-summary div:nth-last-child(-n+2) { border-bottom: 0; }
  .resource-tabs { gap: 0; padding: 0 14px; }
  .resource-tabs button { flex: 1; }
  .form-grid, .filter-bar, .bulk-import-grid, .batch-create-grid, .card-filter-grid, .card-exact-form, .import-group-filter, .notification-filter-grid, .announcement-form-grid, .admin-create-grid { grid-template-columns: 1fr; }
  .announcement-content-field { grid-column: auto; }
  .resource-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .resource-bulk-controls { width: 100%; }
  .resource-bulk-controls select { min-width: 0; flex: 1; }
  .card-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .card-bulk-controls { width: 100%; }
  .card-bulk-controls select { min-width: 0; flex: 1; }
  .notification-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .notification-bulk-controls { width: 100%; }
  .notification-bulk-controls select { min-width: 0; flex: 1; }
  .notification-filter-actions > * { flex: 1; }
  .card-exact-form { max-width: none; }
  .card-exact-form button { width: 100%; }
  .card-filter-actions { align-items: stretch; }
  .card-filter-actions > * { flex: 1; }
  .search-command { align-items: stretch; flex-direction: column; }
  .search-command > strong { align-self: flex-end; }
  .search-card-results li { grid-template-columns: minmax(0, 1fr) auto; }
  .search-card-results li > a { grid-row: 1 / span 2; }
  .search-card-usage { grid-column: 2; grid-row: 1; }
  .search-card-results li > .status { grid-column: 2; grid-row: 2; }
  .card-info-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .public-main { padding: 18px 0 42px; }
  .public-announcement { grid-template-columns: 1fr; gap: 3px; }
  .redeem-center { min-height: 0; grid-template-columns: 1fr; }
  .redeem-entry-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .redeem-limits { margin-top: 26px; }
  .batch-card-entry textarea { min-height: 180px; }
  .queue-empty { min-height: 230px; }
  .extract-tool__head, .extract-tool__body { padding-left: 20px; padding-right: 20px; }
  .resource-top { display: grid; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 0; }
  .file-meta { display: none; }
  .installer-shell { padding: 14px 10px; }
  .install-head, .install-intro, .install-section, .install-submit { padding-left: 18px; padding-right: 18px; }
  .install-head > span { display: none; }
  .requirement-row { grid-template-columns: 24px minmax(0, 1fr); }
  .requirement-row > span:last-child { grid-column: 2; }
  .install-submit { align-items: stretch; flex-direction: column; }
  .result-details div { grid-template-columns: 1fr; gap: 2px; }
  .system-page-actions, .maintenance-body { align-items: stretch; flex-direction: column; }
  .system-page-actions > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-check-list > div { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .system-check-list p { grid-column: 2 / -1; }
  .integrity-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .integrity-summary div { border-bottom: 1px solid var(--line); }
  .maintenance-body dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .maintenance-body form button { width: 100%; }
}

@media (max-width: 480px) {
  .admin-header h1 { font-size: 18px; }
  .dashboard-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-quick-actions .button { width: 100%; }
  .dashboard-operation-summary div { padding-left: 8px; padding-right: 8px; }
  .dashboard-operation-summary dd { overflow-wrap: anywhere; font-size: 11px; }
  .activity-legend { gap: 8px; font-size: 10px; }
  .activity-values { gap: 5px; }
  .search-command form { grid-template-columns: 1fr; }
  .search-command button { width: 100%; }
  .resource-compose .panel-head, .batch-compose .panel-head, .card-query-panel .panel-head, .notification-filter-panel .panel-head, .announcement-compose .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .resource-compose .panel-head .muted, .batch-compose .panel-head .muted, .card-query-panel .panel-head .muted, .notification-filter-panel .panel-head .muted { line-height: 1.4; }
  .public-header { width: 100%; padding-left: 12px; padding-right: 12px; }
  .public-main { width: min(100% - 20px, 1180px); }
  .notification-page-actions { align-items: flex-start; flex-direction: column; }
  .redeem-entry-panel, .download-queue { padding-left: 17px; padding-right: 17px; }
  .redeem-heading h1 { font-size: 23px; }
  .redeem-limits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .redeem-limits div, .redeem-limits div:first-child, .redeem-limits div:last-child { padding: 10px 6px; border-right: 1px solid var(--line); border-bottom: 0; }
  .redeem-limits div:first-child { padding-left: 0; }
  .redeem-limits div:last-child { padding-right: 0; border-right: 0; }
  .redeem-limits dd { font-size: 11px; }
  .queue-head { align-items: flex-start; }
  .queue-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .queue-summary > div { padding: 12px 8px; }
  .queue-summary > div:first-child { padding-left: 0; }
  .queue-item { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
  .queue-actions { grid-column: 2; padding: 0; }
  .queue-actions .button, .queue-actions button { width: 100%; }
  .entry-counter { display: grid; gap: 2px; }
  .system-page-actions > div { grid-template-columns: 1fr; }
}

/* Admin workspace */
.ui-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}
.admin-shell { grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  z-index: 20;
  width: 252px;
  padding: 18px 14px 14px;
  background: #11151d;
  box-shadow: 6px 0 24px rgba(15, 23, 42, .08);
}
.sidebar-top { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px; }
.sidebar .brand { min-width: 0; gap: 10px; margin: 0; color: #fff; font-size: 19px; }
.sidebar .brand img { width: 36px; height: 36px; }
.sidebar .brand span { line-height: 1.1; }
.sidebar .brand small { align-self: flex-end; margin: 0 0 2px -4px; color: #7f8da3; font-size: 10px; font-weight: 700; }
.sidebar-toggle { width: 38px; height: 38px; min-height: 38px; display: none; border-color: #30394a; padding: 0; background: transparent; box-shadow: none; }
.sidebar-toggle:hover { border-color: #465269; background: #1a202b; }
.sidebar-navigation { min-height: 0; flex: 1; overflow-y: auto; margin: 18px -4px 12px; padding: 0 4px; scrollbar-color: #334155 transparent; scrollbar-width: thin; }
.sidebar-nav { display: block; }
.sidebar-nav-group { margin: 0 0 15px; }
.sidebar-nav-group h2 { margin: 0 10px 6px; color: #667085; font-size: 10px; font-weight: 800; letter-spacing: 0; }
.sidebar-nav-group a {
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 10px;
  color: #aeb8c8;
  font-size: 13px;
  font-weight: 650;
}
.sidebar-nav-group a:hover { color: #fff; border-color: #2c3545; background: #1a202b; text-decoration: none; }
.sidebar-nav-group a.active { color: #fff; border-color: rgba(96, 165, 250, .22); background: rgba(37, 99, 235, .22); box-shadow: inset 3px 0 #60a5fa; }
.sidebar-nav-group a .ui-icon { width: 17px; height: 17px; color: #77859a; }
.sidebar-nav-group a:hover .ui-icon, .sidebar-nav-group a.active .ui-icon { color: #8ec5ff; }
.sidebar-nav-group .nav-badge { min-width: 19px; height: 19px; margin: 0; background: #fbbf24; }
.sidebar-user {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  margin: 0;
  border-top: 1px solid #293141;
  padding: 13px 6px 0;
}
.sidebar-avatar { width: 34px; height: 34px; display: grid !important; place-items: center; margin: 0 !important; border: 1px solid #3b4a61; border-radius: 7px; color: #bfdbfe !important; background: #1d2b43; font-size: 13px !important; font-weight: 800; }
.sidebar-user > div { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: #e5e7eb; font-size: 12px; }
.sidebar-user small { margin-top: 1px; color: #667085; font-size: 10px; }
.sidebar-user form { margin: 0; }
.sidebar-logout { width: 34px !important; height: 34px; min-height: 34px !important; border-color: transparent !important; padding: 0 !important; color: #8995a7; background: transparent !important; box-shadow: none !important; }
.sidebar-logout:hover { color: #fff; border-color: #354055 !important; background: #1a202b !important; }
.sidebar-logout .ui-icon { width: 17px; height: 17px; }
.admin-header {
  height: 76px;
  grid-template-columns: minmax(170px, auto) minmax(280px, 560px) auto;
  gap: 24px;
  padding: 0 32px;
  background: rgba(255, 255, 255, .97);
}
.admin-heading { min-width: 0; }
.admin-heading > span { display: block; margin-bottom: 1px; color: #7b8494; font-size: 10px; font-weight: 700; }
.admin-heading h1 { overflow: hidden; color: #121826; font-size: 19px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.admin-global-search { position: relative; display: block; }
.admin-global-search input { height: 40px; min-height: 40px; border-color: #d4dce8; border-radius: 7px; padding: 7px 44px 7px 14px; background: #f7f9fc; }
.admin-global-search input:focus { background: #fff; }
.header-icon-button { position: absolute; top: 3px; right: 3px; width: 34px; height: 34px; min-height: 34px; border: 0; border-radius: 6px; padding: 0; color: #64748b; background: transparent; box-shadow: none; }
.header-icon-button:hover { color: var(--forest-2); background: #eaf2ff; }
.admin-site-link { gap: 7px; min-height: 36px; padding: 6px 10px; }
.admin-site-link .ui-icon { width: 15px; height: 15px; }
.admin-content { width: min(1480px, 100%); padding: 26px 32px 58px; }
.panel { border-color: #dfe5ee; box-shadow: 0 2px 5px rgba(15, 23, 42, .035); }
.panel-head { min-height: 52px; padding: 13px 17px; background: #fcfdff; }
.panel-head h2 { color: #182132; font-size: 15px; }
.dashboard-command-bar { min-height: 62px; margin-bottom: 16px; border-left: 1px solid var(--line); padding: 9px 12px; box-shadow: 0 2px 5px rgba(15, 23, 42, .035); }
.dashboard-quick-actions .button { min-height: 36px; gap: 7px; padding: 6px 11px; font-size: 12px; }
.dashboard-quick-actions .ui-icon { width: 15px; height: 15px; }
.dashboard-operation-summary div { min-width: 105px; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-bottom: 18px; border: 1px solid #dfe5ee; border-radius: var(--radius); background: #fff; box-shadow: 0 2px 5px rgba(15, 23, 42, .035); overflow: hidden; }
.stat { min-height: 92px; display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; gap: 0 12px; border: 0; border-right: 1px solid #e5eaf1; border-radius: 0; padding: 14px 16px; box-shadow: none; }
.stat:last-child { border-right: 0; }
.stat-icon { grid-row: 1 / 3; width: 38px; height: 38px; display: grid !important; place-items: center; border-radius: 7px; color: #2563eb; background: #eaf2ff; }
.stat:nth-child(2) .stat-icon { color: #0f766e; background: #e7f8f5; }
.stat:nth-child(3) .stat-icon { color: #a16207; background: #fff7dc; }
.stat:nth-child(4) .stat-icon { color: #be123c; background: #fff0f3; }
.stat:nth-child(5) .stat-icon { color: #475569; background: #eef2f7; }
.stat-icon .ui-icon { width: 19px; height: 19px; }
.stat dt { align-self: end; color: var(--muted); font-size: 11px; }
.stat dd { align-self: start; margin: 1px 0 0; color: #151c2b; font-size: 22px; font-weight: 800; line-height: 1.2; }
.dashboard-grid { gap: 16px; }
.dashboard-attention-list a { grid-template-columns: minmax(0, 1fr) auto 14px; }
.dashboard-attention-list strong { min-width: 30px; }
.dashboard-attention-list strong .ui-icon { width: 13px; height: 13px; }
.attention-arrow { width: 14px; height: 14px; color: #a0a9b7; }

@media (max-width: 1180px) {
  .admin-shell { grid-template-columns: 228px minmax(0, 1fr); }
  .sidebar { width: 228px; }
  .admin-header { grid-template-columns: minmax(150px, auto) minmax(220px, 1fr) auto; padding: 0 24px; }
  .admin-content { padding-left: 24px; padding-right: 24px; }
  .stat { grid-template-columns: 32px minmax(0, 1fr); gap: 0 9px; padding: 12px; }
  .stat-icon { width: 32px; height: 32px; }
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid #e5eaf1; }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { position: sticky; top: 0; width: 100%; height: auto; padding: 9px 14px; }
  .sidebar-top { min-height: 44px; padding: 0 2px; }
  .sidebar .brand { margin: 0; font-size: 17px; }
  .sidebar .brand img { width: 32px; height: 32px; }
  .sidebar .brand small { margin-bottom: 1px; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-navigation { max-height: 0; overflow: hidden; margin: 0; padding: 0; visibility: hidden; opacity: 0; transition: max-height .22s ease, opacity .18s ease, margin .22s ease; }
  .sidebar.is-open .sidebar-navigation { max-height: 420px; margin-top: 10px; border-top: 1px solid #293141; padding-top: 10px; visibility: visible; opacity: 1; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
  .sidebar-nav-group { margin-bottom: 8px; }
  .sidebar-nav-group h2 { margin-left: 7px; }
  .sidebar-nav-group a { min-height: 38px; margin: 1px 0; padding: 6px 7px; }
  .sidebar-user { display: none; min-height: 50px; grid-template-columns: 30px minmax(0, 1fr) 34px; margin-top: 2px; padding: 10px 3px 2px; }
  .sidebar.is-open .sidebar-user { display: grid; }
  .sidebar-avatar { width: 30px; height: 30px; }
  .admin-header { position: sticky; top: 62px; min-height: 74px; height: auto; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 9px 16px 10px; }
  .admin-heading > span { display: none; }
  .admin-heading h1 { font-size: 18px; }
  .admin-global-search { grid-column: 1 / -1; grid-row: 2; }
  .admin-header-actions { grid-column: 2; grid-row: 1; }
  .admin-content { padding: 18px 14px 42px; }
  .dashboard-command-bar { align-items: stretch; }
  .dashboard-operation-summary div { min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:nth-child(3) { min-height: 82px; border-right: 1px solid #e5eaf1; border-bottom: 1px solid #e5eaf1; }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-last-child(-n+2) { border-bottom: 1px solid #e5eaf1; }
  .stat:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .page-actions { align-items: stretch; flex-direction: column; }
}

@media (max-width: 480px) {
  .sidebar-nav { gap: 4px 8px; }
  .sidebar-nav-group a { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 7px; font-size: 12px; }
  .admin-site-link { min-height: 32px; padding: 4px 8px; font-size: 11px; }
  .admin-content { padding-left: 12px; padding-right: 12px; }
  .dashboard-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-quick-actions .button { justify-content: flex-start; }
  .dashboard-operation-summary div { padding-left: 8px; padding-right: 8px; }
  .stats { margin-bottom: 14px; }
  .stat { grid-template-columns: 30px minmax(0, 1fr); gap: 0 8px; padding: 10px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat dd { font-size: 19px; }
}
