:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #9eb2cb;
  --panel: rgba(7, 12, 24, 0.9);
  --panel-strong: rgba(11, 24, 48, 0.96);
  --line: rgba(182, 206, 240, 0.2);
  --red: #f02d3f;
  --red-deep: #9f1625;
  --blue: #216dff;
  --blue-deep: #071b45;
  --gold: #ffd36a;
  --green: #42d392;
  --shadow: 12px 14px 0 rgba(0, 0, 0, 0.42), 0 24px 80px rgba(0, 0, 0, 0.36);
  --action-font: Impact, Haettenschweiler, "Arial Black", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(240, 45, 63, 0.2), transparent 34%),
    linear-gradient(245deg, rgba(33, 109, 255, 0.28), transparent 42%),
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.12), transparent 32%),
    #070b13;
}

body.light-mode {
  color-scheme: light;
  --ink: #111827;
  --muted: #526174;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(245, 248, 255, 0.96);
  --line: rgba(24, 38, 61, 0.16);
  --red: #d82032;
  --red-deep: #941525;
  --blue: #155de8;
  --blue-deep: #dbe7ff;
  --gold: #9a6500;
  --green: #087d55;
  --shadow: 10px 12px 0 rgba(11, 24, 48, 0.14), 0 24px 70px rgba(22, 34, 52, 0.16);
  background:
    linear-gradient(115deg, rgba(216, 32, 50, 0.13), transparent 36%),
    linear-gradient(245deg, rgba(21, 93, 232, 0.16), transparent 45%),
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.85), transparent 34%),
    #eef3fb;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(30deg, transparent 48%, rgba(255, 255, 255, 0.65) 49%, transparent 51%),
    linear-gradient(150deg, transparent 48%, rgba(255, 255, 255, 0.55) 49%, transparent 51%),
    linear-gradient(90deg, transparent 49%, rgba(240, 45, 63, 0.4) 50%, transparent 51%);
  background-size: 132px 132px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

body.light-mode::before {
  opacity: 0.13;
  background-image:
    linear-gradient(30deg, transparent 48%, rgba(9, 20, 38, 0.46) 49%, transparent 51%),
    linear-gradient(150deg, transparent 48%, rgba(9, 20, 38, 0.36) 49%, transparent 51%),
    linear-gradient(90deg, transparent 49%, rgba(216, 32, 50, 0.28) 50%, transparent 51%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero-panel,
.task-editor,
.calendar-panel,
.list-panel,
.day-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 190px;
  padding: 28px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  clip-path: polygon(0 0, 98% 0, 100% 18px, 100% 100%, 2% 100%, 0 calc(100% - 18px));
}

.theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover {
  transform: translate(-2px, -2px);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -220px;
  width: 560px;
  height: 390px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  transform: rotate(-12deg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 42px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 42px),
    linear-gradient(180deg, rgba(33, 109, 255, 0.26), rgba(240, 45, 63, 0.12));
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
  font-family: var(--action-font);
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 rgba(240, 45, 63, 0.7), 6px 6px 0 rgba(0, 0, 0, 0.55);
}

h1 {
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4.6rem);
}

h2 {
  font-size: 1.25rem;
}

.subtitle {
  max-width: 700px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
  min-width: min(420px, 100%);
}

.summary-strip div {
  min-height: 86px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, rgba(240, 45, 63, 0.18), rgba(3, 8, 18, 0.74));
  border-radius: 6px;
  transform: skew(-4deg);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.32);
}

body.light-mode .summary-strip div,
body.light-mode .task-card,
body.light-mode .list-row {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), transparent 34%),
    rgba(255, 255, 255, 0.82);
}

.summary-strip span {
  display: block;
  font-family: var(--action-font);
  font-size: 2rem;
  font-weight: 900;
}

.summary-strip small {
  color: var(--muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(460px, 1fr) minmax(300px, 390px);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.task-editor,
.calendar-panel,
.list-panel,
.day-panel {
  border-radius: 6px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.task-editor::before,
.calendar-panel::before,
.list-panel::before,
.day-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(25deg, transparent 48%, rgba(255, 255, 255, 0.9) 50%, transparent 52%),
    linear-gradient(155deg, transparent 48%, rgba(255, 255, 255, 0.7) 50%, transparent 52%);
  background-size: 96px 96px;
}

.panel-heading,
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.view-switch button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
  text-transform: uppercase;
}

.view-switch button.active {
  background: linear-gradient(135deg, rgba(240, 45, 63, 0.8), rgba(33, 109, 255, 0.8));
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.32);
}

form {
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(158, 178, 203, 0.24);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(3, 8, 18, 0.62);
  outline: none;
}

body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: rgba(255, 255, 255, 0.74);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 109, 242, 0.18);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-button,
.ghost-button,
.icon-button,
.filter-tabs button {
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-button {
  min-height: 48px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--red), var(--blue));
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.48), 0 16px 34px rgba(240, 45, 63, 0.2);
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
}

.ghost-button,
.filter-tabs button {
  min-height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.filter-tabs button:hover,
.text-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.38);
}

.icon-button {
  width: 46px;
  height: 46px;
  font-size: 2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.hidden {
  display: none;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  grid-auto-rows: minmax(150px, auto);
  position: relative;
  z-index: 1;
}

.weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  position: relative;
  z-index: 1;
}

.day-cell {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: rgba(4, 10, 22, 0.64);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  position: relative;
  overflow: hidden;
  user-select: none;
}

body.light-mode .day-cell {
  background: rgba(255, 255, 255, 0.7);
}

.day-cell::after {
  content: "";
  position: absolute;
  inset: auto -12px -22px auto;
  width: 92px;
  height: 70px;
  opacity: 0.16;
  transform: rotate(-16deg);
  background:
    repeating-linear-gradient(90deg, white 0 1px, transparent 1px 14px),
    repeating-linear-gradient(0deg, white 0 1px, transparent 1px 14px);
}

.day-cell:hover,
.day-cell.selected {
  border-color: rgba(255, 211, 106, 0.9);
  background: rgba(20, 39, 72, 0.86);
}

body.light-mode .day-cell:hover,
body.light-mode .day-cell.selected {
  background: rgba(219, 231, 255, 0.78);
}

.day-cell.selected {
  transform: translateY(-2px);
}

.day-cell.drop-ready {
  border-color: var(--red);
  background: linear-gradient(145deg, rgba(240, 45, 63, 0.32), rgba(33, 109, 255, 0.22));
  box-shadow: inset 0 0 0 2px rgba(255, 211, 106, 0.72), 7px 7px 0 rgba(0, 0, 0, 0.34);
}

.day-cell.outside {
  opacity: 0.45;
}

.day-cell.today .day-number {
  background: var(--red);
  color: white;
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.calendar-missions {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  position: relative;
  z-index: 1;
}

.calendar-task-chip {
  display: block;
  min-height: 25px;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 5px solid var(--blue);
  border-radius: 5px;
  padding: 5px 7px;
  overflow: hidden;
  color: var(--ink);
  background: rgba(6, 15, 31, 0.86);
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
  transform: skew(-5deg);
}

body.light-mode .calendar-task-chip {
  background: rgba(255, 255, 255, 0.86);
}

.calendar-task-chip.High {
  border-left-color: var(--red);
}

.calendar-task-chip.Medium {
  border-left-color: var(--gold);
}

.calendar-task-chip.Low {
  border-left-color: var(--green);
}

.calendar-task-chip.multi-day-task {
  background: linear-gradient(90deg, rgba(33, 109, 255, 0.24), rgba(6, 15, 31, 0.92));
  border-style: solid;
  border-top-color: rgba(255, 211, 106, 0.44);
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

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

.dot.High {
  background: var(--red);
}

.dot.Medium {
  background: var(--gold);
}

.dot.Low {
  background: var(--green);
}

.day-count {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  position: relative;
  z-index: 1;
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.filter-tabs button {
  min-width: 0;
}

.filter-tabs button.active {
  background: var(--blue);
}

.task-list {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.list-view {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.task-card,
.list-row {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 34%),
    rgba(3, 8, 18, 0.72);
  cursor: grab;
  transform: skew(-1deg);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.32);
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
}

.task-card:hover,
.list-row:hover {
  transform: translate(-2px, -2px) skew(-1deg);
  box-shadow: 9px 9px 0 rgba(0, 0, 0, 0.38);
}

.list-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 0.8fr);
  gap: 14px;
  cursor: default;
}

.task-card.dragging,
.calendar-task-chip.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.is-dragging-task .day-cell {
  border-style: dashed;
}

.task-card.High,
.list-row.High {
  border-left-color: var(--red);
}

.task-card.Medium,
.list-row.Medium {
  border-left-color: var(--gold);
}

.task-card.Low,
.list-row.Low {
  border-left-color: var(--green);
}

.task-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.task-card h3,
.list-row h3 {
  margin: 0;
  font-size: 1rem;
}

.task-card p,
.list-row p {
  margin: 8px 0 0;
  color: var(--muted);
}

.meta-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pill.Done {
  background: rgba(66, 211, 146, 0.2);
}

.pill.Doing {
  background: rgba(255, 211, 106, 0.18);
}

.pill.Todo {
  background: rgba(31, 109, 242, 0.2);
}

.pill.recurring {
  background: rgba(255, 211, 106, 0.18);
  color: var(--gold);
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  justify-content: flex-end;
  gap: 8px;
}

.subtasks {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(158, 178, 203, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

body.light-mode .subtasks {
  background: rgba(21, 93, 232, 0.05);
}

.subtask-summary {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.subtask-item {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.subtask-item input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

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

.text-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.text-button.danger {
  border-color: rgba(230, 50, 63, 0.5);
  color: #ff9aa2;
}

.empty-state {
  border: 1px dashed rgba(158, 178, 203, 0.32);
  border-radius: 6px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: 340px 1fr;
  }

  .day-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 10px;
  }

  .hero-panel {
    display: grid;
    padding: 20px;
  }

  .summary-strip,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .day-panel {
    grid-column: auto;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .list-row {
    grid-template-columns: 1fr;
  }

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

  .day-cell {
    min-height: 112px;
    padding: 7px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(112px, auto);
  }

  .calendar-task-chip {
    min-height: 22px;
    padding: 3px 5px;
    font-size: 0.66rem;
  }

  .day-count {
    display: none;
  }

  .calendar-panel {
    padding: 12px;
  }
}
