.admin-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-auth-box {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.auth-brand { margin-bottom: 40px; }
.admin-auth-box h1 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 34px; font-weight: 600; }
.admin-auth-box > p:not(.eyebrow) { margin: 10px 0 24px; color: var(--studio-muted); line-height: 1.65; }
.admin-auth-box label { display: block; margin-bottom: 7px; color: var(--studio-soft); font-size: 13px; font-weight: 800; }
.admin-auth-box input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--studio-border);
  background: var(--studio-bg);
  color: var(--studio-text);
  outline: 0;
}
.admin-auth-box input:focus { border-color: var(--studio-teal); }
.admin-auth-box .primary-button { width: 100%; margin-top: 14px; }
.admin-auth-message { min-height: 20px; margin: 12px 0 0; color: var(--studio-muted); font-size: 13px; }
.admin-auth-message.error { color: var(--studio-danger); }
.admin-auth-message.success { color: var(--studio-green); }

.admin-live-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--studio-border);
  color: var(--studio-muted);
  font-size: 12px;
  font-weight: 800;
}
.admin-live-pill span { width: 7px; height: 7px; background: var(--studio-green); }
.header-actions .admin-home-button { width: auto; min-height: 40px; padding: 0 12px; }
.sidebar-label { margin: 0 12px 8px; color: var(--studio-muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.sidebar-label.app-label { margin-top: 26px; }
.nav-item-disabled { cursor: default; opacity: 0.58; }
.nav-item-disabled small { margin-left: auto; color: var(--studio-gold); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.studio-return { margin-top: auto; }

.admin-main { grid-column: 2; width: min(1440px, 100%); padding: 38px 42px 70px; }
.admin-page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--studio-border); }
.admin-page-head h1 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 32px; font-weight: 600; }
.admin-page-head > div > p:last-child { margin: 10px 0 0; color: var(--studio-muted); }
.refresh-button { flex: 0 0 auto; }
.refresh-button.loading svg { animation: admin-spin 0.8s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

.admin-notice { margin-top: 18px; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--studio-danger) 40%, transparent); color: var(--studio-danger); background: color-mix(in srgb, var(--studio-danger) 7%, transparent); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.admin-metric { min-height: 126px; display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: start; padding: 20px; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.metric-icon, .app-admin-icon { display: grid; place-items: center; color: var(--studio-teal); background: color-mix(in srgb, var(--studio-teal) 9%, transparent); border: 1px solid var(--studio-border); }
.metric-icon { width: 38px; height: 38px; }
.metric-icon svg, .app-admin-icon svg { width: 18px; height: 18px; }
.admin-metric strong, .admin-metric span, .admin-metric small { display: block; }
.admin-metric strong { font-family: 'Oswald', sans-serif; font-size: 30px; line-height: 1; font-weight: 600; }
.admin-metric span { margin-top: 7px; color: var(--studio-soft); font-size: 13px; font-weight: 800; }
.admin-metric small { margin-top: 4px; color: var(--studio-muted); font-size: 11px; }

.admin-section { padding-top: 36px; }
.admin-section-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 15px; }
.admin-section-head h2 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 23px; font-weight: 600; }
.admin-app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-app-card { min-height: 292px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.admin-app-card.upcoming-app { background: color-mix(in srgb, var(--studio-surface) 85%, var(--studio-bg)); }
.admin-app-top { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.app-admin-icon { width: 42px; height: 42px; }
.status-chip { padding: 5px 8px; border: 1px solid var(--studio-border); color: var(--studio-gold); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-chip.status-live { color: var(--studio-green); border-color: color-mix(in srgb, var(--studio-green) 36%, transparent); }
.admin-app-card h3 { margin: 18px 0 0; font-family: 'Oswald', sans-serif; font-size: 24px; font-weight: 600; }
.admin-app-card > p { margin: 8px 0 18px; color: var(--studio-muted); line-height: 1.55; }
.app-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.app-stat-row div { padding-right: 8px; border-right: 1px solid var(--studio-border); }
.app-stat-row div:last-child { border-right: 0; }
.app-stat-row strong, .app-stat-row span { display: block; }
.app-stat-row strong { color: var(--studio-text); font-family: 'Oswald', sans-serif; font-size: 21px; font-weight: 600; }
.app-stat-row span { margin-top: 2px; color: var(--studio-muted); font-size: 10px; }
.app-admin-button { width: fit-content; margin-top: auto; }
.app-admin-button:disabled { cursor: not-allowed; opacity: 0.5; }
.app-ready-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; color: var(--studio-soft); font-size: 12px; }
.app-ready-row svg { width: 15px; color: var(--studio-green); }

.customer-heading { margin-bottom: 12px; }
.load-time, .table-count { color: var(--studio-muted); font-size: 11px; }
.enrollment-form { margin: 0 0 14px; padding: 16px; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.enrollment-form-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.enrollment-form h3 { margin: 0; color: var(--studio-text); font-size: 15px; }
.enrollment-form-head p { margin: 4px 0 0; color: var(--studio-muted); font-size: 12px; line-height: 1.45; }
.enrollment-fields { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 1.5fr) minmax(220px, 1.2fr) auto; gap: 10px; align-items: end; }
.enrollment-fields > label, .enrollment-fields fieldset { min-width: 0; color: var(--studio-soft); font-size: 11px; font-weight: 800; }
.enrollment-fields input[type="text"], .enrollment-fields input[type="email"] { display: block; width: 100%; height: 38px; margin-top: 5px; padding: 0 10px; border: 1px solid var(--studio-border); background: var(--studio-bg); color: var(--studio-text); outline: 0; }
.enrollment-fields input[type="text"]:focus, .enrollment-fields input[type="email"]:focus { border-color: var(--studio-teal); }
.enrollment-fields fieldset { display: flex; flex-wrap: wrap; gap: 7px 12px; min-height: 38px; margin: 0; padding: 0; border: 0; }
.enrollment-fields legend { width: 100%; margin-bottom: 4px; }
.enrollment-fields fieldset label { color: var(--studio-muted); font-weight: 700; white-space: nowrap; }
.enrollment-fields .secondary-button { min-height: 38px; width: auto; white-space: nowrap; }
.enrollment-message { min-height: 0; margin: 10px 0 0; color: var(--studio-muted); font-size: 12px; }
.enrollment-message.success { color: var(--studio-green); }
.enrollment-message.error { color: var(--studio-danger); }
.customer-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.search-field { min-width: 260px; flex: 1; height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.search-field svg { width: 17px; color: var(--studio-muted); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--studio-text); }
.customer-toolbar select { min-width: 190px; padding: 0 12px; border: 1px solid var(--studio-border); background: var(--studio-surface); color: var(--studio-text); }
.customer-table-wrap { overflow-x: auto; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.customer-table { width: 100%; min-width: 940px; border-collapse: collapse; }
.customer-table th { padding: 11px 13px; border-bottom: 1px solid var(--studio-border); color: var(--studio-muted); font-size: 10px; font-weight: 900; text-align: left; text-transform: uppercase; }
.customer-table td { padding: 13px; border-bottom: 1px solid color-mix(in srgb, var(--studio-border) 55%, transparent); vertical-align: middle; }
.customer-table tbody tr:last-child td { border-bottom: 0; }
.customer-table tbody tr:hover td { background: color-mix(in srgb, var(--studio-teal) 5%, transparent); }
.customer-name { color: var(--studio-text); font-weight: 900; }
.customer-role { display: inline-block; margin-left: 6px; color: var(--studio-gold); font-size: 8px; font-weight: 900; text-transform: uppercase; vertical-align: middle; }
.customer-email { margin-top: 2px; color: var(--studio-muted); font-size: 11px; }
.access-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.access-badge { display: inline-flex; align-items: center; padding: 4px 7px; border: 1px solid var(--studio-border); color: var(--studio-muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.access-badge.active { color: var(--studio-green); border-color: color-mix(in srgb, var(--studio-green) 34%, transparent); }
.progress-mini { min-width: 128px; }
.progress-mini-bar { height: 6px; overflow: hidden; background: var(--studio-surface-2); }
.progress-mini-fill { height: 100%; background: var(--studio-teal); }
.progress-mini span { display: block; margin-top: 5px; color: var(--studio-muted); font-size: 10px; }
.access-control { display: inline-flex; align-items: center; gap: 8px; }
.access-control button { min-width: 92px; min-height: 32px; padding: 0 9px; border: 1px solid var(--studio-border); background: transparent; color: var(--studio-soft); cursor: pointer; font-size: 11px; font-weight: 900; }
.access-control button:hover { border-color: var(--studio-teal); color: var(--studio-text); }
.access-control button.revoke { color: var(--studio-danger); }
.row-detail-button { width: 34px; height: 34px; }
.table-loading { padding: 32px !important; color: var(--studio-muted); text-align: center; }
.table-count { margin: 9px 0 0; text-align: right; }

.customer-drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(2, 10, 10, 0.7); }
.customer-drawer { position: absolute; inset: 0 0 0 auto; width: min(480px, 100%); overflow-y: auto; border-left: 1px solid var(--studio-border); background: var(--studio-bg); box-shadow: -24px 0 70px rgba(0, 0, 0, 0.28); }
.drawer-top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 16px; padding: 22px; border-bottom: 1px solid var(--studio-border); background: color-mix(in srgb, var(--studio-bg) 95%, transparent); backdrop-filter: blur(16px); }
.drawer-top h2 { margin: 0; font-family: 'Oswald', sans-serif; font-size: 25px; font-weight: 600; }
.drawer-profile { padding: 22px; border-bottom: 1px solid var(--studio-border); }
.drawer-profile h3 { margin: 0; font-size: 18px; }
.drawer-profile > p { margin: 4px 0 0; color: var(--studio-muted); word-break: break-word; }
.drawer-section { padding: 22px; border-bottom: 1px solid var(--studio-border); }
.drawer-section h4 { margin: 0 0 13px; color: var(--studio-soft); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.drawer-kv { display: grid; grid-template-columns: 120px 1fr; gap: 9px; margin-bottom: 10px; font-size: 12px; }
.drawer-kv span:first-child { color: var(--studio-muted); }
.drawer-kv span:last-child { color: var(--studio-soft); text-align: right; }
.drawer-app { padding: 14px; border: 1px solid var(--studio-border); background: var(--studio-surface); }
.drawer-app + .drawer-app { margin-top: 10px; }
.drawer-app-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.drawer-app strong { font-size: 14px; }
.drawer-app p { margin: 8px 0 12px; color: var(--studio-muted); font-size: 12px; line-height: 1.5; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-actions .secondary-button { min-height: 36px; font-size: 11px; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-app-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .admin-main { width: 100%; padding: 28px 16px 56px; }
  .admin-page-head { align-items: start; }
  .admin-page-head h1 { font-size: 27px; }
  .admin-live-pill { display: none; }
  .header-actions .admin-home-button { width: auto; min-height: 36px; padding: 0 9px; font-size: 12px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .admin-metric { min-height: 116px; padding: 16px; grid-template-columns: 1fr; gap: 11px; }
  .metric-icon { width: 32px; height: 32px; }
  .customer-toolbar { flex-direction: column; }
  .enrollment-form-head, .enrollment-fields { display: block; }
  .enrollment-form-head .status-chip { display: inline-flex; margin-top: 10px; }
  .enrollment-fields > label, .enrollment-fields fieldset, .enrollment-fields .secondary-button { display: block; width: 100%; margin-top: 10px; }
  .enrollment-fields fieldset { min-height: auto; }
  .enrollment-fields fieldset label { display: inline-flex; margin: 4px 10px 0 0; }
  .search-field, .customer-toolbar select { width: 100%; min-width: 0; height: 42px; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .admin-metric { grid-template-columns: auto 1fr; }
  .admin-page-head { display: block; }
  .refresh-button { width: 100%; margin-top: 18px; }
  .app-stat-row { grid-template-columns: 1fr; }
  .app-stat-row div { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--studio-border); }
  .app-stat-row div:last-child { border-bottom: 0; }
  .admin-auth-box { padding: 28px 22px; }
}
