:root {
  color-scheme: light;
  --cp-bg: #f4f7fb;
  --cp-surface: #ffffff;
  --cp-sidebar: #17212b;
  --cp-sidebar-muted: #8fa0af;
  --cp-text: #17212b;
  --cp-muted: #637381;
  --cp-border: #dce3ea;
  --cp-border-strong: #c5d0db;
  --cp-blue: #2f6fed;
  --cp-blue-dark: #2459c4;
  --cp-blue-soft: #e9f0ff;
  --cp-green: #23845c;
  --cp-green-soft: #e6f5ef;
  --cp-amber: #a76413;
  --cp-amber-soft: #fff3dd;
  --cp-red: #bd3d4a;
  --cp-red-soft: #fdecef;
  --cp-shadow: 0 8px 24px rgba(23, 33, 43, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--cp-bg); color: var(--cp-text); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.cp-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.cp-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--cp-sidebar); color: #fff; padding: 18px 14px; }
.cp-brand { display: flex; align-items: center; gap: 11px; min-height: 46px; padding: 4px 8px 20px; text-decoration: none; }
.cp-brand img { width: 34px; height: 34px; }
.cp-brand strong, .cp-brand span { display: block; }
.cp-brand strong { font-size: 14px; line-height: 1.2; }
.cp-brand span { margin-top: 3px; color: var(--cp-sidebar-muted); font-size: 11px; }
.cp-nav { display: grid; gap: 3px; }
.cp-nav button { width: 100%; border: 0; background: transparent; color: #b9c5cf; text-align: left; border-radius: 5px; padding: 10px 11px; cursor: pointer; font-size: 13px; }
.cp-nav button:hover { color: #fff; background: rgba(255,255,255,.055); }
.cp-nav button[aria-current="page"] { color: #fff; background: rgba(47,111,237,.24); box-shadow: inset 3px 0 0 #77a2ff; }
.cp-sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding: 14px 8px 2px; }
.cp-sidebar-foot strong, .cp-sidebar-foot span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-sidebar-foot strong { font-size: 12px; }
.cp-sidebar-foot span { color: var(--cp-sidebar-muted); font-size: 11px; margin-top: 4px; }

.cp-main { min-width: 0; }
.cp-topbar { position: sticky; z-index: 10; top: 0; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--cp-border); }
.cp-title { min-width: 0; }
.cp-title h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.cp-title p { margin: 4px 0 0; color: var(--cp-muted); font-size: 12px; }
.cp-actions { display: flex; align-items: center; gap: 8px; }
.cp-content { width: min(1440px, 100%); margin: 0 auto; padding: 24px 28px 48px; }

.cp-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--cp-border-strong); border-radius: 5px; background: #fff; color: var(--cp-text); padding: 0 13px; font-weight: 600; font-size: 12px; cursor: pointer; text-decoration: none; }
.cp-button:hover { border-color: #aebdca; background: #f9fbfd; }
.cp-button.primary { color: #fff; border-color: var(--cp-blue); background: var(--cp-blue); }
.cp-button.primary:hover { background: var(--cp-blue-dark); }
.cp-button.danger { color: var(--cp-red); border-color: #ebbdc3; }
.cp-button.compact { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.cp-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 190px; }
.cp-table td small { display: block; margin-top: 3px; color: var(--cp-muted); }
.cp-message-list { display: grid; gap: 12px; margin-bottom: 20px; }
.cp-message { border-left: 3px solid var(--cp-blue); padding: 8px 12px; background: #f8fafc; }
.cp-message strong { font-size: 13px; }
.cp-message time { margin-left: 8px; color: var(--cp-muted); font-size: 12px; }
.cp-message p { margin: 7px 0 0; white-space: pre-wrap; }
.cp-button:disabled { opacity: .5; cursor: default; }
.cp-icon-button { width: 36px; height: 36px; border: 1px solid var(--cp-border-strong); border-radius: 5px; background: #fff; color: var(--cp-text); cursor: pointer; }
.cp-icon-button:hover { border-color: #aebdca; background: #f9fbfd; }
.cp-navigation-back { flex: 0 0 36px; display: inline-grid; place-items: center; font-size: 20px; line-height: 1; }

.cp-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--cp-border); background: var(--cp-surface); }
.cp-metric { min-height: 102px; padding: 18px 20px; border-right: 1px solid var(--cp-border); }
.cp-metric:last-child { border-right: 0; }
.cp-metric span, .cp-metric small { display: block; color: var(--cp-muted); font-size: 11px; }
.cp-metric strong { display: block; margin: 10px 0 5px; font-size: 26px; line-height: 1; }

.cp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 20px; }
.cp-layout > *, .cp-panel, .cp-detail { min-width: 0; }
.cp-panel { background: var(--cp-surface); border: 1px solid var(--cp-border); }
.cp-panel + .cp-panel { margin-top: 18px; }
.cp-panel-header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--cp-border); }
.cp-panel-header h2 { margin: 0; font-size: 13px; }
.cp-panel-header span { color: var(--cp-muted); font-size: 11px; }
.cp-panel-body { padding: 16px; }
.cp-notice { display: grid; gap: 5px; margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--cp-amber); background: var(--cp-amber-soft); }
.cp-notice.danger { border-left-color: var(--cp-red); background: var(--cp-red-soft); }
.cp-notice strong { font-size: 12px; }
.cp-notice span { color: var(--cp-muted); font-size: 11px; line-height: 1.45; }
.cp-button.selected { border-color: var(--cp-blue); background: var(--cp-blue-soft); color: var(--cp-blue-dark); }

.cp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cp-toolbar-group { display: flex; align-items: center; gap: 8px; }
.cp-field { display: grid; gap: 6px; }
.cp-field span { color: var(--cp-muted); font-size: 11px; font-weight: 600; }
.cp-input, .cp-select, .cp-textarea { min-height: 36px; width: 100%; border: 1px solid var(--cp-border-strong); border-radius: 5px; background: #fff; color: var(--cp-text); padding: 7px 10px; outline: none; }
.cp-input:focus, .cp-select:focus, .cp-textarea:focus { border-color: var(--cp-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.11); }
.cp-search { width: min(340px, 46vw); }
.cp-textarea { min-height: 86px; resize: vertical; }

.cp-table-wrap { max-width: 100%; overflow: auto; }
.cp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cp-table th { height: 38px; padding: 0 12px; background: #f8fafc; border-bottom: 1px solid var(--cp-border); color: var(--cp-muted); text-align: left; font-size: 10px; text-transform: uppercase; font-weight: 700; }
.cp-table td { height: 48px; padding: 7px 12px; border-bottom: 1px solid #edf1f5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-table tbody tr { cursor: pointer; }
.cp-table tbody tr:hover { background: #f8fbff; }
.cp-table tbody tr.selected { background: var(--cp-blue-soft); }
.cp-table tbody tr:last-child td { border-bottom: 0; }
.cp-table .wide { width: 34%; }
.cp-table .numeric { text-align: right; }
.cp-empty { min-height: 160px; display: grid; place-items: center; color: var(--cp-muted); text-align: center; padding: 24px; }

.cp-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 4px; background: #eef2f5; color: #536370; font-size: 10px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.cp-status.active, .cp-status.succeeded, .cp-status.paid, .cp-status.processed { background: var(--cp-green-soft); color: var(--cp-green); }
.cp-status.trial, .cp-status.trialing, .cp-status.queued, .cp-status.received { background: var(--cp-blue-soft); color: var(--cp-blue-dark); }
.cp-status.past_due, .cp-status.grace_period, .cp-status.retry, .cp-status.open { background: var(--cp-amber-soft); color: var(--cp-amber); }
.cp-status.failed, .cp-status.suspended, .cp-status.dead_letter, .cp-status.unpaid, .cp-status.read_only, .cp-status.canceled { background: var(--cp-red-soft); color: var(--cp-red); }

.cp-detail { position: sticky; top: 90px; align-self: start; background: var(--cp-surface); border: 1px solid var(--cp-border); box-shadow: var(--cp-shadow); }
.cp-detail-header { padding: 18px; border-bottom: 1px solid var(--cp-border); }
.cp-detail-back { margin-bottom: 14px; }
.cp-detail-header h2 { margin: 0; font-size: 16px; }
.cp-detail-header p { margin: 5px 0 0; color: var(--cp-muted); font-size: 11px; overflow-wrap: anywhere; }
.cp-detail-section { padding: 16px 18px; border-bottom: 1px solid var(--cp-border); }
.cp-detail-section:last-child { border-bottom: 0; }
.cp-detail-section h3 { margin: 0 0 12px; font-size: 11px; text-transform: uppercase; color: var(--cp-muted); }
.cp-kv { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; }
.cp-kv span { color: var(--cp-muted); font-size: 11px; }
.cp-kv strong { font-size: 11px; text-align: right; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.cp-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cp-tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--cp-border); margin-bottom: 18px; }
.cp-tabs button { min-height: 40px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--cp-muted); padding: 0 14px; cursor: pointer; font-size: 12px; font-weight: 600; }
.cp-tabs button[aria-selected="true"] { color: var(--cp-blue-dark); border-bottom-color: var(--cp-blue); }
.cp-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cp-form-grid .full { grid-column: 1 / -1; }
.cp-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }

.cp-alert-list { display: grid; }
.cp-alert-row { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 48px; padding: 8px 16px; border-bottom: 1px solid #edf1f5; }
.cp-alert-row:last-child { border-bottom: 0; }
.cp-alert-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cp-blue); }
.cp-alert-dot.warning { background: var(--cp-amber); }
.cp-alert-dot.danger { background: var(--cp-red); }
.cp-alert-row strong, .cp-alert-row span { display: block; }
.cp-alert-row strong { font-size: 12px; }
.cp-alert-row span { margin-top: 3px; color: var(--cp-muted); font-size: 10px; }
.cp-alert-row time { color: var(--cp-muted); font-size: 10px; }

.cp-dialog { width: min(480px, calc(100vw - 32px)); border: 1px solid var(--cp-border); border-radius: 6px; padding: 0; box-shadow: 0 24px 70px rgba(13,24,34,.24); }
.cp-dialog::backdrop { background: rgba(18,29,40,.46); }
.cp-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--cp-border); }
.cp-dialog h2 { margin: 0; font-size: 15px; }
.cp-dialog-copy { margin: 0; color: var(--cp-muted); font-size: 12px; line-height: 1.5; }
.cp-dialog form > div { padding: 18px; display: grid; gap: 14px; }
.cp-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--cp-border); }

.cp-toast { position: fixed; z-index: 100; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 14px; border-radius: 5px; background: #17212b; color: #fff; box-shadow: var(--cp-shadow); font-size: 12px; }
.cp-toast.error { background: #8f2935; }
.cp-mobile-menu { display: none; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); background: #fff; }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 44px 52px; background: #17212b; color: #fff; }
.login-brand .cp-brand { padding: 0; }
.login-product h1 { max-width: 660px; margin: 0; font-size: clamp(34px, 5vw, 72px); line-height: 1; font-weight: 650; }
.login-product p { max-width: 560px; margin: 24px 0 0; color: #aebbc6; font-size: 16px; line-height: 1.55; }
.login-brand footer { color: #738594; font-size: 11px; }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-form { width: min(390px, 100%); }
.login-form h2 { margin: 0; font-size: 24px; }
.login-form > p { margin: 9px 0 28px; color: var(--cp-muted); }
.login-form form { display: grid; gap: 15px; }
.login-form .cp-button { min-height: 42px; margin-top: 3px; }
.login-error { min-height: 20px; margin: 10px 0 0; color: var(--cp-red); font-size: 11px; }
.auth-switch { margin: 22px 0 0 !important; color: var(--cp-muted); font-size: 12px; text-align: center; }
.auth-switch a { color: var(--cp-blue-dark); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-inline-link { margin-top: -7px; text-align: right; }
.auth-inline-link a { color: var(--cp-blue-dark); font-size: 11px; font-weight: 700; text-decoration: none; }
.auth-inline-link a:hover { text-decoration: underline; }
.auth-result { border-left: 3px solid var(--cp-blue); padding: 14px 16px; background: #f8fbff; }
.auth-result strong { display: block; font-size: 14px; }
.auth-result p { margin: 7px 0 14px; color: var(--cp-muted); font-size: 12px; line-height: 1.5; }
.auth-result-actions { display: grid; gap: 8px; }
.auth-status { min-height: 18px; margin: 10px 0 0 !important; color: var(--cp-muted); font-size: 11px; line-height: 1.45; }
.auth-confirmation-help { margin-top: 14px; }
.auth-confirmation-success { margin: -8px 0 18px; border-left-color: #2e8b57; background: #f2faf5; }
.auth-confirmation-success p { margin-bottom: 0; }
.auth-confirmation-help .cp-button { width: 100%; min-height: 38px; }
.auth-confirmation-help .auth-captcha { margin-bottom: 10px; }
.auth-code-input { height: 52px; text-align: center; font-size: 23px; font-variant-numeric: tabular-nums; }
.auth-link-button { border: 0; padding: 0; background: transparent; color: var(--cp-blue-dark); font-weight: 700; cursor: pointer; }
.auth-eyebrow { margin: 0 0 18px !important; color: #77a2ff !important; font-size: 11px !important; font-weight: 700; text-transform: uppercase; }
.auth-trial-label { display: block; margin-bottom: 12px; color: var(--cp-blue-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.registration-form { width: min(470px, 100%); padding-block: 32px; }
.registration-form > div > p { margin: 9px 0 24px; color: var(--cp-muted); }
.auth-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cp-field small { color: var(--cp-muted); font-size: 10px; line-height: 1.4; }
.auth-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.auth-consent { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 9px; color: var(--cp-muted); font-size: 11px; line-height: 1.45; cursor: pointer; }
.auth-consent input { width: 16px; height: 16px; margin: 0; accent-color: var(--cp-blue); }
.auth-captcha { min-height: 65px; }
.registration-success { padding: 8px 0 0; text-align: center; }
.registration-success h2 { margin: 16px 0 8px; }
.registration-success p { margin: 0 0 24px; color: var(--cp-muted); line-height: 1.6; }
.registration-success .cp-button { width: 100%; }
.success-mark { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto; border: 1px solid #b9d2ff; border-radius: 50%; background: var(--cp-blue-soft); color: var(--cp-blue-dark); font-size: 21px; font-weight: 800; }
.cp-mfa-setup { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 20px; border-bottom: 1px solid var(--cp-border); background: #f8fafc; }
.cp-mfa-qr { display: grid; place-items: center; min-height: 240px; background: #fff; border: 1px solid var(--cp-border); }
.cp-mfa-qr img { width: 220px; height: 220px; object-fit: contain; }
.cp-mfa-setup h3 { margin: 2px 0 8px; font-size: 15px; }
.cp-mfa-setup p { max-width: 560px; color: var(--cp-muted); line-height: 1.5; }
.cp-mfa-setup code { display: block; max-width: 560px; padding: 10px; border: 1px solid var(--cp-border); background: #fff; overflow-wrap: anywhere; }
.cp-mfa-setup form { display: flex; align-items: end; gap: 10px; max-width: 420px; margin-top: 16px; }
.cp-mfa-setup form .cp-field { flex: 1; }

@media (max-width: 980px) {
  .cp-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .cp-sidebar { padding-inline: 10px; }
  .cp-brand { justify-content: center; padding-inline: 0; }
  .cp-brand > div, .cp-nav button span, .cp-sidebar-foot { display: none; }
  .cp-nav button { text-align: center; padding-inline: 4px; font-size: 10px; }
  .cp-layout { grid-template-columns: 1fr; }
  .cp-detail { position: static; }
  .cp-metrics { grid-template-columns: repeat(2, 1fr); }
  .cp-metric:nth-child(2) { border-right: 0; }
  .cp-metric:nth-child(-n+2) { border-bottom: 1px solid var(--cp-border); }
}

@media (max-width: 680px) {
  .cp-shell { display: block; }
  .cp-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 232px; transform: translateX(-100%); transition: transform .18s ease; }
  .cp-shell.menu-open .cp-sidebar { transform: translateX(0); }
  .cp-brand { justify-content: flex-start; }
  .cp-brand > div, .cp-nav button span, .cp-sidebar-foot { display: block; }
  .cp-nav button { text-align: left; padding-inline: 11px; font-size: 13px; }
  .cp-mobile-menu { display: inline-grid; place-items: center; }
  .cp-topbar { min-height: 60px; padding: 0 14px; }
  .cp-topbar > .cp-actions:first-child { min-width: 0; }
  .cp-route-shortcuts { display: none; }
  .cp-title p { display: none; }
  .cp-content { padding: 16px 14px 36px; }
  .cp-actions .cp-button:not(.mobile-keep) { display: none; }
  .cp-metrics { grid-template-columns: 1fr 1fr; }
  .cp-metric { min-height: 88px; padding: 14px; }
  .cp-metric strong { font-size: 22px; }
  .cp-toolbar { align-items: stretch; flex-direction: column; }
  .cp-toolbar-group { width: 100%; }
  .cp-search { width: 100%; }
  .cp-form-grid { grid-template-columns: 1fr; }
  .cp-form-grid .full { grid-column: auto; }
  .cp-table { min-width: 720px; }
  .login-page { display: block; }
  .login-brand { min-height: 210px; padding: 24px; }
  .login-product h1 { font-size: 34px; }
  .login-product p, .login-brand footer { display: none; }
  .login-form-wrap { min-height: calc(100vh - 210px); padding: 28px 20px; }
  .registration-form { padding-block: 8px; }
  .auth-form-grid { grid-template-columns: 1fr; }
  .cp-mfa-setup { grid-template-columns: 1fr; }
  .cp-mfa-setup form { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
