* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg1);
}

body,
button,
input {
  font-family: var(--font-sans);
}

body {
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.cc-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  background:
    linear-gradient(rgba(22, 23, 25, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(22, 23, 25, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(circle at 80% 8%, rgba(216, 155, 0, 0.13), transparent 32%),
    var(--bg);
}

.cc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--neutral-950);
}

.cc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
}

.cc-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(216, 155, 0, 0.28));
}

.cc-nav {
  display: grid;
  gap: 8px;
}

.cc-nav a,
.cc-connect button,
.cc-section-head button,
.cc-actions button,
.cc-actions a,
.cc-panel-head button,
.cc-company-button {
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.cc-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 13px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
}

.cc-nav a.is-active {
  color: var(--fg-on-accent);
  background: var(--accent);
}

.cc-connect,
.cc-company-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
}

.cc-company-list {
  min-height: 0;
  flex: 1;
}

.cc-connect label {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.cc-connect input {
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  outline: 0;
}

.cc-connect input:focus {
  border-color: var(--gold-400);
}

.cc-connect button,
.cc-actions button,
.cc-actions a,
.cc-panel-head button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--fg-on-accent);
  background: var(--accent);
  box-shadow: var(--shadow-accent);
}

.cc-connect p {
  margin: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  line-height: 1.6;
}

.cc-section-head,
.cc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cc-section-head button,
.cc-panel-head button {
  min-height: 34px;
  box-shadow: none;
}

.cc-section-head button {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.cc-kicker {
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.cc-sidebar .cc-kicker {
  color: rgba(255, 255, 255, 0.5);
}

.cc-company-list > div:last-child {
  min-height: 0;
  overflow: auto;
}

.cc-company-button {
  display: grid;
  width: 100%;
  min-height: 58px;
  margin-bottom: 8px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
  text-align: start;
}

.cc-company-button.is-active {
  color: var(--fg-on-accent);
  background: var(--accent);
}

.cc-company-button small {
  margin-top: 4px;
  color: currentColor;
  opacity: 0.72;
  font-family: var(--font-mono);
}

.cc-main {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}

.cc-top,
.cc-actions,
.cc-grid {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.cc-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  align-items: end;
  gap: 20px;
  margin-bottom: 16px;
}

.cc-top h1 {
  margin: 8px 0 8px;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.16;
}

.cc-top p,
.cc-muted {
  margin: 0;
  color: var(--fg2);
  font-size: 14px;
  line-height: 1.7;
}

.cc-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.cc-status-strip div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
}

.cc-status-strip span {
  color: var(--fg2);
  font-size: 12px;
}

.cc-status-strip b {
  overflow: hidden;
  color: var(--fg1);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.cc-actions button,
.cc-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cc-actions button:disabled,
.cc-panel-head button:disabled,
.cc-connect button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.cc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cc-panel {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.cc-panel-wide {
  grid-column: 1 / -1;
}

.cc-panel h2 {
  margin: 4px 0 0;
  font-size: 19px;
}

.cc-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.cc-metric,
.cc-row,
.cc-list-empty,
.cc-intel-card {
  background: var(--surface-inset);
  border: 1px solid rgba(19, 19, 22, 0.06);
  border-radius: var(--radius-md);
}

.cc-metric {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 12px;
}

.cc-metric strong {
  color: var(--fg1);
  font-size: 24px;
}

.cc-metric span {
  color: var(--fg2);
  font-size: 13px;
}

.cc-rows {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.cc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.cc-row strong,
.cc-row b {
  overflow-wrap: anywhere;
}

.cc-row small {
  display: block;
  margin-top: 4px;
  color: var(--fg2);
  font-size: 12px;
  line-height: 1.5;
}

.cc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  color: var(--fg1);
  background: rgba(216, 155, 0, 0.13);
  border: 1px solid rgba(216, 155, 0, 0.24);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
}

.cc-badge.is-ok {
  color: #0b5f3a;
  background: rgba(25, 135, 84, 0.12);
  border-color: rgba(25, 135, 84, 0.2);
}

.cc-badge.is-error {
  color: #9f1d2a;
  background: rgba(220, 53, 69, 0.12);
  border-color: rgba(220, 53, 69, 0.2);
}

.cc-list-empty {
  margin-top: 12px;
  padding: 14px;
  color: var(--fg2);
  font-size: 14px;
  line-height: 1.7;
}

.cc-intel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cc-intel-card {
  padding: 12px;
}

.cc-intel-card strong {
  display: block;
  font-size: 22px;
}

.cc-intel-card span {
  color: var(--fg2);
  font-size: 13px;
}

.cc-dialog {
  max-width: min(520px, calc(100vw - 28px));
  color: var(--fg1);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.cc-dialog::backdrop {
  background: rgba(0, 0, 0, 0.44);
}

.cc-dialog form {
  display: grid;
  gap: 12px;
}

.cc-dialog h2,
.cc-dialog p {
  margin: 0;
}

.cc-dialog code {
  display: block;
  overflow-wrap: anywhere;
  padding: 12px;
  direction: ltr;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
}

.cc-dialog-actions {
  display: flex;
  justify-content: end;
}

.cc-dialog-actions button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--fg-on-accent);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.cc-toast {
  position: fixed;
  inset-inline: 18px;
  inset-block-end: 18px;
  z-index: 10;
  width: min(520px, calc(100vw - 36px));
  margin-inline-start: auto;
  padding: 12px 14px;
  color: #fff;
  background: var(--neutral-950);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cc-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .cc-shell {
    display: block;
    min-height: 100dvh;
    height: auto;
  }

  .cc-sidebar {
    position: static;
  }

  .cc-main {
    overflow: visible;
    padding: 18px;
  }

  .cc-top,
  .cc-grid {
    grid-template-columns: 1fr;
  }

  .cc-status-strip,
  .cc-metrics,
  .cc-intel-grid {
    grid-template-columns: 1fr;
  }

  .cc-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .cc-sidebar,
  .cc-main {
    padding: 14px;
  }

  .cc-top h1 {
    font-size: 30px;
  }

  .cc-actions button,
  .cc-actions a {
    width: 100%;
  }
}
