:root {
  --bg: #f5f3f0;
  --bg-elevated: #fcfaf7;
  --surface: #fcfaf7;
  --surface-2: #f1ede7;
  --border: #ddd6cd;
  --border-strong: #c8beb4;
  --text: #5e5a55;
  --muted: #8a847c;
  --accent: #8da1b0;
  --accent-hover: #7f95a5;
  --accent-soft: #e8eef2;
  --high: #c7a6a1;
  --medium: #d8c58e;
  --low: #a8b8c4;
  --success: #7fa08a;
  --success-soft: #e8f0ea;
  --warning-soft: #f3ece4;
  --danger-soft: #f4e8e6;
  --weekend-bg: #e8e2db;
  --weekend-bg-soft: #f2ece6;
  --radius: 12px;
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 6px 18px rgba(109, 98, 88, 0.06);
  --topbar-height: 76px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(180deg, #f8f5f1 0%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.5;
}

body.is-resizing {
  cursor: ew-resize;
  user-select: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(252, 250, 247, 0.96);
  border-bottom: 1px solid rgba(221, 214, 205, 0.92);
}

.topbar-inner {
  max-width: 1200px;
  min-height: var(--topbar-height);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.topbar-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(109, 98, 88, 0.08);
  object-fit: cover;
}

.topbar-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.topbar-copy strong {
  font-size: 1rem;
  line-height: 1.2;
}

.topbar-copy span {
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.35rem;
}

.user-badge {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.36rem 0.75rem;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.logout-btn {
  white-space: nowrap;
}

body.auth-locked .topbar-nav,
body.auth-locked .nav-toggle {
  display: none !important;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 999px;
  background: var(--accent);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.auth-gate {
  max-width: 1200px;
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
  padding: 4rem 1.25rem 2rem;
  display: grid;
  place-items: start center;
}

.auth-card {
  width: min(100%, 430px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.auth-card-head {
  margin-bottom: 1rem;
}

.auth-card-head h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--text);
}

.auth-card-head p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.auth-mode-btn {
  border: none;
  border-radius: 8px;
  padding: 0.58rem 0.75rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(109, 98, 88, 0.08);
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-submit {
  width: 100%;
}

.auth-message {
  min-height: 1.3rem;
  margin: 0.9rem 0 0;
  font-size: 0.84rem;
}

.auth-message.error {
  color: #9c6f6a;
}

.auth-message.success {
  color: var(--success);
}

.auth-message.muted {
  color: var(--muted);
}

.content {
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.section-heading {
  margin-bottom: 0.75rem;
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.85rem 1rem;
}

.section-hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-tab {
  position: relative;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  text-align: center;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.project-tab:hover {
  color: var(--accent);
  background: rgba(232, 238, 242, 0.9);
}

.project-tab.active {
  color: var(--accent);
  background: rgba(232, 238, 242, 0.95);
}

.project-tab::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.45rem;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.16s ease;
}

.project-tab:hover::after,
.project-tab.active::after {
  background: var(--accent);
}

.tab-panel.hidden,
.hidden {
  display: none !important;
}

.task-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.9rem;
}

.field.full,
.form-actions.full {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.28rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.68rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.field-help {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.time-selects {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.45rem;
  align-items: center;
}

.time-selects span {
  color: var(--muted);
  font-weight: 600;
}

.tag-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: stretch;
}

.tag-multiselect {
  position: relative;
}

.tag-select-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.field-tags .tag-multiselect,
.field-tags .tag-select-button {
  height: 100%;
}

.field-tags .tag-select-button {
  align-items: flex-start;
}

.tag-select-button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.tag-selected-badges {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-select-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.22rem 0.45rem;
  border-radius: 0.375rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.1);
}

.tag-placeholder {
  color: var(--muted);
  font-size: 0.84rem;
}

.tag-select-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.tag-dropdown {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 0.2rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 32px rgba(15, 39, 68, 0.14);
}

.tag-dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tag-dropdown-option:hover {
  background: #edf5fd;
}

.tag-dropdown-option.selected {
  background: #e3f0ff;
}

.tag-option-label {
  min-width: 0;
}

.tag-option-check {
  color: var(--accent);
  font-weight: 700;
  min-width: 1rem;
  text-align: right;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.compact-actions {
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.btn {
  padding: 0.58rem 0.95rem;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent);
  color: #faf8f5;
  box-shadow: 0 2px 10px rgba(141, 161, 176, 0.24);
}

.btn.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(127, 149, 165, 0.24);
}

.btn.ghost {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: #ede6dd;
  color: var(--accent-hover);
}

.btn.danger {
  background: var(--danger-soft);
  color: #9c6f6a;
  border: 1px solid #e0c8c4;
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
}

.btn.danger:hover {
  background: #efe0de;
  border-color: #d7b8b4;
}

.btn.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f6f1eb;
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn.icon-btn:hover {
  background: #eee7de;
}

.btn.edit-btn {
  background: #e6edf2;
  color: #647988;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  box-shadow: inset 0 0 0 1px rgba(109, 98, 88, 0.06);
}

.btn.edit-btn:hover {
  background: #dbe5ec;
  color: #596d7a;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: start;
}

.compact-filter-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.gantt-filter-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.compact-filter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.compact-filter-label {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.compact-multiselect {
  width: 84px;
}

.gantt-filter-multiselect {
  width: 200px;
}

.compact-select-button {
  min-height: 22px;
  padding: 0.2rem 0.45rem;
  gap: 0.35rem;
}

.gantt-filter-button {
  min-height: 30px;
  padding: 0.2rem 0.65rem;
}

.compact-badge {
  padding: 0.18rem 0.4rem;
  font-size: 0.65rem;
}

.compact-dropdown {
  min-width: 84px;
  padding: 0.25rem;
}

.gantt-filter-dropdown {
  min-width: 200px;
}

.filter-select {
  min-width: 140px;
  max-width: 220px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.42rem;
  border-radius: 0.375rem;
  background: #e9f0f4;
  color: #60727e;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(109, 98, 88, 0.08);
}

.tag-chip.muted {
  background: #f1ece6;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
}

.list-actions {
  display: flex;
  gap: 0.38rem;
  align-items: start;
  padding-top: 0.05rem;
}

.task-list-content {
  min-width: 0;
}

.task-list-top {
  min-width: 0;
}

.task-list-title-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  min-width: 0;
}

.task-list-title {
  min-width: 0;
  max-width: 100%;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-status-text {
  margin-left: 0.4rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.task-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
}

.task-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.gantt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.gantt-head h2 {
  margin: 0;
  line-height: 1.3;
}

.gantt-head-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  margin-left: auto;
}

.list-head {
  justify-content: flex-start;
}

.dimension-toggle {
  display: inline-flex;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.06);
}

.dimension-toggle .dim-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.dimension-toggle .dim-btn + .dim-btn {
  border-left: 1px solid var(--border);
}

.dimension-toggle .dim-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.dimension-toggle .dim-btn.active {
  background: var(--accent);
  color: #fff;
}

.dimension-toggle .dim-btn.active:hover {
  background: var(--accent-hover);
  color: #fff;
}

.legend {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch.high {
  background: var(--high);
}

.swatch.medium {
  background: var(--medium);
}

.swatch.low {
  background: var(--low);
}

.gantt {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 0.25rem;
}

.gantt-inner {
  min-width: 560px;
}

.gantt-header-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
  align-items: stretch;
}

.gantt-corner {
  padding: 0.35rem 0.75rem 0.5rem 0;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.2rem;
  min-height: 3.25rem;
}

.gantt-corner-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.78rem;
}

.gantt-corner-sub {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.gantt-timeline-header,
.gantt-row-timeline {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  gap: 0.35rem;
  align-items: stretch;
  min-width: 0;
}

.gantt-nav-cell {
  min-height: 1px;
}

.gantt-nav-btn {
  width: 100%;
  align-self: stretch;
  min-height: 2.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.gantt-nav-btn:hover {
  background: #c8ddf5;
  border-color: var(--border-strong);
  color: var(--accent-hover);
}

.gantt-nav-btn:active {
  transform: scale(0.96);
}

.gantt-days-wrap {
  min-width: 0;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  background: var(--bg-elevated);
}

.gantt-days {
  display: grid;
  text-align: center;
  gap: 2px;
  min-height: 100%;
}

.gantt-day {
  padding: 0.45rem 0.2rem;
  font-size: 0.68rem;
  color: var(--muted);
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, #f5f9ff 0%, var(--surface-2) 100%);
  border-radius: 6px 6px 0 0;
}

.gantt-day.weekend {
  background: linear-gradient(180deg, var(--weekend-bg-soft) 0%, var(--weekend-bg) 100%);
  color: #5c6570;
}

.gantt-day:first-child {
  border-left: none;
}

.gantt-day .dow {
  display: block;
  font-weight: 600;
  color: var(--text);
  font-size: 0.78rem;
}

.gantt-day.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: linear-gradient(180deg, #e8f2fc 0%, #d6e8fc 100%);
}

.gantt-day.today.weekend {
  background: linear-gradient(180deg, #dde1e8 0%, #cfd4dc 100%);
}

.gantt-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: stretch;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-label {
  padding: 0.5rem 0.75rem 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.45rem;
  row-gap: 0.15rem;
  align-content: center;
  overflow: hidden;
}

.gantt-task-check {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  margin: 0;
}

.gantt-label strong {
  grid-column: 2;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gantt-label .prio {
  font-size: 0.7rem;
  color: var(--muted);
}

.gantt-tag-row {
  grid-column: 2;
  margin-top: 0.35rem;
}

.gantt-track {
  position: relative;
  border-radius: 0 0 6px 6px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-top: none;
  background: #f7f2ec;
}

.gantt-track-cols {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
  z-index: 0;
  border-radius: 0 0 5px 5px;
  overflow: hidden;
}

.gantt-col {
  flex: 1;
  min-width: 0;
  background: #fbf7f2;
  border-left: 1px solid var(--border);
}

.gantt-col:first-child {
  border-left: none;
}

.gantt-col.weekend {
  background: var(--weekend-bg);
}

.gantt-placeholder-row .gantt-track {
  min-height: 52px;
}

.gantt-placeholder-label {
  justify-content: center;
}

.placeholder-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 26px;
  border-radius: 8px;
  min-width: 12px;
  box-shadow: 0 3px 8px rgba(109, 98, 88, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.65);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.gantt-bar.dragging {
  box-shadow: 0 8px 20px rgba(109, 98, 88, 0.16);
}

.gantt-bar.high {
  background: linear-gradient(180deg, #cfb1ad, var(--high));
  color: #705955;
}

.gantt-bar.medium {
  background: linear-gradient(180deg, #e0cf9d, var(--medium));
  color: #7c6a3f;
}

.gantt-bar.low {
  background: linear-gradient(180deg, #b4c2cc, var(--low));
  color: #61727e;
}

.gantt-bar.completed {
  background: linear-gradient(180deg, #c9d2dd, #94a3b8);
}

.gantt-bar-label {
  flex: 1;
  min-width: 0;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  pointer-events: none;
}

.gantt-handle {
  width: 12px;
  height: 100%;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.22);
  cursor: ew-resize;
  flex: 0 0 12px;
  position: relative;
}

.gantt-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: -3px 0 0 rgba(255, 255, 255, 0.75), 3px 0 0 rgba(255, 255, 255, 0.75);
}

.gantt-handle:hover {
  background: rgba(255, 255, 255, 0.35);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: start;
  padding: 0.58rem 0;
  border-bottom: 1px solid var(--border);
}

.task-list li.task-completed {
  opacity: 0.75;
}

.task-list li.task-completed .tag-chip,
.task-list li.task-completed .prio-tag {
  filter: grayscale(1);
}

.task-list li:last-child {
  border-bottom: none;
}

.task-list .meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.18rem;
}

.tag-dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: 0 18px 40px rgba(15, 39, 68, 0.2);
}

.tag-dialog::backdrop {
  background: rgba(15, 39, 68, 0.32);
}

.tag-dialog-form {
  padding: 1.2rem;
}

.tag-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tag-dialog-head h3 {
  margin: 0;
  font-size: 1rem;
}

.tag-manager-list {
  display: grid;
  gap: 0.65rem;
}

.tag-manager-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.tag-manager-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
}

.tag-manager-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  margin-top: 1rem;
}

.tag-manager-add input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
}

.task-list .prio-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.42rem;
  border-radius: 0.375rem;
  font-size: 0.68rem;
  font-weight: 600;
  margin-left: 0.28rem;
  vertical-align: middle;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(109, 98, 88, 0.08);
}

.task-list .prio-tag.high {
  background: #efe3e1;
  color: #7b615e;
}

.task-list .prio-tag.medium {
  background: #efe4bf;
  color: #7c6a3f;
}

.task-list .prio-tag.low {
  background: #e5edf2;
  color: #61727e;
}

.todo-panel {
  padding: 1rem 1.1rem;
}

.todo-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.todo-form-card {
  min-width: 0;
}

.todo-main {
  min-width: 0;
  display: grid;
  gap: 1rem;
}

.todo-subpanel {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gantt-panel {
  height: 380px;
}

.list-panel {
  height: 340px;
}

.todo-gantt-scroll,
.todo-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
  scrollbar-width: thin;
  scrollbar-color: #c7bdb2 #eee7de;
}

.todo-gantt-scroll::-webkit-scrollbar,
.todo-list-scroll::-webkit-scrollbar {
  width: 10px;
}

.todo-gantt-scroll::-webkit-scrollbar-track,
.todo-list-scroll::-webkit-scrollbar-track {
  background: #eee7de;
  border-radius: 999px;
}

.todo-gantt-scroll::-webkit-scrollbar-thumb,
.todo-list-scroll::-webkit-scrollbar-thumb {
  background: #c7bdb2;
  border-radius: 999px;
  border: 2px solid #eee7de;
}

.todo-gantt-scroll::-webkit-scrollbar-thumb:hover,
.todo-list-scroll::-webkit-scrollbar-thumb:hover {
  background: #b9aea2;
}

.status-filter-group {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(241, 237, 231, 0.9);
  gap: 0.2rem;
}

.status-filter-btn {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.75rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.status-filter-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(109, 98, 88, 0.08);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.schedule-panel {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.schedule-heading {
  margin-bottom: 0.9rem;
}

.schedule-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.record-sidebar,
.schedule-gantt-card,
.stats-card {
  padding: 1rem;
}

.panel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-card-head h3,
.record-section-head h4,
.chart-card-head h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.schedule-main {
  display: grid;
  gap: 1rem;
}

.timer-combobox {
  position: relative;
}

.timer-combobox-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  border: 1px solid #d6cfc7;
  border-radius: 10px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.timer-combobox-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(141, 161, 176, 0.15);
}

.timer-combobox-input input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  font: inherit;
  outline: none;
}

.combobox-toggle {
  border: none;
  border-left: 1px solid #e7dfd7;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.timer-dropdown {
  position: static;
  display: grid;
  gap: 0.2rem;
  margin-top: 0.45rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(109, 98, 88, 0.1);
  max-height: 240px;
  overflow-y: auto;
}

.timer-dropdown-item,
.recent-task-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.timer-dropdown-item:hover,
.recent-task-item:hover {
  background: #f3efea;
  border-color: #ebe3da;
}

.timer-dropdown-item strong,
.recent-task-item strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.timer-dropdown-item span,
.recent-task-item span {
  font-size: 0.76rem;
  color: var(--muted);
}

.schedule-primary-btn {
  width: 100%;
  margin-top: 0.75rem;
}

.record-section {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid #ece5dc;
}

.record-section-head {
  margin-bottom: 0.65rem;
}

.recent-task-list,
.active-timer-list,
.schedule-entry-list {
  display: grid;
  gap: 0.7rem;
}

.empty-note {
  padding: 0.7rem 0.8rem;
  border: 1px dashed #ddd3c8;
  border-radius: 9px;
  background: rgba(241, 237, 231, 0.55);
  font-size: 0.82rem;
  color: var(--muted);
}

.active-timer-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 10px;
  background: rgba(252, 250, 247, 0.96);
  padding: 0.85rem 0.9rem;
}

.active-timer-card.paused {
  border-left-color: var(--medium);
}

.active-timer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.active-timer-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.status-badge.running {
  background: var(--success-soft);
  color: #6f8c77;
}

.status-badge.paused {
  background: var(--warning-soft);
  color: #a48663;
}

.active-timer-meta {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.active-timer-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.active-timer-actions .btn {
  flex: 1 1 0;
}

.schedule-toolbar {
  margin-bottom: 0.55rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.toolbar-date-input {
  min-width: 148px;
  height: 36px;
  padding: 0.42rem 0.7rem;
  border: 1px solid #d6cfc7;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.toolbar-date-input:focus {
  outline: 2px solid rgba(141, 161, 176, 0.2);
  outline-offset: 1px;
  border-color: var(--accent);
}

.toolbar-btn {
  min-width: 78px;
  height: 36px;
  padding-top: 0;
  padding-bottom: 0;
}

.schedule-summary {
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.schedule-day-gantt {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(252, 250, 247, 0.98), rgba(246, 242, 237, 0.96));
  overflow: hidden;
}

.schedule-gantt-scroll {
  overflow-x: auto;
}

.schedule-gantt-inner {
  min-width: 760px;
}

.schedule-gantt-header,
.schedule-gantt-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
}

.schedule-gantt-header {
  border-bottom: 1px solid #e8e1d8;
}

.schedule-gantt-title-cell,
.schedule-gantt-label {
  padding: 0.68rem 0.72rem;
  border-right: 1px solid #e8e1d8;
}

.schedule-gantt-title-cell strong {
  display: block;
  font-size: 0.8rem;
}

.schedule-gantt-hours,
.schedule-gantt-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(36px, 1fr));
}

.schedule-gantt-hours {
  background: rgba(241, 237, 231, 0.7);
  grid-template-columns: repeat(12, minmax(36px, 1fr));
}

.schedule-gantt-hour,
.schedule-track-cell {
  min-width: 36px;
  border-left: 1px solid #ece5dc;
}

.schedule-gantt-hour:first-child,
.schedule-track-cell:first-child {
  border-left: none;
}

.schedule-gantt-hour {
  padding: 0.5rem 0 0.48rem;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
}

.schedule-gantt-row {
  border-top: 1px solid #efe7de;
}

.schedule-gantt-row:first-of-type {
  border-top: none;
}

.schedule-gantt-label {
  display: grid;
  gap: 0.12rem;
  align-content: center;
}

.schedule-gantt-label strong {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-gantt-label span {
  font-size: 0.68rem;
  color: var(--muted);
}

.schedule-gantt-track {
  min-height: 58px;
  background: rgba(252, 250, 247, 0.75);
}

.schedule-track-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(36px, 1fr));
}

.schedule-entry-bar {
  position: absolute;
  height: 21px;
  border-radius: 999px;
  background: #a8b8c4;
  color: #faf8f5;
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  cursor: default;
  box-shadow: 0 4px 10px rgba(168, 184, 196, 0.22);
}

.schedule-entry-bar:hover {
  filter: brightness(0.98);
}

.schedule-entry-bar.is-resizable {
  padding-left: 0;
  padding-right: 0;
}

.schedule-entry-handle {
  position: absolute;
  top: 0;
  width: 12px;
  height: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  cursor: ew-resize;
  padding: 0;
}

.schedule-entry-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: -3px 0 0 rgba(255, 255, 255, 0.65), 3px 0 0 rgba(255, 255, 255, 0.65);
}

.schedule-entry-handle.left {
  left: 0;
  border-radius: 999px 0 0 999px;
}

.schedule-entry-handle.right {
  right: 0;
  border-radius: 0 999px 999px 0;
}

.schedule-gantt-empty {
  padding: 2.4rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.schedule-entry-inline-actions {
  display: none;
}

.segmented-control {
  display: inline-flex;
  padding: 0.18rem;
  background: rgba(241, 237, 231, 0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.segment-btn {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 32px;
  padding: 0.34rem 0.78rem;
  cursor: pointer;
}

.segment-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(109, 98, 88, 0.08);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  border: 1px solid #ece5dc;
  border-radius: 12px;
  background: rgba(250, 248, 245, 0.94);
  padding: 0.95rem;
}

.chart-card-head {
  margin-bottom: 0.8rem;
}

.pie-chart-card,
.bar-chart-card {
  min-height: 320px;
}

.pie-chart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
}

.pie-chart-visual-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}

.pie-chart-svg {
  width: 220px;
  height: 220px;
  display: block;
}

.pie-slice {
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease;
  transform-origin: 110px 110px;
}

.pie-slice:hover {
  filter: brightness(0.98);
}

.pie-slice.pinned {
  filter: saturate(1.02);
}

.pie-slice-popover {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 240px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfaf7;
  box-shadow: 0 8px 18px rgba(109, 98, 88, 0.1);
  white-space: nowrap;
}

.pie-slice-popover-task {
  max-width: 88px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-slice-popover-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.pie-chart-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.65rem;
}

.pie-legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text);
  width: 100%;
  border: 1px solid #ece5dc;
  border-radius: 9px;
  background: rgba(252, 250, 247, 0.96);
  padding: 0.45rem 0.55rem;
  text-align: left;
}

.pie-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.pie-legend-item span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend-item span:last-child {
  color: var(--muted);
  font-size: 0.74rem;
}

.top-bar-list {
  display: grid;
  gap: 0.8rem;
}

.top-bar-item {
  display: grid;
  gap: 0.35rem;
}

.top-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text);
}

.top-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e6dfd7;
  overflow: hidden;
}

.top-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9eb0bb 0%, #7c93a6 100%);
}

.entry-dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100vw - 2rem));
  box-shadow: 0 18px 40px rgba(109, 98, 88, 0.18);
}

.entry-dialog::backdrop {
  background: rgba(94, 90, 85, 0.24);
}

.entry-dialog-form {
  padding: 1.2rem;
}

.entry-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 0.9rem;
}

.entry-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.entry-dialog-actions-right {
  display: flex;
  gap: 0.6rem;
}

.entry-form-grid-single {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-dialog-tip {
  font-size: 0.76rem;
  color: var(--muted);
}

.schedule-bar-popover {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 320px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfaf7;
  box-shadow: 0 8px 20px rgba(109, 98, 88, 0.1);
  min-width: 0;
}

.schedule-bar-popover-task {
  min-width: 0;
  flex: 0 1 auto;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-bar-popover-meta {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.74rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-bar-popover-delete {
  flex: 0 0 auto;
  border: 1px solid #e0c8c4;
  border-radius: 6px;
  background: #f4e8e6;
  color: #9c6f6a;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  cursor: pointer;
}

.schedule-bar-popover-delete:hover {
  background: #eeddd9;
  color: #8e625d;
}

@media (max-width: 900px) {
  .todo-layout {
    grid-template-columns: 1fr;
  }

  .schedule-layout,
  .chart-grid,
  .pie-chart-layout {
    grid-template-columns: 1fr;
  }

  .pie-chart-legend {
    grid-template-columns: 1fr;
  }

  .record-sidebar {
    order: 1;
  }

  .schedule-main {
    order: 2;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .topbar-copy span {
    display: none;
  }

  .nav-toggle {
    display: inline-block;
  }

  .topbar-nav {
    display: none;
    width: 100%;
    margin-left: 0;
    padding-top: 0.35rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
  }

  .topbar-nav.open {
    display: flex;
  }

  .topbar-user {
    margin-left: 0;
  }

  .project-tab {
    width: 100%;
    text-align: left;
  }

  .project-tab::after {
    left: 0.95rem;
    right: auto;
    width: 22px;
  }
}

@media (max-width: 640px) {
  .status-filter-group {
    width: 100%;
    justify-content: stretch;
  }

  .status-filter-btn {
    flex: 1 1 0;
  }

  .schedule-gantt-header,
  .schedule-gantt-row,
  .pie-chart-layout,
  .entry-form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-gantt-title-cell,
  .schedule-gantt-label {
    border-right: none;
    border-bottom: 1px solid #ece5dc;
  }

  .entry-dialog-actions,
  .entry-dialog-actions-right,
  .toolbar-actions,
  .stats-toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .active-timer-actions {
    flex-direction: column;
  }

  .pie-chart-visual {
    width: min(220px, 100%);
    height: min(220px, 100vw - 6rem);
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .field-detail,
  .field-tags {
    grid-column: auto;
  }

  .tag-picker-row,
  .tag-manager-item,
  .tag-manager-add {
    grid-template-columns: 1fr;
  }

  .compact-actions {
    justify-content: stretch;
  }

  .compact-actions .btn {
    flex: 1 1 auto;
  }

  .gantt-header-row,
  .gantt-row {
    grid-template-columns: 120px 1fr;
  }

  .gantt-corner,
  .gantt-label {
    padding-right: 0.5rem;
  }

  .gantt-head-right {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .app-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .auth-gate {
    padding: 2rem 1rem;
  }

  .auth-card {
    padding: 1rem;
  }

  .topbar-brand {
    min-width: 0;
  }

  .topbar-copy strong {
    font-size: 0.95rem;
  }

  .gantt-bar-label {
    font-size: 0.68rem;
  }

  .list-actions,
  .filter-bar {
    width: 100%;
  }
}
