:root {
  color-scheme: dark;
  --bg: #06131e;
  --panel: #0b1d2b;
  --panel-2: #102637;
  --line: #2d4859;
  --text: #f4f7fa;
  --muted: #aab7c2;
  --accent: #37c9ef;
  --accent-dark: #056b91;
  --accent-darker: #034e6e;
  --ok: #83d363;
  --warn: #ffbf2f;
  --danger: #ff7d87;
  --shadow: 0 16px 45px #0008;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 60% 0, #0b2435 0, var(--bg) 48%);
  color: var(--text);
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #8be5ff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 300;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  color: #06202d;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  width: 220px;
  height: 82px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: #081723;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.25; }
.brand-image { width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto; }
.sidebar {
  position: fixed;
  z-index: 19;
  top: 82px;
  bottom: 0;
  left: 0;
  width: 220px;
  padding: 8px 10px 18px;
  background: #081723;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.sidebar nav { display: grid; gap: 6px; }
.nav-item, .nav-add {
  min-height: 44px;
  border: 0;
  color: #d5dde4;
  background: transparent;
  text-align: left;
  padding: 11px 14px;
  border-radius: 7px;
  font-size: 15px;
}
.nav-item.active { color: #8be5ff; background: #153246; box-shadow: inset 3px 0 #37c9ef; }
.nav-add { margin-top: auto; color: #8be5ff; border-top: 1px solid var(--line); border-radius: 0; padding-top: 18px; }
.sidebar-note { font-size: 12px; color: var(--muted); padding: 14px 14px 0; }

.content {
  margin-left: 220px;
  min-height: 100dvh;
  padding: 42px clamp(24px, 4vw, 58px) 80px;
  outline: none;
}
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 26px; }
.page-title { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; }
.subtitle { color: var(--muted); margin: 5px 0 0; }
.actions, .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn, .icon-button {
  min-height: 44px;
  border: 1px solid #4b6b7d;
  background: #102b3d;
  color: var(--text);
  padding: 10px 15px;
  border-radius: 8px;
}
.btn.primary { background: linear-gradient(#076f98, #034f70); border-color: #63d8f5; color: #fff; font-weight: 700; }
.btn.danger { border-color: #94515b; color: #ffb1b7; }
.btn.ghost { background: transparent; }
.icon-button { min-width: 44px; }
.mobile-only { display: none; }

.card { background: linear-gradient(145deg, #0d2130, #091925); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px #0003; }
.date-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 20px 0; }
.date-button { min-height: 72px; border: 0; background: transparent; color: var(--muted); padding: 9px 4px; border-radius: 10px; }
.date-button b, .date-button small { display: block; }
.date-button b { font-size: 18px; color: #e5ebef; margin: 4px 0; }
.date-button.active { background: linear-gradient(#076f98, #034f70); color: #fff; }
.date-button.active b { color: #fff; }
.section-title { color: var(--muted); font-size: 12px; letter-spacing: .09em; text-transform: uppercase; margin: 25px 0 9px; }

.task-list, .list-grid, .member-grid { display: grid; gap: 9px; }
.task {
  display: grid;
  grid-template-columns: 64px 48px minmax(180px, 1.3fr) minmax(105px, .65fr) minmax(140px, .8fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 72px;
  padding: 8px 12px;
}
.task-time { color: #c7d1d9; }
.status-dot {
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #071925;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
}
.status-dot.done { background: #3d8127; border-color: #a5ef88; }
.status-dot.pending { background: #6a4c00; border-color: #ffd261; }
.task-title { font-weight: 700; }
.task-meta, .muted { color: var(--muted); font-size: 13px; }
.task-assignee { color: #c7d1d9; font-size: 13px; }
.status-text { font-size: 13px; color: #66d9f6; }
.status-text.done, .mobile-status.done { color: #a5ef88; }
.status-text.pending, .mobile-status.pending { color: #ffd261; }
.mobile-status { display: none; margin-top: 4px; font-size: 12px; color: #83ddf3; }
.empty { padding: 38px; text-align: center; color: var(--muted); }

.filterbar { display: grid; grid-template-columns: minmax(180px, 1fr) 190px 190px; gap: 10px; margin-bottom: 16px; }
.input { width: 100%; border: 1px solid #47687c; background: #091925; color: var(--text); padding: 11px 12px; border-radius: 8px; outline: none; min-height: 44px; }
textarea.input { min-height: 94px; resize: vertical; }
.field-help { color: var(--muted); font-size: 12px; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.calendar-label { text-align: center; color: var(--muted); font-size: 12px; padding: 8px; }
.calendar-day {
  min-height: 112px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1b28;
  color: var(--text);
  text-align: left;
  overflow: hidden;
}
.calendar-day.other { opacity: .48; }
.calendar-day.today { border-color: #55d6f7; box-shadow: inset 0 0 0 1px #55d6f7; }
.date-number { display: block; font-weight: 800; margin-bottom: 5px; }
.calendar-event { display: block; font-size: 11px; margin-top: 5px; padding: 4px 5px; border-left: 2px solid #55d6f7; background: #123045; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-more { display: block; color: #8be5ff; font-size: 11px; margin-top: 5px; }
.calendar-count { display: none; color: #8be5ff; font-size: 11px; }

.list-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.list-card { padding: 18px; }
.list-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.list-header h2 { margin: 8px 0 0; font-size: 19px; }
.list-item { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list-item input { width: 22px; height: 22px; }
.list-item label { flex: 1; }
.list-item.done label { text-decoration: line-through; color: var(--muted); }
.add-item-form { margin-top: 12px; }

.member-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.member { padding: 18px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #041019; background: var(--avatar-color, #55d6f7); }
.member .btn { margin-left: auto; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.settings-card { padding: 20px; }
.settings-card h2 { margin: 0; font-size: 19px; }
.settings-card .btn { margin: 5px 6px 0 0; }
.file-button { display: inline-flex; align-items: center; cursor: pointer; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; background: #000b; display: grid; place-items: center; padding: 18px; }
.modal { width: min(620px, 100%); max-height: 90dvh; overflow: auto; padding: 22px; background: #0b1d2b; border: 1px solid #4a6c81; border-radius: 12px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 6px; color: #d2d9df; font-size: 13px; }
.field.full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 25px; transform: translate(-50%, 120px); background: #eaf8fc; color: #06202d; padding: 11px 18px; border-radius: 8px; box-shadow: var(--shadow); transition: .25s; max-width: min(90vw, 600px); }
.toast.show { transform: translate(-50%, 0); }
.bottom-nav { display: none; }

@media (max-width: 850px) {
  .topbar { position: sticky; width: 100%; height: 66px; border-right: 0; border-bottom: 1px solid var(--line); padding: 9px 14px; justify-content: space-between; }
  .brand-image { width: 38px; height: 38px; }
  .mobile-only { display: block; }
  .sidebar { top: 66px; bottom: 0; transform: translateX(-105%); transition: transform .2s; width: min(290px, 86vw); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 24px 14px 98px; }
  .page-head { align-items: flex-start; margin-bottom: 18px; }
  .page-title { font-size: 28px; }
  .page-head > .actions .btn:not(.primary) { display: none; }
  .date-strip { overflow: auto; grid-template-columns: repeat(7, 72px); padding-bottom: 4px; scrollbar-width: none; }
  .date-strip::-webkit-scrollbar { display: none; }
  .task { grid-template-columns: 48px 44px minmax(0, 1fr) auto; min-height: 78px; padding: 8px; }
  .task-assignee, .status-text { display: none; }
  .mobile-status { display: block; }
  .task .icon-button { padding: 8px; min-width: 54px; font-size: 12px; }
  .filterbar { grid-template-columns: 1fr 1fr; }
  .filterbar > :first-of-type { grid-column: 1 / -1; }
  .calendar { gap: 4px; }
  .calendar-label { padding: 4px 1px; font-size: 10px; }
  .calendar-day { min-height: 72px; padding: 8px 5px; text-align: center; }
  .calendar-event, .calendar-more { display: none; }
  .calendar-count { display: block; margin-top: 6px; }
  .bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; min-height: 72px; padding-bottom: env(safe-area-inset-bottom); background: #081723f5; border-top: 1px solid var(--line); display: flex; }
  .bottom-nav button { flex: 1; min-height: 58px; border: 0; background: transparent; color: #c1ccd4; font-size: 11px; padding: 8px 2px; }
  .bottom-nav button.active { color: #8be5ff; background: #102b3d; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal { padding: 18px; max-height: calc(100dvh - 24px); }
  .list-grid, .member-grid { grid-template-columns: 1fr; }
  .list-header .actions { width: 100%; }
  .list-header .btn { flex: 1; padding-inline: 8px; }
}

@media (max-width: 430px) {
  .page-head .actions { gap: 5px; }
  .btn { padding: 9px 11px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
