/* Follow-Up Tracker — dependency-free UI                                    */
/* ------------------------------------------------------------------------ */

:root {
  --bg:        #F2F4F8;
  --surface:   #FFFFFF;
  --line:      #E4E7EC;
  --text:      #101828;
  --muted:     #667085;
  --faint:     #98A2B3;
  --accent:    #3538CD;
  --accent-soft: #EEF0FF;
  --ok:        #12B76A;
  --warn:      #F79009;
  --danger:    #F04438;
  --u1:        #12B76A;
  --u2:        #F79009;
  --u3:        #F04438;
  --hold:      #B54708;
  --radius:    12px;
  --shadow:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.16);
  --font:      'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #CBD2DC; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------- boot/gate */
.boot-splash {
  min-height: 100vh; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; color: var(--muted);
}
.boot-logo { font-size: 42px; }

.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.gate-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 34px 30px; width: 100%; max-width: 420px;
}
.gate-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.gate-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }
.gate-card label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
.gate-card .hint { color: var(--faint); font-size: 12px; margin-top: 4px; }
.gate-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ----------------------------------------------------------------- forms */
.inp, .sel, .txa {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: #fff; outline: none;
  transition: border-color .15s;
}
.inp:focus, .sel:focus, .txa:focus { border-color: var(--accent); }
.txa { resize: vertical; min-height: 90px; }
.sel { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23667085' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 10px; padding: 9px 16px; font-weight: 700;
  background: var(--accent); color: #fff; transition: filter .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); font-weight: 600; }
.btn.ghost:hover { background: #F9FAFB; filter: none; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: #101828; color: #fff;
  padding: 0 18px; height: 58px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; }
.brand .dot { font-size: 20px; }
.brand small { display: block; font-size: 10.5px; font-weight: 500; color: #98A2B3; margin-top: -3px; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #E4E7EC; border-radius: 999px; padding: 5px 13px; font-size: 13px;
  cursor: pointer; transition: background .15s; max-width: 220px;
}
.chip:hover { background: rgba(255,255,255,.16); }
.chip b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .dept { color: #98A2B3; white-space: nowrap; }
.admin-badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .4px;
}
.icon-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #E4E7EC; width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.icon-btn:hover { background: rgba(255,255,255,.16); }

/* ------------------------------------------------------------- subheader */
.subbar {
  position: sticky; top: 58px; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.tabs { display: flex; background: #F2F4F8; border-radius: 10px; padding: 3px; gap: 2px; }
.tab {
  border: none; background: transparent; border-radius: 8px; padding: 7px 15px;
  font-weight: 700; font-size: 13.5px; color: var(--muted);
}
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.subbar .grow { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .sel, .filters .inp { width: auto; padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.filters .inp.search { width: 180px; }
.filters .sel { padding-right: 30px; }
.mine-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; font-weight: 600; }
.mine-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ----------------------------------------------------------------- board */
.view { padding: 18px; }
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.col {
  background: #ECEFF4; border-radius: 14px; min-width: 292px; width: 292px;
  flex-shrink: 0; padding: 10px; max-height: calc(100vh - 160px);
  display: flex; flex-direction: column;
}
.col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.col-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px;
  font-weight: 800; font-size: 13.5px;
}
.col-head .count {
  background: #fff; color: var(--muted); font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 1px 9px;
}
.col-head .bullet { width: 9px; height: 9px; border-radius: 50%; }
.col-cards { overflow-y: auto; display: flex; flex-direction: column; gap: 9px; min-height: 40px; padding: 2px; }
.col-empty { color: var(--faint); font-size: 12.5px; text-align: center; padding: 18px 6px; }

.card {
  background: var(--surface); border-radius: 11px; box-shadow: var(--shadow);
  padding: 11px 12px 10px; cursor: pointer; border-left: 4px solid var(--line);
  transition: box-shadow .15s, transform .1s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card.u1 { border-left-color: var(--u1); }
.card.u2 { border-left-color: var(--u2); }
.card.u3 { border-left-color: var(--u3); }
.card.dragging { opacity: .45; }
.card-title { font-weight: 700; font-size: 14px; line-height: 1.35; word-break: break-word; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pill {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px;
  background: #F2F4F8; color: var(--muted); white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}
.pill.dept { background: #EFF8FF; color: #175CD3; }
.pill.proj { background: #F4F3FF; color: #6941C6; }
.pill.urg1 { background: #ECFDF3; color: #067647; }
.pill.urg2 { background: #FFFAEB; color: #B54708; }
.pill.urg3 { background: #FEF3F2; color: #B42318; }
.pill.hold { background: #FFFAEB; color: var(--hold); }
.card-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 9px;
  color: var(--faint); font-size: 12px;
}
.card-foot .who { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot .who b { color: var(--muted); font-weight: 600; }
.hold-note {
  margin-top: 8px; font-size: 12px; color: var(--hold);
  background: #FFFAEB; border-radius: 8px; padding: 5px 9px;
  display: flex; gap: 6px; align-items: baseline;
}
.mine-flag { color: var(--accent); font-weight: 800; }

/* ------------------------------------------------------------------ list */
.list-wrap { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.list-scroll { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 900px; }
.list th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 700;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  cursor: pointer; user-select: none; background: #F9FAFB;
}
.list th .arrow { font-size: 10px; margin-left: 4px; }
.list td { padding: 11px 14px; border-bottom: 1px solid #F2F4F6; vertical-align: top; }
.list tr:last-child td { border-bottom: none; }
.list tbody tr { cursor: pointer; transition: background .12s; }
.list tbody tr:hover { background: #F9FAFB; }
.list .t-title { font-weight: 700; max-width: 340px; }
.list .t-title .sub { font-weight: 400; color: var(--faint); font-size: 12px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.status-pill {
  font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 11px; white-space: nowrap;
}
.status-pill.backlog     { background: #F2F4F7; color: #475467; }
.status-pill.in_progress { background: #EFF8FF; color: #175CD3; }
.status-pill.on_hold     { background: #FFFAEB; color: #B54708; }
.status-pill.finished    { background: #ECFDF3; color: #067647; }
.urg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.urg-dot.u1 { background: var(--u1); }
.urg-dot.u2 { background: var(--u2); }
.urg-dot.u3 { background: var(--u3); box-shadow: 0 0 0 3px #FEE4E2; }

/* ------------------------------------------------------------- dashboard */
.dash { display: flex; flex-direction: column; gap: 16px; max-width: 1180px; margin: 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px 18px; cursor: pointer; transition: box-shadow .15s;
}
.tile:hover { box-shadow: var(--shadow-lg); }
.tile .num { font-size: 28px; font-weight: 800; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.tile.alert .num { color: var(--danger); }
.tile.hold .num { color: var(--hold); }
.tile.prog .num { color: #175CD3; }
.tile.done .num { color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
.panel h3 { font-size: 14px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel h3 .count { color: var(--faint); font-weight: 600; font-size: 12.5px; }
.panel .empty { color: var(--faint); font-size: 13px; padding: 8px 0; }

.mini-task {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px;
  border-radius: 9px; cursor: pointer;
}
.mini-task:hover { background: #F9FAFB; }
.mini-task .t { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-task .age { color: var(--faint); font-size: 12px; white-space: nowrap; }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.bar-row .lbl { width: 120px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; background: #F2F4F8; border-radius: 999px; height: 10px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; background: var(--accent); min-width: 2px; }
.bar-row .n { width: 26px; text-align: right; font-weight: 700; font-size: 12.5px; }

.feed-item { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #F2F4F6; font-size: 13px; cursor: pointer; border-radius: 8px; }
.feed-item:hover { background: #F9FAFB; }
.feed-item:last-child { border-bottom: none; }
.feed-item .ico { flex-shrink: 0; }
.feed-item .body { flex: 1; min-width: 0; }
.feed-item .body .line { color: var(--text); }
.feed-item .body .line b { font-weight: 700; }
.feed-item .body .on { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item .when { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- drawer */
.overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 60;
  display: flex; justify-content: flex-end; animation: fadeIn .15s;
}
.overlay.center { align-items: center; justify-content: center; padding: 18px; }
@keyframes fadeIn { from { opacity: 0; } }
.drawer {
  background: var(--surface); width: 560px; max-width: 100%; height: 100%;
  display: flex; flex-direction: column; animation: slideIn .18s ease-out;
  box-shadow: var(--shadow-lg);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .5; } }
.drawer-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head .id { color: var(--faint); font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.drawer-head h2 { font-size: 17px; font-weight: 800; line-height: 1.3; word-break: break-word; flex: 1; }
.x-btn {
  background: #F2F4F8; border: none; width: 32px; height: 32px; border-radius: 9px;
  font-size: 15px; color: var(--muted); flex-shrink: 0;
}
.x-btn:hover { background: var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 20px; background: #FCFCFD; }

.task-props { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; font-size: 13.5px; margin-bottom: 14px; }
.task-props .k { color: var(--muted); font-weight: 600; }
.task-props .v { word-break: break-word; }
.brief-box {
  background: #F9FAFB; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word;
  margin-bottom: 16px;
}
.brief-box.empty { color: var(--faint); font-style: italic; }

.admin-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px;
}
.admin-actions .lbl { font-size: 12px; font-weight: 800; color: var(--accent); margin-right: 2px; }

.thread h3 { font-size: 13.5px; font-weight: 800; margin: 4px 0 10px; }
.cmt { display: flex; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; color: #fff;
}
.cmt-body { flex: 1; min-width: 0; }
.cmt-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmt-head b { font-size: 13px; }
.cmt-head .dept { color: var(--faint); font-size: 11.5px; }
.cmt-head .when { color: var(--faint); font-size: 11.5px; margin-left: auto; }
.cmt-text {
  background: #F9FAFB; border-radius: 0 10px 10px 10px; padding: 8px 12px;
  font-size: 13.5px; margin-top: 3px; white-space: pre-wrap; word-break: break-word;
}
.cmt.sys { align-items: center; }
.cmt.sys .sys-line { font-size: 12.5px; color: var(--muted); }
.cmt.sys .sys-line b { font-weight: 700; }
.cmt.sys .when { color: var(--faint); font-size: 11.5px; margin-left: 8px; }
.composer { display: flex; gap: 9px; align-items: flex-end; }
.composer .txa { min-height: 44px; max-height: 140px; }

/* ---------------------------------------------------------------- modals */
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  animation: popIn .16s ease-out;
}
@keyframes popIn { from { transform: scale(.96); opacity: 0; } }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 17px; font-weight: 800; flex: 1; }
.modal-body { padding: 14px 22px 22px; }
.modal-body label { display: block; font-weight: 700; font-size: 13px; margin: 13px 0 5px; }
.modal-body label:first-child { margin-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 20px; }

.urg-picker { display: flex; gap: 8px; }
.urg-opt {
  flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 6px;
  background: #fff; text-align: center; font-weight: 700; font-size: 13px;
  transition: all .12s; color: var(--muted);
}
.urg-opt small { display: block; font-weight: 500; font-size: 10.5px; color: var(--faint); }
.urg-opt.sel1 { border-color: var(--u1); background: #ECFDF3; color: #067647; }
.urg-opt.sel2 { border-color: var(--u2); background: #FFFAEB; color: #B54708; }
.urg-opt.sel3 { border-color: var(--u3); background: #FEF3F2; color: #B42318; }

.settings-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.settings-row { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid #F2F4F6; font-size: 13.5px; }
.settings-row:last-child { border-bottom: none; }
.settings-row .n { flex: 1; }
.settings-row .del { background: none; border: none; color: var(--faint); font-size: 14px; padding: 2px 6px; }
.settings-row .del:hover { color: var(--danger); }
.add-row { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #101828; color: #fff; border-radius: 10px; padding: 10px 18px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease-out;
}
.toast.err { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

.refresh-note { color: var(--faint); font-size: 11.5px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
  .brand span.t { display: none; }
  .subbar { top: 58px; padding: 8px 12px; }
  .filters .inp.search { width: 130px; }
  .view { padding: 12px; }
  .col { min-width: 260px; width: 260px; max-height: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  .row2 { grid-template-columns: 1fr; }
  .task-props { grid-template-columns: 96px 1fr; }
  .chip { max-width: 130px; }
  .chip .dept { display: none; }
}
