:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #637083;
  --line: #d8dee8;
  --paper: #fbfcfe;
  --panel: #ffffff;
  --accent: #0f766e;
  --warn: #b45309;
  --danger: #b91c1c;
  --soft: #e7f5f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

button,
.primary,
.day-controls a {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: var(--ink);
  font-weight: 800;
  font-size: 1.15rem;
}

nav {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline {
  display: inline;
}

.link-button {
  border: 0;
  color: var(--accent);
  padding: 0;
}

.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1rem;
}

.power-header,
.quick-capture form,
.planner-actions,
.status-grid,
.dashboard-grid,
.form-grid {
  display: grid;
  gap: 1rem;
}

.power-header {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 1rem;
}

h1,
h2 {
  margin: 0 0 0.5rem;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
  font-size: 1rem;
}

p {
  margin: 0.25rem 0;
}

.day-controls,
.planner-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.quick-capture {
  margin-bottom: 1rem;
}

.quick-capture form {
  grid-template-columns: 1fr auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem;
  background: #fff;
}

.status-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 1rem;
}

.status-grid div,
.band,
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.status-grid span,
.muted,
.noa-item span,
.timeline-row span,
.placement span {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.9fr);
  align-items: start;
}

.main-column,
.side-column {
  display: grid;
  gap: 1rem;
}

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

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.8rem;
  border-left: 6px solid var(--line);
  padding: 0.7rem 0.8rem;
  background: #f8fafc;
  border-radius: 6px;
}

.timeline-row.busy {
  border-left-color: var(--accent);
}

.timeline-row.informational {
  border-left-color: #64748b;
}

.timeline-row.ignored {
  opacity: 0.6;
}

.timeline-row.noa {
  border-left-color: #7c3aed;
}

.focus-block {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--soft);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.conflict {
  border-color: #fed7aa;
}

.noa-item,
.event,
.placement {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: #fff;
}

.noa-item.done {
  opacity: 0.75;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
  align-items: center;
}

.row-actions button {
  padding: 0.3rem 0.5rem;
}

.auth-panel,
.form-band {
  max-width: 860px;
  margin: 2rem auto;
}

.auth-panel form,
.form-band form {
  display: grid;
  gap: 0.8rem;
}

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

.flash-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  background: #eef2ff;
}

.flash.error {
  background: #fee2e2;
  color: var(--danger);
}

.flash.success {
  background: var(--soft);
  color: #115e59;
}

.confirmation-box {
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  padding: 0.8rem;
}

.danger-button {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.calendar-row {
  display: grid;
  grid-template-columns: 90px minmax(180px, 1fr) 180px minmax(160px, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}

.welcome-panel,
.calendar-onboarding {
  max-width: 620px;
  margin: 5rem auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
}

.welcome-panel h1,
.calendar-onboarding h1 {
  font-size: 2rem;
}

.connect-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.connect-actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  padding: 0.7rem 1rem;
  background: #fff;
}

.connect-actions a.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

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

.connections-panel {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.connection-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.connection-card h2 {
  font-size: 1.05rem;
}

.calendar-setup-card {
  display: grid;
  gap: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  text-align: left;
}

.calendar-setup-card h2 {
  font-size: 1.1rem;
}

.calendar-setup-card fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
}

.calendar-setup-card legend {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0 0.25rem;
}

.calendar-setup-card input[type="checkbox"] {
  width: auto;
}

.ready-message {
  color: #115e59;
  font-weight: 700;
}

.compact-header {
  margin-bottom: 1rem;
}

@media (max-width: 860px) {
  .power-header,
  .quick-capture form,
  .dashboard-grid,
  .status-grid,
  .form-grid,
  .calendar-row {
    grid-template-columns: 1fr;
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.power-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.date-line {
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.hero-actions a,
.button-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
}

.daily-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.daily-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.95rem;
}

.daily-summary strong {
  display: block;
  font-size: 1.45rem;
}

.daily-summary span,
.inline-status {
  color: var(--muted);
}

.power-hour-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(520px, 1.8fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.planner-left,
.planner-center,
.planner-right {
  display: grid;
  gap: 1rem;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.quick-panel form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.filter-list,
.filter-checks,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-list a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  color: var(--ink);
  background: #fff;
  font-size: 0.9rem;
}

.filter-list a.active {
  background: var(--soft);
  border-color: #99d6cf;
  color: #115e59;
}

.filter-checks {
  margin-top: 0.8rem;
  display: grid;
}

.action-card,
.waiting-item,
.completed-item,
.pill-event {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.action-card {
  border-left: 5px solid #7c3aed;
}

.action-main span,
.waiting-item span,
.completed-item span,
.pill-event span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.12rem;
}

.schedule-details {
  margin-top: 0.65rem;
}

.schedule-details form,
.compact-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.plan-preview-bar {
  display: grid;
  gap: 0.75rem;
  border: 1px solid #c4b5fd;
  background: #f5f3ff;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.plan-preview-bar form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.all-day-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-event {
  margin: 0;
  border-left: 5px solid #0f766e;
}

.timeline-scroll {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  max-height: 74vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.timeline-scale,
.timeline-canvas {
  position: relative;
  min-height: 900px;
}

.timeline-scale {
  background: #fff;
  border-right: 1px solid var(--line);
  position: sticky;
  left: 0;
  z-index: 2;
}

.time-label {
  position: absolute;
  right: 0.7rem;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline-canvas {
  background-image: linear-gradient(to bottom, rgba(20, 33, 61, 0.07) 1px, transparent 1px);
  background-size: 100% 60px;
}

.open-block,
.timeline-card,
.now-marker {
  position: absolute;
}

.open-block {
  left: 0.5rem;
  right: 0.5rem;
  border: 1px dashed #9ccfc8;
  border-radius: 8px;
  background: rgba(231, 245, 243, 0.72);
  padding: 0.45rem 0.65rem;
  color: #115e59;
  min-height: 28px;
}

.open-block span {
  color: #38736d;
  display: block;
  font-size: 0.82rem;
}

.open-block.drop-ready {
  border-color: #2563eb;
  background: #dbeafe;
}

.timeline-card {
  min-height: 42px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 33, 61, 0.08);
  padding: 0.45rem 0.55rem;
  z-index: 3;
}

.timeline-card.event {
  border-left: 5px solid #0f766e;
}

.timeline-card.action {
  border-left: 5px solid #7c3aed;
}

.timeline-card.preview {
  border: 1px dashed #7c3aed;
  border-left: 5px solid #7c3aed;
  background: #f5f3ff;
}

.timeline-card.has-conflict {
  border-top-color: #b91c1c;
  border-right-color: #b91c1c;
}

.timeline-card span,
.timeline-card em {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.timeline-card b,
.conflict-badge {
  color: #b91c1c;
}

.timeline-card form {
  margin-top: 0.25rem;
}

.timeline-card button {
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
}

.now-marker {
  left: 0;
  right: 0;
  border-top: 2px solid #b91c1c;
  z-index: 5;
}

.now-marker span {
  position: absolute;
  right: 0.5rem;
  top: -0.75rem;
  background: #b91c1c;
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
}

.waiting-item.needs-followup {
  border-color: #f59e0b;
  background: #fffbeb;
}

.sync-panel div {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.week-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.week-calendar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.week-header-row,
.week-all-day-row {
  display: grid;
  grid-template-columns: 76px repeat(7, minmax(132px, 1fr));
}

.week-time-corner,
.week-all-day-label,
.week-day-heading,
.week-all-day-cell {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.week-time-corner,
.week-all-day-label {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.65rem 0.55rem;
  background: #f8fafc;
}

.week-day-heading {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  min-height: 64px;
}

.week-day-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.week-day-heading strong {
  font-size: 0.98rem;
}

.week-day-heading.today,
.week-all-day-cell.today,
.week-day-column.today {
  background-color: #f0fdfa;
}

.week-all-day-cell {
  min-height: 42px;
  padding: 0.35rem;
}

.week-all-day-event {
  border-left: 4px solid var(--accent);
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}

.week-all-day-event span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.week-timeline-scroll {
  display: grid;
  grid-template-columns: 76px minmax(924px, 1fr);
  max-height: calc(100vh - 230px);
  min-height: 620px;
  overflow: auto;
  background: #f8fafc;
}

.week-time-scale,
.week-days-grid,
.week-day-column {
  position: relative;
  min-height: 900px;
}

.week-time-scale {
  border-right: 1px solid var(--line);
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 3;
}

.week-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
}

.week-day-column {
  border-right: 1px solid var(--line);
  background-image: linear-gradient(to bottom, rgba(20, 33, 61, 0.08) 1px, transparent 1px);
  background-size: 100% 60px;
}

.week-open-block {
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  border: 1px dashed #a7d8d2;
  border-radius: 6px;
  background: rgba(231, 245, 243, 0.68);
  color: #115e59;
  padding: 0.32rem 0.4rem;
  min-height: 26px;
  overflow: hidden;
  z-index: 1;
}

.week-open-block strong,
.week-open-block span {
  display: block;
  font-size: 0.76rem;
  line-height: 1.2;
}

.week-open-block span {
  color: #38736d;
}

.week-event-card {
  position: absolute;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  padding: 0.35rem 0.42rem;
  z-index: 2;
  box-shadow: 0 6px 16px rgba(20, 33, 61, 0.08);
}

.week-event-card.read-only {
  border-left-color: #64748b;
  background: #f8fafc;
}

.week-event-card.has-conflict {
  border-top-color: var(--danger);
  border-right-color: var(--danger);
}

.week-event-card strong,
.week-event-card span,
.week-event-card em,
.week-event-card small,
.week-event-card a,
.week-event-card b {
  display: block;
  line-height: 1.18;
}

.week-event-card strong {
  font-size: 0.8rem;
}

.week-event-card span,
.week-event-card em,
.week-event-card small {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
}

.week-event-card b {
  color: var(--danger);
  font-size: 0.7rem;
}

.mobile-day-nav {
  display: none;
}

@media (max-width: 1100px) {
  .power-hour-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .planner-center {
    order: 1;
  }

  .planner-left {
    order: 2;
  }

  .planner-right {
    order: 3;
  }

  .timeline-scroll {
    max-height: 68vh;
  }
}

@media (max-width: 700px) {
  .power-hero,
  .week-hero,
  .daily-summary,
  .quick-panel form {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .timeline-scroll {
    grid-template-columns: 58px minmax(560px, 1fr);
    overflow-x: auto;
  }

  .time-label {
    font-size: 0.75rem;
    right: 0.45rem;
  }

  .mobile-day-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
  }

  .mobile-day-nav a {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    padding: 0.5rem 0.6rem;
    background: #fff;
  }

  .mobile-day-nav span {
    color: var(--muted);
    font-size: 0.9rem;
  }

  .week-header-row,
  .week-all-day-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .week-day-heading,
  .week-all-day-cell,
  .week-day-column {
    display: none;
  }

  .week-day-heading.mobile-selected,
  .week-all-day-cell.mobile-selected,
  .week-day-column.mobile-selected {
    display: block;
  }

  .week-timeline-scroll {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 620px;
  }

  .week-days-grid {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }
}
