:root {
  color-scheme: light;
  --ink: #1f2428;
  --muted: #6f756c;
  --paper: #fbfaf6;
  --surface: #ffffff;
  --line: #dfded5;
  --brand: #245e57;
  --brand-2: #c64f3b;
  --amber: #e2a936;
  --blue: #3576c7;
  --green: #2c8d5b;
  --shadow: 0 18px 50px rgba(31, 36, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(198, 79, 59, 0.12), transparent 32rem),
    linear-gradient(145deg, #f8f4ea 0%, #eef4f1 55%, #f8f4ea 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(100%, 31rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    linear-gradient(rgba(251, 250, 246, 0.86), rgba(238, 244, 241, 0.88)),
    url("https://images.unsplash.com/photo-1513258496099-48168024aec0?auto=format&fit=crop&w=1100&q=80") center/cover;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(100%, 27rem);
  padding: 1.15rem;
  border: 1px solid rgba(223, 222, 213, 0.9);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 2.1rem;
  line-height: 1;
}

.login-card p {
  color: var(--muted);
  line-height: 1.45;
}

.login-card code {
  font-size: 0.84em;
}

.status-banner {
  margin-top: 0.8rem;
  padding: 0.75rem;
  border: 1px solid rgba(198, 79, 59, 0.24);
  border-radius: 0.75rem;
  background: rgba(198, 79, 59, 0.08);
  color: var(--brand-2);
  font-size: 0.82rem;
  font-weight: 750;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0 0.7rem;
  backdrop-filter: blur(18px);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.db-pill {
  max-width: 6.5rem;
  padding: 0.42rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 820;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-pill.online {
  border-color: rgba(44, 141, 91, 0.3);
  background: rgba(44, 141, 91, 0.12);
  color: #17613d;
}

.topbar h1,
.section-head h3,
.hero-copy h2,
.modal-form h3 {
  margin: 0;
  letter-spacing: 0;
}

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

.eyebrow {
  margin: 0 0 0.18rem;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.icon-button,
.ghost-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(31, 36, 40, 0.08);
}

.fallback-icon {
  display: none;
  font-size: 0.7rem;
}

svg {
  width: 1.1rem;
  height: 1.1rem;
}

i[data-lucide] {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  font-style: normal;
}

i[data-lucide="plus"]::before,
i[data-lucide="message-square-plus"]::before {
  content: "+";
}

i[data-lucide="x"]::before {
  content: "x";
}

i[data-lucide="trash-2"]::before {
  content: "Del";
  font-size: 0.62rem;
}

i[data-lucide="check"]::before {
  content: "OK";
  font-size: 0.62rem;
}

i[data-lucide="refresh-cw"]::before {
  content: "Sync";
  font-size: 0.62rem;
}

i[data-lucide="download"]::before {
  content: "Down";
  font-size: 0.62rem;
}

i[data-lucide="copy"]::before {
  content: "Copy";
  font-size: 0.62rem;
}

i[data-lucide="layout-dashboard"]::before {
  content: "Today";
  font-size: 0.58rem;
}

i[data-lucide="calendar-days"]::before {
  content: "Week";
  font-size: 0.58rem;
}

i[data-lucide="target"]::before {
  content: "Goal";
  font-size: 0.58rem;
}

i[data-lucide="archive"]::before {
  content: "Vault";
  font-size: 0.58rem;
}

i[data-lucide="messages-square"]::before {
  content: "Chat";
  font-size: 0.58rem;
}

i[data-lucide="settings"]::before {
  content: "Set";
  font-size: 0.58rem;
}

i[data-lucide="log-out"]::before {
  content: "Out";
  font-size: 0.62rem;
}

i[data-lucide="send"]::before {
  content: "Send";
  font-size: 0.58rem;
}

svg + .fallback-icon,
svg::before {
  display: none;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  min-height: 11.5rem;
  padding: 1.1rem;
  border: 1px solid rgba(36, 94, 87, 0.2);
  border-radius: 1.2rem;
  background:
    linear-gradient(rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.74)),
    url("https://images.unsplash.com/photo-1456513080510-7bf3a84b82f8?auto=format&fit=crop&w=900&q=80") center/cover;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy p {
  max-width: 16rem;
  margin: 0.55rem 0 0;
  color: #4f554f;
  font-size: 0.9rem;
  line-height: 1.45;
}

.hero-copy p:first-child {
  margin: 0 0 0.35rem;
  color: var(--brand-2);
  font-size: 0.76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.hero-copy h2 {
  max-width: 15rem;
  font-size: clamp(1.55rem, 8vw, 2.15rem);
  line-height: 1.02;
}

.focus-ring {
  display: grid;
  place-items: center;
  align-content: center;
  width: 6rem;
  aspect-ratio: 1;
  border: 0.55rem solid rgba(36, 94, 87, 0.18);
  border-top-color: var(--green);
  border-right-color: var(--blue);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
}

.focus-ring span {
  font-size: 1.25rem;
  font-weight: 850;
}

.focus-ring small {
  color: var(--muted);
  font-size: 0.7rem;
}

.identity-switch,
.view-tabs,
.quick-stats,
.vault-filters {
  display: grid;
  gap: 0.55rem;
}

.identity-switch {
  grid-template-columns: 1fr 1fr;
  margin: 1rem 0;
}

.student-tab,
.view-tab,
.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

.student-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  padding: 0.82rem;
  border-radius: 0.7rem;
  text-align: left;
}

.student-tab span {
  font-weight: 800;
}

.student-tab small {
  color: var(--muted);
}

.student-tab.active,
.view-tab.active,
.pill.active {
  border-color: transparent;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 28px rgba(31, 36, 40, 0.16);
}

.student-tab.active small {
  color: rgba(255, 255, 255, 0.72);
}

.quick-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.quick-stats article {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.72);
}

.quick-stats strong {
  display: block;
  font-size: 1.25rem;
}

.quick-stats span {
  color: var(--muted);
  font-size: 0.75rem;
}

.view-tabs {
  position: sticky;
  top: 4.2rem;
  z-index: 15;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 0.38rem;
  border: 1px solid rgba(223, 222, 213, 0.9);
  border-radius: 0.9rem;
  background: rgba(251, 250, 246, 0.8);
  backdrop-filter: blur(16px);
}

.view-tab {
  display: grid;
  place-items: center;
  gap: 0.25rem;
  min-height: 3.1rem;
  border-radius: 0.65rem;
  font-size: 0.68rem;
  font-weight: 760;
}

.view {
  display: none;
  padding-top: 1rem;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0.2rem 0 0.75rem;
}

.section-head h3 {
  font-size: 1.1rem;
}

.section-head.compact {
  margin-top: 1.25rem;
}

.small-action,
.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  border: 0;
  border-radius: 0.65rem;
  font-weight: 780;
}

.small-action {
  min-height: 2.45rem;
  padding: 0 0.75rem;
  background: var(--brand);
  color: #fff;
}

.primary-action,
.secondary-action {
  min-height: 3rem;
  padding: 0 1rem;
}

.primary-action {
  background: var(--ink);
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.today-stack,
.timeline,
.goal-board,
.vault-list,
.suggestion-list {
  display: grid;
  gap: 0.7rem;
}

.chat-panel,
.settings-panel,
.setup-panel {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(31, 36, 40, 0.07);
}

.settings-panel label {
  display: grid;
  gap: 0.38rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.settings-panel input,
.settings-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.78rem;
  background: #fff;
  color: var(--ink);
}

.setup-panel {
  margin-top: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.setup-panel strong {
  color: var(--ink);
}

.chat-panel {
  min-height: 28rem;
  grid-template-rows: 1fr auto;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 22rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.chat-bubble {
  width: fit-content;
  max-width: min(82%, 22rem);
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fff;
}

.chat-bubble.mine {
  align-self: flex-end;
  border-color: rgba(36, 94, 87, 0.22);
  background: rgba(36, 94, 87, 0.1);
}

.chat-bubble strong {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--brand);
  font-size: 0.72rem;
}

.chat-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.38;
}

.chat-time {
  display: block;
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.66rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.chat-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.78rem;
  background: #fff;
  color: var(--ink);
}

.owned-lock {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.5rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: rgba(31, 36, 40, 0.08);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
}

.task-card,
.routine-card,
.goal-card,
.vault-card,
.suggestion-card,
.partner-card {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(31, 36, 40, 0.07);
}

.task-card,
.routine-card,
.goal-card,
.vault-card,
.suggestion-card {
  padding: 0.85rem;
}

.partner-card {
  padding: 1rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
}

.card-top strong {
  display: block;
  margin-bottom: 0.18rem;
}

.meta,
.card-sub {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.marker-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
  margin-top: 0.7rem;
}

.marker {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 780;
}

.marker[data-status="Complete"].active {
  background: rgba(44, 141, 91, 0.15);
  border-color: var(--green);
  color: #17613d;
}

.marker[data-status="Partial"].active {
  background: rgba(53, 118, 199, 0.14);
  border-color: var(--blue);
  color: #235a9c;
}

.marker[data-status="Backlogged"].active {
  background: rgba(226, 169, 54, 0.18);
  border-color: var(--amber);
  color: #8a5d0f;
}

.routine-validity {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.weekday-strip,
.vault-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.75rem;
}

.day-chip,
.pill {
  min-height: 2.45rem;
  border-radius: 999px;
  font-weight: 760;
}

.day-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.day-chip.active {
  background: var(--brand-2);
  color: #fff;
  border-color: transparent;
}

.routine-card {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.8rem;
  align-items: start;
}

.time-block {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.45rem;
  padding: 0.28rem 0.48rem;
  border-radius: 999px;
  background: rgba(36, 94, 87, 0.1);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 780;
}

.goal-card.test {
  border-color: rgba(198, 79, 59, 0.35);
}

.goal-card .date-badge {
  min-width: 4.2rem;
  padding: 0.45rem;
  border-radius: 0.6rem;
  background: rgba(198, 79, 59, 0.12);
  color: var(--brand-2);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 850;
}

.progress-bar {
  height: 0.55rem;
  margin-top: 0.75rem;
  border-radius: 999px;
  background: #ecebe4;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: var(--progress);
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.range-label {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.range-label input {
  width: 100%;
  accent-color: var(--brand);
}

.vault-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

.deadline {
  color: var(--brand-2);
  font-size: 0.74rem;
  font-weight: 840;
  white-space: nowrap;
}

.empty {
  padding: 1.1rem;
  border: 1px dashed #c9c7bd;
  border-radius: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 120;
  transform: translate(-50%, 150%);
  width: min(calc(100vw - 2rem), 27rem);
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  transition: transform 180ms ease;
}

.toast.visible {
  transform: translate(-50%, 0);
}

dialog {
  width: min(calc(100vw - 2rem), 29rem);
  border: 0;
  border-radius: 1rem;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(31, 36, 40, 0.38);
  backdrop-filter: blur(6px);
}

.modal-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.modal-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-form label {
  display: grid;
  gap: 0.38rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.78rem;
  background: #fff;
  color: var(--ink);
}

.modal-form textarea {
  resize: vertical;
}

.grid-2,
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.modal-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.sync-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

@media (max-width: 390px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .focus-ring {
    justify-self: start;
    width: 5.4rem;
  }

  .view-tab span {
    display: none;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}
