:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --text: #151719;
  --muted: #6f757c;
  --line: #dfe4e7;
  --blue: #1f6bea;
  --blue-soft: #e8f0ff;
  --red: #ee3e43;
  --red-soft: #fff0f0;
  --green: #19a974;
  --purple: #8c5ad8;
  --shadow: 0 18px 45px rgba(25, 31, 38, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

body.is-busy .check-box {
  pointer-events: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav-item.is-active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}

.connect-panel,
.panel,
.quick-add {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.connect-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-top: auto;
}

.connect-panel h2,
.panel-heading h2,
.quick-add h2 {
  margin: 0;
  font-size: 14px;
}

.connect-panel label,
.task-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.connect-panel input,
.task-form input,
.task-form select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
}

.connect-panel p {
  margin: 0;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.preset-button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.preset-button.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.primary-button,
.secondary-button,
.icon-button,
.add-button {
  border: 0;
  border-radius: 8px;
}

.primary-button {
  height: 38px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.secondary-button {
  height: 38px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar p {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 46px;
  height: 46px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 21px;
}

.icon-button.is-muted {
  position: relative;
}

.icon-button.is-muted::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 22px;
  height: 2px;
  background: var(--red);
  transform: rotate(-34deg);
}

.add-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.quick-add {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.quick-add-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.quick-add-header span {
  color: var(--muted);
  font-size: 12px;
}

.task-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  align-items: end;
}

.title-field {
  grid-column: span 2;
}

.submit-button {
  min-width: 104px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-section {
  padding: 6px 0;
}

.divider-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-row {
  display: grid;
  grid-template-columns: 28px 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.task-row:first-child {
  border-top: 0;
}

.check-box {
  width: 20px;
  height: 20px;
  border: 2px solid #87909a;
  border-radius: 5px;
  background: transparent;
}

.check-box:hover,
.check-box:focus-visible {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 169, 116, 0.16);
}

.space-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.task-main {
  min-width: 0;
}

.task-title {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.alarm-badge {
  color: var(--red);
  font-size: 18px;
}

.space-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.space-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.space-filter.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.side-panel {
  display: grid;
  gap: 18px;
}

.muted-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
}

.next-alarm {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.timer-face {
  position: relative;
  display: grid;
  place-items: center;
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, #fff 0 43%, transparent 44%),
    conic-gradient(from -90deg, var(--red) var(--timer-fill), #f2f2ef 0);
}

.timer-face::after {
  content: "";
  position: absolute;
  top: 10%;
  width: 2px;
  height: 42%;
  background: var(--text);
  transform: rotate(var(--hand-angle));
  transform-origin: 50% 95%;
}

.timer-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  text-align: center;
}

.timer-copy strong {
  font-size: 30px;
}

.timer-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.calendar-day {
  min-height: 98px;
  padding: 9px;
  border: 0;
  background: var(--surface);
  text-align: left;
}

.calendar-day strong {
  display: block;
  margin-bottom: 8px;
}

.day-dots {
  display: flex;
  gap: 4px;
}

.goal-list,
.alarm-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.goal-card,
.alarm-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.goal-card header,
.alarm-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-bar {
  height: 100%;
  background: var(--green);
}

.empty-state {
  padding: 42px;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .connect-panel {
    margin-top: 0;
  }

  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .title-field {
    grid-column: span 1;
  }

  .workspace {
    padding: 18px;
  }
}

@media (max-width: 680px) {
  .nav-item {
    justify-content: center;
    padding: 0 6px;
  }

  .nav-item span:last-child {
    display: none;
  }

  .topbar {
    align-items: flex-end;
  }

  .topbar h1 {
    font-size: 38px;
  }

  .quick-add-header {
    display: grid;
  }
}
