:root {
  --bg: #F2F2F7;
  --bg-card: #FFFFFF;
  --label: #000000;
  --label-secondary: rgba(60,60,67,0.6);
  --label-tertiary: rgba(60,60,67,0.3);
  --separator: rgba(60,60,67,0.29);
  --blue: #007AFF;
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --tint: #007AFF;
  --fill-tertiary: rgba(118,118,128,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --font: -apple-system, "SF Pro Display", "SF Pro Text", Roboto, sans-serif;
  color-scheme: light;
  /* алиасы для обратной совместимости с инлайн-стилями в app.js */
  --text-secondary: var(--label-secondary);
  --border: var(--separator);
  --success: var(--green);
  --danger: var(--red);
  --accent: var(--tint);
  --card: var(--bg-card);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-card: #1C1C1E;
    --label: #FFFFFF;
    --label-secondary: rgba(235,235,245,0.6);
    --label-tertiary: rgba(235,235,245,0.3);
    --separator: rgba(84,84,88,0.65);
    --blue: #0A84FF;
    --green: #30D158;
    --red: #FF453A;
    --orange: #FF9F0A;
    --tint: #0A84FF;
    --fill-tertiary: rgba(118,118,128,0.24);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000; --bg-card: #1C1C1E;
  --label: #FFFFFF; --label-secondary: rgba(235,235,245,0.6);
  --label-tertiary: rgba(235,235,245,0.3); --separator: rgba(84,84,88,0.65);
  --blue: #0A84FF; --green: #30D158; --red: #FF453A; --orange: #FF9F0A;
  --tint: #0A84FF; --fill-tertiary: rgba(118,118,128,0.24);
  --shadow: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}
:root[data-theme="light"] {
  --bg: #F2F2F7; --bg-card: #FFFFFF;
  --label: #000000; --label-secondary: rgba(60,60,67,0.6);
  --label-tertiary: rgba(60,60,67,0.3); --separator: rgba(60,60,67,0.29);
  --blue: #007AFF; --green: #34C759; --red: #FF3B30; --orange: #FF9500;
  --tint: #007AFF; --fill-tertiary: rgba(118,118,128,0.12);
  --shadow: 0 1px 3px rgba(0,0,0,0.08); --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 110px;
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #app { animation: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* --- Large Title --- */
h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 4px 0 20px;
}

/* --- Tab bar --- */

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--separator);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}

@media (prefers-color-scheme: dark) {
  .tabs { background: rgba(28, 28, 30, 0.82); }
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  background: none;
  border: none;
  color: var(--label-secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tab .tab-icon { font-size: 24px; line-height: 1; }
.tab.active { color: var(--tint); }

/* --- Section label --- */

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 4px 8px;
}

/* --- Grouped cards (shadow, no border) --- */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0 16px;
  margin-bottom: 20px;
}

.card.plain-padding { padding: 16px; }

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--separator);
  min-height: 24px;
}
.item-row:last-child { border-bottom: none; }

.item-text { flex: 1; font-size: 17px; line-height: 1.3; }
.item-text.done { text-decoration: line-through; color: var(--label-secondary); }

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  background: var(--tint);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 20px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s ease;
}
.btn:active { opacity: 0.75; }
.btn:disabled { opacity: 0.4; }

.btn-secondary {
  background: rgba(0,122,255,0.12);
  color: var(--tint);
}
@media (prefers-color-scheme: dark) {
  .btn-secondary { background: rgba(10,132,255,0.16); }
}
:root[data-theme="dark"] .btn-secondary { background: rgba(10,132,255,0.16); }

.btn-danger {
  color: var(--red);
  background: none;
  height: auto;
  padding: 4px 8px;
  font-size: 15px;
  font-weight: 500;
  width: auto;
  border: none;
  cursor: pointer;
}

/* --- Inputs --- */

input[type="text"], input[type="date"], textarea, select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--fill-tertiary);
  color: var(--label);
  font-size: 17px;
  font-family: inherit;
  margin-bottom: 10px;
  appearance: none;
  -webkit-appearance: none;
}
textarea { height: auto; padding: 10px 14px; }
input[type="text"]::placeholder, textarea::placeholder { color: var(--label-tertiary); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--tint); outline-offset: -1px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-secondary);
  margin: 0 2px 6px;
}

.empty-state {
  text-align: center;
  color: var(--label-secondary);
  padding: 48px 24px;
  font-size: 15px;
  line-height: 1.4;
}

/* --- Checkbox (iOS-style circular check) --- */

.checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--label-tertiary);
  margin-right: 12px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.checkbox:active { transform: scale(0.9); }
.checkbox.done { background: var(--green); border-color: var(--green); color: #fff; }

/* --- Progress --- */

.progress-bar {
  height: 8px;
  background: var(--fill-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 16px;
}
.progress-fill { height: 100%; background: var(--tint); border-radius: 4px; transition: width 0.3s ease; }

.limit-note { font-size: 12px; color: var(--label-secondary); margin: 8px 0 4px; text-align: center; line-height: 1.4; }

/* --- Pills --- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--fill-tertiary);
  color: var(--label-secondary);
}
.pill-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.pill-blue   { background: rgba(0,122,255,0.12);  color: var(--blue); }
.pill-green  { background: rgba(52,199,89,0.12);  color: var(--green); }
.pill-red    { background: rgba(255,59,48,0.12);  color: var(--red); }
.pill-orange { background: rgba(255,149,0,0.12);  color: var(--orange); }

/* --- Task card --- */

.task-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

/* --- Icon badge (colored square/circle with emoji) --- */

.cell-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-right: 12px;
}
