:root {
  color-scheme: dark;
  --bg: #090b11;
  --panel: rgba(17, 21, 31, 0.88);
  --panel-2: #1a2130;
  --panel-3: #111827;
  --border: #2a3346;
  --text: #f3f6fb;
  --muted: #9cabc6;
  --accent: #62a5ff;
  --accent-2: #8b5cf6;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(98, 165, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.16), transparent 22%),
    linear-gradient(180deg, #05070c 0%, #0b1020 100%);
}

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

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

.sidebar {
  border-right: 1px solid var(--border);
  padding: 28px;
  background: rgba(7, 10, 17, 0.84);
  backdrop-filter: blur(16px);
}

.main {
  padding: 28px;
}

.brand-block {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.subtle,
label,
li,
.stats,
.mini-muted {
  color: var(--muted);
}

.panel,
.card,
.hero,
.pipeline-card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-top: 18px;
}

.panel h2 {
  margin-bottom: 14px;
}

.panel ul {
  padding-left: 18px;
  margin-bottom: 0;
}

input[type="date"],
input[type="text"],
input[type="password"],
.title-input,
.content-input,
.notes-input,
select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 6px;
}

.title-input {
  font-weight: 700;
}

.content-input,
.notes-input {
  resize: vertical;
  line-height: 1.55;
}

.content-input {
  min-height: 220px;
}

.notes-input {
  min-height: 150px;
}

.stack-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

button {
  margin-top: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: #263146;
}

button.danger-button {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  margin-bottom: 22px;
}

.flash {
  color: var(--muted);
  min-height: 24px;
  font-weight: 700;
}

.flash[data-tone="error"],
.login-error {
  color: #ffb0b0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 16px 18px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
  gap: 22px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}

.card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-header,
.card-footer,
.pipeline-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-footer {
  align-items: end;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(180px, 0.75fr);
  gap: 16px;
}

.side-controls {
  display: grid;
  gap: 12px;
}

.mini-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.meta-badges,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: start;
  justify-content: end;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: #1f293b;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}

.day-name {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
}

.actions button {
  width: auto;
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.pipeline-list {
  display: grid;
  gap: 12px;
}

.pipeline-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.pipeline-card:hover,
.pipeline-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(26, 33, 48, 0.96);
  outline: none;
}

.pipeline-card h3 {
  margin-bottom: 8px;
}

.pipeline-excerpt {
  margin-bottom: 10px;
  color: #dfe7f6;
  line-height: 1.5;
}

.pipeline-hint {
  margin-bottom: 0;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}

.modal-shell.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.76);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-header,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.modal-close-button {
  width: auto;
  margin-top: 0;
}

.modal-content {
  white-space: pre-wrap;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
  line-height: 1.6;
  overflow: auto;
}

.card-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(98, 165, 255, 0.45), var(--shadow);
}

.insight-list {
  display: grid;
  gap: 12px;
}

.insight-row {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.insight-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.login-body {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(460px, calc(100vw - 32px));
}

.login-card {
  margin: 40px auto;
}

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

.login-form button {
  margin-top: 6px;
}

@media (max-width: 1200px) {
  .workspace-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .hero,
  .card-header,
  .card-footer,
  .pipeline-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-badges,
  .actions {
    justify-content: start;
  }
}
