/* ============ KaryaFlow design tokens ============
   ink #12182B · workspace #F3F4F8 · marigold #E8930C
   blue #3E63DD · violet #7C5CD6 · green #1E9E6A · red #D6455D */
:root {
  --ink: #12182B;
  --ink-2: #1B2340;
  --bg: #F3F4F8;
  --surface: #FFFFFF;
  --line: #E3E6EE;
  --text: #1E2536;
  --muted: #667085;
  --accent: #E8930C;
  --accent-soft: #FDF1DC;
  --blue: #3E63DD;
  --violet: #7C5CD6;
  --green: #1E9E6A;
  --red: #D6455D;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 24, 43, .05), 0 4px 16px rgba(18, 24, 43, .05);
  --display: "Sora", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { touch-action: manipulation; }
body {
  font-family: var(--body); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  display: flex; min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ============ sidebar ============ */
.sidebar {
  width: 224px; flex-shrink: 0; background: var(--ink); color: #C6CCE0;
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: var(--ink);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand-name em { font-style: normal; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 9px; font-weight: 500; min-height: 44px;
  border-left: 3px solid transparent;
}
.nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .75; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-2); color: #fff; border-left-color: var(--accent); }
.side-foot { margin-top: auto; }
.flow-legend {
  background: var(--ink-2); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; font-size: 12px;
}
.fl-title { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; }
.fl-line b { color: var(--accent); font-weight: 600; }
.fl-line.dim { color: #8891AC; }

/* ============ layout ============ */
.main { flex: 1; padding: 28px 32px 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.sub { color: var(--muted); margin-top: 3px; max-width: 60ch; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.head-actions { display: flex; gap: 10px; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

/* ============ buttons, chips, misc ============ */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 9px; font-weight: 600; min-height: 44px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #241500; }
.btn.primary:hover { filter: brightness(1.05); }
.link { color: var(--blue); font-weight: 500; }
.link:hover { text-decoration: underline; }
.hint { font-size: 12.5px; color: var(--muted); }
.hint.pad { display: block; padding-top: 10px; }
.empty { color: var(--muted); padding: 14px 4px; font-size: 14px; }
.late { color: var(--red); font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--line);
}
.chip.dept { background: var(--accent-soft); color: #8A5200; border-color: #F3D9AC; }
.chip.role { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.rework { background: #FBEDF0; color: var(--red); border-color: #F3CFD7; }
.chip.pri-low { background: #F0F1F4; }
.chip.pri-medium { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.pri-high { background: var(--accent-soft); color: #8A5200; border-color: #F3D9AC; }
.chip.pri-urgent { background: #FBEDF0; color: var(--red); border-color: #F3CFD7; }
.chip.status-active { background: #E7F6EF; color: var(--green); border-color: #C5E8D8; }
.chip.status-completed { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.status-on\ hold { background: #FBEDF0; color: var(--red); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.none { background: var(--line); color: var(--muted); }

/* ============ KPIs ============ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi-num { font-family: var(--display); font-size: 28px; font-weight: 700; display: block; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-accent { border-top: 3px solid var(--accent); }
.kpi-warn .kpi-num { color: var(--red); }

/* ============ progress bars ============ */
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar.slim { height: 6px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.pct { font-weight: 600; font-size: 13px; min-width: 36px; text-align: right; }

/* ============ dashboard bits ============ */
.proj-list { display: flex; flex-direction: column; }
.proj-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 6px; border-bottom: 1px solid var(--line);
}
.proj-row:last-child { border-bottom: 0; }
.proj-row:hover .proj-name { color: var(--accent); }
.proj-name { font-weight: 600; display: block; }
.proj-meta { font-size: 12.5px; color: var(--muted); }
.proj-side { display: flex; align-items: center; gap: 10px; }

.workload, .perf-chart { display: flex; flex-direction: column; gap: 10px; }
.wl-row, .perf-row { display: flex; align-items: center; gap: 10px; }
.wl-name { width: 120px; font-size: 13.5px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-bar { flex: 1; height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.wl-bar.big { height: 14px; }
.wl-bar span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.wl-bar.big span { background: var(--accent); }
.wl-count { font-weight: 600; font-size: 13px; min-width: 22px; text-align: right; }

/* ============ activity feed ============ */
.feed { list-style: none; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--line); align-items: baseline; }
.feed li:last-child { border-bottom: 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex-shrink: 0; position: relative; top: 4px; }
.feed li.auto .feed-dot { background: var(--accent); }
.feed-body { flex: 1; font-size: 13.5px; }
.feed-task { color: var(--muted); }
.feed-detail { display: block; color: var(--muted); font-size: 12.5px; }
.feed-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tag-auto {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent-soft); color: #8A5200; border-radius: 4px; padding: 1px 6px; margin-left: 6px;
}

/* ============ projects grid ============ */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.proj-card { display: flex; flex-direction: column; gap: 10px; transition: transform .15s ease, box-shadow .15s ease; }
.proj-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(18,24,43,.10); }
.pc-top { display: flex; justify-content: space-between; }
.proj-card h3 { font-size: 16.5px; }
.pc-desc { color: var(--muted); font-size: 13.5px; flex: 1; }
.pc-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* ============ SIGNATURE: the Flow Rail ============ */
.flow-rail {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 18px 22px; background: var(--ink); border: 0; color: #fff;
}
.rail-stage { text-align: center; min-width: 84px; padding: 8px 6px; border-radius: 10px; background: var(--ink-2); opacity: .55; }
.rail-stage.has { opacity: 1; }
.rail-count { font-family: var(--display); font-size: 20px; font-weight: 700; display: block; color: var(--accent); }
.rail-label { font-size: 11px; color: #C6CCE0; text-transform: uppercase; letter-spacing: .05em; }
.rail-arrow { display: flex; flex-direction: column; align-items: center; color: var(--accent); }
.rail-arrow em { font-size: 9px; font-style: normal; text-transform: uppercase; letter-spacing: .08em; color: #8891AC; }
.rail-stats { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: #C6CCE0; }
.rail-stats b { color: #fff; font-family: var(--display); }
.rail-stats .late b, .rail-stats .late { color: #FF8FA3; }

/* ============ tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; padding: 10px 16px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; min-height: 44px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel.hidden { display: none; }

/* ============ kanban board ============ */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
.col-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 12px; border-radius: 8px 8px 0 0; color: #fff;
}
.col-head.st-todo { background: #737C92; }
.col-head.st-inprogress { background: var(--blue); }
.col-head.st-testing { background: var(--violet); }
.col-head.st-qc { background: var(--accent); color: #241500; }
.col-head.st-done { background: var(--green); }
.col-body {
  background: #ECEEF3; border-radius: 0 0 8px 8px; padding: 8px; min-height: 220px;
  display: flex; flex-direction: column; gap: 8px;
}
.col-body.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.task {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; box-shadow: var(--shadow); cursor: grab;
}
.task:active { cursor: grabbing; }
.task.dragging { opacity: .5; }
.task-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.task-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.mini-rail { display: flex; gap: 4px; margin: 8px 0 6px; }
.mini-rail i { width: 14px; height: 4px; border-radius: 99px; background: var(--line); }
.mini-rail i.on { background: var(--accent); }
.task-foot { display: flex; align-items: center; gap: 8px; }
.due { font-size: 11.5px; color: var(--muted); }
.est { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.task-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.task-actions form { display: contents; }
.mini {
  font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.mini:hover { border-color: var(--muted); }
.mini.go { background: var(--accent-soft); border-color: #F3D9AC; color: #8A5200; }
.mini.bad { background: #FBEDF0; border-color: #F3CFD7; color: var(--red); }
.mini.ghost { color: var(--muted); }
.board-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 12px; }

/* ============ tables ============ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.member-cell { display: flex; align-items: center; gap: 10px; }
.score {
  font-family: var(--display); font-weight: 700; padding: 4px 11px; border-radius: 8px; font-size: 14.5px;
}
.score.good { background: #E7F6EF; color: var(--green); }
.score.mid { background: var(--accent-soft); color: #8A5200; }
.score.low { background: #FBEDF0; color: var(--red); }

/* ============ milestones ============ */
.milestones { list-style: none; padding: 0; display: flex; flex-direction: column; }
.milestones li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.milestones li:last-child { border-bottom: 0; }
.check {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line);
  background: var(--surface); color: var(--green); font-weight: 700;
}
.milestones li.done .check { border-color: var(--green); background: #E7F6EF; }
.milestones li.done .ms-title { color: var(--muted); text-decoration: line-through; }
.ms-title { flex: 1; font-weight: 500; }

/* ============ feedback ============ */
.fb-list { list-style: none; padding: 0; }
.fb-list li { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.fb-list li:last-child { border-bottom: 0; }
.fb-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.stars { color: var(--accent); letter-spacing: 2px; font-size: 14px; }
.stars i { font-style: normal; color: var(--line); }
.fb-list p { color: var(--text); font-size: 14px; }

/* ============ forms & modals ============ */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; flex: 1; }
.form input, .form select, .form textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); min-height: 44px;
}
.form textarea { min-height: auto; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); outline: none; }
.form-row { display: flex; gap: 12px; }
.status-select { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); min-height: 44px; background: var(--surface); }

.modal-wrap {
  position: fixed; inset: 0; background: rgba(18, 24, 43, .55); display: none;
  align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 50; overflow-y: auto;
}
.modal-wrap.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 14px; padding: 22px 24px;
  width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(18,24,43,.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 18px; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); width: 44px; height: 44px; }
.x:hover { color: var(--text); }

/* ============ toast ============ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(18,24,43,.35); font-size: 14px; max-width: 380px;
  border-left: 3px solid var(--accent);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ============ responsive ============ */
@media (max-width: 1080px) {
  .board { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; overflow-x: auto; }
  .brand { padding: 0 8px 0 0; }
  .brand-name { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 10px; border-left: 0; border-bottom: 3px solid transparent; }
  .nav a.active { border-bottom-color: var(--accent); }
  .side-foot { display: none; }
  .main { padding: 18px 14px 50px; }
  .board { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .rail-stats { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============ V2 additions ============ */
/* user chip + bell */
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 10px 10px;
  background: var(--ink-2); border-radius: 10px; margin-bottom: 14px;
}
.uc-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.uc-text b { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-text i { font-style: normal; font-size: 11px; color: var(--accent); }
.bell { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #C6CCE0; }
.bell:hover { background: var(--ink); color: #fff; }
.badge {
  position: absolute; top: 2px; right: 2px; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; border-radius: 99px; padding: 1px 5px; font-style: normal;
}
.nav-badge {
  background: var(--red); color: #fff; font-size: 10.5px; border-radius: 99px;
  padding: 1px 7px; margin-left: auto;
}
.logout {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-top: 10px;
  border-radius: 9px; font-size: 13.5px; color: #8891AC; min-height: 44px;
}
.logout:hover { background: var(--ink-2); color: #fff; }

/* login page */
.login-body {
  display: grid; place-items: center; min-height: 100vh; background: var(--ink);
  background-image: radial-gradient(ellipse 80% 60% at 70% -10%, #1B2340 0%, transparent 60%);
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 34px 36px; width: 100%;
  max-width: 400px; box-shadow: 0 24px 80px rgba(0,0,0,.45); margin: 20px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand .brand-mark { width: 42px; height: 42px; }
.login-brand h1 { font-size: 24px; }
.login-brand em { font-style: normal; color: var(--accent); }
.login-sub { color: var(--muted); margin-bottom: 18px; }
.login-error {
  background: #FBEDF0; color: var(--red); border: 1px solid #F3CFD7;
  padding: 9px 13px; border-radius: 8px; font-size: 13.5px; margin-bottom: 12px;
}
.login-hint { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.btn.wide { width: 100%; }

/* my tasks */
.my-tasks { border-left: 3px solid var(--accent); }
.my-list { display: flex; flex-direction: column; }
.my-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.my-row:last-child { border-bottom: 0; }
.my-row:hover .my-title { color: var(--accent); }
.my-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 160px; }

/* filters */
.filter-row { margin-bottom: 16px; }
.filter { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.filter select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); min-height: 44px; min-width: 240px;
}

/* access chips */
.chip.access-admin { background: #FBEDF0; color: var(--red); border-color: #F3CFD7; }
.chip.access-manager { background: var(--accent-soft); color: #8A5200; border-color: #F3D9AC; }
.chip.access-team-lead { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.access-employee { background: #F0F1F4; }
tr.inactive { opacity: .45; }

/* notifications */
.notif-list li.unread { background: var(--accent-soft); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.notif-list li.unread .feed-dot { background: var(--accent); }
.notif-link:hover { color: var(--accent); }

/* task panel modal */
.tp-h { font-size: 13.5px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.inline-form { flex-direction: row; align-items: center; }
.inline-form input[type="number"] { width: 90px; }
.inline-form input[name="note"] { flex: 1; }
.inline-form input[type="file"] { flex: 1; border: 0; padding-left: 0; }
.tp-list { list-style: none; padding: 0; max-height: 160px; overflow-y: auto; }
.tp-list li {
  display: flex; align-items: baseline; gap: 8px; font-size: 13.5px;
  padding: 7px 2px; border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.tp-list li .feed-time { margin-left: auto; }
.check.static { display: inline-grid; place-items: center; }
.htitle { vertical-align: middle; margin-left: 6px; }
.task.mine { border-left: 3px solid var(--accent); }

/* ============ V3 additions ============ */
/* user chip link + sidebar search */
.uc-link { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; border-radius: 8px; }
.uc-link:hover .uc-text b { color: var(--accent); }
.side-search { margin-bottom: 12px; }
.side-search input {
  width: 100%; font: inherit; font-size: 13px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--ink-2); background: var(--ink-2); color: #fff; min-height: 40px;
}
.side-search input::placeholder { color: #8891AC; }
.side-search input:focus { outline: none; border-color: var(--accent); }
.search-big { display: flex; gap: 10px; align-items: center; }
.search-big input {
  flex: 1; font: inherit; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 9px; min-height: 44px;
}

/* KPI deltas */
.kpis.five { grid-template-columns: repeat(5, 1fr); }
.delta { font-size: 12px; font-weight: 700; font-family: var(--body); vertical-align: middle; }
.delta.good { color: var(--green); }
.delta.bad { color: var(--red); }
.delta.flat { color: var(--muted); }

/* health badges */
.health {
  display: inline-flex; font-size: 11.5px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
}
.health.big { font-size: 13px; padding: 6px 14px; }
.h-ok { background: #E7F6EF; color: var(--green); }
.h-risk { background: var(--accent-soft); color: #8A5200; }
.h-late { background: #FBEDF0; color: var(--red); }
.h-hold { background: #F0F1F4; color: var(--muted); }
.h-done { background: #EEF1FB; color: var(--blue); }

/* deadline radar */
.radar { list-style: none; padding: 0; display: flex; flex-direction: column; }
.radar li { display: flex; gap: 12px; padding: 9px 2px; border-bottom: 1px dashed var(--line); align-items: baseline; }
.radar li:last-child { border-bottom: 0; }
.radar-date {
  font-family: var(--display); font-weight: 700; font-size: 13px; min-width: 46px;
  color: var(--text);
}
.radar-body { display: flex; flex-direction: column; min-width: 0; }
.radar-title { font-weight: 600; font-size: 13.5px; }
.radar-title:hover { color: var(--accent); }

/* weekly delivery chart */
.week-chart { display: flex; gap: 10px; align-items: flex-end; height: 170px; padding-top: 8px; }
.wc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.wc-bar { width: 70%; max-width: 42px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height .3s ease; }
.wc-count { font-family: var(--display); font-weight: 700; font-size: 13px; min-height: 18px; }
.wc-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* donut */
.dist { display: flex; gap: 20px; align-items: center; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut-num { font: 700 20px var(--display); fill: var(--text); }
.donut-sub { font: 500 9px var(--body); fill: var(--muted); }
.dist-legend { list-style: none; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 7px; }
.dist-legend li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.dist-legend i { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.dist-legend b { margin-left: auto; font-family: var(--display); }

/* error page */
.login-card.center { text-align: center; }
.err-code { font-size: 56px; color: var(--accent); margin-bottom: 4px; }

/* printable report */
.report-body { display: block; background: var(--bg); }
.report { max-width: 880px; margin: 0 auto; padding: 28px 24px 60px; background: var(--surface); min-height: 100vh; }
.report-bar { display: flex; justify-content: space-between; margin-bottom: 22px; }
.report-brand { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.report-brand em { font-style: normal; color: var(--accent); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.report-head h1 { font-size: 26px; margin: 4px 0 2px; }
.report-desc { color: var(--muted); margin: 10px 0 4px; }
.report h2 { font-size: 15px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.report-kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 18px;
}
.report-kpis div { background: var(--bg); border-radius: 10px; padding: 12px 10px; text-align: center; }
.report-kpis b { display: block; font-family: var(--display); font-size: 19px; }
.report-kpis span { font-size: 11px; color: var(--muted); }
.table.small { font-size: 12.5px; }
.report-foot { margin-top: 34px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

@media print {
  .no-print { display: none !important; }
  body.report-body { background: #fff; }
  .report { max-width: none; padding: 0; }
  .report-kpis { grid-template-columns: repeat(6, 1fr); }
  a { color: inherit; }
}
@media (max-width: 1080px) {
  .kpis.five { grid-template-columns: repeat(2, 1fr); }
  .report-kpis { grid-template-columns: repeat(3, 1fr); }
}

/* ============ V4 additions ============ */
/* requirement form */
.req-form { gap: 10px; }
.req-h {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
  font-family: var(--display); margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.req-h:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.req-h .hint { text-transform: none; letter-spacing: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.check-item {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 8px;
  font-weight: 500 !important; font-size: 13.5px !important; padding: 6px 4px; cursor: pointer;
}
.check-item input { width: 17px; height: 17px; min-height: 0 !important; accent-color: var(--accent); margin: 0; }
.req-actions { display: flex; gap: 10px; margin-top: 16px; }

/* tickets */
.ticket-list { display: flex; flex-direction: column; gap: 12px; }
.ticket { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.tk-main { flex: 1; min-width: 0; }
.tk-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tk-title { font-weight: 600; font-size: 15px; }
.tk-desc { font-size: 13.5px; color: var(--text); margin: 4px 0; }
.tk-controls { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.tk-controls select {
  font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--surface); min-height: 38px;
}
.chip.tk-open { background: #FBEDF0; color: var(--red); border-color: #F3CFD7; }
.chip.tk-in-progress { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.tk-resolved { background: var(--accent-soft); color: #8A5200; border-color: #F3D9AC; }
.chip.tk-reopened { background: #FBEDF0; color: var(--red); border-color: #F3CFD7; font-weight: 700; }
.chip.tk-closed { background: #E7F6EF; color: var(--green); border-color: #C5E8D8; }
.chip.ok-chip { background: #E7F6EF; color: var(--green); border-color: #C5E8D8; }

/* customer confirm row */
.confirm-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 10px 4px; border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.confirm-row:last-child { border-bottom: 0; }
.confirm-form { display: flex; gap: 8px; align-items: center; }
.confirm-form select {
  font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 7px; min-height: 38px;
}
.portal-tk { border: 0; box-shadow: none; padding: 12px 0; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 0; }
.portal-tk:last-of-type { border-bottom: 0; }

/* learnings */
.learn-add textarea { width: 100%; }
.learn-add.done-today { border-left: 3px solid var(--green); }

@media (max-width: 760px) {
  .ticket { flex-direction: column; }
  .tk-controls { flex-direction: row; flex-wrap: wrap; min-width: 0; }
}

/* ============ V5 additions ============ */
/* task detail layout */
.task-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.task-main { min-width: 0; }
.task-side { position: sticky; top: 18px; }
.task-rail { padding: 14px 20px; }
.task-rail .rail-stage { min-width: 88px; padding: 10px 8px; }
.rail-now { display: block; font-size: 9.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.task-rail .rail-stats { gap: 8px; align-items: center; }
.task-rail form { display: inline; }
a.task-title { display: block; font-weight: 600; font-size: 13.5px; line-height: 1.35; color: var(--text); }
a.task-title:hover { color: var(--accent); }

/* details definition list */
.details { display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; font-size: 13.5px; margin: 0; }
.details dt { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.details dd { margin: 0; display: flex; align-items: center; gap: 6px; }
.chip.st-chip-todo { background: #F0F1F4; }
.chip.st-chip-inprogress { background: #EEF1FB; color: var(--blue); border-color: #D9E0F7; }
.chip.st-chip-testing { background: #F1EDFB; color: var(--violet); border-color: #DFD6F5; }
.chip.st-chip-qc { background: var(--accent-soft); color: #8A5200; border-color: #F3D9AC; }
.chip.st-chip-done { background: #E7F6EF; color: var(--green); border-color: #C5E8D8; }

/* comments */
.comment-list { list-style: none; padding: 0; margin-top: 14px; }
.comment-list li { display: flex; gap: 10px; padding: 12px 2px; border-top: 1px solid var(--line); }
.cm-body { flex: 1; min-width: 0; }
.cm-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 3px; }
.cm-body p { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }

/* dashboard agenda */
.agenda { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ag-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.ag-h b { color: var(--text); }
.ag-h.ag-late, .ag-h.ag-late b { color: var(--red); }
.ag-item { display: block; padding: 8px 10px; border-radius: 8px; background: var(--bg); margin-bottom: 6px; }
.ag-item:hover { background: var(--accent-soft); }
.ag-item-late { background: #FBEDF0; }
.ag-title { display: block; font-weight: 600; font-size: 13.5px; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-head h2 { font-size: 17px; min-width: 170px; }
.cal-today { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-cell {
  min-height: 96px; background: var(--bg); border-radius: 8px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px; border: 1px solid transparent;
}
.cal-cell.other-month { opacity: .42; }
.cal-cell.is-today { border-color: var(--accent); background: var(--accent-soft); }
.cal-date { font-family: var(--display); font-weight: 600; font-size: 12px; color: var(--muted); }
.cal-cell.is-today .cal-date { color: #8A5200; }
.cal-ev {
  font-size: 11px; line-height: 1.25; padding: 3px 6px; border-radius: 5px;
  background: #fff; border-left: 3px solid var(--muted); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev:hover { filter: brightness(.97); }
.ev-task { border-left-color: var(--blue); }
.ev-milestone { border-left-color: var(--violet); }
.ev-deadline { border-left-color: var(--accent); }
.ev-reminder { border-left-color: var(--green); }
.cal-ev.ev-done { opacity: .5; text-decoration: line-through; }
.cal-ev.ev-late { background: #FBEDF0; border-left-color: var(--red); color: var(--red); font-weight: 600; }
.cal-more { font-size: 10.5px; color: var(--muted); padding-left: 4px; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: flex; align-items: center; gap: 6px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-legend .ev-task { background: var(--blue); border: 0; }
.cal-legend .ev-milestone { background: var(--violet); border: 0; }
.cal-legend .ev-deadline { background: var(--accent); border: 0; }
.cal-legend .ev-reminder { background: var(--green); border: 0; }
.cal-legend .ev-late-dot { background: var(--red); }
.overdue-panel { border-left: 3px solid var(--red); }

/* manual */
.manual { max-width: 880px; }
.man-h { font-size: 16px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.manual p { margin-bottom: 10px; font-size: 14.5px; }
.man-flow {
  font-family: var(--display); font-weight: 600; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 9px; display: inline-block;
}
.man-ol, .man-ul { margin: 0 0 8px 20px; font-size: 14.5px; }
.man-ol li, .man-ul li { margin-bottom: 7px; }
.manual code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

@media print {
  .sidebar, .no-print, .toast { display: none !important; }
  .main { padding: 0; }
  .manual .card { box-shadow: none; border: 0; page-break-inside: avoid; }
}
@media (max-width: 1080px) {
  .task-layout { grid-template-columns: 1fr; }
  .task-side { position: static; }
  .agenda { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .cal-cell { min-height: 64px; }
  .cal-ev { font-size: 9.5px; }
}

/* ============ V6 additions ============ */
.brand-co { display: block; font-style: normal; font-size: 10px; color: #8891AC; font-weight: 500; letter-spacing: .02em; }
.req-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.req-toolbar form { display: contents; }

/* ticket conversation */
.tk-thread { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.tk-msg {
  background: var(--bg); border-radius: 8px; padding: 8px 11px; margin-bottom: 6px;
  font-size: 13.5px; border-left: 3px solid var(--line);
}
.tk-msg.from-cust { background: var(--accent-soft); border-left-color: var(--accent); }
.tk-msg p { margin-top: 3px; white-space: pre-wrap; word-wrap: break-word; }
.tk-msg b { font-size: 13px; }
.tk-controls-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 180px; align-items: stretch; }
.tk-controls-wrap .mini { text-align: center; }
.file-slim { font-size: 12px; max-width: 190px; }
.inline-form input[type="file"].file-slim { flex: 0 1 auto; }

/* brief tables */
.table.brief th.brief-l { width: 190px; text-align: left; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; vertical-align: top; padding: 10px; }
.table.brief td { font-size: 14px; }
.table.brief td.brief-block { white-space: pre-wrap; }

@media (max-width: 760px) {
  .tk-controls-wrap { min-width: 0; }
}
