/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f0f4f8;
  --card:     #ffffff;
  --dark:     #1e293b;
  --dark2:    #0f172a;
  --hdr-fg:   #f1f5f9;
  --accent:   #6366f1;
  --accent-d: #4f46e5;
  --success:  #22c55e;
  --success-d:#16a34a;
  --danger:   #f43f5e;
  --danger-d: #e11d48;
  --warning:  #fb923c;
  --warning-d:#ea7c1c;
  --muted:    #94a3b8;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --text2:    #64748b;
  --row-a:    #ffffff;
  --row-b:    #f8fafc;
}

html, body {
  height: 100%;
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.screen { display: flex; height: 100vh; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
  min-width: 240px;
  max-width: 340px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--accent); }
.toast-warning { background: var(--warning); }
@keyframes toast-in {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(60px); opacity: 0; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 18px;
  border: none; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
  white-space: nowrap; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-accent  { background: var(--accent);  color: #fff; }
.btn-accent:hover  { background: var(--accent-d); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-d); box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: var(--danger-d); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-d); }
.btn-muted   { background: #e2e8f0; color: var(--text2); }
.btn-muted:hover   { background: #cbd5e1; }
.btn-outline { background: var(--card); color: var(--text2); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-ghost-danger { background: transparent; color: #fca5a5; border: 1.5px solid rgba(252,165,165,0.35); }
.btn-ghost-danger:hover { background: rgba(244,63,94,0.15); color: #fff; border-color: transparent; }
.btn-sm  { padding: 6px 13px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text2); letter-spacing: 0.06em;
  margin-bottom: 5px; margin-top: 16px;
}
.required { color: var(--danger); margin-left: 2px; }
.field-input, .field-textarea, .field-select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--card); color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.field-textarea { resize: vertical; }
.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); font-size: 14px;
  pointer-events: none; opacity: 0.5;
}
.input-with-icon { padding-left: 36px; }
.error-msg { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 8px; }

/* ── LOGIN SCREEN ────────────────────────────────────────────────────────── */
.login-left {
  width: 360px; flex-shrink: 0;
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 44px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-icon { font-size: 56px; color: var(--accent); margin-bottom: 14px; }
.brand-title { font-size: 24px; font-weight: 800; color: #f1f5f9; margin-bottom: 8px; }
.brand-sub { font-size: 13px; color: var(--muted); margin-bottom: 32px; line-height: 1.7; }
.feature-list { list-style: none; text-align: left; width: 100%; }
.feature-list li { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: 13px; padding: 5px 0; }
.feat-arrow { color: var(--accent); font-size: 18px; font-weight: 700; }

.login-right { flex: 1; background: var(--card); display: flex; align-items: center; justify-content: center; }
.login-form-wrap { width: 380px; padding: 0 20px; }
.form-title { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.form-sub { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--muted); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ── APP SCREEN ──────────────────────────────────────────────────────────── */
#app-screen { flex-direction: column; height: 100vh; overflow: hidden; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  color: var(--hdr-fg); padding: 0 24px; height: 56px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; letter-spacing: 0.01em; }
.header-logo { font-size: 22px; color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 14px; }
.avatar-wrap { display: flex; align-items: center; gap: 9px; }
.user-name-label { font-size: 13px; color: #cbd5e1; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; border: 2px solid rgba(255,255,255,0.15);
}

/* Stats bar */
.stats-bar {
  display: flex; align-items: center;
  background: var(--card); border-bottom: 1.5px solid var(--border);
  padding: 0 8px; flex-shrink: 0; gap: 0;
}
.stat-cell { padding: 14px 24px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-done   { color: var(--success); }
.stat-inprog { color: var(--accent); }
.stat-todo   { color: var(--warning); }
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.stat-divider { width: 1px; background: var(--border); margin: 10px 0; align-self: stretch; }
.stat-progress-wrap { margin-left: auto; padding: 10px 24px; min-width: 200px; }
.stat-progress-label { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.stat-progress-track { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.stat-progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width 0.4s ease; width: 0%; }

/* Toolbar */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 20px; background: var(--bg); flex-shrink: 0;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.toolbar-search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 300px; }
.toolbar-search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar-input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--card); color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s; font-family: inherit;
}
.toolbar-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-select {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--card); color: var(--text); outline: none;
  cursor: pointer; transition: border-color 0.15s; font-family: inherit;
}
.toolbar-select:focus { border-color: var(--accent); }

/* Table */
.table-wrap { flex: 1; overflow-y: auto; padding: 0 20px 8px; }
.task-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.task-table thead tr th {
  background: var(--dark2); color: #94a3b8;
  font-size: 11px; font-weight: 700; padding: 10px 14px;
  text-align: left; letter-spacing: 0.06em;
  position: sticky; top: 0; z-index: 2;
}
.task-table thead tr th:first-child { border-radius: 8px 0 0 0; }
.task-table thead tr th:last-child  { border-radius: 0 8px 0 0; }
.task-table tbody tr {
  background: var(--card); cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  border-radius: 8px;
}
.task-table tbody tr:hover { box-shadow: 0 2px 12px rgba(99,102,241,0.1); transform: translateY(-1px); }
.task-table tbody tr.selected { box-shadow: 0 0 0 2px var(--accent), 0 4px 16px rgba(99,102,241,0.2); background: #eef2ff; }
.task-table td { padding: 12px 14px; font-size: 13px; vertical-align: middle; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.task-table td:first-child { border-left: 1px solid var(--border); border-radius: 8px 0 0 8px; }
.task-table td:last-child  { border-right: 1px solid var(--border); border-radius: 0 8px 8px 0; }
.col-check   { width: 36px; }
.col-title   { width: 20%; }
.col-priority { width: 10%; text-align: center; }
.col-status   { width: 13%; text-align: center; }
.col-due      { width: 10%; text-align: center; }
.col-desc     { }
.col-actions  { width: 100px; text-align: center; }

/* Row checkbox indicator */
.row-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; margin: 0 auto;
}
.selected .row-check { border-color: var(--accent); background: var(--accent); color: #fff; font-size: 11px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.badge-high { color: #dc2626; background: #fee2e2; }
.badge-med  { color: #d97706; background: #fef3c7; }
.badge-low  { color: #16a34a; background: #dcfce7; }
.badge-todo { color: #64748b; background: #f1f5f9; }
.badge-prog { color: #2563eb; background: #dbeafe; }
.badge-done { color: #16a34a; background: #dcfce7; }

/* Done row styling */
.done-row td { color: var(--muted) !important; }
.done-row .task-title { text-decoration: line-through; }

/* Row action buttons */
.row-actions { display: flex; gap: 5px; justify-content: center; opacity: 0; transition: opacity 0.15s; }
.task-table tbody tr:hover .row-actions,
.task-table tbody tr.selected .row-actions { opacity: 1; }
.row-btn {
  width: 28px; height: 28px; border: none; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; background: transparent; color: var(--muted);
}
.row-btn:hover { background: var(--bg); color: var(--text); }
.row-btn-edit:hover   { color: var(--warning); background: #fff7ed; }
.row-btn-done:hover   { color: var(--success); background: #f0fdf4; }
.row-btn-delete:hover { color: var(--danger);  background: #fff1f2; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
}
.empty-icon  { font-size: 52px; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; color: var(--muted); }

/* Action bar */
.action-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  background: var(--card); border-top: 1.5px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: none; border-radius: 9px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
  font-family: inherit;
}
.action-btn:active { transform: scale(0.97); }
.action-btn-add      { background: var(--accent); color: #fff; }
.action-btn-add:hover { background: var(--accent-d); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.action-btn-edit      { background: #fff7ed; color: var(--warning); border: 1.5px solid #fed7aa; }
.action-btn-edit:hover { background: #ffedd5; }
.action-btn-complete  { background: #f0fdf4; color: var(--success-d); border: 1.5px solid #bbf7d0; }
.action-btn-complete:hover { background: #dcfce7; }
.action-btn-delete    { background: #fff1f2; color: var(--danger); border: 1.5px solid #fecdd3; }
.action-btn-delete:hover { background: #ffe4e6; }
.action-hint { margin-left: auto; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.status-text { font-size: 12px; color: var(--text2); margin-left: 6px; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--card); border-radius: 14px; overflow: hidden;
  width: 500px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  animation: pop-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop-in {
  from { transform: scale(0.88) translateY(12px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}
.modal-header {
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 16px 22px; display: flex; align-items: center; gap: 10px;
}
.modal-close-btn {
  margin-left: auto; background: rgba(255,255,255,0.15); border: none;
  color: #fff; width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.3); }
.modal-body { padding: 20px 24px 24px; }
.modal-row { display: flex; gap: 14px; }
.modal-col { flex: 1; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Confirm modals */
.confirm-box { width: 400px; }
.confirm-header { background: var(--danger); }
.complete-header { background: var(--success); }
.confirm-icon-wrap {
  width: 72px; height: 72px; border-radius: 50%; margin: 8px auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.delete-icon-wrap   { background: #fff1f2; color: var(--danger); }
.complete-icon-wrap { background: #f0fdf4; color: var(--success); }
.confirm-title { text-align: center; font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.confirm-sub   { text-align: center; font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.confirm-note  { text-align: center; font-size: 12px; color: var(--text2); }

/* Register modal */
.register-box { width: 440px; }
.register-header { background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%); }
.register-header-icon { font-size: 20px; }
.register-sub { font-size: 13px; color: var(--text2); margin-bottom: 4px; margin-top: 2px; }
.password-strength { display: flex; align-items: center; gap: 10px; margin-top: 6px; min-height: 18px; }
.strength-track { flex: 1; height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; }
.strength-fill { height: 100%; width: 0%; border-radius: 99px; transition: width 0.3s, background 0.3s; }
.strength-label { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 60px; }
.match-hint { font-size: 11px; font-weight: 700; margin-top: 5px; min-height: 16px; }
.match-ok  { color: var(--success); }
.match-bad { color: var(--danger); }
.password-rules { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rule { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; transition: color 0.2s; }
.rule::before { content: "○"; font-size: 11px; flex-shrink: 0; }
.rule.pass { color: var(--success); }
.rule.pass::before { content: "✓"; }
.register-signin-link { text-align: center; font-size: 12px; color: var(--text2); margin-top: 14px; }
.register-signin-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.register-signin-link a:hover { text-decoration: underline; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
  .login-form-wrap { width: 100%; padding: 32px 24px; }
  .col-desc, .col-due, .col-actions { display: none; }
  .stats-bar { overflow-x: auto; }
  .stat-progress-wrap { display: none; }
}
