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

:root {
  --bg:       #0f0e17;
  --surface:  #1a1927;
  --border:   #2e2c45;
  --accent:   #e8a838;
  --accent2:  #f25f4c;
  --text:     #fffffe;
  --muted:    #a7a9be;
  --done-bg:  #1f1d2e;
  --green:    #4caf82;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .18;
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -150px; right: -100px;
}
body::after {
  width: 400px; height: 400px;
  background: var(--accent2);
  bottom: -100px; left: -80px;
}

.hidden { display: none !important; }

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .4s, visibility .4s;
}
.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loading-logo {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: var(--text);
}
.loading-logo span { color: var(--accent); }

.loading-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBounce .9s ease-in-out infinite;
}
.loading-dots span:nth-child(2) {
  animation-delay: .15s;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.loading-dots span:nth-child(3) {
  animation-delay: .3s;
  background: var(--accent2);
}

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40%            { transform: scale(1.2); opacity: 1;  }
}

.loading-text {
  font-size: .85rem;
  color: var(--muted);
  letter-spacing: .1em;
}

.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 36px;
}

.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  line-height: 1.1;
  margin-bottom: 28px;
}
.auth-title span { color: var(--accent); }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  padding: 9px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.auth-tab.active {
  background: var(--border);
  color: var(--text);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field-group label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}
.field-group input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .92rem;
  
  height: 46px;
  padding: 0 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-text-fill-color: var(--text);
  
  font-variant-numeric: tabular-nums;
}

.field-group input:-webkit-autofill,
.field-group input:-webkit-autofill:hover,
.field-group input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #0f0e17 inset !important;
  -webkit-text-fill-color: #fffffe !important;
  caret-color: #fffffe;
  transition: background-color 9999s ease-in-out 0s;
}
.field-group input::placeholder { 
  color: var(--muted); 
  opacity: 0.4; 
}
.field-group input:hover {
  border-color: #5a5878;
  background: #16151f;
}
.field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,168,56,.15);
  background: var(--bg);
}
.field-group input.error {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(242,95,76,.15);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap input {
  padding-right: 44px !important;
}
.eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color .2s;
  line-height: 0;
}
.eye-btn:hover { color: var(--text); }

.auth-error {
  font-size: .8rem;
  color: var(--accent2);
  min-height: 18px;
  margin-bottom: 4px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 12px;
  color: #0f0e17;
  font-family: 'DM Sans', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  padding: 13px;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  margin-bottom: 16px;
}
.btn-primary:hover  { opacity: .88; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: .78rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  padding: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.btn-google:hover { border-color: var(--muted); background: var(--border); }

.app-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 16px 80px;
}

.app {
  width: 100%;
  max-width: 560px;
}

header { margin-bottom: 40px; }

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  font-size: .72rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 8px;
}

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
}
header h1 span { color: var(--accent); }

.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-shrink: 0;
}
.user-email {
  font-size: .75rem;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, border-color .2s;
}
.logout-btn:hover { color: var(--accent2); border-color: var(--accent2); }

.stats {
  display: flex;
  gap: 24px;
  margin-top: 18px;
}
.stat { font-size: .8rem; color: var(--muted); }
.stat strong { color: var(--text); font-weight: 500; }

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
}
.input-wrap { flex: 1; }

input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  padding: 14px 18px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder { 
  color: var(--muted); 
  opacity: 0.4; 
}
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,168,56,.18);
}
input[type="text"].error {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(242,95,76,.18);
}

.add-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 14px;
  color: #0f0e17;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  padding: 14px 22px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s, transform .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.add-btn:hover  { opacity: .88; }
.add-btn:active { transform: scale(.96); }

.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
}
.filter-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.filter-btn.active { background: var(--border); color: var(--text); }

#todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  animation: slideIn .3s cubic-bezier(.34,1.56,.64,1) both;
  transition: border-color .2s, opacity .25s;
}
.todo-item:hover { border-color: #3e3c58; }
.todo-item.done  { background: var(--done-bg); opacity: .7; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes fadeOut {
  to { opacity: 0; transform: scale(.95); }
}
.todo-item.removing { animation: fadeOut .2s forwards; }

.check-btn {
  width: 22px; height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s;
  padding: 0;
}
.check-btn:hover { border-color: var(--accent); }
.todo-item.done .check-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.check-btn svg { display: none; }
.todo-item.done .check-btn svg { display: block; }

.todo-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.todo-text {
  font-size: .92rem;
  line-height: 1.4;
  word-break: break-word;
  transition: color .2s;
}
.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-dates { display: flex; flex-direction: column; gap: 4px; }
.todo-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  color: var(--muted);
  line-height: 1;
}
.todo-date svg { flex-shrink: 0; }
.todo-date.date-done { color: var(--green); }

.del-btn {
  background: none;
  border: none;
  color: var(--border);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, background .2s;
}
.del-btn:hover { color: var(--accent2); background: rgba(242,95,76,.1); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
  font-size: .9rem;
}
.empty .icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: .8rem;
  color: var(--muted);
  min-height: 28px;
}
.clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.clear-btn:hover    { color: var(--accent2); background: rgba(242,95,76,.1); }
.clear-btn:disabled { opacity: 0; pointer-events: none; }

:root[data-theme="light"] {
  --bg:      #f4f3f0;
  --surface: #ffffff;
  --border:  #e0ddd8;
  --text:    #0f0e17;
  --muted:   #6e6d7a;
  --done-bg: #f9f8f6;
}

.page {
  min-height: 100vh;
  padding-bottom: 80px;
}

.app-screen { position: relative; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: .7rem;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
  transition: color .2s;
}
.nav-btn.active { color: var(--accent); }
.nav-btn svg { transition: transform .2s; }
.nav-btn.active svg { transform: scale(1.1); }

.settings-section {
  margin-bottom: 28px;
}
.settings-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 12px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 8px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn.active {
  border-color: var(--accent);
  background: rgba(232,168,56,.08);
}
.theme-icon { font-size: 1.5rem; }
.theme-name {
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-user-email {
  font-size: .85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--accent2);
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  font-weight: 500;
  padding: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: background .2s, border-color .2s;
}
.settings-logout-btn:hover {
  background: rgba(242,95,76,.1);
  border-color: var(--accent2);
}

.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 0;
}
.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: #0f0e17;
  font-weight: 700;
  flex-shrink: 0;
}
.account-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.account-email {
  font-size: .88rem;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-hint {
  font-size: .72rem;
  color: var(--muted);
}

.install-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 14px;
  color: #0f0e17;
  font-family: 'DM Sans', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
}
.install-btn:hover  { opacity: .88; }
.install-btn:active { transform: scale(.98); }
.ios-install-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ios-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  color: var(--text);
  line-height: 1.4;
}
.ios-step strong { color: var(--accent); }
.ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0f0e17;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-installed-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  gap: 12px;
}
.app-installed-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: var(--text);
  font-weight: 500;
}
.uninstall-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--accent2);
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.uninstall-btn:hover {
  background: rgba(242,95,76,.1);
  border-color: var(--accent2);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-icon { font-size: 2rem; text-align: center; }
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  text-align: center;
  color: var(--text);
}
.modal-text {
  font-size: .88rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(242,95,76,.08);
  border: 1px solid rgba(242,95,76,.2);
  border-radius: 10px;
}
.modal-steps { display: flex; flex-direction: column; gap: 10px; }
.modal-steps-title {
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 4px;
}
.modal-close-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 14px;
  color: #0f0e17;
  font-family: 'DM Sans', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: opacity .2s;
  margin-top: 4px;
}
.modal-close-btn:hover { opacity: .88; }

.quick-theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000; 
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quick-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.quick-theme-toggle:active {
  transform: scale(0.92);
}

@media (max-width: 600px) {
  .quick-theme-toggle {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}