/* ProMan — Refined palette
   Neutral monochrome base + a single primary accent + 4 functional status tones.
   Differentiation by tone first, color second. */

:root {
  /* Neutrals */
  --grey-950: #0a0e1a;
  --grey-900: #111827;
  --grey-800: #1f2937;
  --grey-700: #374151;
  --grey-600: #4b5563;
  --grey-500: #6b7280;
  --grey-400: #9ca3af;
  --grey-300: #d1d5db;
  --grey-200: #e5e7eb;
  --grey-100: #f3f4f6;
  --grey-50:  #f9fafb;
  --white:    #ffffff;
  --black:    #0a0e1a;

  /* Single primary accent — deep indigo, used sparingly */
  --accent-700: #3730a3;
  --accent-600: #4338ca;
  --accent-500: #4f46e5;
  --accent-100: #eef2ff;
  --accent-50:  #f5f3ff;

  /* Functional status tones */
  --success-700:#047857; --success:#10b981; --success-100:#d1fae5;
  --warning-700:#b45309; --warning:#f59e0b; --warning-100:#fef3c7;
  --danger-700: #b91c1c; --danger: #ef4444; --danger-100: #fee2e2;
  --info-700:   #0369a1; --info:   #0ea5e9; --info-100:   #e0f2fe;

  --bg:       var(--grey-50);
  --surface:  var(--white);
  --surface-2:var(--grey-100);
  --border:   var(--grey-200);
  --border-strong: var(--grey-300);
  --text:     var(--grey-900);
  --muted:    var(--grey-500);
  --primary:  var(--accent-600);
  --primary-600: var(--accent-700);
  --primary-100: var(--accent-100);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 2px 6px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(15, 23, 42, 0.07);
  --radius:    14px;
  --radius-sm: 8px;
  --header-h:  60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-600); }

/* ---------- Horizontal top navigation (single row) ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.topnav .row1 {
  min-height: var(--header-h);
  display: flex; align-items: stretch; gap: 14px;
  padding: 0 24px;
}
.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: none;
}
.topnav .brand:hover { color: var(--accent-600); }
.topnav .brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-600), var(--accent-700));
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 700; box-shadow: 0 4px 10px rgba(67,56,202,0.25);
  overflow: hidden; flex-shrink: 0;
}
.topnav .brand .logo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.topnav .navinline {
  display: flex; align-items: stretch; gap: 2px;
  margin-left: 8px;
}
/* Nav links — sized to fill the bar height so hover area is generous */
.navinline .navlink {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px;
  height: var(--header-h);
  font-size: 13.5px; font-weight: 500;
  color: var(--grey-600);
  white-space: nowrap;
  position: relative;
  background: transparent; border: none; cursor: pointer; font-family: inherit;
  text-decoration: none; border-bottom: none;
}
.navinline > .navlink:hover { color: var(--text); background: var(--grey-50); }
.navinline > .navlink.active {
  color: var(--accent-700);
  box-shadow: inset 0 -2px 0 var(--accent-600);
}
.navinline .navlink .ico { width: 18px; height: 18px; flex-shrink: 0; }
.navinline .navlink .caret { width: 14px; height: 14px; margin-left: 2px; opacity: 0.6; transition: transform 0.15s; flex-shrink: 0; }

/* Hover dropdown groups — full-height trigger, panel attaches with no gap */
.navgroup {
  position: relative;
  display: flex; align-items: stretch;
}
.navgroup > .navlink { height: var(--header-h); }
.navgroup:hover > .navlink,
.navgroup.open > .navlink { background: var(--grey-50); color: var(--text); }
.navgroup:hover > .navlink .caret,
.navgroup.open > .navlink .caret { transform: rotate(180deg); }
.navgroup.active > .navlink { color: var(--accent-700); box-shadow: inset 0 -2px 0 var(--accent-600); }

/* Panel sits flush under the nav so cursor has no gap to cross */
.navgroup > .dd-panel {
  position: absolute; top: 100%; left: 0;
  min-width: 300px; padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s, transform 0.12s;
  z-index: 80;
}
.navgroup:hover > .dd-panel,
.navgroup.open > .dd-panel,
.navgroup:focus-within > .dd-panel {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}

.navgroup .dd-panel a {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--text);
  text-decoration: none; border-bottom: none;
}
.navgroup .dd-panel a:hover { background: var(--grey-50); color: var(--accent-700); }
.navgroup .dd-panel a.active { background: var(--accent-50); color: var(--accent-700); }
.navgroup .dd-panel .dd-ico { width: 20px; height: 20px; flex-shrink: 0; color: var(--accent-600); margin-top: 1px; }
.navgroup .dd-panel .dd-ttl { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.navgroup .dd-panel .dd-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.navgroup .dd-panel .dd-sub a { color: var(--accent-600); font-weight: 600; border-bottom: none; }
.navgroup .dd-panel .dd-sub a:hover { color: var(--accent-700); text-decoration: underline; }
.navgroup .dd-panel .dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.topnav .spacer { flex: 1; }
.topnav .user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
}
.topnav .user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}
.topnav .user-chip .name { font-size: 13px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav .row1 > .icon-btn,
.topnav .row1 > .user-chip,
.topnav .row1 > .notif-wrap,
.topnav .row1 > .settings-wrap { align-self: center; }

/* Settings dropdown (right side of nav) */
.settings-wrap { position: relative; }
.user-chip-btn {
  width: auto !important; height: 36px !important;
  padding: 0 10px 0 4px !important;
  gap: 6px; border-radius: 999px !important;
  display: flex; align-items: center;
}
.user-chip-btn .avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px; flex-shrink: 0;
}
.user-chip-btn .user-chip-caret { width: 14px !important; height: 14px !important; color: var(--grey-500); }
.settings-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  z-index: 100; display: none;
}
.settings-panel.open { display: block; }
.settings-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: var(--surface-2); margin-bottom: 6px;
}
.settings-head .avatar-lg {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.settings-head .settings-name { font-weight: 600; font-size: 13.5px; }
.settings-section { padding: 4px 0; }
.settings-section + .settings-section { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.settings-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: 13.5px; color: var(--text);
  width: 100%; text-align: left;
}
.settings-item:hover { background: var(--surface-2); }
.settings-item.danger:hover { background: var(--danger-100); color: var(--danger-700); }
.settings-item .settings-ico { width: 18px; height: 18px; color: var(--grey-600); flex-shrink: 0; }
.settings-item.danger:hover .settings-ico { color: var(--danger-700); }
.settings-item-ttl { font-weight: 600; font-size: 13.5px; line-height: 1.2; }

/* Toggle switch */
.toggle-switch {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--grey-300); position: relative;
  transition: background 0.15s; flex-shrink: 0;
}
.toggle-switch .toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.toggle-switch.on { background: var(--accent-600); }
.toggle-switch.on .toggle-thumb { transform: translateX(16px); }
.topnav .icon-btn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--grey-600);
  font-size: 16px;
}
.topnav .icon-btn:hover { background: var(--grey-100); color: var(--text); }
.topnav .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--danger); color: var(--white);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--surface);
}

/* Notification dropdown */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 380px; max-height: 480px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 100;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel .head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface);
}
.notif-panel .head h4 { margin: 0; font-size: 14px; }
.notif-panel .empty { padding: 30px 18px; color: var(--muted); text-align: center; font-size: 13px; }
.notif-panel .item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  text-decoration: none; color: inherit;
}
.notif-panel .item:hover { background: var(--grey-50); }
.notif-panel .item.unread { background: var(--accent-50); }
.notif-panel .item.unread:hover { background: var(--accent-100); }
.notif-panel .item .body { flex: 1; min-width: 0; }
.notif-panel .item .ttl { font-weight: 600; font-size: 13px; }
.notif-panel .item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif-panel .item .time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-panel .foot { padding: 10px 16px; text-align: center; border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; }
.notif-panel .foot a { color: var(--accent-600); font-weight: 500; font-size: 13px; }

.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--grey-400); }
.notif-info     { background: var(--info); }
.notif-success  { background: var(--success); }
.notif-warning  { background: var(--warning); }
.notif-critical { background: var(--danger); }
.notif-kind { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }

/* Mobile menu toggle — hidden on desktop only (need higher specificity than .topnav .icon-btn) */
.topnav .menu-toggle { display: none; }
@media (max-width: 1100px) {
  .navinline .navlink span:not(.ico):not(.caret) { display: none; }
  .navinline .navlink { padding: 0 10px; }
}
@media (max-width: 880px) {
  .topnav .row1 { padding: 0 12px; gap: 8px; }
  .topnav .navinline { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; gap: 4px;
    box-shadow: 0 8px 20px rgba(15,23,42,0.08); }
  .topnav.open .navinline { display: flex; }
  .topnav.open .navinline .navlink { height: 42px; padding: 0 14px; width: 100%; justify-content: flex-start; }
  .topnav.open .navinline .navlink span:not(.ico):not(.caret) { display: inline; }
  .topnav.open .navgroup { display: block; width: 100%; }
  .topnav.open .navgroup .dd-panel { position: static; opacity: 1; pointer-events: auto; transform: none;
    border: none; box-shadow: none; padding-left: 30px; min-width: 0; background: var(--grey-50); border-radius: 8px; margin: 4px 0; }
  .topnav .menu-toggle { display: flex; }
  .topnav .user-chip .name { display: none; }
  .notif-panel { width: 320px; right: -8px; }
}

/* Custom confirm dialog */
.cm-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
  z-index: 300;
}
.cm-backdrop.open { opacity: 1; pointer-events: auto; }
.cm {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.94);
  width: 420px; max-width: 92vw;
  background: var(--surface); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.30);
  padding: 28px;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
  z-index: 301; text-align: center;
}
.cm.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.cm-icon { width: 56px; height: 56px; border-radius: 50%;
  background: var(--warning-100); color: var(--warning-700);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.cm-icon svg, .cm-icon i { width: 28px; height: 28px; }
.cm-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.cm-msg { color: var(--grey-700); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.cm-actions { display: flex; gap: 10px; justify-content: center; }
.cm-actions .btn { min-width: 110px; justify-content: center; }

/* ---------- Main content ---------- */
.main { flex: 1; min-width: 0; }
.subbar {
  padding: 18px 28px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.subbar h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.subbar .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-btn { background: transparent !important; border-color: transparent !important; color: var(--grey-600) !important; }
.back-btn:hover { background: var(--grey-100) !important; color: var(--text) !important; }
.content { padding: 18px 28px 32px; }

/* Attachments */
.attach-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.attach-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.attach-item:hover { border-color: var(--accent-500); background: var(--grey-50); }
.attach-ico {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--accent-100); color: var(--accent-700);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.attach-ico svg, .attach-ico i { width: 18px; height: 18px; }
.attach-body { flex: 1; min-width: 0; }
.attach-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { margin-top: 2px; }
.attach-actions { display: flex; gap: 4px; flex-shrink: 0; }
.attach-drop {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 22px; border: 2px dashed var(--border-strong); border-radius: 12px;
  cursor: pointer; color: var(--muted); font-size: 13px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.attach-drop:hover { border-color: var(--accent-500); background: var(--accent-50); color: var(--accent-700); }
.attach-drop svg, .attach-drop i { width: 20px; height: 20px; }

/* Tabs */
.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tabs .tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: transparent; border: none; cursor: pointer;
  color: var(--grey-600); font-size: 13.5px; font-weight: 500;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tabs .tab:hover { color: var(--text); background: var(--grey-50); }
.tabs .tab.active { color: var(--accent-700); border-bottom-color: var(--accent-600); font-weight: 600; }
.tabs .tab i, .tabs .tab svg { width: 16px; height: 16px; }
.tabs .tab-count {
  font-size: 11px; font-weight: 600;
  background: var(--grey-100); color: var(--grey-600);
  padding: 1px 7px; border-radius: 999px;
}
.tabs .tab.active .tab-count { background: var(--accent-100); color: var(--accent-700); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Project header */
.proj-header { padding: 18px 22px; }
.proj-header-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.proj-header-kpis { display: flex; gap: 24px; }
.proj-header-kpis > div { text-align: right; }
.proj-header-kpis .lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.proj-header-kpis .val { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-top: 2px; }
@media (max-width: 700px) {
  .proj-header-kpis { gap: 14px; }
  .proj-header-kpis .val { font-size: 15px; }
}

/* Audit history timeline */
.audit-list { list-style: none; padding: 0; margin: 0; position: relative; }
.audit-list::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.audit-list li { position: relative; padding: 6px 0 12px 28px; font-size: 12.5px; }
.audit-list li::before { content: ""; position: absolute; left: 5px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-600); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border); }
.audit-list li.audit-status::before { background: var(--info); }
.audit-list li.audit-assignee::before { background: var(--warning); }
.audit-list li.audit-created::before { background: var(--success); }
.audit-list .field { font-weight: 600; color: var(--text); }
.audit-list .from { color: var(--danger-700); text-decoration: line-through; }
.audit-list .to { color: var(--success-700); font-weight: 600; }
.audit-list .meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card.tight { padding: 16px; }
.card h2, .card h3 { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

/* KPIs — refined with subtle accent strip on left */
.kpi-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grey-300);
}
.kpi .label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; color: var(--text); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .icon {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.kpi .icon svg, .kpi .icon i { width: 20px; height: 20px; }
.btn svg, .btn i { width: 16px; height: 16px; flex-shrink: 0; }
.btn.sm svg, .btn.sm i { width: 14px; height: 14px; }
.icon-btn svg, .icon-btn i { width: 18px; height: 18px; }
[data-lucide] { display: inline-flex; align-items: center; justify-content: center; }
.kpi.indigo::before { background: var(--accent-600); }
.kpi.indigo .icon { background: var(--accent-100); color: var(--accent-700); }
.kpi.green::before  { background: var(--success); }
.kpi.green .icon  { background: var(--success-100); color: var(--success-700); }
.kpi.amber::before  { background: var(--warning); }
.kpi.amber .icon  { background: var(--warning-100); color: var(--warning-700); }
.kpi.red::before    { background: var(--danger); }
.kpi.red .icon    { background: var(--danger-100); color: var(--danger-700); }
.kpi.blue::before   { background: var(--info); }
.kpi.blue .icon   { background: var(--info-100); color: var(--info-700); }

/* Tables */
/* Every table.proman in the app is wrapped at runtime (see site.js /
   _Layout.cshtml) in a .table-scroll div so wide tables scroll
   horizontally on phones/tablets instead of overflowing the page or
   crushing columns unreadably. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table.proman { min-width: 640px; }
table.proman {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
}
table.proman th, table.proman td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
table.proman th { background: var(--surface-2); font-weight: 600; color: var(--grey-700); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
table.proman tr:last-child td { border-bottom: none; }
table.proman tr:hover td { background: var(--surface-2); }
table.proman a { color: var(--text); font-weight: 500; }
table.proman a:hover { color: var(--accent-600); }

/* Pills — refined: solid neutral by default, accent tones for status */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--grey-100); color: var(--grey-700); border: 1px solid var(--grey-200);
}
.pill.todo       { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }
.pill.inprogress { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.pill.blocked    { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }
.pill.inreview   { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.done, .pill.completed { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }
.pill.cancelled   { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.deployment  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

.pill.new        { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.pill.open       { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.pill.triaged    { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }
.pill.fixed      { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }
.pill.verified   { background: var(--success-100); color: var(--success-700); border-color: var(--success); }
.pill.closed     { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.reopened   { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }
.pill.wontfix    { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.onhold     { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.clarificationneeded { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }
.pill.notabug    { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }

.pill.priority-low      { background: var(--grey-100); color: var(--grey-600); border-color: var(--grey-200); }
.pill.priority-medium   { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.pill.priority-high     { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.priority-critical { background: var(--danger-100); color: var(--danger-700); border-color: var(--danger); font-weight: 700; }

.pill.severity-trivial, .pill.severity-minor { background: var(--grey-100); color: var(--grey-600); border-color: var(--grey-200); }
.pill.severity-major    { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.severity-critical, .pill.severity-blocker { background: var(--danger-100); color: var(--danger-700); border-color: var(--danger); font-weight: 700; }

.pill.notstarted { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }
.pill.missed     { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }

.pill.prospect   { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }
.pill.active     { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }
.pill.inactive   { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.churned    { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }
.pill.onhold     { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.planned    { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }

.pill.rating-1 { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }
.pill.rating-2 { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.rating-3 { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }
.pill.rating-4 { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.pill.rating-5 { background: var(--success-100); color: var(--success-700); border-color: var(--success); font-weight: 700; }

/* Star rating — interactive picker (Customer Inactive capture, etc.). Markup: a
   .star-rating wrapper containing 5 hidden radio inputs each paired with a <label>
   drawn as a star; CSS reverses the visual order + uses ~ sibling selectors so
   hovering/checking star N also lights up stars 1..N to its left. */
.star-rating { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-rating label {
    cursor: pointer; width: 26px; height: 26px; color: var(--grey-300);
    transition: color .12s ease, transform .12s ease;
}
.star-rating label svg { width: 100%; height: 100%; display: block; }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: #f59e0b; transform: scale(1.08); }
.star-rating-display { display: inline-flex; align-items: center; gap: 1px; }

/* Review status */
.pill.rstatus-draft     { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }
.pill.rstatus-submitted { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.rstatus-approved  { background: var(--success-100); color: var(--success-700); border-color: var(--success); }
.pill.rstatus-rejected  { background: var(--danger-100); color: var(--danger-700); border-color: var(--danger); }

/* HR module: assets, lifecycle tasks, document verification, grievances */
.pill.instock     { background: var(--grey-100); color: var(--grey-700); border-color: var(--grey-200); }
.pill.assigned    { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }
.pill.underrepair { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.retired     { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.pending     { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.pill.skipped     { background: var(--grey-100); color: var(--grey-500); border-color: var(--grey-200); }
.pill.rejected    { background: var(--danger-100); color: var(--danger-700); border-color: var(--danger); }
.pill.resolved    { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }

/* ---------- Drawer (slide-out side panel) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
  z-index: 200;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 95vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px rgba(15,23,42,0.20);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
  z-index: 201;
}
.drawer.open { transform: translateX(0); }
.drawer.wide { width: 760px; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 16px; font-weight: 600; }
.drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  background: var(--surface-2);
}
@media (max-width: 600px) {
  .drawer { width: 100%; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--border-strong); cursor: pointer; line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--grey-50); border-color: var(--grey-400); }
.btn.primary { background: var(--accent-600); color: var(--white); border-color: var(--accent-600); box-shadow: 0 1px 2px rgba(67,56,202,0.25); }
.btn.primary:hover { background: var(--accent-700); border-color: var(--accent-700); color: var(--white); }
.btn.danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-700); border-color: var(--danger-700); color: var(--white); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--accent-600); background: var(--accent-50); }
.btn.sm { padding: 5px 9px; font-size: 12px; }


/* Forms */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--grey-700); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
  font: inherit; background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-500);
  box-shadow: 0 0 0 3px var(--accent-100);
}
textarea { min-height: 90px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2); color: var(--grey-500);
  border-color: var(--border); cursor: not-allowed; opacity: 1;
}
/* Checkboxes & radios should NOT inherit the 100%-width form-input look. */
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; margin: 0;
  vertical-align: middle; flex: none;
  accent-color: var(--accent-500);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: none;
}
input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
input[type="radio"] { width: 16px; height: 16px; cursor: pointer; }
input[type="checkbox"]:focus, input[type="radio"]:focus {
  box-shadow: 0 0 0 3px var(--accent-100);
}
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.checkbox-row input { width: auto; }

/* Rich text toolbar (for HTML content textareas) */
.rte-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px; border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 8px 8px 0 0; background: var(--surface-2);
}
.rte-toolbar .rte-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--grey-700); cursor: pointer; line-height: 1;
}
.rte-toolbar .rte-btn:hover { background: var(--grey-100); color: var(--text); }
.rte-toolbar .rte-btn:active { background: var(--accent-100); color: var(--accent-700); }
.rte-toolbar .rte-btn svg, .rte-toolbar .rte-btn i { width: 15px; height: 15px; }
.rte-toolbar .rte-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 4px; }
.rte-field textarea { border-radius: 0 0 8px 8px; }
.rte-field textarea:focus { position: relative; z-index: 1; }

/* Write / Preview tabs above rich text fields */
.rte-field-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.rte-field-head label { margin: 0; }
.rte-tabs { display: flex; gap: 2px; }
.rte-tab {
  padding: 3px 10px; font-size: 11.5px; font-weight: 600; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.rte-tab:hover { color: var(--text); background: var(--grey-50); }
.rte-tab.active { background: var(--accent-100); color: var(--accent-700); }
.rte-preview {
  display: none; border: 1px solid var(--border-strong); border-top: none; border-radius: 0 0 8px 8px;
  padding: 14px 16px; min-height: 90px; max-height: 360px; overflow-y: auto; line-height: 1.7; background: var(--surface);
}
.rte-preview:empty::before { content: "Nothing to preview yet."; color: var(--grey-400); font-style: italic; font-size: 13px; }

/* Inline filter bar (legacy) */
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }

/* Filter drawer header bar */
.list-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.list-toolbar .left, .list-toolbar .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-trigger { position: relative; }
.filter-trigger .filter-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  background: var(--accent-600); color: var(--white);
  font-size: 10px; font-weight: 700; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
  border: 2px solid var(--surface);
}
.filters-drawer .field { margin-bottom: 14px; }
.filters-drawer .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--grey-700); margin-bottom: 5px; }

/* Always-visible table search bar (page topbar, above the list/table) */
.table-search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; min-width: 190px; max-width: 320px; flex: 1 1 220px;
}
.table-search-bar:focus-within { border-color: var(--primary-400, #60a5fa); }
.table-search-bar i { color: var(--muted); flex-shrink: 0; width: 14px; height: 14px; }
.table-search-bar input {
  border: none; outline: none; background: transparent; width: 100%;
  font-size: 13px; color: var(--text); padding: 0;
}
.table-search-bar button.clear-q {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; padding: 0; flex-shrink: 0;
}
.table-search-bar button.clear-q:hover { color: var(--text); }
[data-theme="dark"] .table-search-bar { background: var(--surface); border-color: var(--border); }

/* Role permission panel */
.role-perm-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.role-perm {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  border-left: 3px solid var(--grey-300);
}
.role-perm.admin { border-left-color: var(--accent-600); }
.role-perm.pm    { border-left-color: var(--info); }
.role-perm.support { border-left-color: var(--success); }
.role-perm.dev   { border-left-color: var(--warning); }
.role-perm.cust  { border-left-color: var(--grey-500); }
.role-perm.hr    { border-left-color: #8b5cf6; }
.role-perm h4 { margin: 0 0 8px; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.role-perm h4 .pill { font-size: 10px; padding: 2px 7px; }
.role-perm ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--grey-700); }
.role-perm ul li { margin-bottom: 3px; }
.role-perm .key { font-weight: 700; color: var(--accent-700); }

/* Legacy auth shell (used for the AccessDenied fallback) */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0a0a0a;
  padding: 20px;
}
.auth-card {
  background: var(--surface); border-radius: 16px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }

/* ---- Modern monochrome login (two-column) ---- */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--white); }
.login-art {
  background: var(--white); color: var(--text);
  padding: 40px 48px;
  display: flex; align-items: stretch;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.login-art::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--grey-200) 1px, transparent 0);
  background-size: 22px 22px; opacity: 0.5; pointer-events: none;
}
.login-art-inner { display: flex; flex-direction: column; width: 100%; max-width: 540px; margin: auto; position: relative; }
.login-art .brand-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 26px; color: var(--text);
}
.login-art .logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-600), var(--accent-700));
  color: var(--white); display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.login-illustration {
  width: 100%; max-width: 460px; height: auto;
  margin: 0 auto 26px;
  filter: drop-shadow(0 12px 28px rgba(15,23,42,0.10));
}
.login-pitch h2 {
  font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em;
  margin: 0 0 10px; color: var(--text);
}
.login-pitch p { color: var(--grey-600); font-size: 14px; margin: 0 0 18px; line-height: 1.55; }
.login-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.login-bullets li { font-size: 13px; color: var(--grey-700); display: flex; gap: 8px; align-items: center; }
.login-bullets li span { color: var(--accent-600); font-size: 8px; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px; background: var(--white);
}
.login-card {
  width: 100%; max-width: 380px;
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.015em; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card label { font-weight: 600; }
.login-card input[type="email"],
.login-card input[type="password"] {
  height: 44px; font-size: 14px;
}
.login-card .seed-help {
  background: var(--grey-50); border: 1px dashed var(--border-strong);
  padding: 12px 14px; border-radius: 8px; font-size: 12px;
  color: var(--muted); margin-top: 18px; line-height: 1.7;
}
.login-card .seed-help code {
  background: var(--white); padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border); font-size: 11.5px;
}
.login-card .login-foot { text-align: center; margin-top: 22px; }
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form-wrap { min-height: 100vh; }
}

/* Board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.board .col { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 200px; border: 1px solid var(--border); }
.board .col h4 { margin: 0 0 10px; font-size: 13px; display: flex; justify-content: space-between; }
.board .col-body { min-height: 50px; }
.board .card-task {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm);
  cursor: grab; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}
.board .card-task:hover { border-color: var(--accent-500); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67,56,202,0.10); }
.board .card-task:active { cursor: grabbing; }
.board .card-task .title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); padding-right: 18px; }
.board .card-task .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.board .card-task .task-open {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; opacity: 0;
  transition: opacity 0.15s; border-bottom: none;
}
.board .card-task:hover .task-open { opacity: 1; }
.board .card-task .task-open:hover { background: var(--accent-100); color: var(--accent-700); }
.board .card-task--ghost { opacity: 0.5; background: var(--accent-50) !important; border: 2px dashed var(--accent-500) !important; }
.board .card-task--drag { transform: rotate(2deg); box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.board .card-task--chosen { box-shadow: 0 4px 16px rgba(67,56,202,0.20); }

/* Comments & mentions */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment {
  display: flex; gap: 10px; padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.comment .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--white); display:flex; align-items:center; justify-content:center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.comment .head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.comment .author { font-weight: 600; font-size: 13px; }
.comment .when { font-size: 11px; color: var(--muted); }
.comment .body { font-size: 13.5px; white-space: pre-wrap; word-wrap: break-word; }
.mention {
  display: inline-block; background: var(--accent-100); color: var(--accent-700);
  padding: 0 4px; border-radius: 4px; font-weight: 600;
}
.comment-form { position: relative; margin-top: 12px; }
.comment-form textarea { min-height: 70px; padding-right: 90px; }
.comment-form .submit { position: absolute; right: 8px; bottom: 8px; }
.mention-popup {
  position: absolute; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 200px;
  max-height: 220px; overflow-y: auto; z-index: 90; display: none;
}
.mention-popup.open { display: block; }
.mention-popup .opt {
  padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.mention-popup .opt:hover, .mention-popup .opt.active { background: var(--accent-50); color: var(--accent-700); }
.mention-popup .opt .a {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--white); display:flex; align-items:center; justify-content:center;
  font-weight:600; font-size:10px;
}

/* Timeline (Gantt) — fully rewritten */
.timeline-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.timeline-scroll { overflow-x: auto; overflow-y: visible; position: relative; }
.timeline-table { display: grid; grid-template-columns: 240px 1fr; min-width: 880px; }

/* Header */
.tl-corner, .tl-axis {
  background: var(--grey-50);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 6;
}
.tl-corner {
  padding: 8px 14px; border-right: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--grey-600); display: flex; align-items: center;
}
.tl-axis { position: relative; height: 56px; }

/* Months row (top half of axis) */
.tl-months { position: absolute; left: 0; right: 0; top: 0; height: 26px;
  display: flex; border-bottom: 1px solid var(--border); }
.tl-month {
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; color: var(--grey-700);
  border-right: 1px solid var(--border); background: var(--grey-100);
}
.tl-month:last-child { border-right: none; }

/* Day ticks (bottom half) */
.tl-days { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; }
.tl-day {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--grey-100);
  padding: 8px 4px 0; font-size: 10.5px; color: var(--grey-500);
  white-space: nowrap;
}
.tl-day.weekend { background: rgba(0,0,0,0.015); }
.tl-day.month-start { border-left-color: var(--grey-300); }

/* Body grid rows */
.tl-label, .tl-row-grid {
  border-bottom: 1px solid var(--border);
}
.tl-label {
  padding: 10px 14px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
  font-size: 13px; min-height: 44px; background: var(--surface);
}
.tl-label.group {
  background: var(--grey-50); font-weight: 700; font-size: 12.5px;
  color: var(--grey-700); text-transform: uppercase; letter-spacing: 0.04em;
}
.tl-label .meta { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.tl-row-grid { position: relative; min-height: 44px; background-image:
  linear-gradient(to right, var(--grey-100) 1px, transparent 1px);
  background-size: calc((100% / var(--tl-days, 30))) 100%; }

/* Single "Today" line — drawn once across the entire grid (column 2) */
.tl-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--accent-600); z-index: 3; pointer-events: none;
}
.tl-today-line::before {
  content: "Today"; position: absolute; top: 4px; left: 6px;
  background: var(--accent-600); color: var(--white);
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
  white-space: nowrap; box-shadow: 0 2px 4px rgba(67,56,202,0.30);
}

/* Bars */
.tl-bar {
  position: absolute; top: 8px; height: 28px;
  border-radius: 8px; padding: 0 10px; font-size: 11.5px; line-height: 28px;
  background: var(--accent-500); color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: transform 0.12s, box-shadow 0.12s; border-bottom: none;
  display: flex; align-items: center; gap: 6px; font-weight: 500;
  min-width: 6px;
}
.tl-bar:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
.tl-bar.status-todo       { background: var(--grey-500); }
.tl-bar.status-inprogress { background: var(--info); }
.tl-bar.status-blocked    { background: var(--danger); }
.tl-bar.status-inreview   { background: var(--warning); }
.tl-bar.status-done       { background: var(--success); }
.tl-bar.overdue { outline: 2px solid var(--danger); outline-offset: 1px; }
.tl-bar .tl-pri { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.85); flex-shrink: 0; }

.timeline-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; font-size: 12px; color: var(--muted); align-items: center; }
.timeline-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* Progress bar */
.progress { background: var(--grey-200); height: 6px; border-radius: 999px; overflow: hidden; }
.progress > div { background: linear-gradient(90deg, var(--accent-500), var(--accent-600)); height: 100%; border-radius: 999px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--success-100); color: var(--success-700); border: 1px solid #a7f3d0; font-weight: 500; }
.flash.error { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }

/* Banners — inline informational notices (e.g. soft duplicate warnings) */
.banner { display: flex; align-items: flex-start; gap: 8px; padding: 11px 13px;
  border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; border: 1px solid transparent; line-height: 1.45; }
.banner i { flex-shrink: 0; width: 15px; height: 15px; margin-top: 1px; }
.banner.success { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }
.banner.danger  { background: var(--danger-100);  color: var(--danger-700);  border-color: #fecaca; }
.banner.info    { background: var(--info-100);    color: var(--info-700);    border-color: #bae6fd; }
.banner.warning { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }

/* Field error state (e.g. duplicate mobile number) */
.field input.input-error, .field select.input-error {
  border-color: var(--danger) !important; background: var(--danger-100);
}

/* ---------- Alert modal (blocking validation popups, e.g. duplicate lead) ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.18s; z-index: 300; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-box { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -46%) scale(0.96);
  width: 380px; max-width: 90vw; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 24px 22px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 301; }
.modal-box.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-box .modal-icon { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; background: var(--danger-100); color: var(--danger-700); }
.modal-box .modal-icon i { width: 22px; height: 22px; }
.modal-box h3 { margin: 0 0 8px; font-size: 15.5px; font-weight: 600; }
.modal-box p { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.modal-box .modal-actions { display: flex; justify-content: center; gap: 8px; }
[data-theme="dark"] .banner.info { background: rgba(14,165,233,0.15); color: #7dd3fc; border-color: rgba(14,165,233,0.35); }
[data-theme="dark"] .banner.danger { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.40); }
[data-theme="dark"] .modal-box .modal-icon { background: rgba(239,68,68,0.18); color: #fca5a5; }

/* Detail layout */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-meta dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 10px; }
.detail-meta dd { margin: 4px 0 0; font-weight: 500; }
.detail-meta-grid { display: grid; grid-template-columns: max-content 1fr; column-gap: 14px; row-gap: 8px; align-items: baseline; }
.detail-meta-grid dt { margin: 0; white-space: nowrap; }
.detail-meta-grid dd { margin: 0; }
@media (max-width: 560px) { .detail-meta-grid { grid-template-columns: 1fr; row-gap: 2px; } .detail-meta-grid dd { margin-bottom: 8px; } }

/* Health score */
.health {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  font-weight: 700; font-size: 12.5px; color: var(--white);
  background: var(--success); border: 2px solid var(--success);
}
.health.warn { background: var(--warning); border-color: var(--warning); }
.health.bad  { background: var(--danger); border-color: var(--danger); }

/* Misc */
.muted { color: var(--muted); }
.right { text-align: right; }
.tiny { font-size: 11.5px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.chart-card { padding: 18px; }
.chart-card canvas { max-height: 280px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-header h2 { margin: 0; font-size: 15px; font-weight: 600; }

/* Tom Select overrides */
.ts-wrapper { width: 100% !important; }
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  padding: 7px 11px !important;
  border-radius: 8px !important;
  border-color: var(--border-strong) !important;
  background: var(--surface) !important;
  font: inherit !important;
  min-height: 38px !important;
  box-shadow: none !important;
}
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.focus .ts-control {
  border-color: var(--accent-500) !important;
  box-shadow: 0 0 0 3px var(--accent-100) !important;
}
.ts-wrapper .ts-dropdown {
  border-color: var(--border-strong);
  border-radius: 8px; margin-top: 4px;
  box-shadow: var(--shadow); z-index: 100;
  background: var(--surface);
}
.ts-dropdown .option { padding: 8px 12px; font-size: 13.5px; color: var(--text); }
.ts-dropdown .active { background: var(--accent-50) !important; color: var(--accent-700) !important; }
.ts-dropdown .option.selected { background: var(--accent-600) !important; color: var(--white) !important; }
.ts-dropdown .no-results { padding: 10px 12px; color: var(--muted); }
.ts-wrapper.single .ts-control > input::placeholder { color: var(--muted); }
.ts-wrapper.disabled .ts-control { background: var(--surface-2) !important; opacity: 0.7; }
/* Hide the stray text caret in single-select once an option is chosen */
.ts-wrapper.single:not(.focus) .ts-control > input { caret-color: transparent; }
.ts-wrapper.single.has-items:not(.focus) .ts-control > input { width: 0 !important; min-width: 0 !important; }
.filter-bar .ts-wrapper { min-width: 200px; }

@media (max-width: 880px) {
  .form-grid { grid-template-columns: 1fr; }
  .subbar { padding: 14px 16px 0; }
  .content { padding: 14px 16px 24px; }
}

/* ===== Dark theme ===== */
[data-theme="dark"] {
  --bg:           #0b1020;
  --surface:      #131a2e;
  --surface-2:    #1c2440;
  --border:       #283154;
  --border-strong:#3a4470;
  --text:         #e8ecf5;
  --muted:        #8b94b3;

  --grey-50:  #131a2e;
  --grey-100: #1c2440;
  --grey-200: #283154;
  --grey-300: #3a4470;
  --grey-400: #6b7493;
  --grey-500: #8b94b3;
  --grey-600: #adb5d1;
  --grey-700: #cdd3e7;
  --grey-800: #e2e6f3;
  --grey-900: #f1f3fa;
  --grey-950: #ffffff;

  /* "White" surface in many places (cards, dropdown panels, table rows) should match dark surface */
  --white: #131a2e;

  --primary-100: #1e1b4b;
  --accent-100:  #2b2a7a;
  --accent-50:   #1e1b4b;

  /* Mute the status backgrounds so they don't glow on dark */
  --success-100: rgba(16, 185, 129, 0.15);
  --warning-100: rgba(245, 158, 11, 0.15);
  --danger-100:  rgba(239, 68, 68, 0.18);
  --info-100:    rgba(14, 165, 233, 0.18);
  --success-700: #6ee7b7;
  --warning-700: #fcd34d;
  --danger-700:  #fca5a5;
  --info-700:    #7dd3fc;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow:    0 2px 6px rgba(0,0,0,0.40), 0 12px 28px rgba(0,0,0,0.50);

  color-scheme: dark;
}

[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface-2); color: var(--text); border-color: var(--border-strong);
}
[data-theme="dark"] .topnav { background: var(--surface); border-bottom-color: var(--border); }
[data-theme="dark"] .topnav.open .navinline { background: var(--surface); border-bottom-color: var(--border); }
[data-theme="dark"] .topnav .navinline { background: var(--surface); }
[data-theme="dark"] .navgroup > .dd-panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .navgroup .dd-panel a:hover { background: var(--surface-2); }
[data-theme="dark"] .card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] table.proman { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] table.proman th { background: var(--surface-2); color: var(--grey-600); }
[data-theme="dark"] table.proman tr:hover td { background: var(--surface-2); }
[data-theme="dark"] table.proman a { color: var(--text); }
[data-theme="dark"] .kpi { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .btn { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
[data-theme="dark"] .btn:hover { background: var(--surface-2); }
[data-theme="dark"] .btn.ghost { background: transparent; color: var(--muted); }
[data-theme="dark"] .btn.primary { background: var(--accent-500); border-color: var(--accent-500); color: #fff; }
[data-theme="dark"] .btn.primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
[data-theme="dark"] .pill { background: var(--surface-2); color: var(--grey-600); border-color: var(--border-strong); }
[data-theme="dark"] .pill.todo, [data-theme="dark"] .pill.notstarted, [data-theme="dark"] .pill.draft,
[data-theme="dark"] .pill.new, [data-theme="dark"] .pill.cancelled, [data-theme="dark"] .pill.closed,
[data-theme="dark"] .pill.inactive, [data-theme="dark"] .pill.wontfix, [data-theme="dark"] .pill.notabug { background: var(--surface-2); color: var(--grey-500); border-color: var(--border-strong); }

[data-theme="dark"] .drawer { background: var(--surface); border-left-color: var(--border); }
[data-theme="dark"] .drawer-head { border-bottom-color: var(--border); }
[data-theme="dark"] .drawer-foot { background: var(--surface-2); border-top-color: var(--border); }
[data-theme="dark"] .notif-panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .notif-panel .head { background: var(--surface); }
[data-theme="dark"] .notif-panel .foot { background: var(--surface); border-top-color: var(--border); }
[data-theme="dark"] .notif-panel .item:hover { background: var(--surface-2); }
[data-theme="dark"] .notif-panel .item.unread { background: rgba(67, 56, 202, 0.18); }
[data-theme="dark"] .settings-panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .settings-head { background: var(--surface-2); }
[data-theme="dark"] .settings-item:hover { background: var(--surface-2); }
[data-theme="dark"] .cm { background: var(--surface); color: var(--text); }
[data-theme="dark"] .cm-icon { background: rgba(245,158,11,0.18); color: #fcd34d; }
[data-theme="dark"] .progress { background: var(--surface-2); }
[data-theme="dark"] .empty { background: var(--surface); border-color: var(--border-strong); }
[data-theme="dark"] .flash { background: rgba(16,185,129,0.15); color: #6ee7b7; border-color: rgba(16,185,129,0.35); }
[data-theme="dark"] .flash.error { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.40); }

/* Tom Select dark */
[data-theme="dark"] .ts-wrapper.single .ts-control,
[data-theme="dark"] .ts-wrapper.multi .ts-control {
  background: var(--surface-2) !important; border-color: var(--border-strong) !important; color: var(--text);
}
[data-theme="dark"] .ts-wrapper .ts-dropdown { background: var(--surface); border-color: var(--border-strong); }
[data-theme="dark"] .ts-dropdown .option { color: var(--text); }
[data-theme="dark"] .ts-dropdown .active { background: rgba(67,56,202,0.25) !important; color: #c7d2fe !important; }

/* Flatpickr dark */
[data-theme="dark"] .flatpickr-calendar { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-theme="dark"] .flatpickr-day { color: var(--text); }
[data-theme="dark"] .flatpickr-day.today { border-color: var(--accent-500); }
[data-theme="dark"] .flatpickr-day.selected,
[data-theme="dark"] .flatpickr-day.startRange,
[data-theme="dark"] .flatpickr-day.endRange { background: var(--accent-500); border-color: var(--accent-500); }
[data-theme="dark"] .flatpickr-day:hover { background: var(--surface-2); }
[data-theme="dark"] .flatpickr-months .flatpickr-month,
[data-theme="dark"] .flatpickr-weekdays { background: var(--surface); color: var(--text); }
[data-theme="dark"] .flatpickr-weekday { color: var(--muted); }

/* Login page is intentionally light in both themes */
[data-theme="dark"] .login-shell { background: var(--surface); }
[data-theme="dark"] .login-art { background: var(--surface); border-right-color: var(--border); }
[data-theme="dark"] .login-form-wrap { background: var(--surface); }
[data-theme="dark"] .login-card .seed-help { background: var(--surface-2); border-color: var(--border-strong); }
[data-theme="dark"] .login-card .seed-help code { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .login-pitch h2 { color: var(--text); }
[data-theme="dark"] .login-pitch p { color: var(--muted); }
[data-theme="dark"] .login-bullets li { color: var(--grey-700); }

[data-theme="dark"] .role-perm { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .role-perm ul { color: var(--grey-700); }
[data-theme="dark"] .tabs { border-bottom-color: var(--border); }
[data-theme="dark"] .tabs .tab:hover { background: var(--surface-2); }
[data-theme="dark"] .tabs .tab-count { background: var(--surface-2); color: var(--grey-600); }
[data-theme="dark"] .attach-item { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .attach-item:hover { background: var(--surface); }
[data-theme="dark"] .attach-drop { border-color: var(--border-strong); color: var(--muted); }
[data-theme="dark"] .audit-list::before { background: var(--border); }
[data-theme="dark"] .audit-list li::before { box-shadow: 0 0 0 2px var(--border); }
[data-theme="dark"] .comment { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .mention { background: rgba(67,56,202,0.25); color: #c7d2fe; }
[data-theme="dark"] .timeline-wrap { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .tl-corner, [data-theme="dark"] .tl-axis { background: var(--surface-2); border-bottom-color: var(--border); }
[data-theme="dark"] .tl-month { background: var(--surface-2); color: var(--grey-700); border-right-color: var(--border); }
[data-theme="dark"] .tl-day { color: var(--muted); border-left-color: var(--border); }
[data-theme="dark"] .tl-label { background: var(--surface); border-bottom-color: var(--border); border-right-color: var(--border); }
[data-theme="dark"] .tl-label.group { background: var(--surface-2); color: var(--grey-700); }
[data-theme="dark"] .tl-row-grid { border-bottom-color: var(--border); }
[data-theme="dark"] .board .col { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .board .card-task { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .topnav .icon-btn { background: var(--surface); border-color: var(--border-strong); color: var(--grey-500); }
[data-theme="dark"] .topnav .icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   History timeline (Tasks / Bugs / Tickets — shared partial)
   ============================================================ */
.timeline {
  list-style: none; margin: 0; padding: 0;
  position: relative;
}
/* The vertical rail */
.timeline::before {
  content: ""; position: absolute;
  left: 17px; top: 6px; bottom: 6px; width: 2px;
  background: var(--border);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  padding: 0 0 16px 48px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: 0; top: 0;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--border-strong);
  color: var(--grey-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  flex: none;
}
.tl-dot svg, .tl-dot i { width: 16px; height: 16px; }

/* Action colours */
.tl-created  .tl-dot { background:#ecfdf5; border-color:#10b981; color:#047857; }
.tl-status   .tl-dot { background:#eff6ff; border-color:#3b82f6; color:#1d4ed8; }
.tl-assignee .tl-dot { background:#faf5ff; border-color:#a855f7; color:#7e22ce; }
.tl-comment  .tl-dot { background:#fefce8; border-color:#eab308; color:#a16207; }
.tl-updated  .tl-dot { background:var(--surface-2); border-color:var(--border-strong); color:var(--grey-700); }
.tl-deleted  .tl-dot { background:#fef2f2; border-color:#ef4444; color:#b91c1c; }

.tl-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tl-item:hover .tl-body { border-color: var(--border-strong); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

.tl-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--text);
}
.tl-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: #fff; font-size: 10px; font-weight: 700;
  flex: none;
}
.tl-actor { font-weight: 600; }
.tl-verb  { color: var(--grey-700); }
.tl-field {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--grey-700);
}
.tl-time  { color: var(--muted); font-size: 11px; margin-left: auto; }

.tl-diff {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 6px; font-size: 12px;
}
.tl-old, .tl-new {
  padding: 2px 8px; border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.tl-old { background:#fef2f2; color:#991b1b; text-decoration: line-through; text-decoration-color:#fca5a5; }
.tl-new { background:#ecfdf5; color:#065f46; font-weight: 600; }

.tl-note {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--border-strong);
  border-radius: 4px;
  font-size: 13px;
  color: var(--grey-700);
  white-space: pre-wrap;
}

/* Grouped multi-field edit (one timeline card showing N field diffs) */
.tl-group {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tl-grouprow {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 12px;
}
.tl-field-row {
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 110px;
}

[data-theme="dark"] .tl-old { background: rgba(239,68,68,0.12); color:#fca5a5; }
[data-theme="dark"] .tl-new { background: rgba(16,185,129,0.12); color:#86efac; }
[data-theme="dark"] .tl-field { background: var(--surface-2); }

/* "edited" badge on the Hours summary card's Planned value */
.hs-edited-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  font-size: 10px; font-weight: 600;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.3px;
  cursor: help;
}
.hs-edited-badge:hover { background:#fde68a; }
[data-theme="dark"] .hs-edited-badge { background: rgba(245,158,11,0.18); color:#fde68a; border-color: rgba(245,158,11,0.4); }

/* Sortable table headers — auto-applied to every .proman table by site.js */
table.proman th.sortable {
  cursor: pointer; user-select: none; position: relative; padding-right: 22px;
  transition: background 0.12s;
}
table.proman th.sortable:hover { background: var(--surface-2); }
table.proman th.sortable::after {
  content: "↕"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 11px; opacity: 0.35; transition: opacity 0.12s;
}
table.proman th.sortable:hover::after { opacity: 0.7; }
table.proman th.sortable[aria-sort="ascending"]::after  { content: "↑"; opacity: 1; color: var(--accent-700); }
table.proman th.sortable[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--accent-700); }

/* Lightweight tab pattern used inside cards (e.g. Task Details History/Activities) */
.tabs { gap: 4px; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--grey-700);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; transition: color 0.12s, border-color 0.12s, background 0.12s;
  border-radius: 6px 6px 0 0;
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active {
  color: var(--accent-700);
  border-bottom-color: var(--accent-500);
  background: transparent;
}
.tab-btn .tiny.muted { font-weight: 500; }
.tab-btn .tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 5px;
  background: var(--surface-2); color: var(--grey-600);
  border-radius: 10px; font-size: 11px; font-weight: 700;
}
.tab-btn.active .tab-count { background: var(--accent-100); color: var(--accent-700); }
.tab-panel { animation: tab-fade 0.15s ease-in; }
@keyframes tab-fade { from { opacity: 0; } to { opacity: 1; } }

/* Status sub-tabs: compact pill-style filter row above a table, grouping rows by status. */
.status-filter-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.sf-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--grey-600);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.sf-btn:hover { background: var(--surface-2); color: var(--text); }
.sf-btn .sf-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  background: var(--surface-2); color: var(--grey-500);
  border-radius: 9px; font-size: 10px; font-weight: 700;
}
.sf-btn.active { background: var(--grey-100); color: var(--grey-800); border-color: var(--grey-300, var(--border-strong)); }
.sf-btn.active .sf-count { background: rgba(0,0,0,0.08); color: inherit; }
/* Tint the active state to match each status's pill color for quick scanning. */
.sf-btn.new.active, .sf-btn.open.active        { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.sf-btn.inprogress.active                      { background: var(--info-100); color: var(--info-700); border-color: #bae6fd; }
.sf-btn.triaged.active                         { background: var(--accent-100); color: var(--accent-700); border-color: #c7d2fe; }
.sf-btn.fixed.active, .sf-btn.verified.active  { background: var(--success-100); color: var(--success-700); border-color: #a7f3d0; }
.sf-btn.closed.active, .sf-btn.wontfix.active,
.sf-btn.notabug.active                         { background: var(--grey-100); color: var(--grey-600); border-color: var(--grey-200); }
.sf-btn.reopened.active                        { background: var(--danger-100); color: var(--danger-700); border-color: #fecaca; }
.sf-btn.onhold.active, .sf-btn.clarificationneeded.active { background: var(--warning-100); color: var(--warning-700); border-color: #fde68a; }
.sf-btn.deployment.active                      { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.sf-empty { margin: 0; border-radius: 0 0 var(--radius) var(--radius); border-top: none; padding: 24px 20px; }

/* Toast popups — bottom-right, auto-fade */
.toast-container {
  position: fixed; right: 20px; bottom: 20px; z-index: 500;
  display: flex; flex-direction: column-reverse; gap: 10px;
  width: 340px; max-width: calc(100vw - 40px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--grey-400);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 12px 14px; text-decoration: none; color: inherit;
  animation: toast-in 0.22s ease-out;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-out { opacity: 0; transform: translateX(12px); }
.toast.toast-info     { border-left-color: var(--info); }
.toast.toast-success  { border-left-color: var(--success); }
.toast.toast-warning  { border-left-color: var(--warning); }
.toast.toast-critical { border-left-color: var(--danger); }
.toast .toast-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; background: var(--grey-400); }
.toast.toast-info     .toast-dot { background: var(--info); }
.toast.toast-success  .toast-dot { background: var(--success); }
.toast.toast-warning  .toast-dot { background: var(--warning); }
.toast.toast-critical .toast-dot { background: var(--danger); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-ttl { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.toast .toast-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast .toast-actions { margin-top: 8px; }
.toast .toast-close {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px;
  border-radius: 4px;
}
.toast .toast-close:hover { background: var(--surface-2); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
[data-theme="dark"] .toast { background: var(--surface); border-color: var(--border); }