:root {
  color-scheme: dark;
  --bg: #03040a;
  --panel: rgba(12, 15, 30, 0.9);
  --panel-2: rgba(19, 24, 46, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f7f8ff;
  --muted: #a9adbc;
  --accent: #ff304f;
  --accent-2: #1677ff;
  --good: #72dda6;
  --danger: #ff6b7a;
  --radius: 22px;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.45);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 0%, rgba(22, 119, 255, 0.2), transparent 34%),
    radial-gradient(circle at 86% 20%, rgba(255, 48, 79, 0.18), transparent 30%),
    #03040a;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-pill,
.date-pill {
  min-width: 170px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.status-pill.is-online {
  border-color: rgba(114, 221, 166, 0.35);
  color: var(--good);
}

.app-frame {
  display: grid;
  grid-template-columns: 270px 1fr;
  max-width: 1220px;
  min-height: 720px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(10, 11, 14, 0.78);
  box-shadow: var(--shadow);
}

aside {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 24px;
}

.nav-title {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin-bottom: 10px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-button.is-active,
.nav-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.db-card {
  margin-top: 34px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.db-card strong,
.db-card span {
  display: block;
}

.db-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

main {
  padding: clamp(22px, 4vw, 42px);
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.screen-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.screen-header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 3.1rem);
  letter-spacing: 0;
}

.screen-header p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.entry-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

.form-card {
  padding: clamp(20px, 4vw, 32px);
}

.field {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
}

input:focus {
  border-color: color-mix(in srgb, var(--accent), white 25%);
}

.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
  font-weight: 750;
}

.form-message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
}

.form-message.is-success {
  color: var(--good);
}

.form-message.is-error {
  color: var(--danger);
}

.session-preview {
  padding: 24px;
  background: var(--panel-2);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  color: var(--muted);
}

.metric-row strong {
  font-size: 1.18rem;
  text-align: right;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  min-height: 136px;
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
}

.chart-panel {
  padding: 26px;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.chart-title strong {
  color: var(--text);
}

.chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 10px;
  height: 260px;
  padding-top: 18px;
}

.bar-wrap {
  display: grid;
  align-items: end;
  gap: 8px;
  height: 100%;
}

.bar {
  min-height: 8px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.bar-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 18px;
  }

  .topbar,
  .screen-header {
    align-items: stretch;
    flex-direction: column;
  }

  .app-frame,
  .entry-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .chart {
    gap: 6px;
    height: 210px;
  }

  .bar-label {
    display: none;
  }
}
