/* Shared Focusly palette: pink leads, coral and peach mark secondary moments. */
:root {
  --focusly-pink: #c43f8d;
  --focusly-pink-bright: #b83f86;
  --focusly-coral: #ec8c79;
  --focusly-peach: #f09a58;
  --focusly-blush: #f7dfe9;
  --focusly-cream: #fff9f6;
  --focusly-ink: #20151c;
  --bg: var(--focusly-cream);
  --card: #fffefe;
  --ink: #20151c;
  --muted: #6c6067;
  --line: #eadfdf;
  --pink: var(--focusly-pink);
  --pink2: var(--focusly-berry);
  --soft: var(--focusly-blush);
  --surface-2: #fcf5f2;
  --monitor-frame: #f0dce2;
  --monitor-edge: #d1aebc;
  --screen: #fffdfc;
  --screen-ink: #231b20;
  --screen-muted: #6c6067;
  --chat-out: #fbe0ec;
  --chat-in: #faf3f0;
  --surface-raised: #fff;
  --focusly-berry: #b83f86;
  --pink-ink: #9b2f6c;
  --coral-soft: #fbe6df;
  --coral-ink: #8b392c;
  --peach-soft: #fcebd8;
  --peach-ink: #824713;
  --warm-panel: linear-gradient(120deg, #fff0e2, #fff9f4 72%);
  --badge-gradient: linear-gradient(145deg, #f7dfe9, #eab1d1);
  --badge-ink: #70204e;
  --on-primary: #fff;
  --shadow: 0 12px 35px -26px #70304e55;
}
.btn {
  min-height: 42px;
}
.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 3px;
}
.panel,
.group-box,
.stat,
.modal-card {
  border-radius: 20px;
  border-color: var(--line);
}
.session-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(160px, auto) auto auto;
  gap: 18px;
  align-items: center;
}
.session-row .assignment-main {
  min-width: 0;
}
.session-date {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.session-row .session-duration {
  white-space: nowrap;
}
.session-assignment {
  overflow-wrap: anywhere;
}
.insights-upgrade {
  max-width: 650px;
  padding: 32px;
}
.insights-upgrade h3 {
  font-size: 27px;
  letter-spacing: -0.04em;
}
.insights-upgrade p {
  line-height: 1.7;
  color: var(--muted);
}
.friend-workspace {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(250px, 1.5fr) minmax(
      155px,
      0.7fr
    );
  gap: 18px;
  margin-top: 24px;
  align-items: start;
}
.friend-workspace > *,
.friend-row > *,
.chat-heading > div {
  min-width: 0;
}
.friend-workspace #friendList {
  max-height: 640px;
  overflow: auto;
}
.friend-row {
  gap: 10px;
  flex-wrap: wrap;
}
.friend-chat-choice {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 14px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.friend-chat-choice:hover,
.friend-chat-choice[aria-pressed="true"] {
  background: var(--soft);
  border-color: var(--line);
}
.friend-chat-choice b,
.friend-chat-choice small {
  display: block;
  overflow-wrap: anywhere;
}
.friend-chat-choice small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.friend-conversation {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  min-height: 360px;
}
.chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.chat-heading h3 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.chat-heading small {
  color: var(--muted);
}
.friend-chat-log {
  height: 370px;
  overflow: auto;
  padding: 16px 0;
  overscroll-behavior: contain;
}
.friend-msg,
.group-msg {
  max-width: 85%;
  width: fit-content;
  background: var(--chat-in);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 14px 14px 14px 4px;
  padding: 11px 14px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
}
.friend-msg.mine,
.group-msg.mine {
  background: var(--chat-out);
  margin-left: auto;
  border-radius: 14px 14px 4px 14px;
}
.friend-msg small,
.group-msg small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 5px;
}
.friend-msg.mine small {
  color: var(--ink);
  opacity: 0.8;
}
.chat-body {
  margin: 0;
  white-space: pre-wrap;
}
.friend-compose {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.friend-compose label {
  flex: 1;
  min-width: 130px;
}
.friend-compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 70px;
  max-height: 160px;
  font: inherit;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
}
.friend-upload {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--muted);
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.attachment-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  overflow-wrap: anywhere;
  margin-top: 8px;
}
.attachment-card small {
  margin: 0;
}
.profile-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  --profile-banner: #f3d5e4;
  --profile-accent: var(--focusly-pink);
}
.profile-banner {
  height: 100px;
  background: var(--profile-banner);
}
.profile-content {
  padding: 0 22px 22px;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 4px solid var(--card);
  background: var(--profile-accent);
  color: #fff;
  border-radius: 22px;
  margin-top: -30px;
  position: relative;
  font-size: 24px;
  font-weight: 700;
}
.profile-card h3 {
  font-size: 23px;
  margin: 12px 0 8px;
  overflow-wrap: anywhere;
}
.profile-bio {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}
.profile-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.profile-badges span {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 9px;
}
.profile-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.profile-editor {
  margin-top: 20px;
}
.profile-editor fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 0;
  padding: 14px;
}
.profile-editor legend {
  font-size: 12px;
  color: var(--muted);
}
.palette-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.palette-option {
  position: relative;
  display: grid;
  gap: 5px;
  text-align: center;
  font-size: 11px;
  cursor: pointer;
}
.palette-option i {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.palette-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.palette-option:has(input:checked) i {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}
.palette-option:has(input:focus-visible) i {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}
.profile-editor input[type="text"],
.profile-editor textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
}
.profile-editor textarea {
  resize: vertical;
}
.friend-profile .profile-content {
  padding: 0 14px 16px;
}
.friend-profile .profile-banner {
  height: 68px;
}
.friend-profile .profile-card h3 {
  font-size: 18px;
}
.friend-profile .profile-avatar {
  width: 50px;
  height: 50px;
  font-size: 20px;
}
.friend-profile .btn {
  margin-top: 12px;
  width: 100%;
  font-size: 12px;
}
.mobile-chat-back {
  display: none;
}
.danger-action {
  border: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}
.danger-action .btn {
  color: var(--pink);
  border-color: var(--pink);
}
@media (max-width: 1200px) {
  .friend-workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .friend-profile {
    grid-column: 1/-1;
  }
  .friend-profile .profile-card {
    max-width: 450px;
  }
  .session-row {
    grid-template-columns: minmax(90px, 1fr) auto auto auto;
    gap: 12px;
  }
}
@media (max-width: 768px) {
  .friend-workspace {
    display: block;
  }
  .friend-workspace .friend-conversation,
  .friend-workspace .friend-profile {
    display: none;
  }
  .friend-workspace.conversation-open #friendList {
    display: none;
  }
  .friend-workspace.conversation-open .friend-conversation {
    display: block;
  }
  .friend-workspace.conversation-open.show-profile .friend-profile {
    display: block;
    margin-top: 18px;
  }
  .mobile-chat-back {
    display: inline-flex;
  }
  .friend-chat-log {
    height: 38svh;
    min-height: 220px;
  }
  .friend-conversation {
    padding: 12px;
  }
  .chat-heading {
    flex-wrap: wrap;
  }
  .friend-msg,
  .group-msg {
    max-width: 92%;
  }
  .group-grid > .group-box:nth-child(2),
  .group-grid > .group-right {
    display: none;
  }
  #tab-groups.conversation-open .group-grid > .group-box:first-child {
    display: none;
  }
  #tab-groups.conversation-open .group-grid > .group-box:nth-child(2) {
    display: block;
  }
  #tab-groups.conversation-open.show-details .group-grid > .group-right {
    display: block;
  }
  .session-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px 12px;
  }
  .session-date {
    grid-column: 1/-1;
    grid-row: 2;
    text-align: left;
  }
  .session-row .assignment-main {
    grid-column: 1;
    grid-row: 1;
  }
  .session-duration {
    grid-column: 2;
    grid-row: 1;
  }
  .session-note-link {
    grid-column: 3;
    grid-row: 1;
  }
  .profile-content {
    padding: 0 16px 18px;
  }
  .friend-code-bar {
    flex-wrap: wrap;
  }
  .insights-upgrade {
    padding: 22px;
  }
  .profile-editor fieldset {
    padding: 12px;
  }
}

@media (max-width: 768px) {
  #tab-friends .panel:has(.conversation-open) .friend-code-bar,
  #tab-friends .panel:has(.conversation-open) #friendRequests {
    display: none;
  }
  .friend-workspace.conversation-open {
    margin-top: 0;
  }
}
@media (max-width: 768px) {
  #tab-groups.conversation-open .groups-hero {
    display: none;
  }
  #tab-groups.conversation-open .group-toolbar {
    gap: 8px;
  }
  #tab-groups.conversation-open .group-toolbar .btn {
    padding: 9px 11px;
    font-size: 12px;
    min-height: 38px;
  }
  #tab-groups.conversation-open .owner-note {
    font-size: 11px;
    line-height: 1.6;
    margin: 10px 0;
  }
  .friend-conversation {
    scroll-margin-top: 88px;
  }
}
/* Replace remaining shared-control color literals with semantic surfaces. */
.btn-pink {
  background: var(--pink);
  color: #fff;
}
.friend-code-bar code,
.group-badge,
.pro-mini,
.leader-rank,
.leader-rank.first {
  color: var(--pink);
}
.group-badge,
.pro-mini,
.leader-rank,
.leader-rank.first {
  background: var(--coral-soft);
  color: var(--coral-ink);
}
.focus-duration input[type="range"] {
  accent-color: var(--pink);
}
.timer-ring {
  background: conic-gradient(
    var(--pink) var(--progress),
    var(--line) var(--progress)
  ) !important;
  box-shadow: var(--shadow);
}
.leader-track span {
  background: linear-gradient(90deg, var(--pink), var(--pink2));
}
.achievement-popup {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.achievement-popup span {
  color: var(--muted);
}
.achievement-popup small {
  color: var(--pink);
}
.achievement-popup-icon {
  background: var(--soft);
  color: var(--pink);
}
.goal-symbol {
  color: var(--focusly-coral);
}
.group-choice.active {
  background: var(--soft);
  border-color: var(--pink);
  color: var(--pink-ink);
}
.group-compose {
  border-color: var(--line);
}

/* Value belongs to its own bar track, including a zero-height day. */
.weekly-bars {
  padding-top: 28px;
}
.weekly-day .weekly-track {
  position: relative;
  overflow: visible;
}
.weekly-day .weekly-value {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  min-height: 0;
  line-height: 1.2;
  margin: 0;
  z-index: 1;
  text-align: center;
}
.weekly-day .weekly-fill {
  background: linear-gradient(180deg, var(--pink), var(--pink2));
}
.profile-editor[aria-busy="true"] {
  opacity: 0.8;
}
#profileStatus,
#friendChatStatus {
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.friend-chat-choice small {
  color: var(--pink-ink);
  font-weight: 650;
}

/* Theme components share semantic surfaces; accent color never determines text contrast. */
.achievement-card {
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow);
  --badge-gradient: linear-gradient(145deg, var(--focusly-blush), #eab1d1);
}
.achievement-card:nth-child(3n + 2) {
  --badge-gradient: linear-gradient(145deg, #f9d4c6, var(--focusly-coral));
  --badge-ink: #63281d;
}
.achievement-card:nth-child(3n) {
  --badge-gradient: linear-gradient(145deg, #ffe3bd, var(--focusly-peach));
  --badge-ink: #61350f;
}
.achievement-card h4 {
  color: var(--ink);
  line-height: 1.35;
}
.achievement-card p {
  color: var(--muted);
  line-height: 1.6;
}
.achievement-card.locked {
  border-style: dashed;
  box-shadow: none;
}
.achievement-card.locked .badge-art::before {
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 2px var(--line);
}
.achievement-card.locked .badge-art svg {
  color: var(--muted);
}
.achievement-card .rarity {
  background: var(--soft);
  color: var(--pink-ink);
}
.achievement-card .rarity.epic {
  background: var(--peach-soft);
  color: var(--peach-ink);
}
.achievement-card:nth-child(3n + 2) .rarity {
  background: var(--coral-soft);
  color: var(--coral-ink);
}
.achievement-card:nth-child(3n) .rarity {
  background: var(--peach-soft);
  color: var(--peach-ink);
}
.achievement-detail progress,
.goal-progress {
  appearance: none;
  border: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}
.achievement-detail progress::-webkit-progress-bar,
.goal-progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 8px;
}
.achievement-detail progress::-webkit-progress-value,
.goal-progress::-webkit-progress-value {
  background: linear-gradient(
    90deg,
    var(--focusly-coral),
    var(--focusly-peach)
  );
  border-radius: 8px;
}
.achievement-detail progress::-moz-progress-bar,
.goal-progress::-moz-progress-bar {
  background: linear-gradient(
    90deg,
    var(--focusly-coral),
    var(--focusly-peach)
  );
  border-radius: 8px;
}
.goal-symbol {
  color: var(--peach-ink);
}
.weekly-goal-panel {
  border-top: 3px solid var(--focusly-coral);
}
.schedule-panel {
  background: var(--warm-panel);
  border-top: 3px solid var(--focusly-peach);
}
.schedule-symbol {
  background: var(--peach-soft);
  color: var(--peach-ink);
}
.schedule-info small,
.schedule-foot,
.schedule-empty {
  color: var(--muted);
}
.schedule-foot {
  border-color: var(--line);
}
.btn-pink {
  color: var(--on-primary);
}
.btn-soft {
  background: var(--coral-soft);
  color: var(--coral-ink);
  border: 1px solid transparent;
}
.btn-line:hover {
  background: var(--surface-2);
  border-color: var(--pink);
}
.btn-soft:hover {
  border-color: var(--focusly-coral);
}
.btn:disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.streak-pill {
  background: var(--peach-soft);
  color: var(--peach-ink);
  border-color: var(--line);
}
.streak-flame {
  color: var(--peach-ink);
}
.pro-nudge {
  background: var(--warm-panel);
  border-color: var(--line);
}
.pro-symbol {
  background: var(--coral-soft);
  color: var(--coral-ink);
}
.subject-icon {
  background: var(--peach-soft);
  color: var(--peach-ink);
}
.subject-track span {
  background: var(--focusly-coral);
}
.subject-breakdown > div:nth-child(even) .subject-track span {
  background: var(--focusly-peach);
}
.week-comparison > div {
  padding: 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border-top: 2px solid var(--focusly-coral);
}
.week-comparison > div:last-child {
  border-top-color: var(--focusly-peach);
}
.pro-plan.recommended {
  background: var(--warm-panel);
}
.plan-pro {
  background: var(--warm-panel);
}
#home .together-section {
  background: var(--coral-soft);
  color: var(--ink);
  border-color: var(--line);
}
#home .together-copy p {
  color: var(--muted);
}
#home .hero-tag::before {
  background: var(--focusly-coral);
}
#home .story-chapter .flow-number {
  color: var(--coral-ink);
}
#home .hero-benefits span::before {
  color: var(--focusly-peach);
}

.profile-editor > label {
  display: block;
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 650;
}
.profile-editor fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 18px 0;
  padding: 16px;
}
.profile-editor legend {
  padding: 0 6px;
  color: var(--muted);
}

/* A single premium light appearance, including native controls and dialogs. */
:root {
  color-scheme: light;
}
.profile-editor input[type="text"],
.profile-editor textarea {
  font-weight: 400;
}
.sidebar {
  background: var(--card);
}
