/* CoApps Admin (admin.coapps.app) console.
   Tokens from CoApps Brand Foundation v1.0. Built from the approved Level 1 mockup.
   Visual language matches the landing page and approved setup mockups. */

@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Italic-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-primary: #003A8F;
  --brand-deep: #001F4D;
  --brand-gold: #FFC107;
  --brand-gold-soft: #FFD54F;
  --brand-teal: #00A8A8;
  --white: #FFFFFF;
  --slate-900: #1A1A1A;
  --slate-700: #4B5563;
  --slate-500: #6B7280;
  --slate-200: #E5E7EB;
  --surface: #F7F9FC;
  --blue-50: #EEF4FF;
  --teal-50: #E8F7F6;
  --gold-50: #FFF7D6;
  --danger-50: #FDECEA;
  --border-strong: #CBD5E1;
  --success: #0F9D58;
  --danger: #D93025;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --elev-1: 0 2px 8px rgba(0, 31, 77, 0.08);
  --elev-2: 0 6px 20px rgba(0, 31, 77, 0.12);
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;
  --space-64: 64px;
  --nav-width: 240px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--slate-900);
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--brand-primary); }
h1, h2, h3 {
  margin: 0;
  font-family: Montserrat, Inter, "Segoe UI", sans-serif;
  font-weight: 700;
  color: var(--brand-deep);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header — Deep Blue, on-dark logo, product name kept apart from the logo. */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-24);
  padding: var(--space-12) var(--space-32);
  background: var(--brand-deep);
  color: var(--white);
  flex-shrink: 0;
}
.topbar .logo {
  height: 64px;
  width: auto;
  aspect-ratio: 272 / 292;
  display: block;
  flex-shrink: 0;
}
.product-name {
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 26px;
  color: var(--white);
  letter-spacing: 0.01em;
}
.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-16);
}
.topbar-end .topbar-link {
  color: var(--white);
  padding-left: var(--space-16);
  border-left: 1px solid #3A4F73;
}
.signed-in {
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  color: #C9D6EA;
}
.topbar-link {
  color: #C9D6EA;
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.topbar-link:hover,
.topbar-link:focus-visible {
  color: var(--white);
}

/* Auth pages (sign-in, two-step) */
.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-48) var(--space-24);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--elev-2);
  padding: var(--space-32) var(--space-24);
}
.auth-card h1 {
  font-size: 24px;
  line-height: 32px;
  margin-bottom: var(--space-20);
}
.auth-card .lead {
  margin: 0 0 var(--space-24);
  color: var(--slate-700);
  font-size: 16px;
  line-height: 24px;
}
.staff-note {
  margin: var(--space-16) 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  color: var(--slate-500);
}

.auth-footer {
  padding: var(--space-16) var(--space-32) var(--space-24);
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  color: var(--slate-500);
}

/* Forms */
.stack { display: flex; flex-direction: column; gap: var(--space-16); }
label {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  color: var(--slate-700);
}
input {
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--slate-900);
  min-height: 48px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--white);
  width: 100%;
}
input::placeholder { color: var(--slate-500); font-weight: 500; }
input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--brand-gold);
  outline-offset: 2px;
}
input:focus { border-color: var(--brand-primary); }

button, .button {
  font-family: Inter, "Segoe UI", sans-serif;
  font-weight: 650;
  font-size: 16px;
  line-height: 24px;
  cursor: default;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  min-height: 44px;
  padding: 10px 16px;
  background: var(--white);
  color: var(--brand-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.primary, .btn-primary {
  background: var(--brand-gold);
  color: var(--brand-deep);
  border-color: var(--brand-gold);
}
.button:not(.primary):not(.danger) {
  background: var(--white);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.danger {
  background: var(--white);
  color: var(--danger);
  border-color: var(--danger);
}
.button.small, button.small {
  font-size: 14px;
  line-height: 22px;
  min-height: 36px;
  padding: 6px 12px;
}
.auth-card .primary { width: 100%; min-height: 48px; margin-top: var(--space-8); }

/* OTP */
.otp {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-20);
}
.otp input {
  width: 48px;
  min-width: 0;
  flex: 0 0 48px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  text-align: center;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.backup-link {
  display: block;
  text-align: center;
  margin-top: var(--space-16);
  font-size: 14px;
  line-height: 22px;
  font-weight: 650;
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.backup-link:hover { text-decoration: underline; }

/* Console shell */
.shell {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
}
.sidenav {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--slate-200);
  padding: var(--space-16) var(--space-12);
}
.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.sidenav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--slate-700);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
}
.sidenav a:hover { background: var(--surface); color: var(--brand-deep); }
.sidenav a.current {
  background: var(--blue-50);
  color: var(--brand-primary);
  font-weight: 700;
}

.content {
  flex: 1;
  padding: var(--space-32) var(--space-40) var(--space-48);
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  margin-bottom: var(--space-24);
}
.page-head h1 {
  font-size: 28px;
  line-height: 36px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  margin-bottom: var(--space-12);
}
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb .sep { color: var(--slate-500); font-weight: 500; }
.crumb .here { color: var(--brand-deep); }

/* Table */
.table-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--elev-1);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 22px;
}
th, td {
  text-align: left;
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--slate-200);
}
th {
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  color: var(--slate-500);
  letter-spacing: 0.02em;
  text-transform: none;
  background: var(--surface);
}
tr:last-child td { border-bottom: none; }
td.company { font-weight: 700; color: var(--brand-deep); }
td.subdomain, .mono {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--slate-700);
}
th.col-actions, td.actions { white-space: nowrap; text-align: right; }
td.actions .button + .button { margin-left: var(--space-8); }
.created { color: var(--slate-700); white-space: nowrap; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pending { background: var(--gold-50); color: var(--brand-deep); }
.badge-active { background: var(--teal-50); color: #0B6F6F; }
.badge-suspended { background: var(--danger-50); color: var(--danger); }
.badge-running { background: var(--blue-50); color: var(--brand-primary); }
.badge-complete { background: var(--teal-50); color: #0B6F6F; }

/* Detail layout */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
  align-items: stretch;
}
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--elev-1);
  padding: var(--space-24);
}
.card h2 {
  font-size: 18px;
  line-height: 26px;
  margin-bottom: var(--space-16);
}
.kv {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: var(--space-8) var(--space-16);
  margin: 0;
}
.kv dt { color: var(--slate-500); font-size: 14px; line-height: 22px; }
.kv dd {
  margin: 0;
  font-weight: 700;
  color: var(--brand-deep);
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 22px;
}

.create-list {
  list-style: none;
  margin: 0 0 var(--space-16);
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.create-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-12);
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  font-size: 14px;
  line-height: 22px;
}
.create-list li:last-child { border-bottom: none; }
.create-list .item { font-weight: 600; color: var(--slate-900); }
.create-list .value { font-weight: 500; color: var(--slate-700); text-align: right; }

.note {
  padding: var(--space-12);
  border-radius: var(--radius-sm);
  margin: 0 0 var(--space-20);
  font-size: 14px;
  line-height: 22px;
}
.note-info { background: var(--blue-50); color: var(--brand-primary); }
.note-warn { background: var(--gold-50); color: var(--slate-900); }

.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-12);
  flex-wrap: wrap;
}
.actions .primary,
.actions .danger { min-width: 132px; }

/* Provisioning steps */
.step-cell {
  padding: 14px 10px;
  text-align: center;
}
.step {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.step .icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.step.done .icon {
  background: var(--brand-teal);
  color: var(--white);
}
.step.running .icon {
  background: var(--white);
  color: transparent;
  border: 3px solid var(--border-strong);
  border-top-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--blue-50);
}
.step.waiting .icon {
  background: var(--slate-200);
  color: var(--slate-500);
}
.step .lab {
  font-size: 11px;
  line-height: 16px;
  font-weight: 650;
  color: var(--slate-500);
}
.step.done .lab { color: #0B6F6F; }
.step.running .lab { color: var(--brand-primary); }

th.step-head {
  text-align: center;
  padding: 14px 10px;
  font-weight: 700;
}

.job-company { font-weight: 700; color: var(--brand-deep); }
.job-sub {
  display: block;
  font-weight: 500;
  color: var(--slate-500);
  font-size: 12px;
  line-height: 18px;
}

/* ---- Console additions (states the static mockup did not need) ---- */
[hidden] { display: none !important; }
.sidenav .soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--slate-500);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  cursor: not-allowed;
}
.sidenav .soon small {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 0 6px;
}
button.topbar-link {
  background: none;
  border: 0;
  border-left: 1px solid #3A4F73;
  border-radius: 0;
  padding: 0 0 0 var(--space-16);
  width: auto;
  font-family: inherit;
  cursor: pointer;
}
.form-error {
  margin: var(--space-12) 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-50);
  color: var(--danger);
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
}
.button[disabled], button[disabled] { opacity: 0.55; cursor: not-allowed; }
.badge-rejected { background: var(--slate-200); color: var(--slate-700); }
.badge-failed { background: var(--danger-50); color: var(--danger); }
.badge-queued { background: var(--gold-50); color: var(--brand-deep); }
.step.failed .icon { background: var(--danger); color: var(--white); }
.empty {
  padding: var(--space-24);
  color: var(--slate-500);
  font-size: 14px;
  text-align: center;
}
.backup-input { text-transform: uppercase; letter-spacing: 0.08em; }
.loading { padding: var(--space-32); color: var(--slate-500); }
@keyframes cdb-spin { to { transform: rotate(360deg); } }
.step.running .icon { animation: cdb-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .step.running .icon { animation: none; } }
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
