:root {
  --primary: #1B6B4A;
  --primary-ink: #fff;
  --secondary: #C26D3A;
  --success: #2F9E6B;
  --warning: #C79212;
  --danger: #C44536;
  --info: #3D6B99;
  --background: #F4EFE6;
  --surface: #FFFcf8;
  --surface-2: #EFE6D8;
  --text: #1C1917;
  --muted: #6B645B;
  --border: #E4D5C2;
  --shadow: 0 10px 30px rgba(48, 32, 16, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 44px;
  --font: "Segoe UI", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --max: 760px;
  --admin-max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #fbe8d2 0%, transparent 50%),
              radial-gradient(900px 500px at 110% 0%, #dceee4 0%, transparent 46%),
              var(--background);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
}
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 70%, white); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: .5rem; top: -3rem; background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 20; }
.skip-link:focus { top: .5rem; }

.wrap { width: min(var(--max), calc(100% - 1.5rem)); margin: 0 auto; padding-bottom: 6rem; }
.eyebrow { letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; color: var(--muted); margin: 0 0 .3rem; font-weight: 700; }
.lead { color: var(--muted); font-size: 1.05rem; }
.error-detail {
  margin: 1rem 0 0;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: rgba(0,0,0,.06);
  font-size: .82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}
.muted { color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .7rem 1.1rem; border-radius: 999px;
  border: 0; cursor: pointer; text-decoration: none; font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-lg { min-height: 52px; width: 100%; font-size: 1.05rem; }
.btn.danger, .danger { color: var(--danger); }
.icon-btn {
  width: var(--tap); height: var(--tap); border: 0; background: var(--surface);
  border-radius: 14px; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow);
}

.input {
  width: 100%; min-height: var(--tap); border: 1px solid var(--border); border-radius: 14px;
  padding: .6rem .9rem; background: #fff;
}
.input-lg { min-height: 56px; font-size: 1.15rem; }
.input.mini { min-height: 40px; width: auto; padding: .3rem .5rem; font-size: .85rem; }

.card {
  background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 70%, white);
  margin: 1rem 0;
}
.highlight-card { background: linear-gradient(180deg, #fff, #f7f1e6); border: 1px solid color-mix(in srgb, var(--secondary) 28%, white); }

.alert { padding: .85rem 1rem; border-radius: 12px; }
.alert-danger { background: #fde8e4; color: #7a261c; }
.alert-warn { background: #fff4d6; color: #6a4b00; }
.alert-ok { background: #e5f6ec; color: #1c5c3a; }

.pill {
  display: inline-flex; align-items: center; gap: .25rem;
  border-radius: 999px; padding: .2rem .55rem; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--text);
}
.pill-parallel { background: #e7eef8; color: #27476d; }
.pill-skill { background: #f3e6d4; color: #7a3f12; }
.status-COMPLETED { background: #e2f5ea; color: #1c5c3a; }
.status-IN_PROGRESS { background: #e7eef8; color: #27476d; }
.status-BLOCKED { background: #eee; color: #444; }
.status-ASSIGNED { background: #f8ead7; color: #7a4014; }
.status-OPEN { background: #eef6ef; color: #1B6B4A; }
.noise-noisy { background: #fde7d4; color: #8a3d08; }
.noise-quiet { background: #e5f4f1; color: #0f5f58; }
.noise-normal { background: #eeeae3; color: #4a433b; }
.urgency-ok { background: #e2f5ea; }
.urgency-soon { background: #fff4d6; }
.urgency-urgent { background: #fde8e4; }
.urgency-overdue { background: #2b2b2b; color: #fff; }
.urgency-done { background: #e2f5ea; }

.topbar {
  position: sticky; top: 0; z-index: 8;
  background: color-mix(in srgb, var(--background) 86%, white);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner, .admin-top {
  width: min(var(--max), calc(100% - 1.5rem));
  margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 1rem;
}
.topbar-title { margin: 0; font-size: 1.15rem; }
.page-helper .admin-top, .page-admin .topbar-inner { width: min(var(--admin-max), calc(100% - 1.5rem)); }

.hello h2 { margin: 1.2rem 0 .2rem; font-size: 1.8rem; }
.progress-block { margin: 1rem 0 1.4rem; }
.progress-meta { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: .4rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--secondary))); }

.chips, .gantt-wrap { -webkit-overflow-scrolling: touch; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem 0 0.6rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 38px; padding: .4rem .85rem; border-radius: 999px;
  background: var(--surface); color: var(--text); text-decoration: none; border: 1px solid var(--border);
  display: grid; place-items: center; font-weight: 650; font-size: .9rem;
}
.chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.toolbar { display: flex; align-items: flex-start; gap: .5rem; }
.search-fold { display: flex; align-items: center; }
.search-fold .search-input { width: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; transition: .2s; }
.search-fold.is-open .search-input { width: min(180px, 42vw); padding: .6rem .9rem; border: 1px solid var(--border); opacity: 1; pointer-events: auto; }

.phase-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 1.4rem 0 .6rem; }
.phase-head h2 { margin: 0; font-size: 1.15rem; }
.phase.is-parallel { padding: .4rem; border-radius: 20px; background: color-mix(in srgb, #dbe7f5 55%, transparent); }

.task-card {
  background: var(--surface); border-radius: var(--radius); padding: 1rem;
  box-shadow: var(--shadow); margin-bottom: .9rem; border: 1px solid transparent;
}
.task-card.is-noisy { border-color: color-mix(in srgb, var(--secondary) 45%, white); }
.task-card.is-skill { border-color: color-mix(in srgb, #c26d3a 50%, white); }
.task-card.is-done { opacity: .72; filter: grayscale(.15); }
.task-card-main { display: grid; grid-template-columns: auto 1fr; gap: .8rem; }
.task-num { font-size: 1.4rem; font-weight: 800; color: var(--muted); min-width: 2.2rem; }
.task-room { margin: 0; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.task-body h3 { margin: .1rem 0 .45rem; font-size: 1.12rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.task-facts { list-style: none; padding: 0; margin: .7rem 0 0; color: var(--muted); font-size: .92rem; }
.task-facts li { margin: .2rem 0; }
.own-flag { color: var(--primary); font-weight: 700; }
.noisy-hint { margin: .6rem 0 0; font-size: .9rem; color: #8a3d08; }
.skill-hint { margin: .6rem 0 0; font-size: .9rem; color: #7a3f12; font-weight: 650; }
.task-actions { display: grid; gap: .5rem; margin-top: .9rem; }
.done-banner { display: block; text-align: center; background: #e2f5ea; color: #1c5c3a; border-radius: 12px; padding: .7rem; font-weight: 800; }
.task-details { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); display: grid; gap: .8rem; }
.check { list-style: none; padding: 0; }
.check .is-on { color: var(--success); }

.bottom-nav {
  position: sticky; bottom: 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, white);
  border-top: 1px solid var(--border); padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
  z-index: 9;
}
.page-helper .bottom-nav { position: fixed; left: 0; right: 0; }
.bottom-nav a, .bottom-nav-item {
  min-height: var(--tap); min-width: var(--tap); text-decoration: none; color: var(--muted);
  display: grid; place-items: center; font-size: .75rem; font-weight: 700;
}
.bottom-nav .is-active, .bottom-nav-item.is-active { color: var(--primary); }

.page-auth, .page-setup { display: grid; place-items: center; min-height: 100dvh; padding: 1.2rem; }
.auth-hero, .setup-card, .auth-card {
  width: min(440px, 100%); background: var(--surface); padding: 1.6rem 1.3rem 1.8rem;
  border-radius: 28px; box-shadow: var(--shadow);
}
.auth-hero label { display: grid; gap: .35rem; font-weight: 700; }
.field-hint { margin: -.35rem 0 0; color: var(--muted); font-size: .9rem; font-weight: 400; line-height: 1.4; }
.field-hint strong { color: var(--text); }

.brand-lockup {
  display: flex;
  justify-content: center;
  margin: -.35rem 0 .8rem;
}
.brand-logo-wrap {
  width: min(170px, 48vw);
}
.brand-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(123, 79, 163, .14));
}

.auth-guide {
  margin: 1.35rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--border);
}
.auth-guide h2 {
  margin: 0 0 .65rem;
  font-size: .95rem;
  font-weight: 800;
}
.auth-guide ol {
  margin: 0;
  padding: 0 0 0 1.15rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
  display: grid;
  gap: .45rem;
}
.auth-guide li strong { color: var(--text); font-weight: 700; }
.auth-mark {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 1.4rem; font-weight: 800; margin-bottom: 1rem;
}
.check-list { list-style: none; padding: 0; }
.check-list li { padding: .45rem 0 .45rem 1.6rem; position: relative; }
.check-list li::before { content: "○"; position: absolute; left: 0; }
.check-list .ok::before { content: "✓"; color: var(--success); }
.check-list .bad::before { content: "✕"; color: var(--danger); }
.preview-phases { list-style: none; padding: 0; }
.preview-phases li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.choice { border: 1px solid var(--border); border-radius: 14px; padding: .8rem 1rem; }
.radio, .check-inline { display: flex; gap: .5rem; align-items: center; min-height: 36px; }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.celebrate { text-align: center; }

.toast-root { position: fixed; left: 50%; bottom: 5.2rem; transform: translateX(-50%); z-index: 40; width: min(92vw, 420px); pointer-events: none; }
.toast {
  background: #1c1917; color: #fff; padding: .85rem 1rem; border-radius: 14px; margin-top: .4rem;
  box-shadow: var(--shadow); animation: up .25s ease;
}
.toast.error { background: #7a261c; }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,14,8,.45); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 1rem 1rem 1.4rem;
  max-height: 88dvh; overflow: auto; animation: sheet .25s ease;
}
@keyframes sheet { from { transform: translateY(24px); } }
.sheet h2 { margin: .2rem 0 1rem; }
.slot-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .4rem; margin-bottom: .5rem; }

.admin-shell { display: grid; min-height: 100dvh; }
.sidenav { display: none; }
.sidenav-brand { display: flex; gap: .7rem; align-items: center; padding: 1rem; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.sidenav-link { display: flex; gap: .6rem; align-items: center; padding: .7rem 1rem; min-height: var(--tap); text-decoration: none; color: var(--text); border-radius: 12px; }
.sidenav-link.is-active { background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary); font-weight: 700; }
.sidenav-link.as-btn { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.admin-top { width: min(var(--admin-max), calc(100% - 1.25rem)); padding-top: .4rem; }
.admin-top h1 { margin: 0; font-size: 1.35rem; }
.admin-content { width: min(var(--admin-max), calc(100% - 1.25rem)); margin: 0 auto; padding-bottom: 5.5rem; }
.admin-bottom { display: flex; }
.admin-bottom a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); padding: .8rem .3rem; font-size: .8rem; font-weight: 700; }
.admin-bottom .is-active { color: var(--primary); }
.burger { display: grid; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.stat-card { background: var(--surface); border-radius: 16px; padding: 1rem; box-shadow: var(--shadow); }
.stat-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.stat-card strong { font-size: 1.6rem; }
.stat-card.ok { background: #e9f7ef; }
.stat-card.bad { background: #fde8e4; }
.stat-card.warn { background: #fff4d6; }
.stat-card.info { background: #e7eef8; }
.dash-grid { display: grid; gap: 1rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .45rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }

.page-tools, .filter-bar, .inline-form { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 1rem; align-items: center; }
.inline-search { display: flex; flex: 1 1 16rem; gap: .5rem; min-width: 0; margin: 0; }
.inline-search .input { width: auto; flex: 1 1 auto; min-width: 0; }
.page-tools-add { flex: 0 0 auto; white-space: nowrap; }
.phase-block { padding-top: 1rem; }
.phase-block .phase-head { margin: 0 0 .75rem; }
.admin-task-list { display: grid; }
.admin-task {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem .7rem;
  align-items: start;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.admin-task:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-task-body { display: grid; gap: .55rem; min-width: 0; }
.admin-task-main strong { display: block; font-size: 1.02rem; line-height: 1.3; }
.admin-task-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin: .35rem 0 0; }
.admin-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .75rem;
  align-items: end;
  justify-content: space-between;
}
.admin-task-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr));
  gap: .35rem .5rem;
  flex: 1 1 32rem;
  min-width: 0;
}
.admin-task-fields label {
  display: grid;
  gap: .18rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-task-fields .input { width: 100%; }
.admin-task-btns { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.admin-task-btns .btn { min-height: 40px; padding: .4rem .85rem; font-size: .85rem; }
.admin-task-btns form { margin: 0; }
.drag { cursor: grab; color: var(--muted); padding: .15rem .2rem; line-height: 1; user-select: none; }
.save-status {
  position: fixed; right: 1rem; bottom: 5.5rem; z-index: 15;
  background: #1c1917; color: #fff; padding: .35rem .7rem; border-radius: 999px; font-size: .8rem;
}

.form-grid { display: grid; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; }
.helper-grid { display: grid; gap: 1rem; }
.signup-row { display: grid; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.log-item summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.diff { width: 100%; border-collapse: collapse; font-size: .9rem; }
.diff td, .diff th { border: 1px solid var(--border); padding: .4rem; text-align: left; vertical-align: top; }
.noise-days {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .9rem 1rem 1rem;
  margin: .6rem 0;
}
.noise-days legend {
  padding: 0 .35rem;
  font-weight: 800;
}
.noise-day-options {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  margin-bottom: .85rem;
}
.noise-day-times {
  display: grid;
  gap: .55rem;
}
.noise-day-times label {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: .5rem;
  align-items: center;
  font-weight: 700;
}
.noise-time-pair {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.noise-time-pair .input { max-width: 8.5rem; }
@media (max-width: 560px) {
  .noise-day-times label { grid-template-columns: 1fr; }
}
.noise-grid { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 14px; padding: .8rem; margin: .6rem 0; }

.gantt-wrap { overflow-x: auto; background: var(--surface); border-radius: 16px; padding: 1rem; }
.gantt-head { display: flex; gap: 0; min-width: 640px; margin-left: 160px; }
.gantt-head span { flex: 1; font-size: .75rem; color: var(--muted); text-align: center; }
.gantt-row { display: grid; grid-template-columns: 150px 1fr; gap: .5rem; min-width: 640px; margin: .35rem 0; align-items: center; }
.gantt-label { font-size: .85rem; }
.gantt-label small { display: block; color: var(--muted); }
.gantt-track { position: relative; height: 28px; background: var(--surface-2); border-radius: 8px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .7rem; display: grid; place-items: center; text-decoration: none; overflow: hidden; padding: 0 .3rem; white-space: nowrap; }
.gantt-bar.parallel { background: var(--info); }
.gantt-bar.status-COMPLETED { background: var(--success); }
.gantt-bar.status-BLOCKED { background: #888; }
.gantt-phase { margin: 1rem 0 .3rem; font-size: 1rem; }
.list-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }

.sidenav.open { display: block; position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); background: var(--surface); z-index: 20; box-shadow: var(--shadow); padding: .5rem; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }

@media (min-width: 900px) {
  .page-helper .wrap, .page-helper .topbar-inner { width: min(720px, calc(100% - 2rem)); }
  .page-admin .bottom-nav, .page-admin .burger, .page-admin .admin-bottom { display: none; }
  .admin-shell { grid-template-columns: 250px 1fr; }
  .sidenav { display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface) 90%, #efe6d8); padding: 1rem .8rem; position: sticky; top: 0; height: 100dvh; }
  .sidenav-foot { margin-top: auto; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .helper-grid { grid-template-columns: 1fr 1fr; }
  .save-status { top: 1rem; right: 1.25rem; bottom: auto; }
  .admin-task-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, 96vw); border-radius: 22px; bottom: 6vh; }
  @keyframes sheet { from { transform: translateX(-50%) translateY(24px); } }
}

@media (min-width: 1200px) {
  .admin-task-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
