:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #f97316;
  --accent-soft: #fff7ed;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --done: #ecfdf5;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.2;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem 0.85rem;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

label {
  display: grid;
  gap: 0.35rem;
  color: #304050;
  font-weight: 750;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: #3b4b5c;
  background: #eef3f5;
  font-size: 0.9rem;
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

.simple-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.layout {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.layout.wide {
  width: min(1440px, 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  min-height: 68px;
  padding: 0.85rem max(1rem, calc((100vw - 1060px) / 2));
  border-bottom: 1px solid rgba(220, 227, 234, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.05);
  backdrop-filter: blur(12px);
}

.topbar strong {
  display: block;
  color: var(--text);
  font-size: 1.08rem;
}

.topbar .muted {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.9rem;
}

.topbar nav,
.admin-tabs,
.day-tabs,
.filters {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.topbar a,
.admin-tabs a,
.day-tabs a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #2d3d4d;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.topbar a:hover,
.admin-tabs a:hover,
.day-tabs a:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--primary-soft);
  text-decoration: none;
}

.admin-tabs {
  margin-bottom: 1rem;
}

.admin-tabs a.active,
.day-tabs a.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.day-tabs {
  margin: 1rem 0;
}

.day-tabs a {
  min-width: 118px;
  display: grid;
  gap: 0.05rem;
  text-align: center;
}

.day-tabs small {
  color: inherit;
  font-size: 0.78rem;
  opacity: 0.8;
}

.panel,
.progress-card,
.task-item,
.reminder {
  border: 1px solid rgba(220, 227, 234, 0.95);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 1.1rem;
}

.narrow {
  width: min(460px, 100%);
}

.stack {
  display: grid;
  gap: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
}

.muted {
  color: var(--muted);
  font-weight: 550;
}

.notice,
.alert,
.empty {
  padding: 0.85rem 1rem;
  border-radius: 8px;
}

.notice {
  border: 1px solid #b7e4d7;
  background: var(--primary-soft);
}

.alert {
  color: var(--danger);
  border: 1px solid #f7b4ad;
  background: var(--danger-soft);
}

.empty {
  border: 1px dashed #b7c4cf;
  background: #fff;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.78rem 1rem;
  color: #20303f;
  background: #e8edf1;
  font-weight: 850;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.button:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.button.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

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

.button.danger {
  color: #fff;
  background: var(--danger);
}

.button.secondary {
  color: #fff;
  background: #374151;
}

.button.big {
  min-height: 58px;
  padding-inline: 1.2rem;
  font-size: 1.02rem;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.reminder {
  position: sticky;
  top: 82px;
  z-index: 5;
  padding: 1rem 1.1rem;
  border-left: 6px solid var(--accent);
  background: var(--accent-soft);
  color: #573a0d;
  font-size: 1.02rem;
  font-weight: 850;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0.6rem;
}

.day-head .muted {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.progress-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-meta strong {
  color: var(--primary-dark);
  font-size: 1.65rem;
}

.progress {
  height: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #e4ebef;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #22a06b);
  transition: width 0.2s ease;
}

.task-list {
  display: grid;
  gap: 0.9rem;
}

.task-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border-left: 6px solid #b7c4cf;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.task-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(23, 33, 43, 0.1);
}

.task-item.completed {
  border-left-color: #22a06b;
  background: var(--done);
}

.task-item.next-focus {
  border-color: var(--accent);
  outline: 4px solid rgba(196, 122, 22, 0.22);
  transform: translateY(-2px);
}

.check-wrap {
  display: grid;
  place-items: start center;
  cursor: pointer;
}

.check-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-wrap span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 3px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 4px rgba(15, 118, 110, 0.06);
}

.check-wrap input:focus + span {
  outline: 4px solid rgba(15, 118, 110, 0.14);
}

.check-wrap input:checked + span {
  background: var(--primary);
}

.check-wrap input:checked + span::after {
  content: "";
  width: 13px;
  height: 24px;
  border: solid #fff;
  border-width: 0 5px 5px 0;
  transform: rotate(45deg);
}

.task-time {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 0.45rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid #c3e3db;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.92rem;
  font-weight: 850;
}

.task-body p {
  margin-bottom: 0.7rem;
  color: #475766;
}

.status {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.status-text,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: #fff0d7;
  color: #7a4a07;
  font-size: 0.9rem;
  font-weight: 850;
}

.completed .status-text,
.pill.ok {
  background: #d9f2df;
  color: #1f6a35;
}

.completed-at {
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.weekly-table {
  min-width: 1180px;
}

.weekly-table select,
.weekly-table textarea {
  min-width: 170px;
}

.weekly-table textarea {
  min-height: 58px;
  margin-top: 0.45rem;
}

.edit-row,
.user-row {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.slot-row {
  grid-template-columns: repeat(4, minmax(90px, 1fr)) auto auto;
  align-items: start;
}

.user-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.user-selector {
  align-items: end;
}

.edit-user-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.actions-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.user-list {
  display: grid;
  gap: 0.5rem;
}

.user-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.user-list a.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.user-list span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-check input {
  width: 22px;
  height: 22px;
}

.filters label {
  min-width: 180px;
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  .topbar,
  .day-head,
  .progress-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 0.8rem 1rem;
  }

  .layout {
    padding: 0.85rem;
  }

  .grid.two,
  .slot-row {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .check-wrap span {
    width: 44px;
    height: 44px;
  }

  .day-tabs a {
    flex: 1 1 128px;
  }

  .reminder {
    top: 136px;
  }
}

.user-page .topbar {
  position: static;
  min-height: 54px;
  box-shadow: none;
}

.app-hero {
  color: #fff;
  background: linear-gradient(135deg, #111827, #2563eb);
  padding: 28px 20px;
  text-align: center;
}

.app-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 4vw, 2rem);
}

.app-hero p {
  margin: 0;
  opacity: 0.9;
}

.user-layout {
  width: min(1200px, 100%);
  padding-top: 24px;
  padding-bottom: 40px;
}

.dashboard-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}

.dashboard-bar .progress-card {
  margin: 0;
  padding: 16px;
}

.dashboard-bar .progress {
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
}

.dashboard-bar .progress span {
  background: #16a34a;
}

.dashboard-bar .progress-meta {
  margin: 8px 0 0;
}

.dashboard-bar .progress-meta strong {
  color: var(--text);
  font-size: 1rem;
}

.rules,
.day-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.rules {
  padding: 16px 18px;
  margin-bottom: 18px;
}

.rules h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rule {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fafb;
  line-height: 1.35;
}

.user-page .day-tabs {
  margin: 0 0 18px;
}

.week-switcher {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.week-range {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.week-range strong {
  color: var(--text);
  font-size: 0.92rem;
}

.week-range span {
  color: var(--muted);
  font-size: 0.9rem;
}

.day-card {
  overflow: hidden;
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: #fff;
  background: #111827;
}

.day-card-header h2 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
}

.day-card-header span,
.day-card-header strong {
  font-size: 0.9rem;
  opacity: 0.92;
}

.client-alert {
  margin: 10px;
  padding: 10px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.3;
}

.tasks {
  padding: 10px;
  gap: 8px;
}

.user-page .task-item {
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.user-page .task-item:hover {
  transform: none;
  box-shadow: none;
}

.user-page .task-item.completed {
  border-color: #86efac;
  background: #ecfdf5;
}

.user-page .task-item.next-focus {
  border-color: var(--accent);
  outline: 3px solid rgba(249, 115, 22, 0.2);
}

.user-page .check-wrap span {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  border-width: 2px;
  border-radius: 4px;
  box-shadow: none;
}

.user-page .check-wrap input:checked + span::after {
  width: 6px;
  height: 11px;
  border-width: 0 3px 3px 0;
}

.user-page .task-time {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
}

.user-page .task-body h2 {
  margin-top: 3px;
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.user-page .task-body p {
  margin-top: 4px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.user-page .status {
  margin-top: 7px;
}

.user-page .status-text,
.user-page .pill {
  min-height: 24px;
  font-size: 0.78rem;
}

@media (max-width: 1100px) {
  .dashboard-bar,
  .week-switcher,
  .rules-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .app-hero {
    padding: 24px 16px;
  }

  .user-page .day-tabs a {
    flex: 1 1 140px;
  }
}

@media print {
  .topbar,
  .dashboard-bar .button,
  .day-tabs {
    display: none;
  }

  body {
    background: #fff;
  }

  .rules,
  .day-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
