:root {
  color-scheme: light;
  --bg: #eef4f7;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --ink: #172026;
  --muted: #64717c;
  --line: #dbe4ea;
  --accent: #146c94;
  --accent-dark: #0d4f70;
  --accent-soft: #dceef5;
  --green: #257a5d;
  --yellow: #b56b11;
  --red: #c73e56;
  --shadow: 0 24px 70px rgba(23, 32, 38, 0.12);
}

body.dark {
  color-scheme: dark;
  --bg: #11181d;
  --panel: #18232b;
  --panel-soft: #111a21;
  --ink: #eef6fb;
  --muted: #a5b3bd;
  --line: #2d3d48;
  --accent: #6ab5d8;
  --accent-dark: #98d4ef;
  --accent-soft: #1d3542;
  --green: #78d2a9;
  --yellow: #e7b35a;
  --red: #ef7e91;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(20, 108, 148, 0.14), transparent 30rem),
    linear-gradient(135deg, var(--bg), #e8f2ee);
}

body.dark {
  background:
    radial-gradient(circle at top left, rgba(106, 181, 216, 0.16), transparent 30rem),
    linear-gradient(135deg, #11181d, #1b2028);
}

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

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(20, 108, 148, 0.24);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--panel);
}

textarea {
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 24px;
  width: min(1440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

.sidebar,
.task-form,
.task-board,
.stat {
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

body.dark .sidebar,
body.dark .task-form,
body.dark .task-board,
body.dark .stat {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(24, 35, 43, 0.9);
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 22px;
  padding: 22px;
}

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

.brand-icon {
  width: 58px;
  height: 58px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.1;
}

.status-card {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.status-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--yellow);
}

.status-dot.is-online {
  background: var(--green);
}

.status-dot.is-safe {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(37, 122, 93, 0.12);
}

.views,
.quick-actions {
  display: grid;
  gap: 9px;
}

.view-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.view-button span {
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  text-align: center;
}

.view-button:hover,
.view-button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.quick-actions {
  grid-template-columns: repeat(2, 1fr);
}

.quick-actions button,
.ghost-button,
.small-button {
  min-height: 38px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.quick-actions button:hover,
.ghost-button:hover,
.small-button:hover {
  filter: brightness(0.97);
}

.quick-actions .danger-action {
  grid-column: 1 / -1;
  color: var(--red);
  background: rgba(199, 62, 86, 0.11);
}

.workspace {
  display: grid;
  gap: 20px;
}

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

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat strong {
  font-size: 2.1rem;
  line-height: 1;
}

.editor-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.task-form,
.task-board {
  padding: 22px;
}

.form-heading,
.board-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h3 {
  margin: 0;
  font-size: 1.25rem;
}

.task-form {
  display: grid;
  gap: 11px;
}

.task-form label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

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

.primary-button {
  min-height: 46px;
  margin-top: 4px;
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.toolbar-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 150px 130px;
  gap: 10px;
  width: min(100%, 560px);
}

#task-summary {
  margin: 4px 0 0;
  color: var(--muted);
}

.task-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.task-item.is-done {
  opacity: 0.72;
}

.task-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.task-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.task-check span {
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
}

.task-check input:checked + span {
  background:
    linear-gradient(135deg, transparent 42%, #ffffff 0 58%, transparent 0),
    linear-gradient(45deg, transparent 48%, #ffffff 0 62%, transparent 0),
    var(--green);
  border-color: var(--green);
}

.task-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.task-item.is-done .task-title {
  text-decoration: line-through;
}

.priority-pill,
.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.78rem;
  font-weight: 900;
}

.priority-high {
  color: var(--red);
  background: rgba(199, 62, 86, 0.12);
}

.priority-normal {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.priority-low {
  color: var(--green);
  background: rgba(37, 122, 93, 0.12);
}

.task-notes {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.task-notes:empty {
  display: none;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.meta-overdue {
  color: var(--red);
  background: rgba(199, 62, 86, 0.12);
}

.meta-today {
  color: var(--yellow);
  background: rgba(181, 107, 17, 0.13);
}

.task-actions {
  display: flex;
  gap: 7px;
}

.small-button {
  padding: 0 10px;
}

.danger-button {
  color: var(--red);
  background: rgba(199, 62, 86, 0.11);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 5px 0 0;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.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;
}

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

  .sidebar {
    position: static;
  }

  .views {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1440px);
    padding: 14px 0;
  }

  .topbar,
  .form-heading,
  .board-toolbar {
    display: grid;
  }

  .stats-grid,
  .views,
  .quick-actions,
  .toolbar-controls,
  .form-row {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .task-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }

  .ghost-button {
    width: 100%;
  }
}
