:root {
  --app-bg: #f8f8f4;
  --app-surface: #ffffff;
  --app-text: #414b63;
  --app-muted: #646d7c;
  --app-line: #e2e5e4;
  --app-mint: #e4f0ef;
  --app-mint-strong: #357e79;
  --app-mint-hover: #286965;
  --app-peach: #f7e7db;
  --app-blue: #dfeaff;
  --app-lilac: #eeebf7;
  --app-danger: #a94d4d;
  --app-radius-sm: 8px;
  --app-radius-md: 14px;
  --app-focus: #435b94;
  --app-fast: 160ms ease;
}

html { scroll-padding-top: 20px; }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; border-radius: 6px; color: #fff; background: var(--app-focus); transform: translateY(-150%); transition: transform var(--app-fast); }
.skip-link:focus { transform: translateY(0); }
.of-svg-sprite { display: none; }
.of-market :is(button,a,input,select,textarea):focus-visible,
.admin-view :is(button,a,input,select,textarea):focus-visible,
dialog :is(button,a,input,select,textarea):focus-visible { outline: 3px solid var(--app-focus); outline-offset: 3px; }
.empty-state { padding: 52px 20px; text-align: center; color: var(--app-muted); }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty-state h3, .empty-state h4 { margin: 0 0 5px; color: var(--app-text); font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }

/* Front-end data driven additions */
.of-latest-empty { padding: 28px 0; color: #58716d; font-size: 13px; }
.of-collection-card { min-height: 176px; }
.of-app-copy button, .of-open-app, .of-latest-item, .of-collection-card { touch-action: manipulation; }
.of-dialog-close { display: grid; place-items: center; }
.of-dialog-close svg { width: 18px; height: 18px; }
.of-dialog .of-dialog-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: #356f68; background: var(--app-mint); font-size: 11px; }
.of-dialog .of-dialog-actions { display: flex; gap: 10px; margin-top: 24px; }

/* Admin shell */
.admin-view { min-height: calc(100vh - 34px); background: #f6f7f3; color: var(--app-text); }
.admin-view.active-view { display: flex; }
.admin-sidebar { position: sticky; top: 0; width: 248px; min-height: calc(100vh - 34px); padding: 25px 16px 18px; color: var(--app-text); background: var(--app-mint); border-right: 1px solid #cfdfdc; }
.admin-logo { display: flex; align-items: center; gap: 10px; margin: 0 12px 28px; color: var(--app-text); text-decoration: none; font: 700 19px 'Space Grotesk', sans-serif; letter-spacing: -.7px; }
.admin-logo svg { width: 29px; height: 29px; fill: none; stroke: var(--app-mint-strong); stroke-width: 2; }
.admin-logo b { font-weight: 500; }
.admin-logo small { display: block; padding-top: 2px; color: var(--app-muted); font: 500 9px 'DM Sans', sans-serif; letter-spacing: 1.5px; }
.admin-workspace { display: flex; align-items: center; gap: 10px; margin: 0 2px 24px; padding: 11px; border: 1px solid #c7dad6; border-radius: 9px; background: #f5faf8; }
.admin-workspace div, .admin-user div { display: flex; flex: 1; flex-direction: column; }
.admin-workspace strong, .admin-user strong { font-size: 12px; }
.admin-workspace small, .admin-user small { color: var(--app-muted); font-size: 10px; }
.workspace-avatar, .user-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; color: #fff; background: var(--app-mint-strong); font: 700 10px 'Space Grotesk', sans-serif; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav .nav-group-label { margin: 20px 11px 7px; color: #72817f; font-size: 9px; font-weight: 700; letter-spacing: 1.3px; }
.admin-nav .nav-group-label:first-child { margin-top: 0; }
.admin-nav-item { position: relative; display: flex; align-items: center; width: 100%; min-height: 43px; gap: 11px; padding: 9px 11px; border: 0; border-radius: 8px; color: #596b68; background: transparent; font-size: 13px; text-align: left; transition: background var(--app-fast), color var(--app-fast); }
.admin-nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.admin-nav-item > span { margin-left: auto; min-width: 24px; padding: 2px 6px; border-radius: 10px; color: #4f6d68; background: #d4e6e2; font-size: 9px; text-align: center; }
.admin-nav-item:hover { background: #d8e9e6; color: #315f5a; }
.admin-nav-item.active { color: #2e6661; background: #fff; box-shadow: 0 1px 0 #c9d7d4; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid #cadbd7; }
.user-avatar { border-radius: 50%; color: #4f648c; background: var(--app-blue); }
.admin-content { min-width: 0; flex: 1; }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding: 40px 48px 29px; border-bottom: 1px solid var(--app-line); background: #fbfbf8; }
.admin-header .eyebrow, .dialog-header .eyebrow, .planned-state .eyebrow { margin: 0 0 8px; color: var(--app-muted); font-size: 9px; letter-spacing: 1.4px; }
.admin-header h1 { margin: 0; color: var(--app-text); font: 600 30px/1.2 'Space Grotesk', sans-serif; letter-spacing: -1.2px; }
.admin-subtitle { margin: 8px 0 0; color: var(--app-muted); font-size: 13px; }
.admin-header-actions { display: flex; align-items: center; gap: 10px; }
.admin-icon-button, .admin-primary-button, .admin-secondary-button, .text-button { min-height: 44px; border-radius: 7px; transition: background var(--app-fast), border-color var(--app-fast), color var(--app-fast); }
.admin-icon-button { position: relative; display: grid; place-items: center; width: 44px; border: 1px solid var(--app-line); color: var(--app-muted); background: #fff; }
.admin-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.admin-icon-button i { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border: 1px solid #fff; border-radius: 50%; background: #d87c63; }
.admin-primary-button, .admin-secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border: 1px solid transparent; font-size: 13px; font-weight: 600; }
.admin-primary-button { color: #fff; background: var(--app-mint-strong); }
.admin-primary-button:hover { background: var(--app-mint-hover); }
.admin-primary-button svg, .admin-secondary-button svg, .text-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.admin-secondary-button { color: var(--app-text); border-color: #cbd5d2; background: transparent; }
.admin-secondary-button:hover { border-color: #a9bfba; background: var(--app-mint); }
.admin-main { padding: 28px 48px 52px; }
.admin-screen { display: none; }
.admin-screen.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 150px; padding: 20px; border: 1px solid var(--app-line); border-radius: 12px; background: #fff; }
.metric-card:nth-child(2) { background: #f9f4ef; }
.metric-card:nth-child(3) { background: #f2f6fc; }
.metric-card:nth-child(4) { background: #f1f7f5; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 15px; color: var(--app-muted); font-size: 11px; }
.metric-label svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.metric-card > strong { display: block; color: var(--app-text); font: 600 31px 'Space Grotesk', sans-serif; letter-spacing: -1.4px; }
.metric-card > span { display: block; margin-top: 9px; color: var(--app-muted); font-size: 10px; }
.admin-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-top: 14px; }
.admin-panel { padding: 23px 24px; border: 1px solid var(--app-line); border-radius: 12px; background: #fff; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-head h2 { margin: 0; color: var(--app-text); font: 600 17px 'Space Grotesk', sans-serif; }
.panel-head p { margin: 5px 0 0; color: var(--app-muted); font-size: 11px; }
.soft-badge { padding: 4px 7px; border-radius: 4px; color: #715e8b; background: var(--app-lilac); font-size: 9px; }
.chart-summary { display: flex; align-items: baseline; gap: 7px; margin: 26px 0 14px; }
.chart-summary strong { font: 600 26px 'Space Grotesk', sans-serif; }
.chart-summary span { color: var(--app-muted); font-size: 11px; }
.download-chart { display: flex; align-items: end; gap: 8px; height: 155px; padding-top: 10px; border-bottom: 1px solid var(--app-line); }
.chart-bar { position: relative; flex: 1; min-width: 18px; border-radius: 5px 5px 0 0; background: #badbd5; transition: background var(--app-fast); }
.chart-bar:hover, .chart-bar:focus { background: #73ada5; }
.chart-bar span { position: absolute; left: 50%; bottom: -23px; color: var(--app-muted); font-size: 9px; transform: translateX(-50%); }
.chart-bar b { position: absolute; left: 50%; top: -20px; color: var(--app-text); font-size: 9px; font-weight: 500; transform: translateX(-50%); }
.activity-list { margin-top: 18px; }
.activity-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid #edf0ed; }
.activity-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #4c6863; background: var(--app-mint); font: 600 11px 'Space Grotesk', sans-serif; }
.activity-item strong { display: block; font-size: 11px; }
.activity-item p, .activity-item time { margin: 2px 0 0; color: var(--app-muted); font-size: 9px; }
.products-panel { margin-top: 14px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 7px 9px; border: 0; color: var(--app-mint-strong); background: transparent; font-size: 11px; }
.text-button:hover { background: var(--app-mint); }
.admin-product-table { margin-top: 18px; overflow-x: auto; }
.admin-table-row { display: grid; grid-template-columns: minmax(190px, 1.7fr) .8fr .8fr .7fr auto; align-items: center; min-width: 680px; gap: 14px; padding: 13px 4px; border-top: 1px solid #edf0ed; color: var(--app-muted); font-size: 11px; }
.admin-table-row.header { padding-top: 6px; border: 0; color: #89918f; font-size: 9px; letter-spacing: .3px; }
.admin-product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-product-cell .of-app-icon { width: 36px; height: 36px; border-radius: 9px; }
.admin-product-cell .of-app-icon svg { width: 21px; height: 21px; }
.admin-product-cell strong { display: block; overflow: hidden; color: var(--app-text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-product-cell small { display: block; margin-top: 2px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 9px; }
.status-badge::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ''; }
.status-published { color: #337368; background: #e4f1ed; }
.status-active { color: #337368; background: #e4f1ed; }
.status-draft { color: #6b6685; background: #efedf8; }
.status-paused, .status-withdrawn, .status-inactive { color: #8a604a; background: #f7e9df; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-action { min-height: 36px; padding: 6px 10px; border: 1px solid #d9dfdc; border-radius: 6px; color: var(--app-text); background: #fff; font-size: 10px; }
.table-action:hover { background: #f1f6f4; border-color: #bdd0cc; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--app-line); color: var(--app-muted); font-size: 10px; }
.pagination-summary { white-space: nowrap; }
.pagination-controls { display: flex; align-items: center; gap: 5px; }
.pagination-button { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; padding: 6px 9px; border: 1px solid #d8dfdc; border-radius: 6px; color: var(--app-text); background: #fff; font-size: 10px; transition: background var(--app-fast), border-color var(--app-fast), color var(--app-fast); }
.pagination-button:hover:not(:disabled) { border-color: #afc5c0; background: var(--app-mint); }
.pagination-button[aria-current="page"] { border-color: #99beb7; color: #2f6b66; background: var(--app-mint); font-weight: 700; }
.pagination-button:disabled { cursor: not-allowed; opacity: .42; }
.pagination-size { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pagination-size select { min-height: 36px; padding: 5px 25px 5px 8px; border: 1px solid #d8dfdc; border-radius: 6px; color: var(--app-text); background: #fff; font-size: 10px; }
.pagination-spacer { color: #98a29f; padding-inline: 2px; }
.product-toolbar { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.version-filters { display: flex; gap: 12px; }
.admin-search { display: flex; align-items: center; width: min(430px, 100%); min-height: 44px; gap: 9px; padding: 0 13px; border: 1px solid var(--app-line); border-radius: 8px; background: #fff; }
.admin-search svg { width: 17px; height: 17px; fill: none; stroke: var(--app-muted); stroke-width: 1.7; }
.admin-search input { width: 100%; border: 0; outline: 0; color: var(--app-text); background: transparent; font-size: 13px; }
.admin-filter { display: flex; align-items: center; gap: 9px; color: var(--app-muted); font-size: 11px; }
.admin-filter select { min-height: 44px; padding: 0 30px 0 11px; border: 1px solid var(--app-line); border-radius: 8px; color: var(--app-text); background: #fff; }
.product-manager-panel { padding-top: 12px; }
.product-manager-panel .admin-product-table { margin-top: 0; }
.version-manager-panel { padding-top: 12px; }
.version-table { overflow-x: auto; }
.version-table-row { display: grid; grid-template-columns: minmax(180px, 1.5fr) .65fr .65fr 1fr .75fr auto; align-items: center; min-width: 800px; gap: 14px; padding: 14px 4px; border-top: 1px solid #edf0ed; color: var(--app-muted); font-size: 11px; }
.version-table-row.header { padding-top: 6px; border-top: 0; color: #89918f; font-size: 9px; letter-spacing: .3px; }
.version-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
.version-product .of-app-icon { width: 36px; height: 36px; border-radius: 9px; }
.version-product .of-app-icon svg { width: 21px; height: 21px; }
.version-product strong, .version-number strong { display: block; color: var(--app-text); font-size: 12px; }
.version-product small, .version-number small { display: block; margin-top: 2px; font-size: 9px; }
.release-channel { display: inline-flex; width: fit-content; padding: 4px 7px; border-radius: 4px; color: #526e9f; background: var(--app-blue); font-size: 9px; }
.release-channel.beta { color: #765f8e; background: var(--app-lilac); }
.plan-manager-panel { padding-top: 12px; }
.plan-table { overflow-x: auto; }
.plan-table-row { display: grid; grid-template-columns: minmax(180px, 1.35fr) .65fr .6fr minmax(190px, 1.25fr) .55fr auto; align-items: center; min-width: 900px; gap: 14px; padding: 14px 4px; border-top: 1px solid #edf0ed; color: var(--app-muted); font-size: 11px; }
.plan-table-row.header { padding-top: 6px; border-top: 0; color: #89918f; font-size: 9px; letter-spacing: .3px; }
.plan-name strong, .plan-price strong { display: block; color: var(--app-text); font-size: 12px; }
.plan-name small, .plan-price small { display: block; margin-top: 3px; font-size: 9px; }
.billing-badge { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 5px; color: #526e9f; background: var(--app-blue); font-size: 9px; font-style: normal; }
.billing-yearly { color: #66567b; background: var(--app-lilac); }
.billing-one_time { color: #84624f; background: var(--app-peach); }
.plan-products { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.plan-products span, .plan-products i { display: inline-flex; padding: 4px 6px; border-radius: 5px; color: #4c6762; background: var(--app-mint); font-size: 9px; font-style: normal; }
.plan-products i { color: #6b6685; background: var(--app-lilac); }
.plan-products-empty { color: #9a7460; }
.of-release-list { margin: 18px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--app-line); }
.of-release-list li { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--app-line); }
.of-release-list strong { font-size: 12px; }
.of-release-list span { color: var(--app-muted); font-size: 11px; line-height: 1.6; white-space: pre-line; }
.of-plan-membership { margin: 18px 0 2px; padding: 14px; border: 1px solid #cfe0dc; border-radius: 10px; background: #f0f7f5; }
.of-plan-membership > span { display: block; margin-bottom: 8px; color: var(--app-muted); font-size: 10px; letter-spacing: .2px; }
.of-plan-membership div { display: flex; flex-wrap: wrap; gap: 7px; }
.of-plan-membership strong { padding: 6px 9px; border-radius: 6px; color: #315f59; background: #fff; font-size: 10px; font-weight: 600; }
.planned-state { max-width: 650px; padding: 68px 48px; text-align: center; }
.planned-state > span { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 22px; border-radius: 15px; color: #4e718f; background: var(--app-blue); }
.planned-state > span svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.planned-state h2 { margin: 0 0 10px; font: 600 25px 'Space Grotesk', sans-serif; }
.planned-state > p:not(.eyebrow) { max-width: 420px; margin: 0 auto 25px; color: var(--app-muted); font-size: 13px; line-height: 1.7; }

/* Product editor */
.product-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 0; border: 1px solid #d4ded9; border-radius: 16px; color: var(--app-text); background: var(--app-bg); box-shadow: 0 24px 80px #414b6326; }
.product-dialog::backdrop { background: #647a8752; backdrop-filter: blur(3px); }
.product-dialog form { padding: 28px; }
.detail-dialog .dialog-header { padding: 28px 28px 0; }
.detail-dialog .dialog-body { padding: 0 28px 28px; }
.plan-dialog { width: min(820px, calc(100vw - 32px)); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.dialog-header h2 { margin: 0; font: 600 27px 'Space Grotesk', sans-serif; letter-spacing: -.8px; }
.dialog-header p:not(.eyebrow) { margin: 6px 0 0; color: var(--app-muted); font-size: 12px; }
.dialog-close { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; color: var(--app-text); background: #e9eeea; }
.dialog-close svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.form-error-summary { margin: 0 0 18px; padding: 12px 14px; border-left: 3px solid var(--app-danger); color: #824141; background: #faecea; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: var(--app-text); font-size: 12px; }
.form-field > span { font-weight: 600; }
.form-field b { color: var(--app-danger); }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #ccd5d2; border-radius: 7px; color: var(--app-text); background: #fff; font-size: 14px; }
.form-field textarea { min-height: 86px; resize: vertical; }
.form-field small { color: var(--app-muted); font-size: 10px; }
.form-field em { min-height: 0; color: var(--app-danger); font-size: 10px; font-style: normal; }
.form-field.invalid input, .form-field.invalid select, .form-field.invalid textarea { border-color: var(--app-danger); }
.form-field-wide { grid-column: 1 / -1; }
.form-check { display: flex; align-items: flex-start; gap: 10px; min-height: 54px; padding: 11px 12px; border: 1px solid #d5dfdc; border-radius: 8px; background: var(--app-mint); cursor: pointer; }
.form-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--app-mint-strong); }
.form-check span { display: flex; flex-direction: column; }
.form-check strong { font-size: 12px; }
.form-check small { margin-top: 3px; color: var(--app-muted); font-size: 10px; }
.entitlement-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.entitlement-field legend { padding: 0; color: var(--app-text); font-size: 12px; font-weight: 600; }
.entitlement-field legend b { color: var(--app-danger); }
.entitlement-field > p { margin: 6px 0 10px; color: var(--app-muted); font-size: 10px; }
.entitlement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.entitlement-option { position: relative; display: grid; grid-template-columns: 18px 36px minmax(0, 1fr); align-items: center; gap: 9px; min-height: 64px; padding: 10px; border: 1px solid #d5dfdc; border-radius: 9px; background: #fff; cursor: pointer; transition: border-color var(--app-fast), background var(--app-fast), box-shadow var(--app-fast); }
.entitlement-option:hover { border-color: #afc8c2; background: #f8fbfa; }
.entitlement-option:has(input:checked) { border-color: #8db9b0; background: var(--app-mint); box-shadow: inset 0 0 0 1px #b7d5cf; }
.entitlement-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--app-mint-strong); }
.entitlement-option .of-app-icon { width: 36px; height: 36px; border-radius: 9px; }
.entitlement-option .of-app-icon svg { width: 20px; height: 20px; }
.entitlement-option strong { display: block; overflow: hidden; color: var(--app-text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.entitlement-option small { display: block; margin-top: 3px; color: var(--app-muted); font-size: 9px; }
.entitlement-field > em { display: block; margin-top: 7px; color: var(--app-danger); font-size: 10px; font-style: normal; }
.entitlement-field.invalid .entitlement-grid { padding: 5px; border: 1px solid var(--app-danger); border-radius: 10px; }
.entitlement-empty { grid-column: 1 / -1; margin: 0; padding: 20px; border: 1px dashed #cbd6d3; border-radius: 8px; color: var(--app-muted); text-align: center; font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--app-line); }
.toast { position: fixed; z-index: 2000; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 9px; max-width: 340px; padding: 13px 16px; border: 1px solid #bcd4ce; border-radius: 9px; color: #315f58; background: #eef8f5; box-shadow: 0 12px 35px #4b696127; font-size: 12px; }
.toast[hidden] { display: none; }
.toast svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

@media (max-width: 1050px) {
  .admin-sidebar { width: 218px; }
  .admin-header, .admin-main { padding-left: 28px; padding-right: 28px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .prototype-bar > span:nth-child(2) { font-size: 0; }
  .prototype-bar > span:nth-child(2)::after { content: '开发版本'; font-size: 10px; }
  .admin-view.active-view { display: block; }
  .admin-sidebar { position: static; width: 100%; min-height: auto; padding: 14px 18px 10px; border-right: 0; border-bottom: 1px solid #cfdfdc; }
  .admin-logo { margin: 0 0 12px; }
  .admin-workspace, .admin-user, .admin-nav .nav-group-label { display: none; }
  .admin-nav { flex-direction: row; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-item { width: auto; min-width: max-content; min-height: 42px; padding: 8px 11px; }
  .admin-nav-item > span { display: none; }
  .admin-header { padding: 24px 18px 20px; }
  .admin-header h1 { font-size: 25px; }
  .admin-subtitle { max-width: 260px; }
  .admin-icon-button { display: none; }
  .admin-primary-button { min-width: 44px; }
  .admin-main { padding: 20px 18px 36px; }
  .admin-grid { grid-template-columns: 1fr; }
  .product-toolbar { align-items: stretch; flex-direction: column; }
  .version-filters { flex-wrap: wrap; }
  .version-filters .admin-filter { flex: 1; }
  .version-filters select { flex: 1; }
  .admin-search { width: 100%; }
  .admin-filter { justify-content: space-between; }
  .planned-state { padding: 46px 22px; }
  .pagination { align-items: flex-start; flex-wrap: wrap; }
  .pagination-controls { order: 3; width: 100%; justify-content: space-between; }
  .pagination-button { min-width: 44px; min-height: 44px; }
  .pagination-size select { min-height: 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field-wide { grid-column: auto; }
  .entitlement-grid { grid-template-columns: 1fr; }
  .product-dialog form { padding: 22px 18px; }
  .dialog-header h2 { font-size: 24px; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 132px; }
  .admin-header-actions { align-self: center; }
  .admin-primary-button { padding-inline: 13px; }
  .admin-header-actions .admin-primary-button { font-size: 0; }
  .admin-header-actions .admin-primary-button svg { width: 20px; height: 20px; }
  .toast { right: 16px; bottom: 16px; left: 16px; }
  .pagination-controls .pagination-button:not([aria-current="page"]):not(:first-child):not(:last-child) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---- 第二阶段：订单 / 授权 / 用户 / Webhook / 设置 / 登录 / 审计 ---- */
.order-table, .license-table, .user-table, .webhook-table { overflow-x: auto; }
.order-table-row, .license-table-row, .user-table-row, .webhook-table-row { display: grid; align-items: center; min-width: 780px; gap: 14px; padding: 13px 4px; border-top: 1px solid #edf0ed; color: var(--app-muted); font-size: 11px; }
.order-table-row { grid-template-columns: minmax(120px,1fr) minmax(150px,1.2fr) minmax(150px,1.2fr) .7fr .9fr auto; }
.license-table-row { grid-template-columns: minmax(150px,1.3fr) minmax(120px,1fr) minmax(160px,1.4fr) .8fr .9fr auto; }
.user-table-row { grid-template-columns: minmax(200px,1.7fr) .9fr .8fr .7fr .8fr auto; }
.webhook-table-row { grid-template-columns: minmax(130px,1fr) minmax(190px,1.4fr) .7fr .9fr 1fr auto; }
.order-table-row.header, .license-table-row.header, .user-table-row.header, .webhook-table-row.header { padding-top: 6px; border-top: 0; color: #89918f; font-size: 9px; letter-spacing: .3px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.mono strong { font-weight: 600; }
.admin-product-cell { display: flex; align-items: center; gap: 11px; }
.admin-product-cell strong { color: var(--app-foreground); }

.status-badge.status-paid { color: #1f7a4d; background: #e3f5ea; }
.status-badge.status-processing { color: #526e9f; background: #e7eefb; }
.status-badge.status-refunded { color: #8a6d3b; background: #f7f0e0; }
.status-badge.status-cancelled { color: #9aa3a0; background: #eef1ef; }
.status-badge.status-active { color: #1f7a4d; background: #e3f5ea; }
.status-badge.status-revoked { color: #9aa3a0; background: #eef1ef; }
.status-badge.status-expired { color: #9aa3a0; background: #eef1ef; }
.status-badge.status-failed { color: #c0392b; background: #fbe6e3; }
.status-badge.status-pending { color: #765f8e; background: #efe7f5; }
.role-badge { display: inline-flex; width: fit-content; padding: 4px 8px; border-radius: 5px; font-size: 9px; font-style: normal; }
.role-badge.role-admin { color: #1f7a4d; background: #e3f5ea; }
.role-badge.role-ops { color: #526e9f; background: #e7eefb; }
.role-badge.role-readonly { color: #9aa3a0; background: #eef1ef; }
.role-badge.role-member { color: #765f8e; background: #efe7f5; }

.audit-list, .role-list { display: flex; flex-direction: column; }
.audit-item { display: grid; grid-template-columns: minmax(110px,1fr) auto 1fr auto; gap: 12px; align-items: baseline; padding: 12px 2px; border-top: 1px solid #edf0ed; font-size: 11px; }
.audit-item:first-child { border-top: 0; }
.audit-actor { font-weight: 600; color: var(--app-foreground); }
.audit-item p { margin: 0; color: var(--app-muted); }
.audit-item time { color: #9aa3a0; font-size: 10px; text-align: right; }
.role-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-top: 1px solid #edf0ed; font-size: 12px; }
.role-row:first-child { border-top: 0; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 4px 0 18px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 4px; }
.detail-grid span { font-size: 9px; letter-spacing: .3px; color: #89918f; text-transform: uppercase; }
.detail-grid strong { font-size: 13px; color: var(--app-foreground); }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-head strong { font-size: 16px; }
.detail-list { list-style: none; margin: 8px 0 18px; padding: 0; display: flex; flex-direction: column; }
.detail-list li { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid #edf0ed; font-size: 11px; }
.detail-list li:first-child { border-top: 0; }
.detail-list li.empty { color: #9aa3a0; }
.detail-list li span:first-child { font-family: ui-monospace, monospace; }
.detail-grid + .detail-list, .detail-head + h4 { margin-top: 0; }
h4 { font-size: 12px; color: var(--app-foreground); margin: 6px 0; }
.account-products { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.account-products > span { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--app-foreground); }

dialog:not([open]) { display: none; }
.admin-login-overlay[open] { display: grid; place-items: center; width: 100%; height: 100%; max-width: none; padding: 0; border: 0; background: transparent; }
.admin-login-overlay::backdrop { background: rgba(15,23,42,.55); backdrop-filter: blur(4px); }
.admin-login-card { position: relative; width: min(420px, 92vw); margin: auto; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 25px rgba(0,0,0,.15); display: flex; flex-direction: column; gap: 12px; }
.admin-login-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--app-muted); cursor: pointer; transition: background var(--app-fast), color var(--app-fast); }
.admin-login-close:hover { background: #eef2f0; color: var(--app-text); }
.admin-login-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.admin-login-logo { display: inline-flex; width: 40px; height: 40px; border-radius: 10px; background: var(--app-blue); color: #fff; align-items: center; justify-content: center; }
.admin-login-logo svg { width: 22px; height: 22px; }
.admin-login-card .eyebrow { margin: 0; }
.admin-login-card h2 { font-size: 22px; margin: 2px 0; color: var(--app-foreground); }
.admin-login-sub { margin: 0; color: var(--app-muted); font-size: 12px; }
.admin-login-hint { margin: 4px 0 0; font-size: 10px; color: #9aa3a0; line-height: 1.5; }
.admin-logout-button { margin-left: auto; background: transparent; border: 0; color: var(--app-muted); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; align-items: center; }
.admin-logout-button:hover { background: var(--app-muted); color: #fff; }
.admin-logout-button svg { width: 16px; height: 16px; }

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .audit-item { grid-template-columns: 1fr auto; }
  .audit-item time { grid-column: 1 / -1; text-align: left; }
}
