:root {
  --bg: #090b12;
  --bg-soft: #0f1320;
  --panel: rgba(18, 23, 36, 0.88);
  --panel-strong: #151b2a;
  --panel-soft: rgba(31, 38, 58, 0.78);
  --text: #eef3ff;
  --muted: #8f9ab8;
  --accent: #d7b46a;
  --accent-soft: rgba(215, 180, 106, 0.14);
  --accent-strong: #f1d28d;
  --success: #57c08b;
  --warning: #ffb454;
  --danger: #ff6d7a;
  --border: rgba(170, 187, 228, 0.12);
  --border-strong: rgba(215, 180, 106, 0.24);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(215, 180, 106, 0.12) 0%, rgba(215, 180, 106, 0) 34%),
    radial-gradient(circle at top right, rgba(102, 122, 255, 0.12) 0%, rgba(102, 122, 255, 0) 28%),
    linear-gradient(180deg, #0b0e16 0%, #090b12 100%);
  color: var(--text);
}

a { color: inherit; }
hr { opacity: 0.5; }

.login-body {
  min-height: 100vh;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
}

.login-brand {
  margin-bottom: 18px;
}

.login-form {
  margin-top: 18px;
}

.login-button {
  width: 100%;
}

.login-error {
  color: var(--danger);
  font-weight: 600;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  background: rgba(8, 11, 18, 0.92);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 30px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18, 23, 36, 0.95) 0%, rgba(12, 16, 26, 0.95) 100%);
  box-shadow: var(--shadow);
}

.brand h1, .brand p {
  margin: 0;
}
.brand h1 {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.brand p {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 4px;
}
.brand-kicker {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: linear-gradient(145deg, #e7c67f, #a9823c);
  color: #111522;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: 0 18px 38px rgba(215, 180, 106, 0.2);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  padding: 14px 15px;
  border-radius: 16px;
  cursor: pointer;
  color: #d8e1f7;
  font-size: 0.94rem;
  transition: 160ms ease;
}

.nav-button.active,
.nav-button:hover {
  background: linear-gradient(180deg, rgba(215, 180, 106, 0.15) 0%, rgba(215, 180, 106, 0.08) 100%);
  border-color: var(--border-strong);
  color: #fff6da;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.main-content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 24px;
  padding: 10px 4px 16px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-strong);
  margin: 0 0 8px;
}

.topbar h2 {
  margin: 0;
  font-size: 2.15rem;
  letter-spacing: -0.03em;
}

.page-surface {
  display: block;
}

.ghost-button,
.primary-button,
.inline-button {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: 160ms ease;
}
.ghost-button {
  background: rgba(21, 27, 42, 0.92);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.ghost-button:hover,
.inline-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row-actions,
.form-actions,
.brain-dump-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-label {
  display: inline-flex;
  align-items: center;
}
.primary-button {
  background: linear-gradient(180deg, #e6c37e 0%, #b38a48 100%);
  color: #151821;
  border-color: rgba(255,255,255,0.1);
}
.inline-button {
  background: rgba(32, 39, 58, 0.96);
  color: #f4f7ff;
  border-color: var(--border);
}

.danger-button {
  border-color: rgba(255,109,122,.25);
  color: #ffd3d8;
}

.grid {
  display: grid;
  gap: 18px;
}
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: linear-gradient(180deg, rgba(18, 23, 36, 0.96) 0%, rgba(13, 17, 28, 0.96) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  pointer-events: none;
}
.card h3, .card h4, .card p { margin-top: 0; position: relative; }
.card h3 {
  margin-bottom: 12px;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}
.card h4 { margin-bottom: 8px; color: #eef4ff; }
.card p:last-child { margin-bottom: 0; }

.metric {
  font-size: 2.1rem;
  font-weight: 800;
  margin: 10px 0 4px;
  letter-spacing: -0.04em;
}
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: #f4dfae;
  border: 1px solid rgba(215, 180, 106, 0.18);
}
.badge.success { background: rgba(87,192,139,.14); color: var(--success); border-color: rgba(87,192,139,.18); }
.badge.warning { background: rgba(255,180,84,.12); color: var(--warning); border-color: rgba(255,180,84,.18); }
.badge.danger { background: rgba(255,109,122,.12); color: var(--danger); border-color: rgba(255,109,122,.18); }

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compact-stack {
  gap: 8px;
}

.calendar-day {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(21, 27, 42, 0.55);
}

.calendar-day h4 {
  margin-bottom: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.calendar-header {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  padding-bottom: 6px;
}

.calendar-cell {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  background: rgba(21, 27, 42, 0.45);
}

.calendar-cell.empty {
  background: rgba(255,255,255,0.02);
}

.calendar-cell.has-items {
  border-color: var(--border-strong);
}

.calendar-cell-day {
  font-weight: 700;
  margin-bottom: 8px;
}

.calendar-cell-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

 .calendar-chip,
.calendar-more {
  font-size: 0.74rem;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(215, 180, 106, 0.12);
  color: #f7e6bc;
}

.gap-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(21, 27, 42, 0.45);
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  align-items: start;
}
.kv div:nth-child(odd) { color: var(--muted); }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.filter-field,
.filter-check {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-field input,
.filter-field select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(11, 15, 24, 0.96);
}
.filter-field input::placeholder,
.form-grid textarea::placeholder {
  color: #6f7a98;
}

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

.filter-check {
  justify-content: end;
  color: var(--text);
}

.filter-check input {
  margin-right: 8px;
}

.prompt-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.form-grid textarea {
  min-height: 84px;
  resize: vertical;
}

.brain-dump-textarea {
  min-height: 220px;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.compact-stack {
  gap: 0;
}

.brain-dump-entry,
.execution-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px;
  background: linear-gradient(180deg, rgba(24, 31, 47, 0.92) 0%, rgba(16, 21, 32, 0.92) 100%);
}

.brain-dump-actions,
.execution-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.execution-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

@media (max-width: 1100px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .grid.cols-4, .grid.cols-3, .grid.cols-2, .form-grid { grid-template-columns: 1fr; }
  .filter-toolbar { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .main-content { padding: 20px; }
}
