* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-2: #121a31;
  --border: #0f3460;
  --accent: #e94560;
  --accent-hover: #c73652;
  --blue: #3498db;
  --green: #2ecc71;
  --orange: #f39c12;
  --text: #e0e0e0;
  --muted: #a0a0b8;
  --dim: #63637a;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.setup-error {
  position: fixed;
  inset: 16px 16px auto;
  z-index: 1000;
  max-width: 920px;
  margin: auto;
  padding: 16px 18px;
  border: 1px solid #d95468;
  border-radius: 10px;
  background: #4a1823;
  color: #fff;
  white-space: pre-wrap;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(233, 69, 96, 0.16), transparent 32%),
    radial-gradient(circle at 80% 85%, rgba(52, 152, 219, 0.13), transparent 35%),
    var(--bg);
}

.auth-card {
  width: min(100%, 440px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(22, 33, 62, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-size: 30px;
  font-weight: 800;
}

.auth-card h1 { text-align: center; color: #fff; font-size: 1.8rem; }
.auth-subtitle { margin: 10px 0 24px; color: var(--muted); text-align: center; line-height: 1.45; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.auth-tab {
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.auth-tab.active { background: var(--accent); color: #fff; }

.auth-form { display: grid; gap: 10px; }
.auth-form label { color: var(--muted); font-size: 0.9rem; }
.auth-form input,
.form-group input,
.form-group textarea,
.edit-area input,
.edit-area textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.auth-form input:focus,
.form-group input:focus,
.form-group textarea:focus,
.edit-area input:focus,
.edit-area textarea:focus { border-color: var(--accent); }

.primary-button,
.btn-add {
  margin-top: 6px;
  padding: 11px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.primary-button:hover, .btn-add:hover { background: var(--accent-hover); }
.primary-button:disabled, .btn-add:disabled { opacity: 0.6; cursor: wait; }

.link-button {
  justify-self: center;
  padding: 6px;
  border: 0;
  background: transparent;
  color: #8fc9ef;
  cursor: pointer;
}
.form-hint { color: var(--dim); font-size: 0.82rem; line-height: 1.4; }

.message {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}
.message.error { border-color: #c84258; background: #3d1720; color: #ffdbe1; }
.message.success { border-color: #238b50; background: #143823; color: #d8ffe7; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 26, 49, 0.96);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar h1 { color: var(--accent); font-size: 1.45rem; }
.sync-status { margin-top: 3px; color: var(--dim); font-size: 0.78rem; }
.sync-status.busy { color: #f6c45f; }
.sync-status.error { color: #ff7f91; }
.account-panel { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.user-email { color: var(--muted); font-size: 0.9rem; }
.account-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.toolbar-button {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
}
.toolbar-button:hover { border-color: #2c659b; }
.danger-outline:hover { border-color: var(--accent); color: #ff9cab; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
.add-form {
  padding: 24px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.add-form h2 { margin-bottom: 16px; color: var(--accent); font-size: 1.2rem; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.9rem; }
.form-group textarea, .edit-area textarea { min-height: 60px; resize: vertical; }
.btn-add { padding-inline: 28px; }

.category-switch {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.category-switch input { display: none; }
.category-switch label {
  flex: 1;
  padding: 10px 14px;
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}
.category-switch input:checked + label.cat-work { background: var(--accent); color: #fff; }
.category-switch input:checked + label.cat-personal { background: var(--blue); color: #fff; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.column-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.column-header h2 { font-size: 1.2rem; }
.count { padding: 2px 10px; border-radius: 12px; font-size: 0.85rem; font-weight: 700; }
.col-work .count { background: rgba(233,69,96,.2); color: var(--accent); }
.col-personal .count { background: rgba(52,152,219,.2); color: var(--blue); }

.section { margin-top: 30px; }
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.section-title { font-size: 1.3rem; font-weight: 700; }
.section-header .count { background: var(--border); color: var(--accent); }
.toggle-arrow { color: var(--muted); transition: transform .2s; }
.toggle-arrow.collapsed { transform: rotate(-90deg); }

.task-card {
  padding: 18px;
  margin-bottom: 12px;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  transition: transform .15s;
}
.task-card:hover { transform: translateX(4px); }
.col-personal .task-card { border-left-color: var(--blue); }
.task-card.completed-card { border-left-color: var(--green); opacity: .88; }
.task-title { margin-bottom: 8px; color: #fff; font-size: 1.1rem; font-weight: 650; overflow-wrap: anywhere; }
.task-deadline { margin-bottom: 6px; color: var(--muted); font-size: .85rem; }
.overdue { color: var(--accent); font-weight: 700; }
.on-time { color: var(--green); }
.task-notes { margin-bottom: 12px; color: #c0c0d0; font-size: .9rem; white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.completed-date { margin-bottom: 6px; color: var(--green); font-size: .8rem; }
.task-category-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 4px; font-size: .75rem; vertical-align: middle; }
.badge-work { background: rgba(233,69,96,.2); color: var(--accent); }
.badge-personal { background: rgba(52,152,219,.2); color: var(--blue); }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { padding: 7px 14px; border: 0; border-radius: 6px; cursor: pointer; font-size: .84rem; font-weight: 700; }
.btn:hover { opacity: .85; }
.btn-complete, .btn-save { background: var(--green); color: #fff; }
.btn-restore { background: var(--blue); color: #fff; }
.btn-edit { background: var(--orange); color: #fff; }
.btn-delete { background: #555; color: #eee; }
.btn-cancel { background: #777; color: #fff; }
.edit-area { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.empty-msg { padding: 20px; color: #62627a; text-align: center; font-style: italic; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 20, .8);
}
.modal-card {
  width: min(100%, 430px);
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 25px 80px rgba(0,0,0,.45);
}
.modal-card h2 { margin-bottom: 8px; color: var(--accent); }
.modal-card > p { margin-bottom: 18px; color: var(--muted); }

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .account-panel { justify-content: flex-start; }
  .auth-card { padding: 24px 20px; }
}

@media (max-width: 460px) {
  .container { padding-inline: 12px; }
  .topbar-inner { padding-inline: 12px; }
  .add-form { padding: 18px; }
  .account-actions { width: 100%; }
  .toolbar-button { flex: 1; }
  .category-switch label { padding-inline: 7px; font-size: .88rem; }
}


/* Уведомления и PWA */
.notification-button.enabled {
  border-color: #238b50;
  background: #143823;
  color: #d8ffe7;
}
.notification-button.denied {
  border-color: #c84258;
  background: #3d1720;
  color: #ffdbe1;
}
.notification-button:disabled { opacity: .65; cursor: wait; }
.deadline-help { margin-top: 7px; color: var(--dim); font-size: .8rem; line-height: 1.35; }
.reminder-chip {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 7px;
  border: 1px solid rgba(143, 201, 239, .45);
  border-radius: 999px;
  color: #8fc9ef;
  font-size: .74rem;
  white-space: nowrap;
}
.notification-highlight {
  outline: 2px solid #f6c45f;
  outline-offset: 3px;
  animation: notification-pulse 1.1s ease-in-out 2;
}
@keyframes notification-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(246, 196, 95, 0); }
  50% { box-shadow: 0 0 26px rgba(246, 196, 95, .45); }
}
