
:root {
  color-scheme: light;
  --bg: #f7f7f2;
  --ink: #111827;
  --muted: #69716d;
  --surface: #ffffff;
  --line: #deded6;
  --green: #0d6b57;
  --red: #d94d42;
  --gold: #a77319;
  --blue: #286f9e;
  --shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 247, 242, 0.96)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

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

.auth-panel {
  width: min(100%, 470px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-lock,
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.auth-panel h1,
.hero-band h1,
.detail-panel h1 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-panel h1 {
  margin-top: 12px;
  font-size: 42px;
}

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

.muted,
.small-muted {
  color: var(--muted);
  line-height: 1.6;
}

.small-muted {
  margin: 18px 0 0;
  font-size: 13px;
}

.primary-action,
.ghost-action,
.back-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 850;
  text-decoration: none;
}

.primary-action {
  margin-top: 18px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
}

.ghost-action,
.back-link {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.missing-list code {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4eee3;
  color: #5e2d21;
  font-size: 13px;
}

.hub-shell {
  width: min(100%, 1260px);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 40px) 54px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.account-pill {
  min-width: 0;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.account-pill span:last-child,
.account-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  object-fit: cover;
  background: var(--ink);
  color: #fff;
}

.avatar-fallback {
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.55fr);
  align-items: end;
  gap: clamp(20px, 3vw, 38px);
  min-height: 250px;
  margin-bottom: 26px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.hero-band h1 {
  max-width: 840px;
  font-size: clamp(32px, 3vw, 48px);
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

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

.agenda-section {
  margin: 0 0 20px;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 42px rgba(17, 24, 39, 0.08);
}

.calendar-sync-section {
  margin: 0 0 20px;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 42px rgba(17, 24, 39, 0.06);
}

.calendar-sync-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.calendar-sync-accounts {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.calendar-sync-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.calendar-sync-account strong,
.calendar-sync-account span {
  display: block;
}

.calendar-sync-account span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-sync-connect {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.calendar-sync-connected {
  color: var(--green) !important;
  font-size: 20px !important;
  font-weight: 800;
}

.agenda-heading,
.agenda-panel-heading,
.agenda-task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.agenda-heading h2,
.agenda-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.agenda-heading h2 {
  font-size: clamp(24px, 2.4vw, 30px);
}

.agenda-refresh {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.agenda-refresh:disabled {
  cursor: wait;
  opacity: 0.55;
}

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

.agenda-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 12px;
}

.agenda-stat {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 12px;
  border-left: 4px solid var(--line);
  background: #f8faf9;
}

.agenda-stat strong {
  font-size: 23px;
  line-height: 1;
}

.agenda-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.agenda-stat.overdue { border-color: var(--red); }
.agenda-stat.today { border-color: var(--gold); }
.agenda-stat.upcoming { border-color: var(--green); }
.agenda-stat.attention { border-color: var(--blue); }

.agenda-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}

.agenda-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agenda-panel h3 {
  font-size: 17px;
}

.agenda-panel-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.agenda-panel-heading > div:first-child > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.agenda-panel-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.agenda-calendar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agenda-calendar-button {
  min-width: 30px;
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.agenda-calendar-button:hover,
.agenda-calendar-button:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.agenda-calendar-today {
  min-width: 48px;
}

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

.agenda-day {
  min-width: 0;
  min-height: 60px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f7f2;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.agenda-day.is-today {
  border-color: var(--ink);
  background: #fff;
}

.agenda-day:hover,
.agenda-day:focus-visible,
.agenda-day.is-selected {
  border-color: var(--green);
  background: #eff8f3;
  outline: none;
}

.agenda-day.is-selected {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(13, 107, 87, 0.12);
}

.agenda-day-name,
.agenda-day-marker {
  min-height: 15px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.agenda-day strong {
  font-size: 18px;
}

.agenda-day-marker {
  color: var(--red);
}

.agenda-selected-day {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.agenda-selected-day h4 {
  margin: 0 0 2px;
  font-size: 14px;
}

.agenda-selected-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: #f7faf8;
  text-decoration: none;
}

.agenda-selected-item.source-accounting { border-left-color: var(--red); }
.agenda-selected-item.source-reality { border-left-color: var(--gold); }

.agenda-selected-item strong {
  font-size: 13px;
}

.agenda-selected-item span {
  color: var(--muted);
  font-size: 12px;
}

.agenda-tasks {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.agenda-task {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  text-decoration: none;
}

.agenda-task.source-nemo { border-left-color: var(--green); }
.agenda-task.source-accounting { border-left-color: var(--red); }
.agenda-task.source-reality { border-left-color: var(--gold); }

.agenda-task-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.agenda-task-meta span:last-child {
  color: var(--ink);
}

.agenda-task strong {
  font-size: 15px;
}

.agenda-task p,
.agenda-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.agenda-task p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.application-card {
  position: relative;
  min-height: 235px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 42px rgba(17, 24, 39, 0.08);
  overflow: hidden;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.application-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--green);
}

.application-card.red::before {
  background: var(--red);
}

.application-card.gold::before {
  background: var(--gold);
}

.application-card.blue::before {
  background: var(--blue);
}

.application-card:hover {
  transform: translateY(-4px);
  border-color: rgba(17, 24, 39, 0.28);
  box-shadow: 0 26px 80px rgba(17, 24, 39, 0.15);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-topline strong {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  letter-spacing: 0;
}

.card-icon,
.detail-icon {
  display: inline-grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: #ecf7f3;
  color: var(--green);
  font-size: 22px;
  font-weight: 950;
}

.red .card-icon,
.red .detail-icon {
  background: #fff0ed;
  color: var(--red);
}

.gold .card-icon,
.gold .detail-icon {
  background: #fff5df;
  color: var(--gold);
}

.blue .card-icon,
.blue .detail-icon {
  background: #eaf5fb;
  color: var(--blue);
}

.application-card h2 {
  margin: 0 0 10px;
  font-size: clamp(25px, 2.1vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.application-card p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.detail-shell {
  min-height: 100vh;
}

.detail-panel {
  min-height: 560px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(24px, 6vw, 76px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.detail-panel h1 {
  font-size: clamp(46px, 7vw, 96px);
}

.detail-panel p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.detail-status {
  width: min(100%, 620px);
  margin-top: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  line-height: 1.5;
}

@media (min-width: 1150px) {
  .hero-band h1 {
    max-width: none;
    white-space: nowrap;
  }
}

@media (max-width: 1040px) {
  .application-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hub-header,
  .hero-band {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .hub-header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

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

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

@media (max-width: 560px) {
  .auth-panel {
    padding: 24px;
  }

  .auth-panel h1 {
    font-size: 34px;
  }

  .hub-shell {
    padding: 18px 14px 38px;
  }

  .hero-band {
    min-height: auto;
    padding: 24px;
  }

  .hero-band h1 {
    font-size: 34px;
  }

  .hero-copy {
    font-size: 16px;
  }

  .application-card {
    min-height: 220px;
    padding: 20px;
  }

  .application-card h2 {
    font-size: 30px;
  }

  .account-pill {
    max-width: 210px;
  }

  .agenda-section {
    padding: 16px;
  }

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

  .agenda-day {
    min-height: 58px;
  }
}
