:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-muted: #eef4fb;
  --border: #d4deea;
  --ink: #102036;
  --muted: #60738a;
  --primary: #1f4b8f;
  --primary-deep: #163868;
  --teal: #0f766e;
  --amber: #d97706;
  --danger: #c2410c;
  --shadow: 0 18px 40px rgba(15, 37, 63, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: "IBM Plex Sans", "PingFang SC", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(31, 75, 143, 0.12), transparent 32%),
    radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

body.drawer-open {
  overflow: hidden;
}

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

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
}

.eyebrow, .brand-kicker {
  margin-bottom: 0.4rem;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, #10274b 0%, #173a68 100%);
  color: rgba(255, 255, 255, 0.9);
}

.brand-panel,
.sidebar-footer {
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.brand-panel h2,
.sidebar-user {
  color: #fff;
}

.sidebar-nav {
  display: grid;
  gap: 0.6rem;
}

.nav-link {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.78);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-role {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  opacity: 0.78;
}

.full-width {
  width: 100%;
}

.app-main {
  padding: 1.6rem;
}

.topbar,
.section-heading,
.detail-header,
.inline-row,
.inline-actions,
.table-primary,
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  margin-bottom: 1.2rem;
}

.topbar h1 {
  font-size: 2rem;
}

.topbar-meta {
  display: flex;
  gap: 0.6rem;
}

.meta-pill {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(31, 75, 143, 0.08);
  color: var(--primary);
  font-size: 0.9rem;
}

.content-shell,
.dashboard-grid,
.detail-grid {
  display: grid;
  gap: 1.2rem;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.scope-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.detail-grid {
  grid-template-columns: 360px 1fr;
  margin-top: 1.2rem;
}

.detail-grid.single-column {
  grid-template-columns: 1fr;
}

.panel-card,
.summary-card,
.flash,
.empty-card,
.reminder-banner,
.login-form,
.login-copy {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.panel-card,
.flash,
.empty-card,
.reminder-banner,
.login-form,
.login-copy {
  padding: 1.25rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.summary-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  padding: 1.1rem;
}

.summary-label {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.summary-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
}

.summary-card.tone-info .summary-value { color: var(--primary); }
.summary-card.tone-success .summary-value { color: var(--teal); }
.summary-card.tone-warning .summary-value { color: var(--amber); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #2d63b3);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.05);
}

.button-secondary {
  background: rgba(31, 75, 143, 0.1);
  color: var(--primary);
}

.button-ghost {
  background: rgba(15, 32, 54, 0.06);
  color: var(--ink);
}

.button.is-selected {
  box-shadow: inset 0 0 0 2px rgba(31, 75, 143, 0.18);
}

.flash {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash-success { border-color: rgba(15, 118, 110, 0.26); }
.flash-error { border-color: rgba(194, 65, 12, 0.28); }

.filter-bar,
.form-grid,
.info-grid {
  display: grid;
  gap: 1rem;
}

.filter-bar {
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr)) auto;
  margin-bottom: 1rem;
}

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

.compact-form {
  margin-top: 1rem;
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-group.grow {
  min-width: 0;
}

.field-group label {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.field-group textarea {
  resize: vertical;
}

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

.form-actions,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.table-shell {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 32, 54, 0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 1rem 0.9rem;
  border-bottom: 1px solid rgba(16, 32, 54, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table thead {
  background: var(--surface-muted);
}

.data-table tbody tr:hover {
  background: rgba(31, 75, 143, 0.03);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.tone-neutral { background: rgba(96, 115, 138, 0.12); color: var(--ink); }
.tone-info { background: rgba(31, 75, 143, 0.12); color: var(--primary); }
.tone-success { background: rgba(15, 118, 110, 0.12); color: var(--teal); }
.tone-warning { background: rgba(217, 119, 6, 0.14); color: var(--amber); }
.tone-danger { background: rgba(194, 65, 12, 0.14); color: var(--danger); }

.stack-list {
  display: grid;
  gap: 0.8rem;
}

.stack-row,
.reminder-row,
.metric-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-muted);
}

.stack-link:hover {
  transform: translateY(-1px);
}

.stack-meta {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
}

.info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.info-grid dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.info-grid dd {
  margin: 0.2rem 0 0;
  color: var(--ink);
  font-weight: 600;
}

.notes-block,
.follow-up-box {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(16, 32, 54, 0.08);
}

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 1rem;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  box-shadow: 0 0 0 6px rgba(31, 75, 143, 0.1);
}

.timeline-card {
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-muted);
}

.timeline-meta,
.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 54, 0.5);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100%;
  padding: 1.2rem;
  background: rgba(250, 252, 255, 0.98);
  box-shadow: -16px 0 40px rgba(16, 32, 54, 0.18);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.drawer-body {
  margin-top: 1rem;
  overflow: auto;
  max-height: calc(100vh - 110px);
  padding-right: 0.2rem;
}

.reminder-banner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.banner-title {
  color: var(--ink);
  font-weight: 700;
}

.calendar-shell {
  margin-bottom: 1rem;
}

.view-toggle {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.calendar-day,
.week-row {
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-muted);
}

.calendar-day header,
.week-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.calendar-list,
.week-posts {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.calendar-post,
.week-pill {
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: #fff;
}

.week-pill {
  display: flex;
  justify-content: space-between;
}

.empty-card {
  text-align: center;
}

.pulse-focus {
  animation: pulse-focus 1.5s ease;
}

@keyframes pulse-focus {
  0% { box-shadow: 0 0 0 0 rgba(31, 75, 143, 0.3); }
  100% { box-shadow: 0 0 0 18px rgba(31, 75, 143, 0); }
}

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

.login-card {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.2rem;
  max-width: 1080px;
  width: 100%;
}

.login-copy,
.login-form {
  min-height: 100%;
}

.login-copy {
  display: grid;
  gap: 1rem;
  padding: 2rem;
  background:
    linear-gradient(145deg, rgba(31, 75, 143, 0.92), rgba(15, 118, 110, 0.82)),
    #173a68;
  color: rgba(255, 255, 255, 0.9);
}

.login-copy h1,
.login-copy p,
.demo-note,
.demo-note span {
  color: #fff;
}

.account-list {
  display: grid;
  gap: 0.8rem;
}

.demo-note {
  display: inline-grid;
  gap: 0.3rem;
  width: fit-content;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-list {
  display: grid;
  gap: 0.9rem;
}

.progress-row {
  display: grid;
  gap: 0.55rem;
}

.progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 32, 54, 0.08);
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
}

@media (max-width: 1100px) {
  .summary-grid,
  .summary-grid.compact,
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .detail-grid,
  .login-card,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }
}

@media (max-width: 760px) {
  .app-main,
  .sidebar,
  .login-shell {
    padding: 1rem;
  }

  .summary-grid,
  .summary-grid.compact,
  .dashboard-grid,
  .filter-bar,
  .form-grid,
  .info-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading,
  .detail-header,
  .scope-banner,
  .stack-row,
  .metric-row,
  .reminder-row,
  .reminder-banner,
  .inline-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .drawer-panel {
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(16, 32, 54, 0.08);
  }

  .data-table td {
    padding: 0.4rem 0;
    border-bottom: none;
  }
}
