/* Cirqco Control operator console */
.control-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, #d9ebe4 0%, transparent 42%),
    linear-gradient(180deg, #eef2f5 0%, var(--paper) 55%);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0 0.5rem 1.25rem; border-bottom: 1px solid var(--line-soft); margin-bottom: 0.75rem;
}
.sidebar-brand img { height: 32px; width: auto; }
.sidebar-brand div strong { display: block; font-size: 0.95rem; color: var(--teal); }
.sidebar-brand div span { font-size: 0.75rem; color: var(--muted); }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  border: none; background: transparent; text-align: left;
  padding: 0.65rem 0.75rem; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 0.88rem; color: var(--muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: #f0f5f3; color: var(--ink); }
.nav-item.active { background: var(--teal-soft); color: var(--teal); }
.nav-item .count {
  margin-left: auto; font-size: 0.75rem; font-weight: 700;
  background: #e8edf2; color: var(--muted); padding: 0.1rem 0.45rem; border-radius: 999px;
}
.nav-item.active .count { background: rgba(26, 138, 125, 0.2); color: var(--teal); }

.sidebar-foot {
  padding: 0.75rem 0.5rem 0; border-top: 1px solid var(--line-soft); margin-top: 0.5rem;
}
.sidebar-foot a { font-size: 0.82rem; color: var(--muted); text-decoration: none; display: block; padding: 0.35rem 0; }
.sidebar-foot a:hover { color: var(--teal); }

.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.5rem; background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.topbar p { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--muted); }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.main-content { padding: 1.25rem 1.5rem 2rem; }

.command-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

.form-card { padding: 1.25rem; }
.form-card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.form-card p { margin: 0 0 1rem; font-size: 0.85rem; color: var(--muted); }
.form-grid {
  display: grid; gap: 0.75rem;
}
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

.badge.revoked { background: #fde8e8; color: #b42318; }
.badge.expired { background: #fff4e5; color: #b54708; }
.badge.grace { background: #fff8e6; color: #a15c07; }
.badge.active { background: var(--online-bg); color: var(--online); }

.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.wizard-steps {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.wizard-step {
  font-size: 0.78rem; padding: 0.35rem 0.7rem; border-radius: 999px;
  background: #eef2f5; color: var(--muted); font-weight: 600;
}
.wizard-step.active { background: var(--teal-soft); color: var(--teal); }
.wizard-step.done { background: var(--online-bg); color: var(--online); }

.alert-card {
  padding: 1rem 1.1rem; border-radius: var(--radius-sm);
  background: #fff8e6; border: 1px solid #f5dfa3; color: #7a5b12;
  font-size: 0.88rem; margin-bottom: 1rem;
}
.alert-card strong { display: block; margin-bottom: 0.25rem; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.flags-cell {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.78rem; color: var(--muted); white-space: pre-wrap; max-width: 180px;
}

@media (max-width: 900px) {
  .control-app { grid-template-columns: 1fr; }
  .command-grid { grid-template-columns: 1fr; }
  .command-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar {
    position: relative; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 0.85rem 1rem; gap: 0.5rem;
  }
  .sidebar-brand { border: none; margin: 0; padding: 0; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar-foot { display: none; }
  .nav-item { padding: 0.5rem 0.65rem; }
}

@media (max-width: 560px) {
  .command-kpi-row { grid-template-columns: 1fr; }
  .form-grid.two-col { grid-template-columns: 1fr; }
}

/* Login page */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(42, 157, 143, 0.25) 0%, transparent 45%),
    linear-gradient(135deg, var(--hero-from) 0%, var(--hero-mid) 50%, var(--hero-to) 100%);
}
.login-card {
  width: min(440px, 100%); background: var(--panel);
  border: 1px solid var(--line-soft); border-radius: 18px;
  padding: 2rem 1.75rem; box-shadow: var(--shadow-lg);
}
.login-card .wordmark { height: 36px; margin-bottom: 1rem; }
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; color: var(--teal); }
.login-card .lede { margin: 0 0 1.25rem; color: var(--muted); line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.login-card .field { width: 100%; }
.login-help {
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-soft);
  font-size: 0.85rem; color: var(--muted); line-height: 1.45;
}
.login-help p { margin: 0 0 0.65rem; }
.login-help code { font-family: ui-monospace, monospace; font-size: 0.82rem; }
.back-link {
  display: inline-block; margin-bottom: 1rem; color: var(--teal);
  font-size: 0.88rem; font-weight: 600; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
