:root {
  --sf-navbar-bg: #1f2a37;
  --sf-accent: #f59e0b;

  /* Canonical status colors, shared by badges / kanban / gantt / charts */
  --st-notstarted: #6c757d;
  --st-inprogress: #0d6efd;
  --st-waiting:    #0dcaf0;
  --st-onhold:     #fd7e14;
  --st-delayed:    #dc3545;
  --st-completed:  #198754;
  --st-na:         #adb5bd;
}

html { font-size: 14px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }
body { margin-bottom: 40px; background: #f6f7f9; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ---- navbar ---- */
.sf-navbar { background: var(--sf-navbar-bg); }
.sf-navbar .navbar-brand { color: #fff; }
.sf-navbar .nav-link { color: #cbd5e1; }
.sf-navbar .nav-link:hover { color: #fff; }
.sf-navbar .nav-link.active { color: #fff; border-bottom: 2px solid var(--sf-accent); }

/* ---- dashboard tiles ---- */
.sf-tile { border: 0; border-radius: .6rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); background:#fff; }
.sf-tile .sf-tile-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.sf-tile .sf-tile-label { color:#6c757d; font-size:.8rem; text-transform:uppercase; letter-spacing:.03em; }

/* ---- status badges ---- */
.st-badge { color:#fff; font-weight:600; }
.st-notstarted { background: var(--st-notstarted) !important; }
.st-inprogress { background: var(--st-inprogress) !important; }
.st-waiting    { background: var(--st-waiting) !important; color:#06343d !important; }
.st-onhold     { background: var(--st-onhold) !important; }
.st-delayed    { background: var(--st-delayed) !important; }
.st-completed  { background: var(--st-completed) !important; }
.st-na         { background: var(--st-na) !important; }

.pr-asap   { color: var(--st-delayed); font-weight:700; }
.pr-high   { color: var(--st-onhold); font-weight:700; }
.pr-medium { color: var(--st-inprogress); }
.pr-low    { color: #6c757d; }

/* ---- kanban ---- */
.kanban { display:flex; gap:.75rem; overflow-x:auto; padding-bottom:.5rem; }
.kanban-col { flex: 0 0 16rem; background:#eef1f4; border-radius:.5rem; padding:.5rem; min-height:8rem; }
.kanban-col.dragover { outline: 2px dashed var(--sf-accent); }
.kanban-col h6 { font-size:.78rem; text-transform:uppercase; letter-spacing:.03em; color:#475569; }
.kanban-card { background:#fff; border-radius:.4rem; padding:.5rem .6rem; margin-bottom:.5rem;
  box-shadow:0 1px 2px rgba(0,0,0,.1); cursor:grab; border-left:4px solid var(--st-notstarted); }
.kanban-card:active { cursor:grabbing; }
.kanban-card .kc-job { font-weight:600; font-size:.85rem; }
.kanban-card .kc-desc { font-size:.75rem; color:#6c757d; }

/* ---- gantt timeline (horizontal scroll, sticky labels) ---- */
.gantt-scroll { overflow-x:auto; border:1px solid #eceff2; border-radius:.4rem; max-height:75vh; }
.gantt-row { display:flex; align-items:stretch; height:1.9rem; border-bottom:1px solid #f1f3f5; }
.gantt-axis-row { position:sticky; top:0; z-index:3; background:#fff; height:1.6rem; border-bottom:1px solid #dee2e6; }
.gantt-label { position:sticky; left:0; z-index:2; background:#fff; flex:0 0 13rem; width:13rem;
  display:flex; align-items:center; gap:.15rem; padding:0 .5rem; font-size:.78rem; overflow:hidden;
  border-right:1px solid #eceff2; }
.gantt-label a { white-space:nowrap; }
.gantt-track { position:relative; flex:0 0 auto; height:100%; }
.gantt-bar { position:absolute; top:.35rem; height:1.1rem; border-radius:.25rem; opacity:.92; min-width:3px; }
.gantt-today { position:absolute; top:0; bottom:0; width:2px; background:var(--st-delayed); z-index:1; }
.gantt-tick { position:absolute; top:0; bottom:0; border-left:1px solid #eceff2; font-size:.62rem; color:#94a3b8; padding-left:3px; }
.gantt-axis-row .gantt-label { background:#fff; }

/* ---- department progress stepper (ported from JobTracker) ---- */
.stepper { display:flex; gap:0; max-width:34rem; }
.stepper .step { flex:1 1 0; min-width:0; text-align:center; position:relative; }
.stepper .step .dot { width:24px; height:24px; border-radius:50%; margin:0 auto; display:flex;
  align-items:center; justify-content:center; font-size:.72rem; font-weight:600; border:2px solid #ced4da;
  background:#fff; color:#6c757d; position:relative; z-index:1; }
.stepper .step .step-name { font-size:.66rem; line-height:1.05; margin-top:.15rem; color:#6c757d; }
.stepper .step:not(:first-child)::before { content:""; position:absolute; top:11px; left:-50%;
  width:100%; height:2px; background:#ced4da; z-index:0; }
.stepper .step.done .dot { background:#198754; border-color:#198754; color:#fff; }
.stepper .step.done .step-name { color:#198754; }
.stepper .step.done:not(:first-child)::before { background:#198754; }
.stepper .step.current .dot { border-color:#0d6efd; color:#0d6efd; box-shadow:0 0 0 .15rem rgba(13,110,253,.2); }
.stepper .step.current .step-name { color:#0d6efd; font-weight:600; }

td form { margin-bottom: 0; }
.cursor-pointer { cursor: pointer; }

/* ---- full-screen progress overlay (PDF report) ---- */
.sf-overlay { position: fixed; inset: 0; background: rgba(31,42,55,.55); z-index: 1080; display: flex; align-items: center; justify-content: center; }
.sf-overlay-box { background: #fff; border-radius: .6rem; padding: 1.5rem; width: min(28rem, 90vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); text-align: center; }

/* ---- chat assistant ---- */
.sf-chat-log { height: 28rem; overflow-y: auto; background: #f6f7f9; border-radius: .5rem; padding: .75rem; }
.sf-msg { max-width: 85%; padding: .5rem .75rem; border-radius: .7rem; margin-bottom: .5rem; font-size: .9rem; line-height: 1.35; }
.sf-msg-user { background: #0d6efd; color: #fff; margin-left: auto; border-bottom-right-radius: .2rem; }
.sf-msg-bot { background: #fff; border: 1px solid #e9ecef; border-bottom-left-radius: .2rem; }
.sf-msg-bot a { font-weight: 600; }
.sf-chat-list { max-height: 24rem; overflow-y: auto; }
.sf-chat-item { display: flex; justify-content: space-between; align-items: center; gap: .25rem; padding: .3rem .5rem; border-radius: .4rem; cursor: pointer; font-size: .85rem; }
.sf-chat-item:hover { background: #eef1f4; }
.sf-chat-item.active { background: #e7f1ff; font-weight: 600; }
.sf-chat-item .del { color: #c0c6cc; cursor: pointer; padding: 0 .2rem; }
.sf-chat-item .del:hover { color: #dc3545; }

/* ---- AI Work: plan side panel + in-chat plan cards ---- */
.sf-plan-list { max-height: 32rem; overflow-y: auto; }
.sf-plan-item { border: 1px solid #e9ecef; border-left: 3px solid #6f42c1; border-radius: .5rem; padding: .5rem .6rem; margin-bottom: .5rem; cursor: pointer; background: #fff; }
.sf-plan-item:hover { background: #faf9fe; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sf-plan-item.applied { border-left-color: #198754; opacity: .85; }
.aw-plan-bubble { border-left: 3px solid #6f42c1; padding-left: .6rem; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* auto-growing chat / refine textareas (Enter sends, Shift+Enter = newline) */
.aw-grow { resize: none; overflow-y: auto; max-height: 9rem; line-height: 1.35; }
/* full-screen blocking overlay shown while an update runs (covers the modal too) */
.aw-busy { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
    background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.aw-busy-box { text-align: center; }
