.admin-page { min-width: 320px; }
.admin-topbar { padding-inline: clamp(20px, 3vw, 48px); gap: 0; }
.brand-product { color: var(--subtle); font-weight: 500; }
.admin-label { margin-left: 22px; padding-left: 22px; border-left: 1px solid var(--line); font-size: 13px; color: var(--subtle); }
.admin-topbar .header-actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.header-link,.back-link { color: var(--subtle); text-decoration: none; font-size: 13px; }
.header-link:hover,.back-link:hover { color: var(--accent); }
.admin-user { font-size: 13px; color: var(--subtle); }
.admin-shell { max-width: 1800px; margin: 0 auto; padding: 24px clamp(20px, 3vw, 48px) 24px; }
.auth-loading { margin: 15vh auto; text-align: center; color: var(--subtle); }
.login-panel { width: min(100%, 424px); margin: clamp(38px, 9vh, 100px) auto; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.login-panel h1 { margin: 0; font-size: 25px; font-weight: 650; letter-spacing: -.025em; }
.login-intro { margin: 12px 0 28px; font-size: 14px; color: var(--subtle); line-height: 1.75; }
.login-panel form { display: grid; gap: 18px; }
.login-submit { width: 100%; margin-top: 4px; }
.back-link { display: inline-block; margin-top: 25px; }
.workspace-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 18px; }
.workspace-heading h1 { margin: 0; font-size: clamp(25px, 2.3vw, 31px); font-weight: 650; letter-spacing: -.025em; }
.section-description { margin: 6px 0 0; color: var(--subtle); font-size: 13px; line-height: 1.65; }
.refresh-group { display: flex; align-items: center; gap: 16px; }
.last-updated { font-size: 12px; color: var(--subtle); }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.summary-item { padding: 14px 24px; display: grid; gap: 5px; position: relative; }
.summary-item + .summary-item::before { content: ""; position: absolute; top: 22px; bottom: 22px; left: 0; width: 1px; background: var(--line); }
.summary-item > span { color: var(--subtle); font-size: 12px; }
.summary-item strong { font-size: 29px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.summary-item small { color: var(--subtle); font-size: 11px; }
.provider-switch { margin-bottom: 18px; padding: 16px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.provider-selection-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px; }
.provider-selection-form .field { flex: 0 1 280px; min-width: 180px; }
.provider-selection-form .field select { min-height: 38px; padding: 8px 10px; font-size: 13px; }
.provider-selection-form .btn { min-height: 38px; }
.provider-selection-form .text-button { align-self: center; margin-top: 19px; }
.provider-help,.provider-current,.provider-config-note { font-size: 12px; line-height: 1.75; color: var(--subtle); }
.provider-help { margin: 10px 0 0; }
.provider-current { margin: 4px 0 0; color: var(--accent); }
@media (min-width: 1100px) {
  .provider-switch { display: grid; grid-template-columns: auto 1fr; gap: 0 28px; }
  .provider-selection-form { grid-row: 1 / 3; }
  .provider-switch > .provider-help { align-self: end; margin: 0; }
  .provider-switch > .provider-current { align-self: start; margin: 0; }
}
.provider-error { margin-top: 12px; }
.provider-error .notice { margin: 0 0 10px; }
.provider-config-note { margin: 0; padding: 0 24px 18px; }
.provider-configs { padding: 0 24px 24px; }
.provider-config { padding: 20px 0; border-top: 1px solid var(--line); }
.provider-config-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 12px; }
.provider-config-heading h3 { margin: 0; font-size: 14px; font-weight: 600; }
.provider-config-meta { margin: 0 0 16px; color: var(--subtle); font-size: 12px; line-height: 1.7; }
.provider-fields { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(260px, 1.3fr); gap: 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.provider-fields .field { min-width: 0; }
.provider-fields .field input { min-height: 38px; font-size: 13px; }
.provider-key-field,.provider-form-bottom { grid-column: 1 / -1; }
.provider-key-field small { font-weight: 400; line-height: 1.7; color: var(--subtle); }
.provider-form-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.provider-form-bottom .btn { margin-left: auto; }
.provider-clear-key { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--subtle); }
.provider-clear-key input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.provider-save-error { grid-column: 1 / -1; }
.provider-save-error .notice { margin: 0; }
.provider-cell { min-width: 110px; max-width: 160px; overflow-wrap: anywhere; }
.workspace-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.workspace-tabs { display: flex; gap: 28px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.workspace-tab { position: relative; min-height: 50px; padding: 0 3px; border: 0; background: transparent; color: var(--subtle); font: inherit; font-size: 14px; cursor: pointer; }
.workspace-tab.active { color: var(--accent); font-weight: 600; }
.workspace-tab.active::after { position: absolute; content: ""; bottom: -1px; right: 0; left: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 16px 24px 14px; }
.panel-heading h2 { margin: 0; font-size: 17px; font-weight: 650; }
.panel-heading p { margin: 7px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.65; }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 24px; align-items: flex-end; }
.filter-form .field { flex: 1 0 126px; min-width: 0; }
.filter-form .search-field { flex: 2.2 0 240px; }
.field { font-size: 12px; }
.filter-form .field input,.filter-form .field select { min-height: 38px; padding: 8px 10px; font-size: 13px; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { min-height: 38px; }
.status-filters { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 24px; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 11px; border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 12px; background: var(--muted); color: var(--subtle); cursor: pointer; }
.status-chip:hover { border-color: var(--line); color: var(--text); }
.status-chip.active { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.status-count { opacity: .8; font-size: 11px; font-variant-numeric: tabular-nums; }
.batch-panel { margin: 0 24px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.batch-panel summary { padding: 11px 14px; font-size: 12px; cursor: pointer; color: var(--text); }
.batch-panel summary span { margin-left: 8px; color: var(--subtle); font-size: 11px; }
.batch-content { border-top: 1px solid var(--line); padding: 14px; }
.batch-content textarea { min-height: 95px; font-family: inherit; }
.batch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
#batch-active { color: var(--accent); font-size: 12px; }
.table-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 24px; border-top: 1px solid var(--line); }
.selection-actions { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--subtle); flex-wrap: wrap; }
.text-button { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px; padding: 5px 0; cursor: pointer; white-space: nowrap; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { opacity: .5; cursor: default; }
.list-total { margin-left: auto; font-size: 12px; color: var(--subtle); }
.export-actions { display: flex; gap: 8px; }
.list-notice { margin: 0 24px 18px; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-block: 1px solid var(--line); scrollbar-width: thin; }
#data-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
#data-table.orders-table { min-width: 1680px; }
#data-table.cards-table,#data-table.inventory-table { min-width: 780px; }
#data-table.is-empty { min-width: 100%; }
#data-table.is-empty thead { display: none; }
#data-table th { height: 42px; padding: 10px 14px; background: var(--muted); color: var(--subtle); font-size: 11px; font-weight: 500; white-space: nowrap; }
#data-table td { padding: 15px 14px; vertical-align: top; border-top: 1px solid var(--line); line-height: 1.65; }
#data-table tbody tr:first-child td { border-top: 0; }
#data-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
#data-table tbody tr.is-selected { background: var(--accent-soft); }
#data-table th:first-child,#data-table td:first-child { padding-left: 24px; }
#data-table th:last-child,#data-table td:last-child { padding-right: 24px; }
.check-cell { width: 44px; }
.row-checkbox { width: 15px; height: 15px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }
.cell-primary { display: block; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.cell-secondary { display: block; color: var(--subtle); font-size: 11px; margin-top: 5px; }
.copy-value { border: 0; background: transparent; color: var(--text); font: inherit; padding: 0; text-align: left; cursor: pointer; max-width: 240px; overflow-wrap: anywhere; }
.copy-value:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.key-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; letter-spacing: .015em; max-width: 215px; }
.date-cell { white-space: nowrap; font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.note-cell { min-width: 130px; max-width: 190px; color: var(--subtle); }
.note-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 5px 12px; flex-wrap: wrap; min-width: 115px; max-width: 150px; }
.row-actions .text-button { padding-block: 0; }
.text-button.danger { color: var(--danger); }
.order-status { white-space: nowrap; }
.progress-note { max-width: 170px; line-height: 1.5; }
.table-empty td { height: 225px; text-align: center; vertical-align: middle !important; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 30px 14px; }
.empty-state strong { font-size: 14px; color: var(--text); font-weight: 550; }
.empty-state p { color: var(--subtle); margin: 0; font-size: 12px; line-height: 1.7; max-width: 390px; }
.empty-state .btn { margin-top: 6px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; gap: 20px; }
.table-footer p { margin: 0; color: var(--subtle); font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 14px; }
.pagination > span { min-width: 56px; text-align: center; color: var(--subtle); font-size: 12px; }
.workspace-note { margin: 16px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.7; }
.admin-dialog { padding: 0; width: min(760px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 20px 70px #16233a20; }
.admin-dialog::backdrop { background: #101b2e50; }
.action-dialog { width: min(580px, calc(100vw - 32px)); }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 19px; font-weight: 600; }
.dialog-close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; padding: 0; color: var(--subtle); border: 1px solid var(--line); background: var(--surface); border-radius: 6px; font-size: 22px; cursor: pointer; }
.dialog-close:hover { background: var(--muted); color: var(--text); }
.dialog-body { padding: 24px; }
.dialog-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--line); }
.detail-status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.detail-status-line .muted { font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; margin: 0; }
.detail-grid > div { min-width: 0; }
.detail-grid dt { color: var(--subtle); font-size: 11px; margin-bottom: 6px; }
.detail-grid dd { margin: 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.detail-grid .wide { grid-column: 1 / -1; }
.detail-grid .copy-value { max-width: 100%; font-size: 13px; }
.detail-section { margin-top: 25px; padding-top: 23px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.detail-note-form { display: grid; gap: 10px; }
.detail-note-form textarea { min-height: 85px; }
.detail-note-form .btn { justify-self: end; }
.log-list { display: grid; gap: 13px; list-style: none; padding: 0; margin: 0; }
.log-list li { display: grid; grid-template-columns: 152px 1fr; gap: 14px; font-size: 12px; line-height: 1.7; }
.log-list time { color: var(--subtle); font-size: 11px; }
.log-list span { overflow-wrap: anywhere; }
.log-more { margin-top: 15px; }
.muted { color: var(--subtle); }
.dialog-description { margin: 0 0 22px; font-size: 13px; color: var(--subtle); line-height: 1.8; }
.action-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.action-form .form-submit { justify-self: end; }
.action-result { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.action-result h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.action-result p { font-size: 12px; line-height: 1.75; color: var(--subtle); }
.generated-keys { width: 100%; margin-top: 6px; min-height: 160px; font: 11px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: var(--text); resize: vertical; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.import-keys { min-height: 190px; font: 12px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; }
.import-rejections { margin: 12px 0 0; padding-left: 20px; color: var(--danger); font-size: 12px; line-height: 1.9; }
#confirm-message { margin: 0; font-size: 14px; color: var(--subtle); line-height: 1.85; white-space: pre-line; }
.skip-link { position: fixed; z-index: 100; top: -80px; left: 20px; background: var(--surface); padding: 12px 18px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); }
.skip-link:focus { top: 12px; }
button:focus-visible,a:focus-visible,summary:focus-visible,[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; }
@media (min-width: 900px) {
  #data-table.orders-table:not(.is-empty) th:last-child,#data-table.orders-table:not(.is-empty) td:last-child { position: sticky; right: 0; width: 164px; min-width: 164px; box-shadow: -1px 0 0 var(--line); }
  #data-table.orders-table:not(.is-empty) th:last-child { z-index: 2; background: var(--muted); }
  #data-table.orders-table:not(.is-empty) td:last-child { z-index: 1; background: var(--surface); }
  #data-table.orders-table tbody tr:hover td:last-child { background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
  #data-table.orders-table tbody tr.is-selected td:last-child { background: var(--accent-soft); }
}
@media (max-width: 1100px) {
  .last-updated { display: none; }
  .filter-form .search-field { flex-basis: 100%; }
  .filter-form .field { flex-grow: 1; }
  .table-toolbar { gap: 10px 16px; }
  .selection-actions { flex: 1 0 100%; }
  .list-total { margin-left: 0; }
  .export-actions { margin-left: auto; }
}
@media (max-width: 640px) {
  .admin-topbar { padding-inline: 18px; }
  .admin-label,.admin-user { display: none; }
  .admin-topbar .header-actions { gap: 12px; }
  .header-link { font-size: 12px; }
  .admin-shell { padding: 24px 14px; }
  .workspace-heading { gap: 12px; margin-bottom: 20px; }
  .workspace-heading .section-description { max-width: 210px; font-size: 12px; }
  .refresh-group { flex-shrink: 0; }
  .refresh-group .btn { padding-inline: 10px; font-size: 12px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
  .summary-item { padding: 16px 18px; }
  .summary-item:nth-child(3),.summary-item:nth-child(4) { border-top: 1px solid var(--line); }
  .summary-item:nth-child(3)::before { display: none; }
  .summary-item strong { font-size: 25px; }
  .summary-item small { font-size: 10px; }
  .provider-switch { padding: 16px; }
  .provider-selection-form { gap: 10px; }
  .provider-selection-form .field { flex: 1 0 100%; }
  .provider-selection-form .field select,.provider-fields .field input { min-height: 44px; font-size: 16px; }
  .provider-selection-form .text-button { margin-top: 0; }
  .provider-config-note { padding-inline: 16px; }
  .provider-configs { padding-inline: 16px; }
  .provider-fields { grid-template-columns: minmax(0, 1fr); }
  .provider-config-meta { font-size: 11px; }
  .provider-form-bottom { align-items: stretch; flex-direction: column; }
  .provider-form-bottom .btn { margin-left: 0; }
  .workspace-tabs { padding-inline: 16px; gap: 20px; overflow-x: auto; }
  .workspace-tab { font-size: 13px; min-height: 52px; flex-shrink: 0; }
  .panel-heading { padding: 20px 16px 18px; }
  .panel-heading p { max-width: 240px; }
  .panel-heading .btn { flex-shrink: 0; padding-inline: 10px; font-size: 12px; }
  .filter-form { padding-inline: 16px; gap: 12px 10px; }
  .filter-form .field { flex-basis: calc(50% - 6px); }
  .filter-form .search-field { flex-basis: 100%; }
  .filter-form .field input,.filter-form .field select { min-height: 44px; font-size: 16px; }
  .filter-actions { flex: 1 0 100%; }
  .filter-actions .btn { flex: 1; }
  .status-filters { flex-wrap: nowrap; overflow-x: auto; padding: 16px; }
  .status-chip { flex-shrink: 0; }
  .batch-panel { margin-inline: 16px; }
  .batch-panel summary span { display: none; }
  .table-toolbar { padding: 14px 16px; }
  .selection-actions { gap: 8px 12px; }
  .list-notice { margin-inline: 16px; }
  .table-footer { flex-direction: column; align-items: stretch; padding: 14px 16px; gap: 12px; }
  .table-footer p { text-align: center; font-size: 11px; }
  .pagination { justify-content: space-between; }
  .login-panel { padding: 28px 24px; margin-block: 42px; }
  .login-panel h1 { font-size: 23px; }
  .dialog-header,.dialog-body { padding: 20px; }
  .dialog-footer { padding: 16px 20px; }
  .detail-grid { gap: 18px 14px; }
  .detail-grid dd { font-size: 12px; }
  .log-list li { grid-template-columns: 1fr; gap: 1px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; } }
