:root {
  --bg: #eef1f7;
  --bg-soft: #f8f9fc;
  --panel: #ffffff;
  --panel-muted: #f4f6fb;
  --line: #cfd7ea;
  --line-strong: #aeb9d6;
  --text: #182235;
  --muted: #5f6d88;
  --brand: #5a72ad;
  --brand-soft: #e8eefb;
  --brand-strong: #3d568f;
  --success: #1e8a58;
  --warning: #a76713;
  --danger: #bb3a3a;
  --configured: #2e65c8;
  --disabled: #6b7280;
  --archived: #9b5b26;
  --unknown: #7448b8;
  --shadow: 0 16px 36px rgba(37, 57, 101, 0.1);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(90, 114, 173, 0.08), transparent 22rem),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1400px, 95vw);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted,
.status-line,
.lead,
.field-note,
.notes-box,
.notice {
  color: var(--muted);
}

.auth-view {
  min-height: calc(100vh - 3rem);
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 1.2rem;
}

.auth-hero,
.auth-card,
.cp-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-hero,
.auth-card,
.cp-box {
  padding: 1.2rem;
}

.auth-hero h1,
.auth-card h2,
.cp-header h1,
.cp-box h2 {
  margin: 0;
}

.lead {
  margin: 0.5rem 0 0;
  max-width: 42rem;
  line-height: 1.6;
}

.google-mount {
  min-height: 48px;
}

.auth-links,
.cp-header,
.cp-header__brand,
.cp-header__actions,
.sidebar-actions,
.server-nav-item__tools,
.hero-status,
.hero-badges,
.hero-actions,
.form-actions,
.toggle-grid,
.cp-main-grid {
  display: flex;
  gap: 0.8rem;
}

.auth-links,
.cp-header__actions,
.sidebar-actions,
.server-nav-item__tools,
.hero-badges,
.hero-actions,
.toggle-grid {
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 0.7rem 1rem;
}

.btn:hover,
.btn:focus-visible {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn--ghost {
  background: var(--panel);
  color: var(--brand-strong);
  border-color: var(--line-strong);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.btn--danger {
  color: #a23434;
  border-color: #d2a8a8;
}

.panel-view {
  display: grid;
  gap: 1rem;
}

.cp-header {
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
}

.cp-header__brand {
  align-items: center;
}

.cp-header__mark {
  width: 2.6rem;
  height: 2.6rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #f7f9ff, #dfe7fb);
  border: 1px solid var(--line-strong);
  color: var(--brand-strong);
  font-weight: 800;
}

.cp-header__actions {
  align-items: center;
  justify-content: flex-end;
}

.signed-in {
  margin: 0;
  color: var(--muted);
}

.cp-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.cp-sidebar,
.cp-main,
.notice-stack,
.server-nav-list {
  display: grid;
  gap: 1rem;
}

.cp-box__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}

.cp-box__head h2 {
  font-size: 1.15rem;
}

.cp-box--summary .status-line {
  margin-bottom: 0.85rem;
}

.summary-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel-muted);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.78rem 0.9rem;
  border-top: 1px solid var(--line);
}

.summary-row:first-child {
  border-top: 0;
}

.summary-row strong {
  color: var(--brand-strong);
}

.notice-stack {
  gap: 0.7rem;
}

.notice {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.85rem 1rem;
  line-height: 1.5;
}

.notice--warn {
  border-left: 4px solid var(--warning);
}

.notice--info {
  border-left: 4px solid var(--configured);
}

.cp-box--hero {
  display: grid;
  gap: 0.9rem;
}

.hero-status {
  justify-content: space-between;
  align-items: start;
}

.hero-status h2 {
  font-size: 1.8rem;
}

.hero-connection {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fcfdff, var(--panel-muted));
}

.hero-connection__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.hero-connection strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.1rem;
}

.badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.badge--success {
  color: var(--success);
  background: #edf8f2;
  border-color: #badcc8;
}

.badge--muted,
.mini-badge--muted {
  color: var(--muted);
  background: #f3f5f9;
  border-color: var(--line);
}

.badge--configured,
.mini-badge--configured {
  color: var(--configured);
  background: #edf4ff;
  border-color: #b9cfee;
}

.badge--disabled,
.mini-badge--disabled {
  color: var(--disabled);
  background: #f1f3f6;
  border-color: #d0d6df;
}

.badge--archived,
.mini-badge--archived {
  color: var(--archived);
  background: #fff4e8;
  border-color: #e6c7aa;
}

.badge--unknown,
.mini-badge--unknown {
  color: var(--unknown);
  background: #f4eefe;
  border-color: #d9c7f2;
}

.cp-main-grid {
  align-items: stretch;
}

.cp-main-grid > .cp-box {
  flex: 1 1 0;
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
}

.status-table th,
.status-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.78rem 0.85rem;
  border-top: 1px solid var(--line);
}

.status-table tr:first-child th,
.status-table tr:first-child td {
  border-top: 0;
}

.status-table th {
  width: 34%;
  color: var(--muted);
  font-weight: 700;
}

.notes-box {
  min-height: 100%;
  line-height: 1.65;
  white-space: pre-wrap;
  padding: 0.2rem 0;
}

.server-nav-list {
  gap: 0.7rem;
}

.server-nav-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-muted);
  overflow: hidden;
}

.server-nav-item.is-selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(90, 114, 173, 0.16);
}

.server-nav-item__main {
  width: 100%;
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem 0.75rem;
  border: 0;
  text-align: left;
  background: transparent;
  color: inherit;
}

.server-nav-item__main:hover,
.server-nav-item__main:focus-visible {
  background: rgba(90, 114, 173, 0.08);
}

.server-nav-item__title {
  font-weight: 700;
  color: var(--text);
}

.server-nav-item__meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.server-nav-item__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.server-nav-item__tools {
  padding: 0 0.9rem 0.8rem;
}

.nav-action {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font-size: 0.9rem;
  padding: 0;
}

.nav-action:hover,
.nav-action:focus-visible {
  text-decoration: underline;
}

.nav-action:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: not-allowed;
}

.cp-box--form .cp-box__head {
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.42rem;
}

.field span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.field--full {
  grid-column: 1 / -1;
}

.input {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 0.78rem 0.85rem;
}

.input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(90, 114, 173, 0.18);
  outline-offset: 1px;
  border-color: var(--brand);
}

.textarea {
  resize: vertical;
  min-height: 96px;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.toggle-grid {
  align-items: center;
}

.field-note,
.status-line {
  line-height: 1.5;
}

.status-line {
  min-height: 1.3rem;
  white-space: pre-wrap;
}

.status-line[data-tone="danger"] {
  color: var(--danger);
}

.status-line[data-tone="success"] {
  color: var(--success);
}

.input:disabled {
  background: #f4f6fb;
  color: var(--muted);
}

.empty-state {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  background: var(--panel-muted);
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .auth-view,
  .cp-layout {
    grid-template-columns: 1fr;
  }

  .cp-main-grid {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw, 96vw);
  }

  .cp-header,
  .cp-header__actions,
  .hero-status,
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .status-table th,
  .status-table td {
    display: block;
    width: 100%;
  }

  .status-table th {
    padding-bottom: 0.15rem;
    border-bottom: 0;
  }

  .status-table td {
    padding-top: 0;
  }
}
