@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lexend:wght@600;700;800&display=swap');

:root {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --bg-soft: #eef1f8;
  --bg-hover: #e6eaf5;
  --text: #171b26;
  --text-muted: #636d80;
  --text-faint: #97a0b3;
  --border: #e1e5ef;
  --accent: #3b5bfd;
  --accent-2: #7b61ff;
  --accent-contrast: #ffffff;
  --accent-soft: #e9edff;
  --success: #17975f;
  --success-soft: #e1f7ec;
  --warning: #b3790a;
  --warning-soft: #fdf1da;
  --danger: #d63246;
  --danger-soft: #fceaed;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(23, 27, 38, 0.05);
  --shadow: 0 4px 16px rgba(23, 27, 38, 0.06), 0 1px 3px rgba(23, 27, 38, 0.05);
  --shadow-lg: 0 16px 40px rgba(23, 27, 38, 0.12), 0 2px 8px rgba(23, 27, 38, 0.06);
  --transition: 180ms cubic-bezier(.4,0,.2,1);
  --font-display: "Lexend", "Inter", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0d1017;
  --bg-elevated: #161b26;
  --bg-soft: #1d2330;
  --bg-hover: #242b3b;
  --text: #edf0f7;
  --text-muted: #9aa3b8;
  --text-faint: #636d80;
  --border: #272e3e;
  --accent: #7b93ff;
  --accent-2: #9d8bff;
  --accent-contrast: #0b0e16;
  --accent-soft: #212c54;
  --success: #3ecf94;
  --success-soft: #112d23;
  --warning: #e8b250;
  --warning-soft: #332710;
  --danger: #f07183;
  --danger-soft: #371920;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: var(--text-faint) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 8px; font-family: var(--font-display); letter-spacing: -0.01em; }
p { margin: 0 0 8px; color: var(--text-muted); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 17px; font-size: 14px; font-weight: 600;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-contrast);
  box-shadow: 0 4px 14px rgba(59, 91, 253, 0.3);
}
.btn-primary:hover { opacity: 0.94; box-shadow: 0 6px 20px rgba(59, 91, 253, 0.38); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor;
  border-top-color: transparent; opacity: .75; animation: spin 700ms linear infinite; margin-right: 4px; vertical-align: -2px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 14px; transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-error { color: var(--danger); font-size: 13px; min-height: 0; }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 7px;
  border: none; background: none; font-size: 15px; opacity: .6; transition: opacity var(--transition), background var(--transition);
}
.pw-toggle:hover { opacity: 1; background: var(--bg-hover); }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }

.card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; transition: box-shadow var(--transition), border-color var(--transition);
}

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new { background: var(--accent-soft); color: var(--accent); }
.badge-in_progress { background: var(--warning-soft); color: var(--warning); }
.badge-review { background: var(--accent-soft); color: var(--accent-2); }
.badge-done { background: var(--success-soft); color: var(--success); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%; font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-display);
}
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--bg-elevated); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.avatar-c0 { background: #e0e7ff; color: #4338ca; }
.avatar-c1 { background: #fce7f3; color: #be185d; }
.avatar-c2 { background: #d1fae5; color: #047857; }
.avatar-c3 { background: #fef3c7; color: #b45309; }
.avatar-c4 { background: #cffafe; color: #0e7490; }
.avatar-c5 { background: #fee2e2; color: #b91c1c; }
.avatar-c6 { background: #ede9fe; color: #6d28d9; }
.avatar-c7 { background: #dbeafe; color: #1d4ed8; }
:root[data-theme="dark"] .avatar-c0 { background: #312e5c; color: #c7d2fe; }
:root[data-theme="dark"] .avatar-c1 { background: #4a2037; color: #f9a8d4; }
:root[data-theme="dark"] .avatar-c2 { background: #0f3d30; color: #6ee7b7; }
:root[data-theme="dark"] .avatar-c3 { background: #453214; color: #fcd34d; }
:root[data-theme="dark"] .avatar-c4 { background: #103a44; color: #67e8f9; }
:root[data-theme="dark"] .avatar-c5 { background: #4a1f1f; color: #fca5a5; }
:root[data-theme="dark"] .avatar-c6 { background: #352155; color: #c4b5fd; }
:root[data-theme="dark"] .avatar-c7 { background: #1e3258; color: #93c5fd; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(640px circle at 12% 18%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(520px circle at 88% 82%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 60%),
    var(--bg);
}
.auth-box { position: relative; z-index: 2; width: 100%; max-width: 400px; padding: 34px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.auth-brand .mark { width: 34px; height: 34px; border-radius: 10px; }
.auth-box h1 { font-size: 23px; }
.auth-decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.floating-card {
  position: absolute; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); animation: float-around 16s ease-in-out infinite;
  display: flex; align-items: center; gap: 8px;
}
.floating-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
@keyframes float-around {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(18px, -24px) rotate(2deg); }
  50% { transform: translate(-10px, -10px) rotate(-2deg); }
  75% { transform: translate(-22px, 16px) rotate(1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { font-weight: 700; }
.theme-toggle-floating { position: absolute; top: 18px; right: 18px; z-index: 3; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; background: var(--bg-elevated); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; transition: transform var(--transition);
}
.sidebar .brand {
  font-weight: 800; font-size: 16px; padding: 6px 10px 20px; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
}
.sidebar .brand .mark { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 14px; transition: background var(--transition), color var(--transition);
}
.nav-link .ic { font-size: 16px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--bg-soft); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.clock { font-size: 12px; color: var(--text-faint); padding: 0 10px; font-variant-numeric: tabular-nums; }

.lang-switch { display: flex; gap: 4px; padding: 0 2px; }
.lang-switch button {
  flex: 1; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-muted);
  border-radius: 7px; padding: 5px 0; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.lang-switch button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.lang-switch button:hover { color: var(--text); }
.lang-switch-floating { position: absolute; top: 18px; right: 66px; z-index: 3; width: 120px; }

.main { flex: 1; min-width: 0; padding: 24px 30px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--bg-soft); padding: 5px 14px 5px 5px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text); }

.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-soft); font-size: 16px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.theme-toggle:hover { border-color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { text-align: left; display: flex; align-items: flex-start; gap: 14px; }
.stat-card .icon {
  width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent);
}
.stat-card.tone-progress .icon { background: var(--warning-soft); color: var(--warning); }
.stat-card.tone-success .icon { background: var(--success-soft); color: var(--success); }
.stat-card.tone-danger .icon { background: var(--danger-soft); color: var(--danger); }
.stat-card .num { font-size: 25px; font-weight: 800; font-family: var(--font-display); line-height: 1.2; }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

.input {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 14px; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  height: 42px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { cursor: pointer; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

.search-wrap { position: relative; flex: 1; min-width: 220px; }
.search-wrap .search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint);
  font-size: 14px; pointer-events: none; display: flex;
}
.search-wrap input { width: 100%; padding-left: 38px; padding-right: 36px; }
.search-wrap .clear-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--bg-hover); color: var(--text-muted); font-size: 12px; align-items: center; justify-content: center;
  display: none; transition: background var(--transition), color var(--transition);
}
.search-wrap .clear-btn:hover { background: var(--danger-soft); color: var(--danger); }
.search-wrap.has-value .clear-btn { display: flex; }

.status-filter { position: relative; }
.status-filter-btn { display: inline-flex; align-items: center; gap: 9px; }
.status-filter-btn .chev { font-size: 10px; color: var(--text-faint); transition: transform var(--transition); }
.status-filter-btn.open .chev { transform: rotate(180deg); }
.filter-count {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 999px; font-size: 11px;
  font-weight: 800; min-width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.status-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 8px; min-width: 210px; display: none;
}
.status-dropdown.open { display: block; animation: pop-in 140ms ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.status-dropdown .sd-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px; font-size: 14px; cursor: pointer; border-radius: 8px;
  transition: background var(--transition);
}
.status-dropdown .sd-row:hover { background: var(--bg-soft); }
.status-dropdown .sd-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dropdown .sd-foot {
  border-top: 1px solid var(--border); margin-top: 6px; padding: 8px 8px 2px; display: flex; justify-content: flex-end;
}
.status-dropdown .sd-clear { font-size: 12.5px; font-weight: 700; color: var(--text-muted); background: none; border: none; padding: 4px 6px; }
.status-dropdown .sd-clear:hover { color: var(--danger); }

.toggle-pill {
  display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px 8px 8px;
  transition: border-color var(--transition), color var(--transition); user-select: none; box-shadow: var(--shadow-sm);
}
.toggle-pill:hover { color: var(--text); }
.toggle-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-pill .track {
  width: 34px; height: 20px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); position: relative;
  transition: background var(--transition), border-color var(--transition); flex-shrink: 0;
}
.toggle-pill .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-faint);
  transition: transform var(--transition), background var(--transition);
}
.toggle-pill input:checked ~ .track { background: var(--accent-soft); border-color: var(--accent); }
.toggle-pill input:checked ~ .track::after { transform: translateX(14px); background: var(--accent); }
.toggle-pill.active { border-color: var(--accent); color: var(--accent); }

.chart { display: flex; flex-direction: column; gap: 10px; }
.chart-row { display: grid; grid-template-columns: 110px 1fr 42px; align-items: center; gap: 10px; }
.chart-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.chart-track { height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; transition: width 500ms cubic-bezier(.2,.8,.2,1); }
.chart-value { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.chart-empty { color: var(--text-faint); font-size: 13px; padding: 10px 0; }

.view-switch { display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; box-shadow: var(--shadow-sm); }
.view-switch-btn { border: none; background: none; width: 34px; height: 34px; border-radius: 7px; color: var(--text-muted); font-size: 15px; transition: background var(--transition), color var(--transition); }
.view-switch-btn.active { background: var(--accent-soft); color: var(--accent); }

.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--bg-soft); border-radius: var(--radius); padding: 12px; min-height: 120px; border: 1px solid var(--border); transition: background var(--transition), border-color var(--transition); }
.kanban-col.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; font-size: 13.5px; padding: 0 2px; }
.kanban-col-head .count { background: var(--bg-elevated); border-radius: 999px; font-size: 11.5px; padding: 1px 8px; color: var(--text-muted); font-weight: 700; }
.kanban-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; margin-bottom: 10px;
  cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card.dragging { opacity: .4; }
.kanban-card .title { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.kanban-card .meta-row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); }
.kanban-empty { text-align: center; color: var(--text-faint); font-size: 12px; padding: 16px 0; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.info-item { background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.info-item.span-2 { grid-column: 1 / -1; }
.info-item .info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.info-item .info-value { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.assignee-col-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.assignee-col-row { display: flex; align-items: center; gap: 7px; }
.info-note { display: flex; align-items: flex-start; gap: 8px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 10px; }
.info-note.tone-success { background: var(--success-soft); color: var(--success); }

.attachments-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.attachment-item { display: flex; align-items: center; gap: 10px; background: var(--bg-soft); border-radius: 10px; padding: 8px 11px; }
.att-icon { font-size: 18px; flex-shrink: 0; }
.att-body { flex: 1; min-width: 0; }
.att-name { font-size: 13.5px; font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name:hover { color: var(--accent); }
.att-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.att-delete { border: none; background: none; color: var(--text-faint); font-size: 13px; width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; transition: background var(--transition), color var(--transition); }
.att-delete:hover { background: var(--danger-soft); color: var(--danger); }

.comments-section { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; }
.comments-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; padding-right: 4px; }
.comment-item { display: flex; gap: 9px; align-items: flex-start; }
.comment-body { flex: 1; background: var(--bg-soft); border-radius: 10px; padding: 8px 11px; }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.comment-head .ntime { font-size: 11px; color: var(--text-faint); }
.comment-text { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea {
  flex: 1; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px;
  font-size: 13.5px; resize: none; color: var(--text); font-family: inherit;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.shortcuts-list { display: flex; flex-direction: column; gap: 10px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 14px; color: var(--text-muted); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 7px;
  background: var(--bg-soft); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--text); box-shadow: var(--shadow-sm);
}
.search-wrap .search-hint {
  position: absolute; right: 34px; top: 50%; transform: translateY(-50%); pointer-events: none;
  transition: opacity var(--transition);
}
.search-wrap.has-value .search-hint, .search-wrap:focus-within .search-hint { opacity: 0; }

.notif-wrap { position: relative; }
.notif-bell { position: relative; }
.notif-badge {
  position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 2px solid var(--bg); animation: badge-pop 280ms ease-out;
}
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-width: 86vw; max-height: 420px; overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 8px; display: none; z-index: 60;
}
.notif-panel.open { display: block; animation: pop-in 150ms ease-out; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 10px; }
.notif-panel-head h4 { margin: 0; font-size: 14px; }
.notif-panel-head button { font-size: 12.5px; font-weight: 700; color: var(--accent); background: none; border: none; }
.notif-item { display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; font-size: 13.5px; align-items: flex-start; transition: background var(--transition); }
.notif-item:hover { background: var(--bg-soft); }
.notif-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex-shrink: 0; }
.notif-item.read .dot { background: transparent; }
.notif-item .nmsg { flex: 1; line-height: 1.4; color: var(--text); }
.notif-item.read .nmsg { color: var(--text-muted); }
.notif-item .ntime { font-size: 11px; color: var(--text-faint); display: block; margin-top: 2px; }
.notif-empty { text-align: center; padding: 30px 10px; color: var(--text-faint); font-size: 13px; }

.filter-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px 0 13px; height: 42px; box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}
.filter-chip:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-chip .fc-icon { font-size: 14px; flex-shrink: 0; }
.input.bare {
  background: none; border: none; padding: 0; height: auto; font-weight: 600; color: var(--text);
  box-shadow: none !important;
}

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  display: grid; grid-template-columns: 2fr 1fr 1.4fr 0.9fr; gap: 14px; align-items: center;
  padding: 15px 18px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.task-row:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.task-row > * { min-width: 0; }
.task-row .title { font-weight: 700; }
.task-row .desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row .assignees { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.task-row .due { font-size: 13px; text-align: right; color: var(--text-muted); font-weight: 600; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 20, 0.55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 50; opacity: 0; transition: opacity var(--transition);
}
.modal-backdrop.open { display: flex; opacity: 1; }
.modal { background: var(--bg-elevated); border-radius: 18px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 26px; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform var(--transition); border: 1px solid var(--border); }
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.modal-head h2 { font-size: 19px; }
.modal-close { border: none; background: var(--bg-soft); color: var(--text-muted); width: 30px; height: 30px; border-radius: 50%; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background var(--transition); }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px;
  padding: 12px 30px 12px 14px; box-shadow: var(--shadow-lg); font-size: 14px; min-width: 240px; max-width: 340px;
  animation: toast-in 280ms cubic-bezier(.2,.8,.2,1);
}
.toast.leaving { animation: toast-out 220ms ease-in forwards; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast-ic { font-size: 16px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); animation: toast-shrink 3.8s linear forwards; }
.toast.success .toast-bar { background: var(--success); }
.toast.error .toast-bar { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px) scale(.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px) scale(.96); } }
@keyframes toast-shrink { from { width: 100%; } to { width: 0%; } }

.vote-card { display: flex; flex-direction: column; gap: 8px; }
.vote-card .meta { font-size: 13px; color: var(--text-muted); }
.vote-progress { height: 8px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.vote-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 320ms ease-out; border-radius: 999px; }
.vote-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab-btn { padding: 10px 16px; border: none; background: none; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; transition: color var(--transition), border-color var(--transition); }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-color: var(--accent); }

.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elevated); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); }
th { color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--bg-soft); font-weight: 700; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-soft); }
tr:last-child td { border-bottom: none; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-faint); font-size: 14px; }
.empty-state .ic { font-size: 30px; display: block; margin-bottom: 10px; opacity: .6; }

.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.admin-grid > * { min-width: 0; }
.section-title { font-size: 15.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.decor-ring { position: fixed; top: -90px; right: -90px; width: 280px; height: 280px; border-radius: 50%; border: 26px solid var(--accent-soft); opacity: .4; animation: spin 50s linear infinite; z-index: 0; pointer-events: none; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- Entrance animations ---------- */
@keyframes fade-in-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in-scale { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.pop { animation: fade-in-up 460ms cubic-bezier(.2,.8,.2,1) both; }
.pop-scale { animation: fade-in-scale 420ms cubic-bezier(.2,.8,.2,1) both; }
.stat-grid .card:nth-child(1) { animation-delay: 0ms; }
.stat-grid .card:nth-child(2) { animation-delay: 60ms; }
.stat-grid .card:nth-child(3) { animation-delay: 120ms; }
.stat-grid .card:nth-child(4) { animation-delay: 180ms; }
.report-grid .card:nth-child(1) { animation-delay: 0ms; }
.report-grid .card:nth-child(2) { animation-delay: 60ms; }
.report-grid .card:nth-child(3) { animation-delay: 120ms; }
.report-grid .card:nth-child(4) { animation-delay: 180ms; }

.icon-pulse { animation: icon-pulse 2.4s ease-in-out infinite; }
@keyframes icon-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.stat-card:hover .icon { animation: icon-pulse 900ms ease-in-out; }
.card { will-change: transform; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card:hover, .vote-card:hover { transform: translateY(-2px); }

/* ---------- Skeleton loading ---------- */
.skeleton {
  position: relative; overflow: hidden; background: var(--bg-soft); border-radius: 8px; color: transparent !important;
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skeleton-row { height: 68px; border-radius: var(--radius); margin-bottom: 10px; }
.skeleton-card { border-radius: var(--radius); }

/* ---------- Ripple ---------- */
.btn, .nav-link, .task-row, .toggle-pill, .tab-btn { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; background: currentColor; opacity: .25; pointer-events: none;
  transform: scale(0); animation: ripple-out 560ms ease-out;
}
@keyframes ripple-out { to { transform: scale(2.6); opacity: 0; } }

/* ---------- Sidebar active indicator ---------- */
.nav-link { position: relative; }
.nav-link.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 4px; height: 20px;
  border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.nav-link .ic { transition: transform var(--transition); }
.nav-link:hover .ic { transform: scale(1.15) rotate(-4deg); }

/* ---------- Badge live states ---------- */
.badge-overdue { animation: badge-breathe 1.8s ease-in-out infinite; }
@keyframes badge-breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 35%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 0%, transparent); } }
.badge-in_progress::before { animation: dot-blink 1.6s ease-in-out infinite; }
@keyframes dot-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Confetti ---------- */
.confetti-piece {
  position: fixed; top: -12px; width: 8px; height: 14px; z-index: 300; pointer-events: none;
  animation: confetti-fall linear forwards; border-radius: 2px;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(540deg); opacity: .2; }
}

/* ---------- Auth page blobs ---------- */
.auth-page::before, .auth-page::after {
  content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%; filter: blur(10px); z-index: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  animation: blob-float 14s ease-in-out infinite;
}
.auth-page::before { top: -160px; left: -160px; }
.auth-page::after {
  bottom: -180px; right: -160px; animation-delay: -7s;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%);
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, 40px) scale(1.08); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ---------- Count-up number ---------- */
.num { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .task-row { grid-template-columns: 1fr; }
  .task-row .due { text-align: left; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card .icon { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
  .stat-card .num { font-size: 20px; }
  .stat-card .label { font-size: 11.5px; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  table { min-width: 560px; }
}
