*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* BlinkCMS brand palette */
  --brand:        #0066CC;   /* Blink primary blue */
  --brand-dark:   #004EA3;
  --brand-nav:    #6d00e7;   /* topbar deep navy */
  --brand-teal:   #00B4D8;   /* accent teal */

  --bg:      #F0F4F8;
  --surface: #FFFFFF;
  --surface2:#E8EFF7;
  --border:  #D0DCE8;
  --border2: #B8CADA;

  --text:  #0B1929;
  --text2: #3A5068;
  --text3: #7A96AE;

  --blue:     #0066CC; --blue-bg: #E0EEFA; --blue-dark: #004EA3;
  --red:      #C0392B; --red-bg:  #FDECEA; --red-border:#F0A8A0;
  --amber:    #C07000; --amber-bg:#FEF3E0; --amber-border:#F5C96A;
  --green:    #1A7F4B; --green-bg:#E3F5EC;

  --bar-todo:    #0066CC;
  --bar-wip:     #00B4D8;
  --bar-done:    #1A7F4B;
  --bar-pending: #7B61FF;

  --pending: #5A46CC; --pending-bg: #EEEBFF; --pending-border: #B8AEED;

  --radius: 8px; --radius-lg: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.app { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; }

/* --- LOGIN SCREEN --- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0B1929 0%, #0A3060 60%, #004EA3 100%); }
.login-card { background: #6d00e7; border: 1px solid #D0DCE8; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 8px 40px rgba(0,0,0,0.3); }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-logo-icon { width: 36px; height: 36px; background: var(--blue); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; }
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-card h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 24px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.login-field input { width: 100%; height: 38px; font-size: 13px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s; font-family: inherit; }
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,102,204,0.12); }
.login-btn { width: 100%; height: 40px; border-radius: var(--radius); border: none; background: linear-gradient(90deg, #0066CC, #00B4D8); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 6px; font-family: inherit; transition: opacity 0.15s;margin-bottom: 20px; }
.login-btn:hover { opacity: 0.9; }
.login-error { font-size: 12px; color: var(--red); background: var(--red-bg); border: 1px solid var(--red-border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 14px; display: none; }
.login-error.show { display: block; }
.login-hint { font-size: 11px; color: var(--text3); text-align: center; margin-top: 16px; line-height: 1.6; }
.login-hint code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-family: monospace; }

/* --- TOP NAV BAR --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand-nav);
  border-bottom: none;
  padding: 0 20px; height: 52px;
  position: sticky; top: 0; z-index: 50;
  margin: -2rem -1.5rem 0;
  gap: 8px; overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.logo-icon { width: 26px; height: 26px; background: var(--brand); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-name { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.02em; }

.main-nav { display: flex; align-items: center; gap: 0; height: 100%; flex: 1; justify-content: center; overflow: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 5px;
  height: 52px; padding: 0 12px;
  border: none; background: transparent;
  color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.nav-item svg { opacity: 0.5; flex-shrink: 0; transition: opacity 0.15s; }
.nav-item:hover { color: rgba(255,255,255,0.85); }
.nav-item:hover svg { opacity: 0.8; }
.nav-item.active { color: #fff; border-bottom-color: var(--brand-teal); }
.nav-item.active svg { opacity: 1; }

/* --- USER PILL --- */
.user-pill { display: flex; align-items: center; gap: 6px; padding: 3px 3px 3px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.08); flex-shrink: 0; }
.user-pill-av { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; background: var(--brand-teal); color: #fff; flex-shrink: 0; }
.user-pill-name { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.85); white-space: nowrap; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.user-pill-logout { width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent; color: rgba(255,255,255,0.4); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; }
.user-pill-logout:hover { background: rgba(255,80,80,0.2); color: #ff8080; }

/* --- SUBBAR (search, filters, actions) --- */
.subbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  margin: 0 -1.5rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.subbar-left  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.subbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 9px; color: var(--text3); pointer-events: none; }
.search-input { height: 32px; width: 180px; padding: 0 10px 0 28px; font-size: 13px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface2); color: var(--text); outline: none; font-family: inherit; transition: all 0.15s; }
.search-input:focus { background: var(--surface); border-color: var(--blue); width: 220px; }
.filter-select { height: 32px; font-size: 13px; padding: 0 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface2); color: var(--text2); font-family: inherit; cursor: pointer; outline: none; }
.filter-select:focus { border-color: var(--blue); }

.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.vtoggle-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: var(--surface2); color: var(--text3); cursor: pointer; transition: all 0.15s; }
.vtoggle-btn + .vtoggle-btn { border-left: 1px solid var(--border); }
.vtoggle-btn:hover { background: var(--surface); color: var(--text2); }
.vtoggle-btn.active { background: var(--blue); color: #fff; }

.icon-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); color: var(--text3); cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border2); }

.btn-add { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: var(--radius); border: none; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; transition: background 0.15s; }
.btn-add:hover { background: var(--blue-dark); }

/* responsive: hide nav labels on narrow screens */
@media (max-width: 900px) {
  .nav-item span { display: none; }
  .nav-item { padding: 0 8px; }
  .user-pill-name { display: none; }
  .logo-name { display: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 10px; }
  .subbar { padding: 8px 10px; }
  .search-input { width: 130px; }
  .search-input:focus { width: 150px; }
  .filter-select { font-size: 12px; }
  .btn-add span { display: none; }
}

/* --- FILTER BAR --- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-bar-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-section-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.fbar-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-family: inherit; cursor: pointer; color: var(--text2); transition: all 0.15s; white-space: nowrap; }
.fbar-btn:hover { border-color: var(--border2); background: var(--surface2); }
.fbar-cnt { font-size: 11px; font-weight: 600; opacity: 0.65; }
.fbar-overdue:hover, .fbar-overdue.active { background: var(--red); color: #fff; border-color: var(--red); }
.fbar-overdue.active .fbar-cnt { opacity: 0.8; }
.fbar-today:hover, .fbar-today.active { background: var(--amber); color: #fff; border-color: var(--amber); }
.fbar-tomorrow:hover, .fbar-tomorrow.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.filter-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.fbar-active-filter { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius); background: var(--blue-bg); border: 1px solid #85B7EB; color: var(--blue-dark); font-size: 12px; font-weight: 500; }
.fbar-clear { border: none; background: transparent; color: var(--blue); cursor: pointer; font-size: 11px; padding: 0; line-height: 1; font-family: inherit; opacity: 0.7; transition: opacity 0.1s; }
.fbar-clear:hover { opacity: 1; }

/* --- TEAM STRIP (inline) --- */
.team-strip-inline { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.team-chip-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 5px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-family: inherit; color: var(--text2); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.team-chip-btn:hover { border-color: var(--border2); background: var(--surface2); }
.team-chip-btn.active { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }
.chip-av-sm { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; flex-shrink: 0; }
.chip-cnt { font-size: 11px; opacity: 0.5; margin-left: 1px; }
.team-chip-btn.active .chip-cnt { opacity: 0.7; }


input[type=text], input[type=date], input[type=email], input[type=password], select, textarea {
  height: 34px; font-size: 13px; padding: 0 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[type=text] { width: 160px; }
textarea { height: auto; padding: 8px 10px; resize: vertical; }

.btn { height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap; transition: all 0.15s; font-family: inherit; }
.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* --- VIEW SWITCHER (board/table) --- */
.view-switcher { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.view-btn { height: 34px; padding: 0 12px; border: none; background: var(--surface); color: var(--text2); font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s; font-family: inherit; }
.view-btn + .view-btn { border-left: 1px solid var(--border); }
.view-btn:hover { background: var(--surface2); }
.view-btn.active { background: var(--blue); color: #fff; }
.view-btn svg { width: 14px; height: 14px; }

/* --- STATS --- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.stat-val { font-size: 22px; font-weight: 600; }

/* --- ADD FORM --- */
.add-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 1.5rem; display: none; }
.add-form.open { display: block; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.form-group { display: flex; flex-direction: column; flex: 1; min-width: 120px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; }

/* --- BOARD --- */
.columns { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.col { background: var(--surface2); border-radius: var(--radius-lg); padding: 12px; }
.col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.col-title { font-size: 13px; font-weight: 500; color: var(--text2); }
.col-count { font-size: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; color: var(--text3); }
.task { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; transition: border-color 0.15s; }
.task:hover { border-color: var(--border2); }
.task.is-overdue { border-color: var(--red-border); background: #fff8f8; }
.task.is-today { border-color: var(--amber-border); background: #fffcf5; }
.task.is-tomorrow { border-color: #85B7EB; background: #f5faff; }
.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.task-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.task-title.done { text-decoration: line-through; color: var(--text3); }
.priority { font-size: 11px; padding: 2px 7px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.p-high { background: #FAECE7; color: #993C1D; } .p-medium { background: var(--amber-bg); color: #854F0B; } .p-low { background: var(--green-bg); color: #3B6D11; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--blue-bg); color: var(--blue); }
.due-badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; font-weight: 500; }
.due-overdue { background: #F7C1C1; color: #791F1F; } .due-today { background: var(--amber-border); color: #633806; } .due-tomorrow { background: #B5D4F4; color: var(--blue-dark); }
.due-normal { font-size: 11px; color: var(--text3); }
.assignee-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; }
.task-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.act-btn { font-size: 11px; padding: 3px 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; transition: all 0.1s; font-family: inherit; }
.act-btn:hover { background: var(--surface2); }
.act-btn.move-btn { color: var(--blue); border-color: #85B7EB; font-weight: 500; }
.act-btn.move-btn:hover { background: var(--blue-bg); }
.act-btn.edit-act { color: var(--text2); }
.act-btn.del-act { color: var(--red); }
.act-btn.del-act:hover { background: var(--red-bg); border-color: var(--red-border); }
.empty { text-align: center; padding: 24px 12px; color: var(--text3); font-size: 13px; }

/* --- TABLE --- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 580px; }
thead th { background: var(--surface2); padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--text2); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
thead th:hover { color: var(--text); } thead th.sorted { color: var(--blue); }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; } tbody tr:hover { background: var(--surface2); }
tbody tr.is-overdue { background: #fff8f8; } tbody tr.is-today { background: #fffcf5; } tbody tr.is-tomorrow { background: #f5faff; }
td { padding: 10px 12px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.title-cell { white-space: normal; line-height: 1.4; font-weight: 500; min-width: 160px; }
td.title-cell.done { text-decoration: line-through; color: var(--text3); }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.s-todo { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.s-inprogress { background: var(--blue-bg); color: var(--blue-dark); }
.s-pendingclient { background: var(--pending-bg); color: var(--pending); }
.s-done     { background: var(--green-bg); color: var(--green); }
.s-finished { background: var(--green-bg); color: var(--green); }
.s-archive  { background: #f0f0f0; color: #666; }
.tbl-select { font-size: 12px; height: 26px; padding: 0 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; font-family: inherit; }

/* pcard toggle button */
.pcard-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface2); color: var(--text2); font-size: 12px; font-family: inherit; cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
.pcard-toggle:hover { background: var(--blue-bg); color: var(--blue); border-color: #85B7EB; }
.pcard-toggle.open { background: var(--blue-bg); color: var(--blue); border-color: #85B7EB; }
.pcard-toggle span { font-weight: 600; }

/* --- EDIT MODAL --- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); width: 100%; max-width: 520px; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.modal-close { width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; color: var(--text2); cursor: pointer; font-size: 16px; font-family: inherit; transition: background 0.1s; }
.modal-close:hover { background: var(--surface2); }
.modal-body { padding: 20px; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-label { font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.modal .form-group input, .modal .form-group select { width: 100%; height: 36px; font-size: 13px; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal textarea { width: 100%; height: 72px; font-size: 13px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; font-family: inherit; }
.modal textarea:focus { outline: none; border-color: var(--blue); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface2); }

/* --- TEAM MODAL --- */
.team-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: none; align-items: center; justify-content: center; z-index: 100; }
.team-modal-bg.open { display: flex; }
.team-modal { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; width: 380px; max-width: 95vw; border: 1px solid var(--border); }
.team-modal h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-info { flex: 1; font-size: 13px; }
.member-sub { font-size: 11px; color: var(--text3); }
.add-member-row { display: flex; gap: 8px; margin-top: 10px; }
.add-member-row input { flex: 1; }

/* --- EMAIL PANEL --- */
.email-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 1.5rem; display: none; }
.email-panel.open { display: block; }
.email-panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.email-subtitle { font-size: 13px; color: var(--text2); margin-bottom: 16px; }
.email-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 99px; margin-bottom: 16px; }
.email-status.configured { background: var(--green-bg); color: var(--green); }
.email-status.not-configured { background: var(--amber-bg); color: #854F0B; }
.email-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.setting-row { display: flex; align-items: flex-start; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 200px; }
.setting-label { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.setting-desc { font-size: 12px; color: var(--text3); }
.setting-control { flex-shrink: 0; min-width: 280px; }
.setting-control input[type=text] { width: 100%; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input[type=checkbox] { width: 36px; height: 20px; appearance: none; background: var(--border2); border-radius: 99px; cursor: pointer; transition: background 0.2s; position: relative; flex-shrink: 0; }
.toggle input[type=checkbox]:checked { background: var(--blue); }
.toggle input[type=checkbox]::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left 0.2s; }
.toggle input[type=checkbox]:checked::after { left: 18px; }
.panel-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.test-result { font-size: 12px; padding: 4px 10px; border-radius: 99px; }
.test-result.ok { background: var(--green-bg); color: var(--green); }
.test-result.fail { background: var(--red-bg); color: var(--red); }
.setup-note { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 12px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.setup-note code { background: var(--border); padding: 1px 5px; border-radius: 4px; font-family: monospace; font-size: 11px; }

/* --- DASHBOARD --- */
.dash-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 1.5rem; }
.dcard { background: var(--surface2); border-radius: var(--radius); padding: 14px 16px; }
.dcard-label { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.dcard-val { font-size: 26px; font-weight: 600; }
.dash-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px; }
.dash-section h2 { font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 14px; }
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.pcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pcard-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pcard-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.pcard-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.pstat { background: var(--surface2); border-radius: var(--radius); padding: 8px; text-align: center; }
.pstat-val { font-size: 22px; font-weight: 600; }
.pstat-label { font-size: 11px; color: var(--text3); margin-top: 2px; }
.bar-track { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.leg-row { display: flex; gap: 12px; font-size: 11px; color: var(--text3); flex-wrap: wrap; }
.leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 3px; vertical-align: middle; flex-shrink: 0; }
.ptask-list { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.ptask-row { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.ptask-row:last-child { border-bottom: none; }
.ptask-title { flex: 1; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 10px; padding: 2px 7px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.pill-todo { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.pill-wip { background: var(--blue-bg); color: var(--blue-dark); }
.pill-pending { background: var(--pending-bg); color: var(--pending); }
.pill-done { background: var(--green-bg); color: var(--green); }
.pill-overdue { background: #F7C1C1; color: #791F1F; }
.pill-high { background: #FAECE7; color: #993C1D; }
.pill-medium { background: var(--amber-bg); color: #854F0B; }
.pill-low { background: var(--green-bg); color: #3B6D11; }
.overdue-box { background: var(--surface); border: 1px solid var(--red-border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px; }
.overdue-box h2 { font-size: 13px; font-weight: 500; color: var(--red); margin-bottom: 12px; }
.od-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.od-row:last-child { border-bottom: none; }
.od-title { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-days { font-size: 12px; color: var(--red); font-weight: 600; white-space: nowrap; }
.bar-table { width: 100%; border-collapse: collapse; }
.bar-table td { padding: 4px 0; vertical-align: middle; }
.bar-name-cell { font-size: 13px; color: var(--text); width: 100px; padding-right: 12px; white-space: nowrap; }
.bar-visual-cell { width: 100%; }
.bar-count-cell { font-size: 12px; color: var(--text3); padding-left: 10px; white-space: nowrap; width: 110px; }
.bar-segments { display: flex; height: 20px; border-radius: 4px; overflow: hidden; gap: 2px; }

/* --- EMAIL POLLER --- */
.poller-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 12px; border-radius: 99px; font-weight: 500; }
.poller-status.running  { background: var(--green-bg); color: var(--green); }
.poller-status.stopped  { background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }
.poller-status.error    { background: var(--red-bg);   color: var(--red); }
.poller-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.poller-dot.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.poller-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.poller-stat { background: var(--surface2); border-radius: var(--radius); padding: 12px 14px; }
.poller-stat-label { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.poller-stat-val { font-size: 20px; font-weight: 600; }

/* --- MODAL SIZES --- */
.modal-lg { max-width: 620px; }

/* --- TASK DETAIL POPUP --- */
.detail-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.detail-field { background: var(--surface2); border-radius: var(--radius); padding: 10px 12px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.detail-val { font-size: 13px; color: var(--text); }
.detail-desc-block { margin-bottom: 4px; }
.detail-desc { font-size: 13px; color: var(--text2); line-height: 1.7; background: var(--surface2); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; }

/* --- DASHBOARD MATRIX --- */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.matrix-table thead th { background: var(--surface2); padding: 9px 12px; text-align: center; font-size: 12px; font-weight: 500; color: var(--text2); border-bottom: 1px solid var(--border); }
.matrix-name-th { text-align: left !important; }
.matrix-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.matrix-table tbody tr:last-child { border-bottom: none; }
.matrix-table tbody tr:not(.matrix-total-row):hover { background: var(--surface2); }
.matrix-name-td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
.matrix-count-td { padding: 10px 12px; text-align: center; }
.matrix-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; border-radius: 99px; font-size: 12px; font-weight: 600; padding: 0 7px; }
.matrix-total-row { background: var(--surface2); }
.matrix-total-row td { font-size: 13px; border-top: 2px solid var(--border); }

/* --- CHANGELOG DATE FILTERS --- */
.cl-date-filters { display: flex; gap: 3px; }
.cl-date-btn { height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-family: inherit; color: var(--text2); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.cl-date-btn:hover { border-color: var(--border2); background: var(--surface2); }
.cl-date-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }


.cl-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cl-toolbar select { height: 32px; font-size: 13px; }
.cl-refresh { margin-left: auto; }
.cl-empty { text-align: center; padding: 3rem; color: var(--text3); font-size: 14px; }
.cl-list { display: flex; flex-direction: column; gap: 2px; }
.cl-entry { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; transition: border-color 0.15s; }
.cl-entry:hover { border-color: var(--border2); }
.cl-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.cl-icon-created  { background: var(--green-bg); }
.cl-icon-updated  { background: var(--blue-bg); }
.cl-icon-deleted  { background: var(--red-bg); }
.cl-body { flex: 1; min-width: 0; }
.cl-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.cl-task { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.cl-action-badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; flex-shrink: 0; }
.cl-badge-created { background: var(--green-bg); color: var(--green); }
.cl-badge-updated { background: var(--blue-bg); color: var(--blue-dark); }
.cl-badge-deleted { background: var(--red-bg); color: var(--red); }
.cl-meta { font-size: 11px; color: var(--text3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 5px; }
.cl-by { color: var(--text2); font-weight: 500; }
.cl-diffs { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.cl-diff { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.cl-field { color: var(--text3); min-width: 64px; }
.cl-from { color: var(--text2); background: var(--surface2); padding: 1px 6px; border-radius: 4px; text-decoration: line-through; opacity: 0.7; }
.cl-arr { color: var(--text3); font-size: 10px; }
.cl-to { background: var(--blue-bg); color: var(--blue-dark); padding: 1px 6px; border-radius: 4px; }
.cl-load-more { width: 100%; margin-top: 10px; }
.cl-count { font-size: 12px; color: var(--text3); margin-bottom: 10px; }

/* --- POINTS SYSTEM --- */
.pts-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; }
.pts-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.pts-section-head h2 { font-size: 15px; font-weight: 600; }
.pts-admin-badge { font-size: 11px; background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); border-radius: 99px; padding: 2px 10px; font-weight: 500; }

/* Leaderboard cards */
.pts-cards { display: flex; flex-direction: column; gap: 12px; }
.pts-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: border-color 0.15s; }
.pts-card:hover { border-color: var(--border2); }
.pts-card-first { border-color: #F4C431; background: #FFFDF0; }
.pts-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pts-medal { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; }
.pts-member-name { font-size: 14px; font-weight: 600; }
.pts-member-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.pts-score { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.pts-pts-label { font-size: 13px; font-weight: 400; color: var(--text3); margin-left: 3px; }

.pts-bar-track { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.pts-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue) 0%, #6C9EE5 100%); border-radius: 99px; transition: width 0.6s ease; }
.pts-card-first .pts-bar-fill { background: linear-gradient(90deg, #E6A817 0%, #F4C431 100%); }

.pts-breakdown-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.pts-base-total { color: var(--text2); }
.pts-bonus { color: var(--green); font-weight: 600; }
.pts-penalty { color: var(--red); font-weight: 600; }
.pts-waived { color: var(--amber); font-size: 11px; background: var(--amber-bg); padding: 1px 6px; border-radius: 4px; }

.pts-task-list { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.pts-task-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.pts-task-row:last-child { border-bottom: none; }
.pts-task-name { flex: 1; color: var(--text); font-weight: 500; min-width: 120px; }
.pts-complexity-badge { font-size: 10px; padding: 1px 7px; border-radius: 99px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.pts-base { color: var(--text2); }
.pts-net-sm { font-weight: 700; color: var(--text); margin-left: auto; white-space: nowrap; }

/* Admin task table */
.pts-admin-table { min-width: 700px; }
.pts-task-title-cell { font-size: 13px; font-weight: 500; }
.pts-task-title-wrap { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pts-override-badge { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--pending-bg); color: var(--pending); font-weight: 600; white-space: nowrap; }

.pts-override-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pts-override-input-wrap { display: flex; align-items: center; gap: 4px; }
.pts-override-input { width: 72px; height: 28px; font-size: 13px; font-weight: 600; padding: 0 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; outline: none; text-align: center; }
.pts-override-input:focus { border-color: var(--blue); background: var(--surface); }
.pts-override-input::placeholder { font-weight: 400; color: var(--text3); font-size: 11px; }
.pts-override-save { height: 28px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--blue); background: var(--blue-bg); color: var(--blue); font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.pts-override-save:hover { background: var(--blue); color: #fff; }
.pts-override-clear { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text3); font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; }
.pts-override-clear:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.pts-cx-select { height: 28px; font-size: 12px; padding: 0 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; cursor: pointer; }
.pts-delay-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text2); }
.pts-delay-toggle input { cursor: pointer; width: 14px; height: 14px; accent-color: var(--amber); }

.pts-member-notice-box { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; }

/* Settings grid */
.pts-settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.pts-setting-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.pts-setting-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.pts-setting-input-row { display: flex; align-items: center; gap: 6px; }
.pts-setting-input-row input { width: 100%; height: 32px; font-size: 14px; font-weight: 600; padding: 0 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; outline: none; }
.pts-setting-input-row input:focus { border-color: var(--blue); }
.pts-pts { font-size: 12px; color: var(--text3); white-space: nowrap; }

@media (max-width: 700px) {
  .pts-settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pts-task-row { gap: 5px; }
  .pts-score { font-size: 22px; }
}

/* --- TOAST --- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 13px; padding: 8px 18px; border-radius: 99px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 999; white-space: nowrap; }
.toast.show { opacity: 1; }
.loading { text-align: center; padding: 3rem; color: var(--text3); font-size: 14px; }

@media (max-width: 700px) {
  .columns, .people-grid { grid-template-columns: 1fr; }
  .stats, .dash-summary { grid-template-columns: repeat(2,1fr); }
  .setting-control { min-width: 100%; }
  .modal-row { grid-template-columns: 1fr; }

  /* Table: hide less important columns, let title breathe */
  .tbl-wrap { border-radius: var(--radius); }
  table { min-width: 0; font-size: 12px; }
  thead th:nth-child(4),   /* Tag */
  thead th:nth-child(5),   /* Assignee */
  tbody td:nth-child(4),
  tbody td:nth-child(5)  { display: none; }
  td, thead th { padding: 8px 8px; }
  td.title-cell { min-width: 0; }
  .tbl-select { font-size: 11px; height: 24px; }
  .act-btn { font-size: 10px; padding: 2px 6px; }
}