:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #162033;
  background: #f5f7fb;
  --navy: #162033;
  --muted: #6b7484;
  --line: #e4e8ef;
  --blue: #375dfb;
  --blue-soft: #edf1ff;
  --green: #14804a;
  --red: #c63838;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; padding: 24px 16px; background: var(--navy); color: #fff; }
.brand { padding: 0 12px 28px; }
.brand strong { display: block; font-size: 19px; letter-spacing: -.03em; }
.brand span { display: block; margin-top: 6px; color: #9faac0; font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav a { padding: 11px 12px; border-radius: 9px; color: #b9c2d4; font-size: 14px; }
.nav a:hover, .nav a.active { background: #29354e; color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 32px 56px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 24px; }
.section-head p { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 20px rgba(22, 32, 51, .03); }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 10px; font-size: 30px; font-weight: 700; }
.card h3 { margin: 0 0 14px; font-size: 16px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #4a5568; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; padding: 10px 11px; border: 1px solid #d6dce6; border-radius: 8px; background: #fff; color: var(--navy); }
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid #dfe5ff; border-color: var(--blue); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 15px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 650; }
.button.secondary { background: var(--blue-soft); color: #2945c8; }
.button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.button:disabled { cursor: wait; opacity: .55; }
.notice { padding: 13px 15px; border-radius: 9px; background: #fff8e7; color: #775713; font-size: 13px; }
.error { padding: 13px 15px; border-radius: 9px; background: #fff0f0; color: var(--red); font-size: 13px; }
.success { padding: 13px 15px; border-radius: 9px; background: #ecfaf2; color: var(--green); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 99px; background: #eef1f5; color: #5d6879; font-size: 11px; font-weight: 700; }
.status.success { background: #e5f7ed; color: var(--green); }
.status.failed { background: #ffebeb; color: var(--red); }
.status.running, .status.queued, .status.processing_result, .status.provider_running, .status.waiting_provider_result { background: #eaf0ff; color: #3153d4; }
.status.processing, .status.quality_check { background: #eaf0ff; color: #3153d4; }
.status.cancelled { background: #f1f2f4; color: #6b7484; }
.product-card { display: grid; gap: 15px; }
.product-meta { color: var(--muted); font-size: 12px; }
.asset-list { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-choice { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: #4a5568; font-size: 12px; }
.asset-choice input { width: auto; }
.template-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.template-card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.template-card:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.template-card input { position: absolute; opacity: 0; pointer-events: none; }
.template-card span { display: grid; gap: 8px; }
.template-card strong { font-size: 15px; }
.template-card small, .template-card em { color: var(--muted); font-size: 12px; font-style: normal; }
.asset-thumb { width: 76px; height: 60px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #f6f8fb; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.media-card video { display: block; width: 100%; max-height: 290px; border-radius: 8px; background: #111827; }
.media-card img { display: block; width: 100%; max-height: 290px; object-fit: contain; border-radius: 8px; background: #f6f8fb; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.loading { padding: 40px 0; color: var(--muted); text-align: center; }
.empty { padding: 32px 16px; color: var(--muted); text-align: center; border: 1px dashed #cfd6e2; border-radius: 10px; }
.id-code { max-width: 260px; overflow: hidden; color: #34415a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.context { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.billing-detail { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.billing-detail:last-child { border-bottom: 0; }
.billing-detail strong { color: var(--navy); font-weight: 650; }
.plan-list { display: grid; gap: 10px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; }
.plan-row > div:first-child { display: grid; gap: 4px; }
.plan-row span, .plan-price small { color: var(--muted); font-size: 11px; }
.plan-price { display: grid; gap: 3px; text-align: right; font-weight: 700; }
.plan-row .purchase-plan { min-height: 32px; padding: 0 10px; font-size: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.plan-card { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(24, 38, 72, .04); }
.plan-card.current { border-color: #8ca5f3; box-shadow: 0 0 0 2px rgba(89, 113, 220, .12); }
.plan-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-card-head h3 { margin: 6px 0 0; }
.plan-current { padding: 4px 7px; border-radius: 999px; color: #3153b7; background: #edf1ff; font-size: 11px; white-space: nowrap; }
.plan-card-price { color: var(--navy); font-size: 22px; font-weight: 750; letter-spacing: -.03em; }
.plan-features { display: grid; gap: 7px; min-height: 82px; }
.plan-feature { color: #3d4b65; font-size: 12px; }
.plan-intent { width: 100%; }
.plan-section-head { margin-top: 26px; }
.quota-preview > div { flex: 1 1 300px; }
.quota-preview p { margin: 5px 0 0; }
.quota-ready { border-color: #c9e6d5; background: #f3fbf6; }
.quota-ready .button { flex: 0 0 auto; }
.upgrade-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 26px 30px; border-radius: 16px; color: #fff; background: linear-gradient(120deg, #192440, #344a92); }
.upgrade-hero h2 { margin: 8px 0; }
.upgrade-hero p { max-width: 580px; margin: 0; color: #cbd5f1; line-height: 1.6; }
.upgrade-hero .eyebrow { color: #aebcff; }
.upgrade-current { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.upgrade-current strong { color: var(--navy); }
.upgrade-request-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.upgrade-request-row strong { color: var(--navy); }

.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; margin-left: 10px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 30px 34px; overflow: hidden; border-radius: 18px; color: #fff; background: linear-gradient(120deg, #192440, #344a92); }
.hero-card h2 { margin: 10px 0 8px; font-size: clamp(25px, 4vw, 38px); letter-spacing: -.04em; }
.hero-card p { max-width: 510px; margin: 0 0 20px; color: #cbd5f1; line-height: 1.7; }
.hero-card .eyebrow { color: #aebcff; }
.hero-orb { display: grid; place-items: center; width: 150px; height: 150px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: #d8dfff; font-size: 70px; background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,.03)); }
.metric-grid { margin-bottom: 18px; }
.metric-card { min-height: 132px; }
.section-card { margin-top: 18px; }
.section-head h3 { margin-bottom: 4px; }
.section-head p { margin: 0; }
.video-list { display: grid; gap: 8px; }
.video-row { display: flex; align-items: center; width: 100%; gap: 12px; padding: 13px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--navy); text-align: left; }
.video-row:hover { background: #f8f9fc; }
.video-row-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; color: var(--blue); background: var(--blue-soft); }
.video-row-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.video-row-main strong { font-size: 13px; }
.video-row-main small { color: var(--muted); }
.video-row-status { flex: 0 0 auto; }
.video-row-arrow { color: #a1a9b8; font-size: 20px; }
.empty-icon { margin-bottom: 8px; color: var(--blue); font-size: 28px; }
.empty strong { display: block; color: var(--navy); }
.empty p { margin: 7px 0 15px; }
.hidden { display: none !important; }
.form-panel { margin-bottom: 18px; }
.product-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.product-card-head { display: flex; justify-content: space-between; gap: 12px; }
.product-card-head h3 { margin: 5px 0; }
.upload-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.upload-form { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.upload-label { display: flex; gap: 8px; align-items: center; }
.upload-label span:last-child { display: grid; gap: 3px; }
.upload-label small { color: var(--muted); font-size: 11px; }
.upload-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 18px; }
.upload-form input { padding: 7px; font-size: 11px; }
.upload-form .button { min-height: 32px; font-size: 12px; }
.asset-status-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); margin: 2px 0 4px; }
.asset-status-item { display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: 9px; background: #f8f9fc; }
.asset-status-item span:last-child { display: grid; gap: 3px; }
.asset-status-item small { color: var(--muted); font-size: 11px; }
.asset-status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #c9ced8; }
.asset-status-dot.ready { background: var(--green); box-shadow: 0 0 0 4px #e8f7ef; }
.template-catalog { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.template-catalog-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.template-preview { position: relative; display: grid; place-items: center; min-height: 210px; color: #cbd5ff; font-size: 70px; background: linear-gradient(145deg, #1c2746, #5067c8); }
.template-preview span { position: absolute; bottom: 16px; color: #fff; font-size: 11px; letter-spacing: .08em; }
.template-catalog-body { padding: 18px; }
.template-catalog-body h3 { margin: 0 0 7px; font-size: 18px; }
.template-catalog-body p { min-height: 42px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.template-catalog-body .actions { justify-content: space-between; }
.template-art { display: grid; place-items: center; width: 100%; height: 70px; margin-bottom: 10px; border-radius: 9px; color: #cbd5ff; font-size: 28px; background: linear-gradient(145deg, #1c2746, #5067c8); }
.flow-steps { display: flex; gap: 7px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.flow-steps span { padding: 8px 12px; border-radius: 99px; background: #eef1f5; }
.flow-steps span.active { color: #2945c8; background: var(--blue-soft); }
.generate-card { padding: 25px; }
.generate-section { display: flex; gap: 14px; padding: 3px 0 25px; }
.generate-section + .generate-section { padding-top: 25px; border-top: 1px solid var(--line); }
.section-number { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 700; }
.section-body { flex: 1; min-width: 0; }
.section-body h3 { margin-top: 4px; }
.job-asset-check { margin-top: 12px; }
.job-asset-state { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 9px; background: #fff8e7; }
.job-asset-state.ready { background: #ecfaf2; }
.job-asset-state span:last-child { display: grid; gap: 3px; }
.job-asset-state small { color: var(--muted); }
.generate-submit { display: flex; align-items: center; gap: 14px; padding-top: 4px; }
.generate-submit p { margin: 0; }
.progress-card { margin-bottom: 18px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-track { height: 10px; overflow: hidden; border-radius: 99px; background: #e8ebf1; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #375dfb, #7a8eff); transition: width .4s ease; }
.processing-placeholder { display: grid; place-items: center; min-height: 260px; color: var(--muted); text-align: center; }
.processing-placeholder strong { margin-top: 14px; color: var(--navy); }
.processing-placeholder p { margin: 6px 0 0; }
.video-result video { display: block; width: 100%; max-height: 580px; border-radius: 10px; background: #111827; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--blue); font-size: 13px; }
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid #dfe5ff; border-top-color: var(--blue); border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
.spinner.large { width: 34px; height: 34px; margin: 0; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f6f8fb; }
.auth-card { width: min(100%, 440px); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: 0 18px 50px rgba(22, 34, 51, 0.08); }
.auth-card h1 { margin: 28px 0 8px; }
.auth-tabs { display: flex; gap: 8px; margin: 22px 0; }
.admin-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 24px 28px; border-radius: 16px; color: #fff; background: linear-gradient(120deg, #192440, #344a92); }
.admin-banner h2 { margin: 8px 0 6px; font-size: 28px; letter-spacing: -.03em; }
.admin-banner p { margin: 0; color: #cbd5f1; font-size: 13px; }
.admin-banner .eyebrow { color: #aebcff; }
.admin-section + .admin-section { margin-top: 26px; }
.admin-section .section-head { margin-bottom: 12px; }
.admin-section .section-head h3 { margin: 0 0 4px; }
.admin-section .section-head p { margin: 0; }
.admin-section h4 { margin: 0 0 10px; font-size: 14px; }
.admin-summary-badges { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.admin-summary-badges span { padding: 6px 9px; border-radius: 99px; background: #f1f3f7; }
.cost-trend { display: grid; gap: 12px; }
.cost-trend-row { display: grid; gap: 6px; }
.cost-trend-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.cost-trend-head strong { color: var(--navy); }
.cost-trend-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf0f5; }
.cost-trend-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: linear-gradient(90deg, #375dfb, #7a8eff); }
.admin-cost-table { margin-top: 22px; }
.status.admin-status-succeeded, .status.admin-status-success, .status.admin-status-confirmed { background: #e5f7ed; color: var(--green); }
.status.admin-status-failed { background: #ffebeb; color: var(--red); }
.status.admin-status-estimated, .status.admin-status-queued, .status.admin-status-pending, .status.admin-status-running, .status.admin-status-processing { background: #eaf0ff; color: #3153d4; }
.status.admin-status-unknown { background: #fff8e7; color: #775713; }
.sales-metrics-grid { margin-bottom: 18px; }
.sales-metric { min-height: 108px; }
.sales-metric .metric-value { color: var(--blue); }
.table-wrap select { min-height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); background: #fff; }
.table-wrap td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.account-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 26px 30px; border-radius: 16px; color: #fff; background: linear-gradient(120deg, #192440, #344a92); }
.account-hero h2 { margin: 8px 0 5px; font-size: 28px; }
.account-hero p { margin: 0; color: #cbd5f1; }
.account-hero .eyebrow { color: #aebcff; }
.metric-date { font-size: 20px; }
.quota-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-bottom: 18px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #f8f9fc; font-size: 13px; }
.quota-preview strong { color: var(--navy); }
.quota-preview small { flex-basis: 100%; }
.quota-warning { display: grid; gap: 8px; margin-bottom: 18px; }
.quota-warning .button { width: max-content; }
.usage-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.usage-summary > div { display: grid; gap: 4px; padding: 13px; border-radius: 10px; background: #f8f9fc; }
.usage-summary strong { color: var(--navy); font-size: 22px; }
.usage-summary span { color: var(--muted); font-size: 12px; }
.quota-main { display: grid; gap: 3px; margin-bottom: 10px; }
.quota-main strong { color: var(--navy); font-size: 32px; letter-spacing: -.04em; }
.quota-main span { color: var(--muted); font-size: 12px; }
.account-progress { margin-bottom: 16px; }
.upgrade-placeholder { padding: 60px 20px; text-align: center; }
.upgrade-placeholder h2 { margin: 10px 0 8px; }
.upgrade-placeholder p { margin: 0 0 22px; }
.upgrade-request-state { display: grid; gap: 6px; margin-bottom: 18px; }
.commercial-pipeline-table select { min-width: 110px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); background: #fff; font-size: 12px; }
.table-subtext { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { width: auto; padding: 14px 16px; }
  .brand { padding: 0 0 12px; }
  .nav { display: flex; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .upload-grid, .asset-status-grid { grid-template-columns: 1fr; }
  .hero-orb { display: none; }
  .generate-submit { align-items: flex-start; flex-direction: column; }
  .admin-banner { align-items: flex-start; flex-direction: column; }
  .account-hero { align-items: flex-start; flex-direction: column; }
  .usage-summary { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}
