:root {
  --color-primary: #27272a;
  --color-accent: #f97316;
  --color-secondary: #64748b;
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --fw-light: 300;
  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 900;
  --line: #e4e4e7;
  --soft: #f4f4f5;
  --shadow: 0 20px 50px rgba(39, 39, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-primary);
  font-family: var(--font-main);
  font-weight: var(--fw-regular);
  line-height: 1.5;
}

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

code,
.trigger-data {
  font-family: var(--font-code);
  font-weight: 500;
}

a {
  color: inherit;
}

.public-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(100, 116, 139, 0.12), transparent 42%),
    var(--color-bg);
}

.home-shell {
  width: min(1100px, 100%);
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.home-intro,
.login-panel,
.panel,
.card,
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.home-intro {
  padding: 28px 20px;
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-logo {
  width: min(330px, 82vw);
  height: auto;
  margin-bottom: 36px;
}

.eyebrow {
  color: var(--color-accent);
  font-weight: var(--fw-bold);
  margin: 0 0 10px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: var(--fw-black);
}

h2 {
  font-size: 24px;
  font-weight: var(--fw-bold);
}

h3 {
  font-size: 18px;
  font-weight: var(--fw-semibold);
}

.lead {
  max-width: 680px;
  margin: 18px 0 0;
  font-size: 18px;
  color: var(--color-secondary);
}

.signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.signal-row span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--color-secondary);
  font-size: 13px;
  font-weight: var(--fw-semibold);
}

.login-panel {
  padding: 28px;
  align-self: center;
}

.muted {
  color: var(--color-secondary);
}

label {
  display: block;
  margin: 16px 0 6px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: var(--fw-semibold);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--color-primary);
  padding: 9px 11px;
}

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

.button {
  border: 0;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 14px;
  background: var(--soft);
  color: var(--color-primary);
  font-weight: var(--fw-bold);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button.primary {
  background: var(--color-accent);
  color: #fff;
}

.button.dark {
  background: var(--color-primary);
  color: #fff;
}

.button.danger {
  background: var(--color-error);
  color: #fff;
}

.button.success {
  background: var(--color-success);
  color: #fff;
}

.login-panel .button {
  width: 100%;
  margin-top: 18px;
}

.alert {
  border-radius: 6px;
  padding: 10px 12px;
  margin: 14px 0;
  font-size: 14px;
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.24);
}

.alert.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.sidebar {
  background: var(--color-primary);
  color: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar .brand-logo {
  width: 190px;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  margin: 0;
}

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

.nav-list button,
.nav-list a {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,.72);
  min-height: 40px;
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  font-weight: var(--fw-semibold);
}

.nav-list button.active {
  background: rgba(249, 115, 22, 0.18);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 14px;
}

.topbar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 32px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.panel,
.card {
  padding: 18px;
  box-shadow: none;
}

.card-list {
  display: grid;
  gap: 10px;
}

.project-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--color-primary);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.project-card.active {
  border-color: var(--color-accent);
  outline: 2px solid rgba(249, 115, 22, 0.18);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.subcard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  margin-top: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.table th {
  color: var(--color-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.status-online {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.status-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.status-archived {
  background: rgba(100, 116, 139, 0.14);
  color: var(--color-secondary);
}

.viewer-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 22px;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}

.tabs button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  background: #fff;
  font-weight: var(--fw-bold);
}

.tabs button.active {
  background: var(--color-primary);
  color: #fff;
}

.button-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.action-button {
  min-height: 82px;
  font-size: 17px;
}

.toast {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (min-width: 760px) {
  .home-intro {
    padding: clamp(28px, 5vw, 56px);
  }

  .grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (min-width: 980px) {
  .home-shell {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  }

  .home-intro {
    min-height: 520px;
  }

  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .sidebar {
    padding: 22px;
    gap: 22px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 24px;
  }

  .topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .topbar h1 {
    font-size: 36px;
  }

  .grid.two {
    grid-template-columns: 340px minmax(0, 1fr);
  }
}
