.admin-body { margin: 0; background: #edf1f3; color: #15232c; }
.admin-login { min-height: 100vh; display: grid; grid-template-columns: minmax(300px,1fr) minmax(380px,520px); background: #071522; }
.admin-login-brand { padding: clamp(34px,7vw,96px); display: flex; gap: 18px; align-items: flex-start; color: #fff; background-image: linear-gradient(rgba(40,153,174,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(40,153,174,.08) 1px,transparent 1px); background-size: 32px 32px; }
.admin-login-brand img { width: 118px; height: 38px; object-fit: contain; }
.admin-login-brand > div { padding-left: 18px; border-left: 1px solid #29465a; }
.admin-login-brand strong,.admin-login-brand small { display: block; }
.admin-login-brand strong { font-size: 20px; }
.admin-login-brand small { margin-top: 6px; color: #6f91a6; font: 10px Consolas,monospace; }
.admin-login form { align-self: center; margin: 28px; padding: 48px; border-radius: 7px; background: #fff; }
.admin-login h1 { margin: 0; font-size: 30px; }
.admin-login form > p:not(.eyebrow) { margin: 10px 0 28px; color: #6d7980; }
.admin-login label { display: grid; gap: 7px; margin-bottom: 16px; color: #40505a; font-size: 12px; font-weight: 700; }
.admin-login form > button { width: 100%; }
.admin-login form > a { display: block; margin-top: 16px; color: #176fe6; text-align: center; font-size: 12px; }
#adminLoginError { min-height: 20px; display: block; margin-top: 12px; color: #c34e3c; text-align: center; font-size: 12px; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 15px; display: flex; flex-direction: column; background: #071522; color: #dbe8ef; }
.admin-brand { padding: 4px 6px 28px; display: flex; align-items: center; gap: 12px; }
.admin-brand img { width: 80px; height: 25px; object-fit: contain; }
.admin-brand > div { padding-left: 12px; border-left: 1px solid #29465a; }
.admin-brand strong,.admin-brand small { display: block; white-space: nowrap; }
.admin-brand strong { font-size: 14px; }
.admin-brand small { margin-top: 4px; color: #718b9b; font: 8px Consolas,monospace; }
.admin-sidebar nav { display: grid; gap: 4px; }
.admin-sidebar nav button { min-height: 44px; padding: 0 13px; display: flex; align-items: center; gap: 11px; border: 0; border-left: 3px solid transparent; border-radius: 3px; background: transparent; color: #91a9b8; text-align: left; font-weight: 700; }
.admin-sidebar nav button span { min-width: 34px; color: #6f91a6; font-size: 10px; font-weight: 800; }
.admin-sidebar nav button.active { border-left-color: #2a8cf0; background: #102b40; color: #fff; }
.admin-sidebar-footer { margin-top: auto; padding: 15px 7px 0; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #20394b; }
.admin-sidebar-footer strong,.admin-sidebar-footer small { display: block; }
.admin-sidebar-footer small { margin-top: 3px; max-width: 125px; overflow: hidden; color: #708b9b; text-overflow: ellipsis; }
.admin-sidebar-footer button { border: 0; background: transparent; color: #ed9d8a; }
.admin-main { min-width: 0; }
.admin-topbar { min-height: 76px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d7dfe3; background: #fff; }
.admin-topbar h1 { margin: 0; font-size: 22px; }
.admin-topbar .eyebrow { margin-bottom: 3px; }
.admin-topbar > div:last-child { display: flex; align-items: center; gap: 14px; }
.admin-topbar > div:last-child span { color: #657881; font-size: 11px; }
.admin-topbar a { padding: 8px 10px; border: 1px solid #c7d4dc; border-radius: 4px; color: #236797; font-size: 11px; font-weight: 700; }
.admin-view { padding: 26px 32px 60px; }
.admin-metric-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); border: 1px solid #d7e0e5; background: #fff; }
.admin-metric-grid > div { padding: 17px 14px; border-right: 1px solid #e0e6e9; }
.admin-metric-grid > div:last-child { border-right: 0; }
.admin-metric-grid span,.admin-metric-grid b { display: block; }
.admin-metric-grid span { color: #71808a; font-size: 10px; }
.admin-metric-grid b { margin-top: 7px; font-size: 22px; }
.admin-band { min-height: 112px; margin-top: 18px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; border-left: 4px solid #25aa9c; background: #0c2434; color: #f2f7fa; }
.admin-band h2 { margin: 0; font-size: 18px; }
.admin-band p:not(.eyebrow) { margin: 7px 0 0; color: #8ca5b2; }
.admin-section,.admin-config-form { margin-top: 18px; padding: 22px; border: 1px solid #d7e0e5; background: #fff; }
.admin-section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.admin-section-title h2 { margin: 0; font-size: 17px; }
.admin-section-title p { margin: 5px 0 0; color: #71808a; font-size: 11px; }
.pricing-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; }
.pricing-grid label { padding: 11px; border-left: 2px solid #25aa9c; background: #eff5f5; }
.pricing-grid label > span { min-height: 30px; display: block; color: #40525c; font-size: 11px; font-weight: 700; }
.pricing-grid label > div { display: flex; gap: 5px; }
.pricing-grid input { min-width: 0; padding: 7px; }
.pricing-grid button,.admin-table-wrap button { border: 1px solid #bdcbd3; border-radius: 3px; background: #fff; color: #236797; font-size: 10px; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.admin-config-form label { display: grid; gap: 7px; margin-bottom: 15px; color: #40515b; font-size: 11px; font-weight: 700; }
.admin-config-form label small { color: #71808a; font-weight: 400; }
.provider-config-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 8px 0 24px; }
.provider-card { min-width: 0; padding: 15px; border: 1px solid #cfdbe2; border-top: 3px solid #258bdd; border-radius: 5px; background: #f8fafb; transition: opacity .2s,border-color .2s; }
.provider-card.disabled { opacity: .58; border-top-color: #8798a2; }
.provider-card > header,.provider-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.provider-card > header { margin-bottom: 15px; }
.provider-card > header strong,.provider-card > header small { display: block; }
.provider-card > header strong { font-size: 14px; }
.provider-card > header small { margin-top: 3px; color: #758691; font-size: 9px; }
.provider-card textarea { min-height: 88px; resize: vertical; font: 10px/1.55 Consolas,monospace; }
.provider-card > footer { padding-top: 11px; border-top: 1px solid #dfe6ea; color: #607784; font-size: 10px; }
.provider-switch { margin: 0 !important; display: flex !important; grid-template-columns: auto auto; align-items: center; gap: 6px !important; white-space: nowrap; }
.provider-switch input { width: 16px; height: 16px; }
.default-model-title { padding-top: 20px; border-top: 1px solid #dfe6ea; }
.admin-model-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding-top: 18px; border-top: 1px solid #e0e6e9; }
.admin-model-grid label > span { margin-top: 3px; color: #40515b; }
.admin-note { padding: 11px; border-left: 3px solid #2a8cf0; background: #edf5fd; color: #40647c; font-size: 11px; }
.admin-form-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.model-pricing-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid #dfe6ea; }
.model-price-tools { margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.model-price-tools input { width: min(420px,100%); }
.model-price-tools span { color: #71808a; font-size: 11px; }
.model-pricing-table { max-height: 520px; overflow: auto; border: 1px solid #d7e0e5; }
.model-price-row { min-width: 720px; margin: 0 !important; padding: 8px 10px; display: grid !important; grid-template-columns: 120px 54px minmax(220px,1fr) 150px 78px; align-items: center; gap: 10px !important; border-bottom: 1px solid #e5eaed; background: #fff; }
.model-price-row:nth-child(even) { background: #f7f9fa; }
.model-price-row code { overflow: hidden; color: #23485e; text-overflow: ellipsis; white-space: nowrap; }
.model-price-family { padding: 3px 5px; border-radius: 3px; background: #e8f0f5; text-align: center; }
.model-price-family.image { background: #e4f3ef; color: #14715d; }
.model-price-family.video { background: #f3e9dc; color: #8b5a22; }
.model-price-unit { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.model-price-unit input { width: 72px; padding: 6px; }
.model-price-row small { color: #71808a; font-weight: 400; }
.r2-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.r2-form-grid label { display: grid; gap: 6px; margin-bottom: 14px; color: #40515b; font-size: 11px; font-weight: 700; }
.r2-form-grid small { color: #71808a; font-weight: 400; }
.r2-actions { display: flex; align-items: center; justify-content: space-between; color: #607784; font-size: 11px; }
.admin-table-wrap { overflow: auto; border: 1px solid #d7e0e5; background: #fff; }
.admin-table-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; }
.admin-table-wrap th,.admin-table-wrap td { padding: 12px 10px; border-bottom: 1px solid #e4e9ec; text-align: left; white-space: nowrap; }
.admin-table-wrap th { color: #70808a; background: #f4f6f7; font-size: 10px; }
.admin-table-wrap td strong,.admin-table-wrap td small { display: block; }
.admin-table-wrap td small { margin-top: 3px; color: #7a8992; }
.status-tag { padding: 3px 6px; border-radius: 3px; color: #805e20; background: #f5e9ca; }
.status-tag.active { color: #16715e; background: #dff2ed; }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 76px minmax(0,1fr); }
  .admin-brand > div,.admin-sidebar nav button:not(.active) { overflow: hidden; }
  .admin-brand img { width: 45px; }
  .admin-brand > div,.admin-sidebar nav button { font-size: 0; }
  .admin-sidebar nav button { justify-content: center; padding: 0; }
  .admin-sidebar nav button span { font-size: 10px; }
  .admin-sidebar-footer > div { display: none; }
  .admin-metric-grid { grid-template-columns: repeat(3,1fr); }
  .pricing-grid { grid-template-columns: repeat(2,1fr); }
  .provider-config-grid { grid-template-columns: 1fr; }
  .r2-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .admin-login { grid-template-columns: 1fr; }
  .admin-login-brand { padding: 28px; }
  .admin-login form { margin: 0 14px 18px; padding: 26px 20px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 10px; }
  .admin-brand,.admin-sidebar-footer { display: none; }
  .admin-sidebar nav { grid-template-columns: repeat(4,1fr); }
  .admin-sidebar nav button { min-height: 42px; font-size: 0; }
  .admin-sidebar nav button span { min-width: 0; font-size: 10px; }
  .admin-topbar { padding: 14px; }
  .admin-topbar > div:last-child span { display: none; }
  .admin-view { padding: 14px 10px 40px; }
  .admin-metric-grid { grid-template-columns: repeat(2,1fr); }
  .admin-form-grid,.admin-model-grid,.pricing-grid { grid-template-columns: 1fr; }
}
