:root {
  --bg: #140a0b;
  --card: rgba(38, 20, 20, 0.78);
  --card-2: rgba(58, 30, 28, 0.7);
  --line: rgba(255, 255, 255, 0.09);
  --text: #fff4f0;
  --muted: #c9a9a2;
  --accent: #ff5a1f;
  --accent-2: #ff9a1f;
  --grad: linear-gradient(135deg, #ff3d3d 0%, #ff5a1f 55%, #ff9a1f 100%);
  --glow: 0 10px 40px -8px rgba(255, 74, 42, 0.3);
  --danger: #ff6b8b;
  --ok: #4fe0a8;
  --radius: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 16px 120px;
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vw 60vw at 0% 0%, rgba(230, 40, 40, 0.42), transparent 60%),
    radial-gradient(55vw 55vw at 100% 100%, rgba(255, 140, 30, 0.38), transparent 60%),
    radial-gradient(40vw 40vw at 85% 10%, rgba(255, 90, 31, 0.16), transparent 60%),
    var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: currentColor; }
svg .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Header */
.top, main { max-width: 1120px; margin: 0 auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 18px;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { filter: drop-shadow(0 6px 18px rgba(255, 90, 31, 0.6)); }
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.brand p { margin: 0; font-size: 13px; }

/* Switches */
.auto-switch, .mini-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.auto-switch {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(16px);
}
.auto-switch input, .mini-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
input:checked + .switch { background: var(--grad); box-shadow: var(--glow); }
input:checked + .switch::after { transform: translateX(18px); }
input:focus-visible + .switch { outline: 2px solid #fff; outline-offset: 2px; }
.mini-switch { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-switch .switch { width: 34px; height: 20px; }
.mini-switch .switch::after { width: 14px; height: 14px; }
.mini-switch input:checked + .switch::after { transform: translateX(14px); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.8);
}

.hero { text-align: center; padding: 28px 22px 24px; }
.hero-title { font-size: clamp(40px, 8vw, 64px); margin: 18px 0 0; font-weight: 800; letter-spacing: -0.03em; }
.hero-title #hero-hours {
  background: linear-gradient(135deg, #fff 30%, #ffc9a8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { font-size: 18px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero-money { margin: 4px 0 18px; font-size: 20px; font-weight: 700; }
.hero-money small { color: var(--muted); font-weight: 500; font-size: 14px; }

/* Segmented control (Yearly / Monthly) */
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
}
.seg button {
  border: 0;
  background: transparent;
  padding: 9px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.seg button.on { background: #fff; color: #2a1210; box-shadow: 0 4px 16px rgba(255, 255, 255, 0.18); }

/* Check bullets */
.checks {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 18px;
  max-width: 720px;
  text-align: left;
}
.checks li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.checks li b { margin-left: auto; font-weight: 700; }
.tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--c, var(--accent));
}
.tick::after { content: ''; width: 7px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* Sections */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 14px;
  flex-wrap: wrap;
}
.section-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ghost-btn {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 14px;
}
.ghost-btn { text-decoration: none; }
.ghost-btn:hover { border-color: rgba(255, 255, 255, 0.25); }

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

/* Project card */
.project { display: flex; flex-direction: column; gap: 16px; position: relative; }
.project.running { border-color: rgba(255, 90, 31, 0.7); box-shadow: 0 10px 40px -8px rgba(255, 74, 42, 0.45), 0 0 0 1px rgba(255, 90, 31, 0.4) inset; }
.project.archived { opacity: 0.55; }
.p-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  flex: none;
  background: var(--c, #ff5a1f);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 8px 24px -6px color-mix(in srgb, var(--c, #ff5a1f) 50%, transparent);
}
.p-name { font-weight: 700; font-size: 16px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-client { font-size: 13px; color: var(--muted); margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-head > div:not(.avatar) { min-width: 0; flex: 1; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card-2);
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn svg { width: 16px; height: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--grad);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--glow);
  width: fit-content;
}
.badge svg { width: 14px; height: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}
.chip.live { color: #ffd2bd; background: rgba(255, 90, 31, 0.2); }
.chip.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ff8a4a; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* Live Claude session: a faint turning ring, a slow breathing glow, and tiny flames
   licking up from the top edge. Smooth easing everywhere, no hard steps. */
@property --flame-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.project.live::before,
.project.live::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
}
.project.live::before {
  padding: 1.5px;
  background: conic-gradient(from var(--flame-angle), #ff3d3d, #ff7a1f, #ffcf5c, #ff5a1f, #e0262f, #ff9a1f, #ff3d3d);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.55;
  animation: flame-turn 14s linear infinite;
}
.project.live::after {
  box-shadow: 0 0 22px -4px rgba(255, 110, 40, 0.45), 0 -8px 28px -12px rgba(255, 170, 60, 0.55);
  animation: flame-breathe 4.8s ease-in-out infinite alternate;
}
@keyframes flame-turn { to { --flame-angle: 360deg; } }
@keyframes flame-breathe { from { opacity: 0.35; } to { opacity: 0.8; } }

.flames { position: absolute; left: 22px; right: 22px; top: -11px; height: 14px; pointer-events: none; }
.flames i {
  position: absolute;
  bottom: 0;
  width: 7px;
  height: 12px;
  margin-left: -3.5px;
  border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 85%, #fff3c4 0%, #ffcf5c 22%, #ff7a1f 52%, rgba(255, 61, 61, 0) 74%);
  transform-origin: 50% 100%;
  filter: blur(0.5px);
  opacity: 0;
  animation: flame-lick 2.4s ease-in-out infinite;
}
@keyframes flame-lick {
  0% { opacity: 0; transform: translateY(2px) scale(0.55, 0.4) rotate(0deg); }
  25% { opacity: 0.85; transform: translateY(0) scale(1, 1) rotate(-4deg); }
  55% { opacity: 0.65; transform: translateY(-2px) scale(0.8, 1.25) rotate(3deg); }
  100% { opacity: 0; transform: translateY(-6px) scale(0.45, 0.9) rotate(-2deg); }
}
/* Spread the flames out and give each its own size and rhythm so they never move in step. */
.flames i:nth-child(1)  { left: 3%;  animation-duration: 2.3s; animation-delay: -0.2s; }
.flames i:nth-child(2)  { left: 12%; animation-duration: 2.9s; animation-delay: -1.4s; width: 5px; height: 9px; }
.flames i:nth-child(3)  { left: 21%; animation-duration: 2.1s; animation-delay: -0.9s; }
.flames i:nth-child(4)  { left: 30%; animation-duration: 3.2s; animation-delay: -2.1s; width: 6px; height: 10px; }
.flames i:nth-child(5)  { left: 39%; animation-duration: 2.6s; animation-delay: -0.5s; width: 8px; height: 14px; }
.flames i:nth-child(6)  { left: 48%; animation-duration: 2.2s; animation-delay: -1.8s; }
.flames i:nth-child(7)  { left: 57%; animation-duration: 3s;   animation-delay: -0.3s; width: 5px; height: 9px; }
.flames i:nth-child(8)  { left: 66%; animation-duration: 2.5s; animation-delay: -1.1s; width: 8px; height: 13px; }
.flames i:nth-child(9)  { left: 75%; animation-duration: 2.8s; animation-delay: -2.4s; }
.flames i:nth-child(10) { left: 84%; animation-duration: 2.2s; animation-delay: -0.7s; width: 6px; height: 10px; }
.flames i:nth-child(11) { left: 92%; animation-duration: 3.1s; animation-delay: -1.6s; width: 5px; height: 9px; }
.flames i:nth-child(12) { left: 98%; animation-duration: 2.4s; animation-delay: -2s; }

@media (prefers-reduced-motion: reduce) {
  .project.live::before, .project.live::after { animation: none; }
  .flames { display: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.p-stats { display: flex; align-items: baseline; gap: 8px; }
.p-time { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.p-rate { font-size: 13px; color: var(--muted); margin-left: auto; }
.p-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.cta {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 15px;
  background: var(--grad);
  box-shadow: var(--glow);
  transition: transform 0.1s, filter 0.2s;
}
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: scale(0.98); }
.cta.stop { background: #fff; color: #2a1210; box-shadow: 0 8px 30px -8px rgba(255, 255, 255, 0.25); }
.cta.danger { background: rgba(255, 107, 139, 0.16); color: var(--danger); box-shadow: none; }
.cta.plain { background: var(--card-2); box-shadow: none; border: 1px solid var(--line); }

.add-card {
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  background: transparent;
  border-radius: var(--radius);
  min-height: 200px;
  color: var(--muted);
  font-weight: 600;
}
.add-card:hover { color: var(--text); border-color: rgba(255, 90, 31, 0.6); }

/* Lists (profile-style rows) */
.list { padding: 6px 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--accent)); }
.day-head { display: flex; justify-content: space-between; margin: 22px 4px 8px; font-weight: 700; font-size: 14px; color: var(--muted); }
.note-input {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed transparent;
  width: 100%;
  font-size: 13px;
  color: var(--muted);
  padding: 2px 0;
}
.note-input:hover, .note-input:focus { border-bottom-color: var(--line); outline: none; color: var(--text); }
.status { text-transform: capitalize; }
.status.paid { color: var(--ok); background: rgba(79, 224, 168, 0.12); }
.status.sent { color: #ffc27a; background: rgba(255, 154, 31, 0.16); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.form-grid h3 { margin: 10px 0 0; font-size: 16px; }
.form-grid .span { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid label.inline { flex-direction: row; align-items: center; }
.field {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  width: 100%;
}
.field:focus { outline: none; border-color: rgba(255, 90, 31, 0.8); box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.2); }
.field.compact { width: auto; padding: 8px 12px; }
textarea.field { resize: vertical; }
select.field option { background: #2a1614; }
input[type='color'].field { padding: 4px; height: 46px; }

/* Dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 12, 12, 0.86);
  border: 1px solid var(--line);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7);
  z-index: 10;
}
.dock button {
  border: 0;
  background: transparent;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.dock button.on { color: #fff; background: rgba(255, 255, 255, 0.08); }
.dock .orb {
  width: 62px;
  height: 62px;
  margin: -22px 8px 0;
  background: radial-gradient(circle at 35% 30%, #ffc2a0, #ff4a2a 45%, #e0262f);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(24, 12, 12, 0.9), 0 10px 30px rgba(255, 74, 42, 0.4);
}
.dock .orb svg { width: 26px; height: 26px; }
.dock .orb.running { animation: orb 2s ease-in-out infinite; background: radial-gradient(circle at 35% 30%, #fff, #ffc2a0 40%, #ff4a2a); color: #5a1a0a; }
@keyframes orb { 50% { box-shadow: 0 0 0 6px rgba(24, 12, 12, 0.9), 0 10px 50px rgba(255, 120, 60, 0.5); } }

/* Dialog */
dialog {
  width: min(520px, calc(100vw - 32px));
  color: var(--text);
  background: rgba(34, 17, 16, 0.96);
  padding: 22px;
}
dialog::backdrop { background: rgba(12, 4, 4, 0.6); backdrop-filter: blur(4px); }
dialog .form-grid { margin-top: 0; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(20px);
  background: #fff;
  color: #2a1210;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 20;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); color: #fff; }

@media (max-width: 560px) {
  .top { flex-direction: row; }
  .auto-switch span:first-child { display: none; }
  .seg button { padding: 8px 16px; }
  .dock button { width: 42px; height: 42px; }
  .list-row { padding: 12px 14px; }
}

/* Login */
.login-page { padding-bottom: 16px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; padding: 36px 28px 28px; }
.login-logo { margin: 0 auto 4px; filter: drop-shadow(0 10px 30px rgba(255, 90, 31, 0.7)); }
.login-card h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.login-card > p { margin: -8px 0 6px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card .code { letter-spacing: 0.4em; font-size: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.login-card .cta { margin-top: 4px; }
.login-card .cta:disabled { opacity: 0.6; }
.login-error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; font-weight: 600; }
.login-card > label[for='password'] { margin-bottom: -8px; }
.pw-wrap { position: relative; }
.pw-wrap .field { padding-right: 48px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--text); background: rgba(255, 255, 255, 0.06); outline: none; }
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle .eye-off, .pw-toggle[aria-pressed='true'] .eye { display: none; }
.pw-toggle[aria-pressed='true'] .eye-off { display: block; }
