/* ============================================================
   TaskFlow — app.css  (ClickUp-inspired, Lexend font)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   LIGHT MODE (default)
   ============================================================ */
:root {
  --brand:       #16a34a;
  --brand-dark:  #128a3e;
  --brand-light: #e6f7ec;
  --brand-hover: #ecfaf1;

  --bg:          #f5f6f8;
  --surface:     #ffffff;
  --surface2:    #f0f1f5;
  --surface3:    #e4e5ec;
  --sidebar-bg:  #1a1d2e;
  --sidebar-txt: #9ea4be;
  --sidebar-hover: rgba(255,255,255,.08);
  --sidebar-active-bg: rgba(22,163,74,.2);

  --success:   #1dbc8a;
  --warning:   #f59e0b;
  --danger:    #f1416c;
  --info:      #4da6ff;

  --text:      #1a1d2e;
  --text-2:    #4b506b;
  --muted:     #8b90a7;
  --border:    #e4e5ec;
  --radius:    8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg:          #0e0f17;
  --surface:     #161825;
  --surface2:    #1e2033;
  --surface3:    #272b43;
  --sidebar-bg:  #0b0c14;
  --sidebar-txt: #7880a0;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active-bg: rgba(22,163,74,.25);

  --text:      #e6e8f0;
  --text-2:    #9ea4be;
  --muted:     #5c6280;
  --border:    #272b43;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

/* ============================================================
   BASE
   ============================================================ */
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lexend', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: width .25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }

.sidebar-logo {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px; font-weight: 800; color: #fff;
  font-family: 'Lexend', sans-serif;
}
.logo-text {
  font-size: 16px; font-weight: 700; color: #fff;
  white-space: nowrap; letter-spacing: -.02em;
  transition: opacity .2s, width .2s;
}
/* moved to collapsed block */

.sidebar-workspace {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.workspace-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s;
}
.workspace-badge:hover { background: var(--sidebar-hover); }
.workspace-dot {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.workspace-name {
  font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; flex: 1;
  transition: opacity .2s, width .2s;
}
/* moved to collapsed block */

.sidebar-nav {
  flex: 1; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto; overflow-x: hidden;
}
.nav-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--sidebar-txt);
  padding: 10px 10px 4px;
  white-space: nowrap;
  transition: opacity .2s;
}
/* moved to collapsed block */

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--sidebar-txt);
  font-size: 13.5px; font-weight: 500;
  transition: all .15s; cursor: pointer;
  white-space: nowrap; position: relative;
}
.nav-item svg { flex-shrink: 0; }
.nav-item .nav-label { transition: opacity .2s, width .2s; }
/* moved to collapsed block */
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--brand); }
.nav-badge {
  margin-left: auto;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  transition: opacity .2s;
}
/* moved to collapsed block */

.sidebar-user {
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer; transition: background .2s;
}
.user-row:hover { background: var(--sidebar-hover); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info-col { flex: 1; overflow: hidden; transition: opacity .2s, width .2s; }
/* moved to collapsed block */
.user-name { display: block; font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-label { display: block; font-size: 11px; color: var(--sidebar-txt); }
.logout-btn { color: var(--sidebar-txt); transition: color .2s; flex-shrink: 0; background: none; border: none; cursor: pointer; padding: 2px; }
.logout-btn:hover { color: var(--danger); }

/* Sidebar collapse btn */
.sidebar-collapse-btn {
  position: absolute; right: -12px; top: 28px;
  width: 24px; height: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: all .2s; z-index: 101;
  box-shadow: var(--shadow-sm);
}
.sidebar-collapse-btn:hover { color: var(--brand); border-color: var(--brand); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.main-content.collapsed { margin-left: 64px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  padding: 0 24px; height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
  transition: background .25s, border-color .25s;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.page-title { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.02em; white-space: nowrap; }

.topbar-search { flex: 1; max-width: 360px; min-width: 140px; position: relative; }
.topbar-search input {
  width: 100%;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px 7px 34px;
  font-family: 'Lexend', sans-serif; font-size: 13px;
  color: var(--text); outline: none;
  transition: border-color .2s, background .2s;
}
.topbar-search input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.topbar-search input::placeholder { color: var(--muted); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.topbar-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; position: relative;
}
.topbar-icon-btn:hover { background: var(--surface2); color: var(--text); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--surface);
}
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-wrap { padding: 24px; flex: 1; animation: fadeInUp .3s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* View tabs */
.view-tabs {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface2); border-radius: 8px;
  padding: 3px; border: 1px solid var(--border);
}
.view-tab {
  padding: 5px 12px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  cursor: pointer; border: none; background: transparent;
  font-family: 'Lexend', sans-serif;
  display: flex; align-items: center; gap: 5px;
  transition: all .15s;
}
.view-tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.view-tab:hover:not(.active) { color: var(--text); }

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--stat-accent, var(--brand));
}
.stat-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--stat-icon-bg, var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  color: var(--stat-accent, var(--brand));
  margin-bottom: 10px;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1.1; }
.stat-trend { font-size: 11px; color: var(--muted); margin-top: 4px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-wrap { background: var(--surface2); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #4ade80); transition: width .5s ease; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; display: flex; justify-content: space-between; font-weight: 500; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius);
  font-family: 'Lexend', sans-serif; font-size: 13.5px;
  font-weight: 600; cursor: pointer; border: none;
  text-decoration: none; transition: all .15s;
  white-space: nowrap; letter-spacing: -.01em;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-success { background: rgba(29,188,138,.1); color: var(--success); border: 1px solid rgba(29,188,138,.25); }
.btn-success:hover { background: rgba(29,188,138,.2); }
.btn-danger { background: rgba(241,65,108,.1); color: var(--danger); border: 1px solid rgba(241,65,108,.2); }
.btn-danger:hover { background: rgba(241,65,108,.18); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--brand); }
.btn-soft { background: var(--brand-light); color: var(--brand); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand-hover); border-color: var(--brand); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
}
.badge-urgent { background: rgba(241,65,108,.1); color: var(--danger); }
.badge-high   { background: rgba(245,158,11,.1);  color: var(--warning); }
.badge-normal { background: rgba(22,163,74,.1); color: var(--brand); }
.badge-low    { background: var(--surface2); color: var(--muted); }
.badge-success{ background: rgba(29,188,138,.1); color: var(--success); }
.badge-info   { background: rgba(77,166,255,.1);  color: var(--info); }
.badge-warning{ background: rgba(245,158,11,.1);  color: var(--warning); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; margin-bottom: 6px; }
.form-control {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px;
  color: var(--text); font-size: 13.5px; font-family: 'Lexend', sans-serif;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.form-control::placeholder { color: var(--muted); }
select.form-control option { background: var(--surface); color: var(--text); }
textarea.form-control { resize: vertical; min-height: 88px; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 16px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface2); border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 520px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 24px;
  transform: translateY(10px) scale(.98); transition: transform .25s;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.modal-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: rgba(29,188,138,.08); border: 1px solid rgba(29,188,138,.2); color: var(--success); }
.alert-danger  { background: rgba(241,65,108,.08); border: 1px solid rgba(241,65,108,.2);  color: var(--danger); }
.alert-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2);  color: var(--warning); }
.alert-info    { background: rgba(77,166,255,.08);  border: 1px solid rgba(77,166,255,.2);   color: var(--info); }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.section-count { background: var(--surface2); border: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; }

/* ============================================================
   TASK CARD
   ============================================================ */
.task-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 6px;
  transition: border-color .15s, box-shadow .15s;
  display: flex; align-items: flex-start; gap: 12px;
}
.task-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.task-check {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-radius: 50%; flex-shrink: 0; margin-top: 3px;
  cursor: pointer; transition: border-color .15s;
  display: flex; align-items: center; justify-content: center;
}
.task-check:hover { border-color: var(--brand); }
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; font-size: 10px; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ============================================================
   KANBAN BOARD
   ============================================================ */
.board-view { display: none; }
.board-view.active { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.list-view.hidden { display: none; }

.kanban-col { min-width: 272px; width: 272px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--surface2); margin-bottom: 4px;
}
.kanban-col-title { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; color: var(--text); }
.col-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-col-count { font-size: 11px; color: var(--muted); font-weight: 600; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kanban-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kanban-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.kanban-card-assignee {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff;
}
.kanban-add-btn {
  padding: 8px; border-radius: var(--radius);
  border: 1px dashed var(--border); background: transparent;
  color: var(--muted); font-family: 'Lexend', sans-serif; font-size: 12.5px;
  cursor: pointer; width: 100%; text-align: left;
  transition: all .15s; display: flex; align-items: center; gap: 7px;
}
.kanban-add-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-hover); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar select,
.filter-bar .form-control { width: auto; font-size: 12.5px; padding: 5px 10px; }

/* ============================================================
   PROJECT GRID
   ============================================================ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.project-card:hover { box-shadow: var(--shadow); border-color: var(--proj-color, var(--brand)); }
.project-card-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--proj-color, var(--brand)); }
.project-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.project-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.project-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.member-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  border: 2px solid var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; margin-left: -6px;
}
.member-avatar:first-child { margin-left: 0; }

/* ============================================================
   FAB
   ============================================================ */
.fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(22,163,74,.4); z-index: 150;
  transition: all .2s; font-size: 22px;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(22,163,74,.5); }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  z-index: 999; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 100px; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.cmd-overlay.open { opacity: 1; pointer-events: auto; }
.cmd-palette {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; width: 540px; max-width: calc(100vw - 40px);
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(-8px) scale(.97); transition: transform .2s;
}
.cmd-overlay.open .cmd-palette { transform: translateY(0) scale(1); }
.cmd-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmd-input { flex: 1; background: none; border: none; outline: none; font-family: 'Lexend', sans-serif; font-size: 15px; color: var(--text); }
.cmd-input::placeholder { color: var(--muted); }
.cmd-results { max-height: 360px; overflow-y: auto; }
.cmd-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer;
  font-size: 13.5px; color: var(--text-2); transition: background .1s;
}
.cmd-result-item:hover, .cmd-result-item.selected { background: var(--brand-hover); color: var(--brand); }
.cmd-result-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmd-shortcut { margin-left: auto; font-size: 11px; background: var(--surface2); padding: 2px 7px; border-radius: 4px; color: var(--muted); }
.cmd-footer { padding: 8px 18px; border-top: 1px solid var(--border); display: flex; gap: 16px; font-size: 11.5px; color: var(--muted); }
.kbd { background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-family: monospace; font-size: 11px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; min-width: 260px; max-width: 360px;
  animation: toastIn .3s ease;
}
.toast.removing { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.activity-item:last-child { border-bottom: none; }
.activity-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #4ade80); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; margin-top: 1px; }
.activity-text { flex: 1; line-height: 1.5; color: var(--text-2); }
.activity-text strong { color: var(--text); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   CARD
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; transition: background .25s, border-color .25s; }
.card-sm { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-bg { min-height: 100vh; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 40px 36px; width: 400px; max-width: 100%; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 52px; height: 52px; background: linear-gradient(135deg, var(--brand), #4ade80); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 12px; font-family: 'Lexend', sans-serif; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -.03em; }
.login-subtitle { font-size: 13.5px; color: var(--muted); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; line-height: 1.6; }

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; color: var(--muted); font-size: 13px; }
.drop-zone:hover { border-color: var(--brand); background: var(--brand-hover); color: var(--brand); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }
  .logo-text, .workspace-name, .nav-label, .nav-badge, .nav-section-label, .user-info-col { display: none !important; }
  .main-content { margin-left: 64px !important; }
}
@media (max-width: 600px) {
  .content-wrap { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
}

/* img preview */
.img-preview { max-width: 100%; border-radius: var(--radius); margin-top: 10px; display: none; }

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-dropdown-title { font-size: 14px; font-weight: 700; }
.notif-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 10px;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}
.notif-item:hover { background: var(--surface2); }
.notif-item:last-child { border-bottom: none; }
.notif-item-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--brand-light);
  color: var(--brand);
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text { font-size: 12.5px; color: var(--text); line-height: 1.4; margin-bottom: 3px; }
.notif-item-time { font-size: 11px; color: var(--muted); }
.notif-item.unread { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }

/* ============================================================
   USER MENU DROPDOWN (topbar avatar)
   ============================================================ */
.user-menu-wrapper { position: relative; }
.user-avatar-btn { border: none; cursor: pointer; padding: 0; font-family: inherit; }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
  overflow: hidden;
}
.user-menu-dropdown.open { display: block; }
.user-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.user-menu-header .user-name { color: var(--text); }
.user-menu-header .user-role-label { color: var(--muted); }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.user-menu-item:last-child { border-bottom: none; }
.user-menu-item:hover { background: var(--surface2); }
.user-menu-item i { font-size: 15px; color: var(--muted); width: 16px; text-align: center; }
.user-menu-item-danger { color: var(--danger); }
.user-menu-item-danger i { color: var(--danger); }
.user-menu-item-danger:hover { background: rgba(241,65,108,.08); }

/* ============================================================
   BOOTSTRAP ICONS — NAV ICON SIZE
   ============================================================ */
.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 17px;
  text-align: center;
}

/* ============================================================
   SIDEBAR COLLAPSED — CENTER EVERYTHING
   ============================================================ */

/* Hide text using display:none so gap is fully eliminated */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .workspace-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info-col,
.sidebar.collapsed .logout-btn { display: none !important; }

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 16px 0;
  gap: 0;
}
.sidebar.collapsed .sidebar-workspace { padding: 6px 0; }
.sidebar.collapsed .workspace-badge {
  justify-content: center;
  padding: 6px 0;
  gap: 0;
}
.sidebar.collapsed .sidebar-nav { padding: 10px 4px; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
  width: 100%;
}
.sidebar.collapsed .sidebar-user { padding: 8px 4px; }
.sidebar.collapsed .user-row {
  justify-content: center;
  padding: 8px 0;
  gap: 0;
}

/* ============================================================
   SIDEBAR TOGGLE BTN (in topbar)
   ============================================================ */
#sidebar-toggle-btn {
  color: var(--muted);
  transition: color .2s, background .2s;
}
#sidebar-toggle-btn:hover { color: var(--brand); background: var(--brand-light); }

/* ============================================================
   NOTIFICATION BELL + COUNTER BADGE
   ============================================================ */
.notif-wrapper {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  overflow: visible !important;
}
.notif-counter {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Lexend', sans-serif;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
  line-height: 1;
  pointer-events: none;
}

/* ============================================================
   TOPBAR AVATAR
   ============================================================ */
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================
   TOPBAR ICON BTN — ensure overflow visible for badge
   ============================================================ */
.topbar-icon-btn {
  overflow: visible;
}

/* ============================================================
   SEARCH ICON (Bootstrap Icons version)
   ============================================================ */
.search-icon {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
  font-size: 14px;
}

/* ============================================================
   TASK ROW (projects/view.php wide layout)
   ============================================================ */
.task-row {
  display: grid;
  grid-template-columns: 1fr 140px 110px 130px 56px;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 4px;
  padding: 0 8px 0 4px;
  min-height: 52px;
  transition: border-color .15s, box-shadow .15s;
}
.task-row:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }

.task-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 8px;
  min-width: 0;
}
.task-row-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.task-row-title:hover { color: var(--brand); }
.task-row-title.done-title {
  text-decoration: line-through;
  opacity: .55;
}
.task-row-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 100%;
  border-left: 1px solid var(--border);
}
.task-row-assignee { min-width: 0; }
.task-row-due      { white-space: nowrap; }
.task-row-progress { min-width: 0; }

/* Responsive: hide some cols on small screens */
@media (max-width: 860px) {
  .task-row { grid-template-columns: 1fr 100px 60px 44px; }
  .task-row-due { display: none; }
}
@media (max-width: 640px) {
  .task-row { grid-template-columns: 1fr 44px; }
  .task-row-assignee, .task-row-due, .task-row-progress { display: none; }
}

/* ============================================================
   TASK CHECK — clickable actionable state
   ============================================================ */
.task-check.actionable {
  cursor: pointer;
  border-color: var(--muted);
}
.task-check.actionable:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: scale(1.1);
}
.task-check.done {
  background: var(--success);
  border-color: var(--success);
}
.task-check {
  transition: all .15s;
}

/* ============================================================
   FILTER BAR — refined (Lexend, proper padding)
   ============================================================ */
.filter-bar {
  font-family: 'Lexend', sans-serif;
  padding: 12px 16px;
  gap: 10px;
}
.filter-bar select,
.filter-bar .form-control,
.filter-bar .tf-dropdown {
  width: auto;
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 32px 8px 12px;
  letter-spacing: .005em;
}
.filter-bar .btn,
.filter-bar .btn-sm {
  font-family: 'Lexend', sans-serif;
  font-weight: 500;
  padding: 8px 14px;
}

/* ============================================================
   STANDARD SELECT — default styling for plain native <select>
   elements (non-searchable, no Tom Select), matched to invoice.php.
   More specific classes (.assign-select, .status-select, .filter-bar
   select, .form-control, .tf-dropdown, .ts-control, etc.) still win
   via normal CSS specificity.
   ============================================================ */
select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  color: var(--text);
  background-color: var(--surface2);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%238b90a7' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
select:focus { border-color: var(--brand); background-color: var(--surface); }

/* Give every raw <select> the custom caret so the unenhanced state
   (brief flash before JS boots, or JS-disabled) still looks themed. */
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%238b90a7' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ============================================================
   TF-DROPDOWN — custom themed dropdown (replaces native <select>)
   The native select is kept in the DOM (hidden) so forms + onchange
   keep working. The .tf-dropdown shell is what the user sees.
   ============================================================ */
.tf-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  max-width: 100%;
  padding: 9px 32px 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Lexend', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.tf-dropdown:hover { border-color: var(--brand); }
.tf-dropdown:focus-visible,
.tf-dropdown.open {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.tf-dropdown[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  background: var(--surface2);
}
.tf-dropdown .tf-dropdown-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.tf-dropdown .tf-dropdown-label.placeholder { color: var(--muted); }
.tf-dropdown .tf-dropdown-caret {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  transition: transform .15s, color .15s;
}
.tf-dropdown.open .tf-dropdown-caret {
  color: var(--brand);
  transform: translateY(-50%) rotate(180deg);
}

/* Full-width variant for forms / modals */
.tf-dropdown.tf-dropdown-block { display: flex; width: 100%; }

/* ----- The popup panel (lumalabas sa ilalim) ----- */
.tf-dropdown-menu {
  position: absolute;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.tf-dropdown-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Custom scrollbar inside the popup for polish */
.tf-dropdown-menu::-webkit-scrollbar { width: 8px; }
.tf-dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.tf-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 4px;
}
.tf-dropdown-menu::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ----- Individual option rows ----- */
.tf-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.35;
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-dropdown-option + .tf-dropdown-option { margin-top: 1px; }
.tf-dropdown-option:hover,
.tf-dropdown-option.focus {
  background: var(--brand-hover);
  color: var(--brand);
}
.tf-dropdown-option.selected {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
.tf-dropdown-option.selected::after {
  content: "\f272"; /* bootstrap-icons check */
  font-family: "bootstrap-icons";
  margin-left: auto;
  font-size: 12px;
  color: var(--brand);
}
.tf-dropdown-option[data-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}
.tf-dropdown-option.muted {
  color: var(--muted);
  font-style: italic;
}

/* Dark-mode menu edge polish */
[data-theme="dark"] .tf-dropdown-menu {
  background: var(--surface);
  border-color: var(--surface3);
}
[data-theme="dark"] .tf-dropdown-option:hover,
[data-theme="dark"] .tf-dropdown-option.focus {
  background: rgba(22,163,74,.15);
}
[data-theme="dark"] .tf-dropdown-option.selected {
  background: rgba(22,163,74,.22);
}

/* Small variant for compact rows (filter bar) */
.tf-dropdown.tf-dropdown-sm {
  padding: 7px 30px 7px 11px;
  font-size: 12.5px;
  min-width: 130px;
}
.tf-dropdown.tf-dropdown-sm .tf-dropdown-caret {
  right: 10px;
  font-size: 10px;
}

/* The hidden native select — kept for form submission */
.tf-dropdown-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: flex-start;
}
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
}

.settings-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 16px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.settings-nav-item i { font-size: 15px; width: 18px; text-align: center; }
.settings-nav-item:hover { background: var(--surface2); color: var(--text); }
.settings-nav-item.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  min-width: 0;
}

.settings-section { margin-bottom: 6px; }
.settings-section-head { margin-bottom: 18px; }
.settings-section-head h3 {
  font-family: 'Lexend', sans-serif;
  font-size: 16px; font-weight: 700;
  color: var(--text); letter-spacing: -.01em;
}
.settings-section-head p {
  font-size: 12.5px; color: var(--muted);
  margin-top: 2px;
}
.settings-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 26px 0;
}

.settings-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
@media (max-width: 640px) {
  .settings-grid-2 { grid-template-columns: 1fr; }
}

.settings-empty {
  display: flex; align-items: center; gap: 12px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}
.settings-empty i { font-size: 22px; color: var(--muted); }

/* ---- Avatar preview + dropzone ---- */
.avatar-preview {
  width: 104px; height: 104px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 700;
  overflow: hidden; flex-shrink: 0;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.avatar-dropzone {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.avatar-dropzone:hover,
.avatar-dropzone.drag {
  border-color: var(--brand);
  background: var(--brand-light);
}

/* ---- Password strength ---- */
.pw-strength {
  height: 4px; width: 100%;
  background: var(--surface2);
  border-radius: 4px; overflow: hidden;
  margin-top: 8px;
}
.pw-strength-bar {
  height: 100%; width: 0;
  background: var(--danger);
  transition: width .2s, background .2s;
}

/* ---- Sessions list ---- */
.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.session-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 17px;
}
.session-body { flex: 1; min-width: 0; }
.session-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
}
.session-device { font-size: 13.5px; font-weight: 600; color: var(--text); }
.session-meta   { font-size: 11.5px; color: var(--muted); }

/* ---- Theme picker ---- */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) { .theme-picker { grid-template-columns: 1fr; } }
.theme-option {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  background: var(--surface);
}
.theme-option:hover { border-color: var(--brand); transform: translateY(-1px); }
.theme-option.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.theme-option input { position: absolute; opacity: 0; }
.theme-preview {
  display: flex; gap: 0;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.theme-preview-sidebar { width: 28%; }
.theme-preview-content { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.theme-preview-bar { height: 8px; border-radius: 4px; width: 80%; }
.theme-preview-bar.short { width: 55%; }

.theme-preview-light .theme-preview-sidebar { background: #1a1d2e; }
.theme-preview-light                         { background: #f5f6f8; }
.theme-preview-light .theme-preview-bar      { background: #c7c9d3; }

.theme-preview-dark  .theme-preview-sidebar  { background: #0b0c14; }
.theme-preview-dark                          { background: #161825; }
.theme-preview-dark  .theme-preview-bar      { background: #2d3147; }

.theme-preview-system                        { background: linear-gradient(90deg, #f5f6f8 50%, #161825 50%); }
.theme-preview-system .theme-preview-sidebar { background: linear-gradient(180deg, #1a1d2e 50%, #0b0c14 50%); }
.theme-preview-system .theme-preview-bar     { background: linear-gradient(90deg, #c7c9d3 50%, #2d3147 50%); }

.theme-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text);
}

/* ---- Accent color swatches ---- */
.accent-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.accent-swatch {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: transform .15s;
}
.accent-swatch:hover { transform: translateY(-1px); }
.accent-swatch input { position: absolute; opacity: 0; }
.accent-swatch span {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  transition: box-shadow .15s;
}
.accent-swatch.active span {
  box-shadow: 0 0 0 2px var(--text);
}
.accent-swatch small { font-size: 11px; color: var(--muted); }
.accent-swatch.active small { color: var(--text); font-weight: 600; }

/* ---- Toggle switches ---- */
.toggle-list { display: flex; flex-direction: column; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-body { flex: 1; min-width: 0; }
.toggle-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.toggle-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.switch {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--surface3);
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---- Account info grid ---- */
.info-grid { display: flex; flex-direction: column; }
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: 0; }
.info-key { color: var(--muted); font-weight: 500; }
.info-val { color: var(--text); font-weight: 600; }

/* ---- Danger zone box ---- */
.danger-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(241,65,108,.25);
  background: rgba(241,65,108,.04);
  border-radius: var(--radius);
}

/* ============================================================
   AVATAR MENU DROPDOWN (topbar)
   ============================================================ */
.avatar-menu-wrapper {
  position: relative;
  display: flex; align-items: center;
}
.avatar-menu-wrapper .topbar-avatar {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.avatar-menu-wrapper .topbar-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
  overflow: hidden;
  animation: avatarMenuIn .15s ease;
}
.avatar-menu.open { display: block; }
@keyframes avatarMenuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.avatar-menu-head {
  padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--brand-light) 0%, transparent 100%);
}
.avatar-menu-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4ade80);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}
.avatar-menu-info { flex: 1; min-width: 0; }
.avatar-menu-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar-menu-email {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.avatar-menu-role-row {
  display: flex; align-items: center; gap: 4px;
  margin-top: 6px;
  font-size: 11px;
}
.avatar-menu-role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .02em;
}
.avatar-menu-dept {
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.avatar-menu-section {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
}
.avatar-menu-section:last-of-type { border-bottom: none; }
.avatar-menu-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 4px;
}

.avatar-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.avatar-menu-item > i:first-child {
  font-size: 15px;
  width: 18px;
  text-align: center;
  color: var(--text-2);
  transition: color .15s;
}
.avatar-menu-item > span { flex: 1; }
.avatar-menu-chevron {
  font-size: 11px !important;
  color: var(--muted) !important;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}
.avatar-menu-item:hover {
  background: var(--surface2);
  color: var(--brand);
}
.avatar-menu-item:hover > i:first-child { color: var(--brand); }
.avatar-menu-item:hover .avatar-menu-chevron {
  opacity: 1;
  transform: translateX(2px);
}

.avatar-menu-item-danger {
  margin: 6px;
  color: var(--danger);
}
.avatar-menu-item-danger > i:first-child { color: var(--danger); }
.avatar-menu-item-danger:hover {
  background: rgba(241,65,108,.08);
  color: var(--danger);
}
.avatar-menu-item-danger:hover > i:first-child { color: var(--danger); }

.avatar-menu-theme-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px;
}
.avatar-menu-theme-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
}
.avatar-menu-theme-label i {
  font-size: 15px; width: 18px; text-align: center; color: var(--text-2);
}
.avatar-menu-theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.avatar-menu-theme-btn:hover {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}


/* =====================================================
   FLATPICKR — COP Green Theme
   ===================================================== */

/* Date input textbox */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input.flatpickr-input {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  padding: 9px 40px 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Lexend', sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background-color: var(--surface2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='2' y='4' width='16' height='14' rx='2' stroke='%238b90a7' stroke-width='1.5'/%3E%3Cpath d='M2 8h16' stroke='%238b90a7' stroke-width='1.5'/%3E%3Cpath d='M6 2v4M14 2v4' stroke='%238b90a7' stroke-width='1.5' stroke-linecap='round'/%3E%3Ccircle cx='6.5' cy='12' r='1' fill='%238b90a7'/%3E%3Ccircle cx='10' cy='12' r='1' fill='%238b90a7'/%3E%3Ccircle cx='13.5' cy='12' r='1' fill='%238b90a7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 18px 18px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input.flatpickr-input:focus {
  border-color: var(--brand);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Crect x='2' y='4' width='16' height='14' rx='2' stroke='%2316a34a' stroke-width='1.5'/%3E%3Cpath d='M2 8h16' stroke='%2316a34a' stroke-width='1.5'/%3E%3Cpath d='M6 2v4M14 2v4' stroke='%2316a34a' stroke-width='1.5' stroke-linecap='round'/%3E%3Ccircle cx='6.5' cy='12' r='1' fill='%2316a34a'/%3E%3Ccircle cx='10' cy='12' r='1' fill='%2316a34a'/%3E%3Ccircle cx='13.5' cy='12' r='1' fill='%2316a34a'/%3E%3C/svg%3E");
}
input.flatpickr-input[readonly] { cursor: pointer; }

/* =====================================================
   TOM SELECT — COP Green Theme
   ===================================================== */

.ts-wrapper { width: 100%; }
.ts-control {
  width: 100% !important;
  height: 40px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  padding: 9px 40px 9px 12px !important;
  background: var(--surface2) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius) !important;
  font-family: 'Lexend', sans-serif !important;
  font-size: 13.5px !important;
  color: var(--text) !important;
  box-shadow: none !important;
  cursor: pointer !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 8l5 5 5-5' stroke='%238b90a7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 11px center !important;
  background-size: 18px 18px !important;
  transition: border-color .2s, box-shadow .2s, background-color .2s !important;
  min-height: unset !important;
  flex-wrap: nowrap !important;
  outline: none !important;
}
.ts-wrapper.focus .ts-control {
  border-color: var(--brand) !important;
  background-color: var(--surface) !important;
  box-shadow: 0 0 0 3px rgba(22,163,74,.12) !important;
  outline: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 8l5 5 5-5' stroke='%2316a34a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
.ts-wrapper .ts-control::after { display: none !important; }
.ts-wrapper .ts-control > input {
  font-family: 'Lexend', sans-serif !important; font-size: 13.5px !important;
  color: var(--text) !important; padding: 0 !important; margin: 0 !important;
  background: transparent !important; border: none !important; outline: none !important;
  caret-color: var(--brand) !important;
}
.ts-control .placeholder { color: var(--muted) !important; font-weight: 400 !important; }

/* Dropdown panel */
.ts-dropdown {
  background: var(--surface) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06) !important;
  font-family: 'Lexend', sans-serif !important;
  font-size: 13.5px !important;
  margin-top: 5px !important;
  z-index: 99999 !important;
  overflow: hidden !important;
}
.ts-dropdown .ts-dropdown-content { padding: 5px !important; max-height: 260px !important; }
.ts-dropdown .option {
  padding: 9px 12px !important;
  color: var(--text-2) !important;
  border-radius: var(--radius) !important;
  font-size: 13.5px !important; font-weight: 400 !important;
  transition: background .1s, color .1s !important;
  cursor: pointer !important;
}
.ts-dropdown .option:hover, .ts-dropdown .option.active {
  background: var(--brand-light) !important; color: var(--brand-dark) !important;
}
.ts-dropdown .option.selected {
  background: var(--brand) !important; color: #fff !important; font-weight: 600 !important;
}
.ts-dropdown .option.selected:hover, .ts-dropdown .option.selected.active {
  background: var(--brand-dark) !important; color: #fff !important;
}
.ts-dropdown .optgroup-header {
  padding: 8px 12px 4px !important; font-size: 10px !important; font-weight: 700 !important;
  text-transform: uppercase !important; letter-spacing: .08em !important; color: var(--muted) !important;
}
.ts-wrapper.status-select-ts .ts-control {
  padding: 4px 28px 4px 10px !important; font-size: 12px !important;
  border-radius: 6px !important; background-size: 14px 14px !important; background-position: right 8px center !important;
  height: auto !important;
}
[data-theme="dark"] .ts-control { background: var(--surface2) !important; }
[data-theme="dark"] .ts-dropdown { background: var(--surface) !important; border-color: var(--border) !important; }
[data-theme="dark"] .ts-dropdown .option { color: var(--text-2) !important; }
[data-theme="dark"] .ts-dropdown .option:hover, [data-theme="dark"] .ts-dropdown .option.active {
  background: rgba(22,163,74,.18) !important; color: #4ade80 !important;
}