:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-blue: #eff6ff;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --accent: #475569;
  --danger: #b42318;
  --danger-bg: #fff1f2;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eaf1fb 0, rgba(245, 247, 251, 0) 210px),
    var(--bg);
  color: var(--ink);
}

body.admin-mode {
  background:
    linear-gradient(180deg, #dbeafe 0, rgba(245, 247, 251, 0) 238px),
    #f3f7fc;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 9px;
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow,
.section-kicker,
.week-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1rem, 5.3vw, 1.34rem);
  font-weight: 680;
  line-height: 1.04;
  letter-spacing: 0;
  white-space: nowrap;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.language-toggle,
.icon-button,
.nav-button,
.close-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 680;
}

.flag {
  position: relative;
  display: inline-block;
  width: 21px;
  height: 14px;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
  flex: 0 0 auto;
}

.flag-it {
  background: linear-gradient(90deg, #178a4a 0 33.3%, #ffffff 33.3% 66.6%, #ca3b35 66.6%);
}

.flag-de {
  background: linear-gradient(180deg, #111111 0 33.3%, #dd1f26 33.3% 66.6%, #ffd642 66.6%);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
}

.admin-icon-button svg,
.account-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--brand-strong);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-button svg {
  stroke: #475569;
}

.account-button.is-logged-in {
  border-color: #bfdbfe;
  background: var(--surface-blue);
}

.admin-icon-button.is-active {
  border-color: #bfdbfe;
  background: var(--brand);
}

.admin-icon-button.is-active svg {
  stroke: #ffffff;
}

.admin-status {
  width: 50px;
  color: #94a3b8;
  font-size: 0.52rem;
  font-weight: 650;
  line-height: 1.05;
  text-align: right;
  text-transform: lowercase;
}

.admin-status.is-active {
  color: var(--brand-strong);
}

.account-menu,
.copy-next-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  border: 1px solid #c7d8f8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.account-menu {
  right: 0;
  width: 164px;
  padding: 6px;
}

.account-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 0.82rem;
  font-weight: 560;
}

.account-menu button:active {
  background: var(--surface-blue);
}

.copy-next-popover {
  right: 38px;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.copy-start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 178px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-strong);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
  font-size: 0.68rem;
  font-weight: 680;
  line-height: 1.05;
  white-space: normal;
}

.copy-confirm-box {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(240px, calc(100vw - 24px));
  display: grid;
  gap: 7px;
  margin-top: 0;
  padding: 9px;
  border: 1px solid #c7d8f8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.copy-confirm-box strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 660;
  line-height: 1.2;
}

.copy-confirm-box label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 540;
}

.copy-confirm-box input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--brand);
}

.copy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.week-panel,
.note-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.week-panel {
  padding: 10px;
}

.admin-mode .week-panel,
.admin-mode .status-strip div,
.admin-mode .note-panel {
  border-color: #bfdbfe;
}

.week-heading {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.week-center {
  position: relative;
  min-width: 0;
}

.week-heading h2 {
  margin: 0 0 4px;
  color: var(--brand-strong);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.08;
}

.week-range-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.week-range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 24px 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-blue);
  font-size: 0.8rem;
  font-weight: 580;
}

.week-range::after {
  content: "▾";
  position: absolute;
  right: 10px;
  color: var(--muted);
  font-size: 0.72rem;
}

.week-menu {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  z-index: 6;
  width: 176px;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid #c7d8f8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.week-menu input {
  min-height: 36px;
  font-size: 0.86rem;
}

.nav-button {
  width: 38px;
  height: 42px;
  border-radius: 8px;
  color: var(--brand-strong);
  font-size: 1.72rem;
  line-height: 1;
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.status-strip div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.status-strip div:first-child {
  background: var(--surface-blue);
  border-color: #c7d8f8;
}

.status-strip strong {
  color: var(--brand-strong);
  font-size: 1.12rem;
  font-weight: 720;
  line-height: 1;
}

.status-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 560;
}

.note-panel {
  margin-bottom: 10px;
  padding: 9px 10px;
  border-left: 4px solid #93c5fd;
}

.note-panel p:last-child {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 520;
}

.admin-toolbar {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
  padding: 9px;
  border: 1px solid #c7d8f8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

.admin-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.admin-toolbar strong {
  color: var(--brand-strong);
  font-size: 0.84rem;
  font-weight: 660;
}

.admin-toolbar span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.copy-next-panel {
  display: grid;
  gap: 7px;
}

.copy-scope {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.copy-scope label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #334155;
  font-size: 0.72rem;
  font-weight: 560;
}

.copy-scope input {
  width: 14px;
  min-height: 14px;
  margin: 0 5px 0 0;
  accent-color: var(--brand);
}

.toolbar-logout {
  justify-self: center;
}

.task-section {
  margin-top: 10px;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.section-title h3 {
  margin: 2px 0 0;
  font-size: 0.94rem;
  font-weight: 640;
  line-height: 1.18;
}

.section-kicker.accent {
  color: var(--accent);
}

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

.task-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.045);
  cursor: pointer;
}

.task-card.is-expanded {
  align-items: start;
}

.task-card.is-admin {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.08);
}

.task-card.is-dragging {
  opacity: 0.72;
  transform: scale(1.01);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.16);
  animation: task-wiggle 0.16s ease-in-out infinite alternate;
}

@keyframes task-wiggle {
  from {
    rotate: -0.35deg;
  }

  to {
    rotate: 0.35deg;
  }
}

.check-control {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #8aa4c9;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.check-mark {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  transform: scale(0.72);
}

.task-card.is-done .check-control {
  border-color: var(--brand);
  background: var(--brand);
}

.task-card.is-done .check-mark::after {
  content: "";
  display: block;
  width: 11px;
  height: 7px;
  margin: 3px 0 0 3px;
  border-left: 2.5px solid #ffffff;
  border-bottom: 2.5px solid #ffffff;
  transform: rotate(-45deg);
}

.task-copy {
  min-width: 0;
}

.task-summary {
  display: grid;
  grid-template-columns: 1fr 22px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.task-card.is-admin .task-summary {
  grid-template-columns: 1fr 22px 28px 28px 28px;
}

.task-title {
  margin: 0;
  color: #1f2937;
  font-size: 0.88rem;
  font-weight: 560;
  line-height: 1.18;
}

.task-arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #64748b;
  font-size: 0.78rem;
  transition: transform 0.18s ease, background 0.18s ease;
}

.task-admin-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 700;
  touch-action: none;
}

.reorder-button {
  color: #475569;
  font-size: 0.9rem;
}

.add-task-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--brand-strong);
  font-size: 0.86rem;
  font-weight: 620;
}

.task-detail {
  margin: 1px 22px 2px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 430;
  line-height: 1.28;
}

.task-card.is-expanded .task-arrow {
  background: var(--surface-blue);
  transform: rotate(180deg);
}

.task-card.is-done .task-title,
.task-card.is-done .task-detail {
  text-decoration: line-through;
  text-decoration-thickness: 1.6px;
  text-decoration-color: rgba(37, 99, 235, 0.3);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  background: rgba(15, 23, 42, 0.42);
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  z-index: 20;
}

.admin-sheet {
  width: min(100%, 560px);
  max-height: min(88vh, 720px);
  margin: 0 auto;
  overflow: auto;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
  padding: 0 12px 14px;
}

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -12px 9px;
  padding: 12px 12px 8px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(219, 227, 239, 0.78);
  backdrop-filter: blur(12px);
}

.sheet-header h2 {
  margin: 2px 0 0;
  font-size: 1.1rem;
  font-weight: 650;
}

.close-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 1.4rem;
}

.sheet-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.logout-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #c7d8f8;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 620;
}

.edit-type-toggle {
  justify-self: start;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.admin-login,
.admin-reset,
.admin-task-edit {
  display: grid;
  gap: 9px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 560;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input {
  min-height: 38px;
  padding: 0 9px;
}

textarea {
  resize: vertical;
  padding: 8px 9px;
  line-height: 1.25;
}

.primary-button,
.secondary-button,
.danger-button,
.copy-trigger {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 640;
}

.primary-button {
  border: 0;
  background: var(--brand);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid #c7d8f8;
  background: var(--surface-blue);
  color: var(--brand-strong);
}

.text-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 580;
  text-align: center;
}

.copy-trigger {
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: var(--brand-strong);
  text-align: center;
  padding: 0 12px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.danger-button {
  border: 1px solid #fecdd3;
  background: var(--danger-bg);
  color: var(--danger);
}

.form-message {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 520;
}

.admin-week-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #c7d8f8;
  border-radius: 8px;
  background: var(--surface-blue);
}

.admin-week-card span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 620;
  text-transform: uppercase;
}

.admin-week-card strong {
  grid-column: 1;
  color: var(--brand-strong);
  font-size: 0.98rem;
  font-weight: 700;
}

.admin-week-card small {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 520;
  text-align: right;
}

.copy-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.copy-panel .form-message {
  grid-column: 1 / -1;
}

.add-task-button {
  width: 100%;
}

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

.admin-task {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.admin-task-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 650;
}

.language-stack {
  display: grid;
  gap: 8px;
}

.language-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.language-group-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 620;
}

.compact-field {
  min-width: 0;
}

.compact-field input,
.compact-field textarea {
  font-size: 0.82rem;
  font-weight: 440;
}

.compact-field textarea {
  height: 46px;
  min-height: 46px;
  resize: none;
  overflow: hidden;
}

.compact-field textarea:focus {
  height: 82px;
  overflow: auto;
}

.type-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 560;
  white-space: nowrap;
}

.type-toggle input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--brand);
}

.small-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 0.74rem;
}

.sticky-save {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -10px 20px rgba(255, 255, 255, 0.86);
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 9px;
    padding-right: 9px;
  }

  .topbar {
    gap: 5px;
  }

  h1 {
    font-size: 0.98rem;
  }

  .language-toggle {
    min-height: 32px;
    padding: 0 6px;
    font-size: 0.76rem;
  }

  .icon-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .admin-status {
    width: 44px;
    font-size: 0.48rem;
  }

  .copy-next-popover {
    right: 37px;
  }

  .edit-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 680px) {
  body {
    background:
      linear-gradient(180deg, #eaf1fb 0, rgba(245, 247, 251, 0) 250px),
      var(--bg);
  }

  .app-shell {
    padding-top: 26px;
  }
}
