/* MakerWorks — component styles. tokens.css carries every color/type/motion
   decision; nothing in here hardcodes a brand value. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--petsies-navy); }

[hidden] { display: none !important; }

/* ---- buttons + inputs ------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  min-height: 40px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--dur) var(--pop), background var(--dur), box-shadow var(--dur), border-color var(--dur);
}
.btn:hover { background: var(--tint); border-color: var(--line-2); }
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 3px solid var(--petsies-soft); outline-offset: 1px; }

.btn-primary {
  background: var(--brand, var(--company));
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { background: var(--brand, var(--company)); filter: brightness(1.06); }

.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--company-soft); }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  position: relative;
}

input[type="text"], input[type="email"], input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 9px 12px;
  min-height: 40px;
  color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--petsies-soft);
  outline-offset: 0;
  border-color: var(--petsies);
}
textarea { resize: vertical; min-height: 70px; }
::placeholder { color: var(--ink-3); }

label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 4px; }

/* ---- chips / dots / avatars ------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--company-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.warn { background: var(--warn-soft); color: #8a5a10; }
.chip.danger { background: var(--danger-soft); color: var(--budsies-magenta); }
.chip.success { background: var(--emerald-soft); color: var(--emerald); }
.chip.brand { background: var(--brand-soft, var(--company-soft)); color: var(--brand, var(--ink-2)); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand, var(--ink-3)); flex: none; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--company-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-head);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- screens ---------------------------------------------------------- */
.screen-center {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.login-card { width: 380px; max-width: 100%; padding: 36px 32px; text-align: center; }
.login-card h1 { font-size: 30px; letter-spacing: -0.5px; }
.login-card .tagline { color: var(--ink-2); margin: 6px 0 26px; font-size: 14px; }
.login-card .stack { display: grid; gap: 10px; text-align: left; }
.brand-dots { display: inline-flex; gap: 5px; margin-left: 8px; vertical-align: middle; }
.login-brand { margin: 0; }
.login-logo { width: 240px; max-width: 100%; height: auto; display: block; margin: 4px auto 6px; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 12px;
  margin: 14px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { min-height: 20px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.msg.error { color: var(--budsies-magenta); }
.msg.success { color: var(--emerald); }

/* ---- app layout -------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px 12px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
}
.sidebar-nav { padding: 0 10px; display: grid; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: var(--tint); color: var(--ink); }
.nav-item.active { background: var(--company-soft); color: var(--ink); }

.sidebar-projects { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.brand-group-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--ink-3);
  margin: 14px 6px 3px;
}
.proj-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  padding: 6px 10px 6px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-item:hover { background: var(--tint); color: var(--ink); }
.proj-item.active { background: var(--brand-soft, var(--company-soft)); color: var(--ink); font-weight: 600; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}
.sidebar-foot .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar h2 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 9px; }
.hamburger { display: none; }

.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.view-toggle button {
  border: 0;
  background: var(--surface);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.view-toggle button.active { background: var(--company); color: #fff; }

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--budsies-magenta);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.content { flex: 1; overflow-y: auto; padding: 20px 22px 40px; min-height: 0; }

/* ---- dashboard --------------------------------------------------------- */
.dash-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-head h2 { font-size: 22px; flex: 1; }

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--warn-soft);
  color: #8a5a10;
  border-radius: 999px;
  padding: 6px 13px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
}

.week-bar-wrap { margin: 4px 0 18px; max-width: 460px; }
.week-bar-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.week-bar { height: 8px; border-radius: 999px; background: var(--company-soft); overflow: hidden; }
.week-bar > div { height: 100%; border-radius: 999px; background: var(--emerald); transition: width 400ms var(--pop); }

.panel { margin-bottom: 20px; overflow: hidden; }
.panel-title { font-size: 13.5px; font-weight: 700; font-family: var(--font-head); padding: 11px 14px; display: flex; align-items: center; gap: 8px; }

.mytask-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.mytask-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.mytask-row .proj { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mytask-row.done .title { text-decoration: line-through; color: var(--ink-3); }

.brand-section-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-size: 14px; margin: 18px 2px 8px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 10px; }
.proj-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform var(--dur) var(--pop), box-shadow var(--dur);
  text-align: left;
}
.proj-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.proj-card .nm { font-family: var(--font-head); font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-card .sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-card .meta { min-width: 0; }

.ring { flex: none; }
.ring .track { stroke: var(--company-soft); }
.ring .fill { stroke: var(--brand, var(--company)); transition: stroke-dasharray 500ms var(--pop); }
.ring text { fill: var(--ink-2); font: 700 10.5px var(--font-head); }

.empty {
  color: var(--ink-2);
  font-size: 14px;
  padding: 26px 14px;
  text-align: center;
}

/* ---- checkbox (complete a task) ---------------------------------------- */
.task-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--surface);
  flex: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  transition: background var(--dur), border-color var(--dur), transform var(--dur) var(--pop);
  padding: 0;
}
.task-check:hover { border-color: var(--emerald); color: var(--emerald); }
.task-check.done { background: var(--emerald); border-color: var(--emerald); color: #fff; animation: check-bounce 420ms var(--pop); }
@keyframes check-bounce {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ---- board -------------------------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.col { background: rgba(77, 84, 108, 0.05); border-radius: var(--r-lg); padding: 10px; min-height: 220px; }
.col-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-size: 13.5px; padding: 2px 6px 10px; color: var(--ink-2); }
.col-head .count { background: var(--company-soft); border-radius: 999px; font-size: 11.5px; padding: 1px 8px; }
.col.drop-target { outline: 2px dashed var(--brand, var(--petsies)); outline-offset: -2px; background: var(--brand-soft, var(--tint)); }

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 11px 12px;
  margin-bottom: 9px;
  cursor: grab;
  transition: transform var(--dur) var(--pop), box-shadow var(--dur), opacity var(--dur);
}
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card.dragging { opacity: 0.45; cursor: grabbing; }
.task-card.lifted { transform: scale(1.04) rotate(1.5deg); box-shadow: var(--shadow-lg); }
.task-card .t-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; word-break: break-word; }
.task-card .t-foot { display: flex; align-items: center; gap: 8px; }
.task-card .t-foot .spacer { flex: 1; }
.task-card.celebrate { animation: card-pop 700ms var(--pop); box-shadow: 0 0 0 3px var(--gold), var(--shadow-lg); }
@keyframes card-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.quick-add {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.quick-add input { min-height: 38px; background: var(--surface); }

/* ---- list view ----------------------------------------------------------- */
.list-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-table th {
  text-align: left;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.list-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.list-table tr:last-child td { border-bottom: 0; }
.list-table tr:hover td { background: var(--tint); }
.list-table .title-cell { cursor: pointer; min-width: 220px; }
.list-table select, .list-table input[type="date"] { min-height: 32px; padding: 4px 8px; font-size: 13px; width: auto; }
.list-table tr.done .title-cell { text-decoration: line-through; color: var(--ink-3); }

/* ---- modals ---------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 41, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 640px;
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 8px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 4px 18px 18px; overflow-y: auto; }
.modal-title-input {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 19px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  flex: 1;
  min-width: 0;
}
.modal-title-input:hover { border-color: var(--line); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.due-quick { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.due-quick .chip { cursor: pointer; border: 0; }
.due-quick .chip:hover { background: var(--petsies-soft); color: var(--petsies-navy); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 12px; }
.tabs button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand, var(--company)); }

.comment { display: flex; gap: 10px; padding: 8px 0; }
.comment .meta { font-size: 12px; color: var(--ink-3); }
.comment .body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.composer { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.composer textarea { flex: 1; }

.attach-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; }
.attach-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-row .sz { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.feed-row { display: flex; gap: 9px; padding: 5px 0; font-size: 13px; color: var(--ink-2); }
.feed-row .when { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---- bell dropdown ----------------------------------------------------------- */
.bell-wrap { position: relative; }
.bell-panel {
  position: absolute;
  right: 0;
  top: 46px;
  width: 360px;
  max-width: calc(100vw - 30px);
  max-height: 70dvh;
  overflow-y: auto;
  z-index: 40;
}
.notif-row { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.notif-row:hover { background: var(--tint); }
.notif-row.unread { background: var(--petsies-soft); }
.notif-row .tt { font-size: 13.5px; font-weight: 600; }
.notif-row .bb { font-size: 12.5px; color: var(--ink-2); white-space: pre-line; }
.notif-row .when { font-size: 11.5px; color: var(--ink-3); }

/* ---- brand picker (new project) ------------------------------------------------ */
.brand-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.brand-pick button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.brand-pick button.active { border-color: var(--brand); background: var(--brand-soft); }

/* ---- members modal -------------------------------------------------------------- */
.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.member-row .who { flex: 1; min-width: 0; }
.member-row .who .em { font-size: 12px; color: var(--ink-3); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch .knob {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-2);
  transition: background var(--dur);
}
.switch .knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left var(--dur) var(--pop);
}
.switch input:checked + .knob { background: var(--emerald); }
.switch input:checked + .knob::after { left: 19px; }

/* ---- sync status pill ---------------------------------------------------------------- */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 5px 11px;
  background: var(--emerald-soft); color: var(--emerald);
  white-space: nowrap; border: 0; cursor: default;
}
.sync-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: none;
}
.sync-pill.stale { background: var(--warn-soft); color: #8a5a10; }
.sync-pill.none  { background: var(--company-soft); color: var(--ink-3); }

/* ---- toast + confetti --------------------------------------------------------------- */
.toast-wrap { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; }
.toast {
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 300ms var(--pop);
}
.toast.error { background: var(--budsies-magenta); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

/* ---- loading skeleton ------------------------------------------------------------------ */
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--company-soft);
  border-top-color: var(--petsies);
  animation: spin 800ms linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- responsive -------------------------------------------------------------------------- */
@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 28% 0 0;
    z-index: 60;
    transform: translateX(-102%);
    transition: transform 240ms ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .board .col { min-width: 78vw; scroll-snap-align: start; }
  .content { padding: 14px 14px 40px; }
}

/* ---- calm mode: every animation off, celebrations become a quiet tint ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .task-card.celebrate { box-shadow: 0 0 0 2px var(--emerald), var(--shadow); }
}
