:root {
  color-scheme: light;
  --ink: #202a32;
  --muted: #68777b;
  --line: #dfe7e6;
  --paper: #fff;
  --canvas: #f2f6f5;
  --green: #087f67;
  --green-dark: #076752;
  --orange: #a85d22;
  --red: #b43e43;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #edf5f0, #f6f8f5 58%, #e6f1ef); }
.login-panel { width: min(400px, 100%); display: grid; gap: 13px; padding: 32px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); box-shadow: 0 18px 50px #1b463313; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 5px; background: #d9eee8; color: var(--green); font-size: 12px; font-weight: 800; text-decoration: none; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 750; }
.login-panel h1, .page-heading h1 { margin: 0; font-size: 24px; }
.login-panel label, .panel label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.login-panel input, .panel input, .panel select, .search-input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); }
.login-panel input:focus, .panel input:focus, .panel select:focus, .search-input:focus { border-color: var(--green); outline: 2px solid #087f671c; }
.button { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); font-size: 12px; font-weight: 650; }
.button:hover { background: #f4f8f6; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.login-error { min-height: 16px; margin: 0; color: var(--red); font-size: 11px; }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 22px; border-bottom: 1px solid var(--line); background: white; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 13px; font-weight: 750; text-decoration: none; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
[data-locale-mount] { display: inline-flex; align-items: center; gap: 6px; }
.locale-flag { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.locale-select { max-width: 150px; padding: 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
.workspace { width: min(1360px, 100%); margin: 0 auto; padding: 26px 24px 56px; }
.provider-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: start; gap: 22px; }
.provider-sidebar { position: sticky; top: 14px; display: grid; align-content: start; gap: 3px; padding-right: 12px; border-right: 1px solid var(--line); }
.provider-nav-item { width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); text-align: left; font-size: 12px; font-weight: 600; }
.provider-nav-item:hover { background: #edf5f0; color: var(--ink); }
.provider-nav-item[aria-current="page"] { background: #e2f1e9; color: var(--green-dark); }
.provider-nav-parent { display: flex; align-items: center; justify-content: space-between; color: var(--ink); }
.provider-nav-parent::after { content: "▾"; color: var(--muted); font-size: 10px; }
.provider-nav-parent[aria-expanded="false"]::after { content: "▸"; }
.provider-subnav { display: grid; gap: 2px; margin: 1px 0 5px 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.provider-subnav .provider-nav-item { min-height: 32px; font-size: 11px; }
.provider-content { min-width: 0; }
.provider-content .operation-grid { grid-template-columns: minmax(0, 1fr); }
.provider-view-empty { padding: 16px; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.page-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.page-heading { margin-bottom: 20px; }
.page-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.operation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.announcement-layout { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr); align-items: start; gap: 14px; }
.announcement-upload { display: grid; gap: 8px; padding: 12px; border: 1px dashed #cbdad5; border-radius: 4px; background: #f7faf8; }
.announcement-upload .form-hint { margin: 0; }
.announcement-upload input[type=file] { padding: 6px; background: #fff; }
.announcement-style-row { display: grid; grid-template-columns: minmax(70px, .8fr) minmax(85px, 1fr) auto auto; align-items: end; gap: 10px; }
.announcement-style-row input[type=color] { min-height: 38px; padding: 4px; }
.announcement-style-row .publish-toggle { white-space: nowrap; }
.announcement-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.announcement-form .publish-toggle { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.announcement-form .publish-toggle input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--green); }
.provider-ai-toggle { display: flex !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.provider-ai-toggle input { width: 16px !important; min-height: 16px !important; margin: 0; accent-color: var(--green); }
.data-section table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; white-space: normal; }
.announcement-table { min-width: 660px; }
.announcement-preview { display: flex; align-items: center; gap: 8px; max-width: 260px; white-space: normal; }
.announcement-preview img { width: 82px; height: 34px; flex: 0 0 auto; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
.announcement-preview span { overflow-wrap: anywhere; }
.announcement-status { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 3px; background: #f1efeb; color: #74736f; font-size: 10px; font-weight: 700; }
.announcement-status.published { background: #e1f3e9; color: #216b48; }
.announcement-actions { display: flex; gap: 5px; }
.announcement-actions .button { min-height: 28px; padding: 0 8px; font-size: 10px; }
.announcement-actions .delete-announcement { color: var(--red); }
.panel { display: grid; align-content: start; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.panel-heading h2, .section-heading h2 { margin: 0; font-size: 16px; }
.panel-heading .eyebrow, .section-heading .eyebrow { margin-bottom: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-hint { margin: -3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.data-section { margin-top: 24px; }
.ai-usage-report { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.ai-usage-report h3 { margin: 0; font-size: 15px; }
.ai-usage-report .section-heading { margin-bottom: 8px; }
.ai-usage-table { min-width: 820px; }
.section-heading { margin-bottom: 10px; }
.search-input { max-width: 300px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #edf1f0; text-align: left; font-size: 11px; white-space: nowrap; }
th { background: #f7f9f8; color: var(--muted); font-size: 10px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; padding: 4px 7px; border-radius: 3px; background: #e1f3e9; color: #216b48; font-size: 10px; font-weight: 700; }
.status.inactive, .status.revoked { background: #f1efeb; color: #74736f; }
.status.unused { background: #e5f1f4; color: #336b7b; }
.row-button { min-height: 27px; padding: 0 8px; font-size: 10px; }
.issued-result { margin-top: 16px; padding: 16px; border: 1px solid #abd6c8; border-radius: 5px; background: #eff8f3; }
.issued-result h2 { margin: 0 0 6px; font-size: 14px; }
.issued-result p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.issued-key-list { display: grid; gap: 5px; max-height: 180px; overflow: auto; margin: 0 0 12px; padding: 10px; border: 1px solid #d7e8df; background: white; font: 12px/1.7 Consolas, monospace; user-select: all; }
.group-buy-design-sections { display: grid; gap: 14px; margin-top: 16px; }
.group-buy-design-section { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.group-buy-design-section > header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.group-buy-design-section > header span { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.group-buy-design-section h2 { margin: 0; font-size: 15px; }
.group-buy-design-table { min-width: 790px; }
.group-buy-design-table th, .group-buy-design-table td { vertical-align: top; white-space: normal; line-height: 1.65; }
.group-buy-design-table thead th { white-space: nowrap; }
.group-buy-design-table tbody th { width: 170px; background: white; color: var(--ink); font-size: 11px; }
.group-buy-design-table td:nth-child(2) { min-width: 300px; }
.group-buy-design-table td:nth-child(3) { min-width: 300px; color: #526056; }
.group-buy-global-notice { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; border: 1px solid #e9d5ad; border-radius: 6px; background: #fffaf0; }
.group-buy-global-notice strong { font-size: 12px; }
.group-buy-global-notice p { margin: 5px 0 0; color: #75664d; font-size: 11px; line-height: 1.65; }
.group-buy-global-notice > span { max-width: 290px; color: #805b24; font-size: 11px; font-weight: 700; line-height: 1.55; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 22px; max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 5px; background: #202a32; color: white; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: .16s; font-size: 12px; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .workspace { padding: 20px 14px 40px; }
  .provider-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .provider-sidebar { position: static; display: flex; flex-wrap: wrap; gap: 3px; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .provider-nav-item { width: auto; }
  .provider-nav-group { display: grid; align-content: start; }
  .provider-subnav { display: flex; flex-wrap: wrap; margin: 2px 0 0; padding: 0 0 0 7px; }
  .provider-subnav .provider-nav-item { width: auto; }
  .operation-grid { grid-template-columns: 1fr; }
  .announcement-layout { grid-template-columns: 1fr; }
  .page-heading { align-items: start; }
  .group-buy-global-notice { align-items: flex-start; flex-direction: column; }
  .group-buy-global-notice > span { max-width: none; }
  .form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .topbar { padding: 8px 14px; }
}
@media (max-width: 430px) {
  .login-panel { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 20px; }
  .search-input { max-width: 48%; }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .operation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
