/* ===== Taskie Styles ===== */
:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --card: #1c2333;
  --card-2: #212a3d;
  --border: rgba(255,255,255,0.08);
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #569CD4;
  --accent-2: #4ec9b0;
  --danger: #f85149;
  --warn: #d29922;
  --ok: #3fb950;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

#app { min-height: 100%; }

/* ===== Slogan bar ===== */
.slogan-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  text-align: center;
  padding: 14px 16px 10px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--accent-2);
  background: linear-gradient(180deg, rgba(13,17,23,0.98), transparent);
  z-index: 50;
  font-weight: 600;
  transition: opacity 0.3s;
  pointer-events: none;
}
.slogan-bar.fade { opacity: 0.4; }

/* ===== Login ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(86,156,212,0.12), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(78,201,176,0.10), transparent 50%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.logo-wrap { text-align: center; margin-bottom: 28px; }
.logo { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 12px; box-shadow: 0 4px 20px rgba(86,156,212,0.3); }
.logo-wrap h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.tagline { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.login-card label { display: block; margin: 14px 0 6px; color: var(--text-dim); font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.login-card input:focus { border-color: var(--accent); }
.btn.primary.big { width: 100%; padding: 14px; margin-top: 20px; font-size: 16px; }

.slogan-overlay {
  position: fixed;
  bottom: 40px;
  left: 0; right: 0;
  text-align: center;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

/* ===== Layout ===== */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.mini-logo { display: flex; }
.top-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:disabled { opacity: 0.3; }

.content {
  flex: 1;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Bottom nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(22,27,34,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s;
}
.nav-btn .nav-icon { font-size: 20px; line-height: 1; }
.nav-btn.active { color: var(--accent); }

/* ===== Cards ===== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.section-head h3 { font-size: 17px; font-weight: 700; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:active { transform: scale(0.99); }
.card-list { display: flex; flex-direction: column; gap: 4px; }
.card.processed { opacity: 0.75; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-desc { color: var(--text-dim); margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.card-smart { color: var(--accent-2); margin-top: 6px; font-size: 13.5px; }
.card-done { color: var(--ok); margin-top: 4px; font-size: 13.5px; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 12px; }
.meta { color: var(--text-dim); font-size: 13px; }
.meta b { color: var(--text); font-weight: 600; }

.card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.badge { font-size: 11px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge.open { background: rgba(86,156,212,0.15); color: var(--accent); }
.badge.ok { background: rgba(63,185,80,0.15); color: var(--ok); }
.badge.fail { background: rgba(248,81,73,0.15); color: var(--danger); }
.badge.warn { background: rgba(210,153,34,0.15); color: var(--warn); }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: #4a8ac0; }
.btn.secondary { background: var(--accent-2); color: #0d1117; }
.btn.ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.primary.small, .btn.ghost.small, .btn.secondary.small { padding: 7px 12px; font-size: 13px; }
.btn.tiny { padding: 4px 8px; font-size: 12px; border-radius: 8px; }
.btn.ghost.tiny.danger { color: var(--danger); }
.btn.active-filter { border-color: var(--accent); color: var(--accent); }

.filter-chips { margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
}
.chip button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 16px;
  font-size: 14px;
}

/* ===== Ratings ===== */
.rating-list { display: flex; flex-direction: column; gap: 14px; }
.rating-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.rating-info { flex: 1; min-width: 0; }
.rating-name { font-size: 15px; font-weight: 600; display: block; }
.rating-actions { display: inline-flex; gap: 4px; margin-left: 6px; }
.rating-slider { flex: 1; min-width: 80px; accent-color: var(--accent); height: 4px; }
.rating-val-wrap { min-width: 56px; text-align: right; font-size: 20px; font-weight: 700; color: var(--accent); }
.rating-val { font-size: 22px; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.hint { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }

.date-nav { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.history-card h3 { font-size: 14px; margin-bottom: 10px; color: var(--accent); }
.hist-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.hist-val { font-weight: 700; color: var(--accent-2); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg-soft);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-bottom: none;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-card h3 { margin-bottom: 18px; font-size: 18px; }
.modal-card label { display: block; margin: 14px 0 6px; color: var(--text-dim); font-size: 13px; }
.modal-card input, .modal-card textarea, .modal-card select {
  width: 100%;
  padding: 11px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.modal-card textarea { min-height: 70px; resize: vertical; }
.modal-card input:focus, .modal-card textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.check-row { display: flex !important; align-items: center; gap: 8px; }
.check-row input { width: auto; }

/* ===== Searchable select ===== */
.searchable-select { position: relative; }
.ss-input { width: 100%; }
.ss-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 50;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow);
}
.ss-item { padding: 10px 12px; cursor: pointer; font-size: 14px; }
.ss-item:hover { background: rgba(86,156,212,0.15); }
.ss-item.empty { color: var(--text-dim); cursor: default; }

/* ===== Settings ===== */
.settings-section { margin-bottom: 24px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row label { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }
.settings-row input, .settings-row select {
  flex: 1;
  max-width: 240px;
  padding: 9px 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.photo-row { display: flex; align-items: center; gap: 12px; }

.user-card { margin-bottom: 8px; }
.user-row { display: flex; align-items: center; gap: 12px; }
.user-info { flex: 1; min-width: 0; }
.user-info b { display: block; }
.user-actions { display: flex; gap: 6px; }

/* ===== Avatar ===== */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.avatar.initials {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
  animation: toastIn 0.25s ease;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.hidden { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Help ===== */
.help-content { padding: 20px; line-height: 1.7; }
.help-content h4 { margin: 16px 0 8px; color: var(--accent); }
.help-content p { margin: 6px 0; }
.help-content ul { padding-left: 20px; }
.slogans-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Error ===== */
.error-screen { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--danger); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-2); border-radius: 3px; }

/* ===== Dark scroll on iOS ===== */
@media (min-width: 640px) {
  .modal-card { border-radius: 20px; margin: 40px auto; border-bottom: 1px solid var(--border); }
}