:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #17212b;
  --muted: #657384;
  --faint: #8b97a5;
  --line: #dce3ea;
  --line-strong: #c7d1dc;
  --teal: #0f8f8c;
  --teal-soft: #e1f4f3;
  --amber: #c47b1b;
  --amber-soft: #fff0d9;
  --violet: #7262c7;
  --violet-soft: #ece9ff;
  --rose: #c24f6f;
  --rose-soft: #ffe7ee;
  --shadow: 0 18px 48px rgba(21, 32, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.brand-block,
.task-card-top,
.phone-header,
.toolbar,
.day-head,
.progress-row,
.editor-actions,
.editor header {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
}

.brand-meta,
.task-time,
.phone-header span,
.mobile-task span,
.mobile-task small,
.empty-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-action,
.editor-actions button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #162433;
  font-weight: 700;
  cursor: pointer;
}

.side-section {
  display: grid;
  gap: 10px;
}

.side-section h2 {
  margin: 0;
  color: #526171;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.queue-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.queue-item span {
  font-size: 0.88rem;
  font-weight: 700;
}

.queue-item small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--amber);
  font-size: 0.76rem;
}

.month-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.month-toolbar div {
  display: flex;
  gap: 6px;
}

.month-toolbar button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.two-month-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344354;
  font-size: 0.82rem;
  font-weight: 650;
}

.mini-calendars {
  display: grid;
  gap: 14px;
}

.mini-calendar {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mini-calendar h3 {
  margin: 0;
  font-size: 0.95rem;
}

.mini-weekdays,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.mini-weekdays span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-align: center;
}

.mini-grid button,
.mini-grid > span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #273544;
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.mini-grid button:hover,
.mini-grid button.selected {
  background: var(--teal-soft);
  color: #075f5d;
}

.mini-grid button.selected {
  box-shadow: inset 0 0 0 1px #8fd4d2;
  font-weight: 800;
}

.mini-grid em {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--teal);
  font-size: 0;
}

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

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

.topbar h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar {
  gap: 8px;
}

.more-menu-wrap {
  position: relative;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: grid;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.more-menu button {
  display: block;
  width: 100%;
  height: auto;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.more-menu button:hover {
  background: var(--surface-soft);
}

.toolbar button,
.icon-button,
.edit-button,
.expand-button,
.drag-handle,
.close-editor,
.close-panel {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.split-layout {
  display: block;
  align-items: start;
}

.mobile-calendar-toggle,
.mobile-calendar-panel {
  display: none;
}

.toolbar .mobile-calendar-toggle {
  display: none;
}

.day-board {
  display: grid;
  grid-template-columns: repeat(var(--day-count), minmax(250px, 1fr));
  gap: 12px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 12px;
}

.day-column {
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  transition: border-color 160ms ease, background 160ms ease;
  cursor: pointer;
}

.day-column.drop-target {
  border-color: var(--teal);
  background: #edfafa;
}

.day-head {
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.day-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.day-head h2 {
  margin: 3px 0 0;
  font-size: 1.05rem;
}

.task-list {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.task-card {
  display: grid;
  gap: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(22, 36, 51, 0.06);
  cursor: default;
}

.task-card.dragging {
  opacity: 0.55;
}

.task-card.touch-moving {
  border-color: var(--teal);
  box-shadow: 0 10px 28px rgba(15, 143, 140, 0.18);
}

.task-card.amber,
.mobile-task.amber {
  border-left-color: var(--amber);
}

.task-card.violet,
.mobile-task.violet {
  border-left-color: var(--violet);
}

.task-card.rose,
.mobile-task.rose {
  border-left-color: var(--rose);
}

.task-card-top {
  align-items: flex-start;
  gap: 9px;
}

.task-card-top > div {
  min-width: 0;
  flex: 1;
}

.task-card h3 {
  margin: 3px 0 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.drag-handle,
.edit-button,
.expand-button {
  width: 28px;
  height: 28px;
  color: var(--faint);
  background: transparent;
}

.expand-button {
  transition: transform 160ms ease, color 160ms ease;
}

.task-card.expanded .expand-button {
  color: var(--teal);
  transform: rotate(180deg);
}

.task-details {
  display: grid;
  gap: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 180ms ease, opacity 160ms ease, margin-top 160ms ease;
}

.task-card.expanded .task-details {
  max-height: 260px;
  margin-top: 10px;
  opacity: 1;
}

.task-card.collapsed .task-time {
  color: var(--faint);
}

.progress-row {
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.progress-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7edf2;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.checklist {
  display: grid;
  gap: 7px;
}

.checklist label,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344354;
  font-size: 0.83rem;
}

.checklist input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.checklist input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.empty-day {
  display: grid;
  place-items: center;
  min-height: 90px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
}

.mobile-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #162433;
  color: #f7fafc;
  box-shadow: var(--shadow);
}

.phone-header {
  gap: 10px;
}

.phone-header svg {
  color: #8ed9d7;
}

.phone-header div {
  display: grid;
  gap: 2px;
}

.phone-header span {
  color: #b5c1cd;
}

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mobile-tabs button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #d7e0e8;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.mobile-tabs button.active {
  color: #092c2b;
  background: #93dfdc;
}

.mobile-list {
  display: grid;
  gap: 8px;
}

.mobile-task {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.mobile-task div {
  display: grid;
  gap: 3px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 14, 20, 0.42);
}

.editor {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor header {
  justify-content: space-between;
}

.editor h2 {
  margin: 0;
  font-size: 1.2rem;
}

.close-editor,
.close-panel {
  border: 0;
  font-size: 1.4rem;
}

.editor label:not(.toggle-row) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.editor input,
.editor select,
.editor textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  text-transform: none;
}

.editor textarea {
  min-height: 96px;
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

.editor-actions {
  justify-content: space-between;
  gap: 10px;
}

.delete-task {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #ffd2dc;
  border-radius: 8px;
  color: #a83755;
  background: var(--rose-soft);
  cursor: pointer;
}

.editor-actions button[type="submit"] {
  min-width: 110px;
}

.info-panel {
  gap: 18px;
}

.help-copy p {
  margin: 0;
  color: #344354;
  line-height: 1.5;
}

.settings-list fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-list legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344354;
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.month-toolbar .today-button {
  width: auto;
  min-width: 50px;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 800;
}

.toolbar .more-menu button {
  display: block;
  width: 100%;
  height: auto;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.segmented-control input:checked + span {
  border-color: #8fd4d2;
  color: #075f5d;
  background: var(--teal-soft);
}

.mobile-font-small .topbar h1,
.mobile-font-small .day-head h2,
.mobile-font-small .task-card h3 {
  font-size: 0.94em;
}

.mobile-font-tiny .topbar h1,
.mobile-font-tiny .day-head h2,
.mobile-font-tiny .task-card h3 {
  font-size: 10px;
}

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

  .sidebar {
    display: none;
  }

  .toolbar .mobile-calendar-toggle {
    display: grid;
  }

  .mobile-calendar-panel.open {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .mobile-calendar-panel h2 {
    margin: 0;
    color: #526171;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

}

@media (max-width: 720px) {
  .workspace {
    padding: 14px;
  }

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

  .toolbar {
    flex-shrink: 0;
  }

  .day-board {
    grid-template-columns: repeat(var(--mobile-cols), minmax(160px, 1fr));
    overflow-x: auto;
  }

  .day-column {
    min-height: auto;
  }

  .day-head {
    padding: 10px;
  }

  .day-head h2 {
    font-size: 0.92rem;
  }

  .task-list {
    padding: 8px;
  }

  .task-card {
    padding: 10px;
  }

  .drag-handle {
    display: none;
  }

}
