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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0a0a;
  color: #f4d9a6;
  min-height: 100dvh;
}

#view-app {
  background: linear-gradient(180deg, #3d2f1f 0%, #2a1f15 30%, #1a1410 60%, #0a0a0a 100%);
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ── Sign-in ─────────────────────────────────────────────── */
.signin-container {
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.signin-container h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 3px;
  color: #f4d9a6;
  text-transform: uppercase;
}
.tagline { color: #888; line-height: 1.65; font-size: 0.9rem; letter-spacing: 0.3px; }
.signin-prompt { font-weight: 400; color: #888; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; margin-top: 0.5rem; }
.copyright { font-size: 0.72rem; color: #444; letter-spacing: 0.5px; margin-top: 1rem; }

#signin-form { display: flex; flex-direction: column; gap: 0; }
#signin-form .form-group { margin-bottom: 0.75rem; }
#signin-form .form-group label {
  display: block;
  font-size: 0.68rem;
  color: #666;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#signin-form .form-group input[type="email"],
#signin-form .form-group input[type="password"] {
  width: 100%;
  border: 1px solid rgba(244, 217, 166, 0.2);
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  outline: none;
  background: rgba(244, 217, 166, 0.04);
  color: #f4d9a6;
  -webkit-appearance: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
#signin-form .form-group input:focus { border-color: rgba(244, 217, 166, 0.5); }
#signin-form .form-group input::placeholder { color: #444; }
.signin-message {
  font-size: 0.82rem;
  padding: 0.5rem 0;
  margin-bottom: 0.25rem;
  letter-spacing: 0.3px;
}
.signin-message.error   { color: #d4472d; }
.signin-message.success { color: #6a9a6a; }
.signin-btn {
  width: 100%;
  padding: 0.75rem;
  background: #f4d9a6;
  color: #1a1410;
  border: none;
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: opacity 0.2s;
  font-family: inherit;
}
.signin-btn:hover { opacity: 0.88; }
.signin-link {
  background: none;
  border: none;
  color: #555;
  font-size: 0.78rem;
  cursor: pointer;
  letter-spacing: 0.4px;
  padding: 0;
  text-align: center;
  font-family: inherit;
  transition: color 0.2s;
}
.signin-link:hover { color: #f4d9a6; }

/* ── App header ──────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(244, 217, 166, 0.06) 0%, rgba(244, 217, 166, 0.01) 100%);
  border-bottom: 1px solid #2a2520;
  padding: 14px 16px 0;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.app-title {
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 2.5px;
  color: #f4d9a6;
  text-transform: uppercase;
  white-space: nowrap;
}
.signout-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 0.68rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.3s;
  padding: 4px 8px;
  font-family: inherit;
}
.signout-btn:hover { color: #f4d9a6; }

/* ── Navigation tabs ─────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  background: none;
  border: none;
  font-size: 0.68rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 0 10px;
  cursor: pointer;
  transition: color 0.3s;
  position: relative;
  white-space: nowrap;
  font-family: inherit;
}
.nav-tab:hover { color: #f4d9a6; }
.nav-tab.active { color: #f4d9a6; }
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #f4d9a6;
  animation: slideUnderline 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUnderline {
  from { width: 0; left: 50%; }
  to   { width: 100%; left: 0; }
}

/* ── Group filter chips ──────────────────────────────────── */
.group-filter {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(244, 217, 166, 0.06);
  scrollbar-width: none;
}
.group-filter::-webkit-scrollbar { display: none; }
.group-chip {
  flex-shrink: 0;
  background: rgba(244, 217, 166, 0.05);
  border: 1px solid rgba(244, 217, 166, 0.12);
  border-radius: 0;
  padding: 0.3rem 0.8rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: pointer;
  white-space: nowrap;
  color: #777;
  transition: all 0.2s;
  font-family: inherit;
}
.group-chip:hover { color: #f4d9a6; border-color: rgba(244, 217, 166, 0.3); }
.group-chip.active {
  background: rgba(244, 217, 166, 0.1);
  color: #f4d9a6;
  border-color: rgba(244, 217, 166, 0.35);
}

/* ── Entry list ──────────────────────────────────────────── */
.entries-list {
  padding: 14px 16px 6rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Entry card ──────────────────────────────────────────── */
.entry-card {
  background: linear-gradient(135deg, rgba(244, 217, 166, 0.08) 0%, rgba(244, 217, 166, 0.02) 100%);
  border: 1px solid rgba(244, 217, 166, 0.14);
  border-radius: 0;
  padding: 12px 14px;
  animation: cardSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: translateY(8px);
  transition: border-color 0.2s;
}
.entry-card:hover { border-color: rgba(244, 217, 166, 0.28); }
.entry-card.completed { opacity: 0.4; }

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

.entry-main { display: flex; align-items: flex-start; gap: 12px; }
.entry-body { flex: 1; cursor: pointer; min-width: 0; }

.grp-badge {
  display: inline-block;
  background: rgba(244, 217, 166, 0.08);
  border-radius: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.62rem;
  color: #777;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.entry-desc {
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
  color: #f4d9a6;
  font-weight: 300;
  letter-spacing: 0.2px;
}
.entry-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.entry-date { font-size: 0.68rem; color: #555; }

.due-chip {
  font-size: 0.62rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0;
  background: rgba(244, 217, 166, 0.08);
  color: #888;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.due-chip.due-today { background: rgba(201, 162, 39, 0.15); color: #c9a227; }
.due-chip.overdue   { background: rgba(212, 71, 45, 0.15);  color: #d4472d; }

/* ── Card action buttons ─────────────────────────────────── */
.btn-complete {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 0;
  border: 1.5px solid rgba(244, 217, 166, 0.25);
  background: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s;
}
.btn-complete:hover { border-color: #f4d9a6; color: #f4d9a6; }

.btn-restore {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(244, 217, 166, 0.18);
  border-radius: 0;
  padding: 0.25rem 0.65rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-restore:hover { color: #f4d9a6; border-color: rgba(244, 217, 166, 0.4); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #444;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
}

/* ── Bottom bar ──────────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 1.5rem 1.5rem 1.5rem;
  pointer-events: none;
  z-index: 20;
}

.design-credit {
  pointer-events: all;
  margin: 0;
  font-size: 0.7rem;
  color: rgba(244, 217, 166, 0.35);
  letter-spacing: 0.3px;
  line-height: 50px;
}

.design-credit a {
  color: rgba(244, 217, 166, 0.55);
  text-decoration: none;
}

.design-credit a:hover {
  color: rgba(244, 217, 166, 0.85);
  text-decoration: underline;
}

/* ── FAB ─────────────────────────────────────────────────── */
.fab {
  position: relative;
  bottom: auto;
  right: auto;
  margin-left: auto;
  pointer-events: all;
  width: 50px;
  height: 50px;
  border-radius: 0;
  background: #f4d9a6;
  color: #1a1410;
  font-size: 1.75rem;
  line-height: 1;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(244, 217, 166, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: transform 0.15s, box-shadow 0.15s;
  font-weight: 300;
}
.fab:active { transform: scale(0.93); box-shadow: 0 4px 10px rgba(244, 217, 166, 0.12); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100;
  display: flex;
  align-items: flex-end;
}
.modal {
  background: #1a1410;
  border: 1px solid #2a2520;
  border-bottom: none;
  border-radius: 0;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
}
.modal h2 {
  margin-bottom: 1.25rem;
  font-size: 0.72rem;
  font-weight: 400;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.68rem;
  color: #555;
  margin-bottom: 0.35rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.optional { color: #3a3a3a; font-size: 0.65rem; font-weight: normal; }
.form-group input[type="text"],
.form-group input[type="date"] {
  width: 100%;
  border: 1px solid rgba(244, 217, 166, 0.14);
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  outline: none;
  background: rgba(244, 217, 166, 0.04);
  color: #f4d9a6;
  -webkit-appearance: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: rgba(244, 217, 166, 0.4); }
.form-group input::placeholder { color: #3a3a3a; }

.autocomplete-wrap { position: relative; }
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1e1a16;
  border: 1px solid rgba(244, 217, 166, 0.14);
  border-top: none;
  border-radius: 0;
  z-index: 10;
  max-height: 160px;
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.suggestion-item {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: #888;
  border-bottom: 1px solid rgba(244, 217, 166, 0.04);
  transition: background 0.15s, color 0.15s;
}
.suggestion-item:hover { background: rgba(244, 217, 166, 0.06); color: #f4d9a6; }

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 0.5rem;
}
.form-actions-right { display: flex; gap: 0.5rem; }

.form-actions button {
  padding: 0.65rem 1.1rem;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(244, 217, 166, 0.18);
  background: rgba(244, 217, 166, 0.04);
  color: #777;
  font-family: inherit;
  transition: all 0.2s;
}
.form-actions button:hover { color: #f4d9a6; border-color: rgba(244, 217, 166, 0.38); }
.form-actions button[type="submit"] {
  background: #f4d9a6;
  color: #1a1410;
  border-color: #f4d9a6;
  font-weight: 600;
}
.form-actions button[type="submit"]:hover { opacity: 0.88; }
.btn-danger {
  background: none !important;
  border: 1px solid rgba(212, 71, 45, 0.4) !important;
  color: #d4472d !important;
}
.btn-danger:hover { border-color: #d4472d !important; background: rgba(212, 71, 45, 0.06) !important; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1a16;
  border: 1px solid rgba(244, 217, 166, 0.18);
  color: #f4d9a6;
  padding: 0.55rem 1.2rem;
  border-radius: 0;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ── Desktop ─────────────────────────────────────────────── */
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal {
    border: 1px solid #2a2520;
    border-radius: 0;
    max-width: 480px;
    margin: 0 auto;
    padding: 1.75rem;
  }
  .signin-container { padding: 3rem 2rem; }
  .entries-list { max-width: 600px; margin: 0 auto; }
  .group-filter { justify-content: center; max-width: 600px; margin: 0 auto; }
}
