/* ============ TAT ENGINEER PROJECT TRACKER — design system ============ */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root{
  --blue:#3b82f6;--green:#22c55e;--amber:#f59e0b;--red:#ef4444;--purple:#a855f7;--cyan:#06b6d4;--orange:#f97316;
  --radius:9px;--radius-lg:13px;--radius-sm:6px;
  --font:'IBM Plex Sans Thai','IBM Plex Sans',system-ui,sans-serif;
  --mono:'IBM Plex Mono',ui-monospace,monospace;
  --sidebar-w:248px;
  --shadow-sm:0 1px 2px rgba(0,0,0,.06);
  --shadow:0 4px 16px rgba(8,12,20,.10);
  --shadow-lg:0 18px 48px rgba(8,12,20,.20);
}
/* ----- DARK (default) ----- */
[data-theme=dark]{
  --bg:#0c0f15;--surface:#141922;--surface2:#1b212c;--surface3:#222a37;--surface4:#2b3543;
  --border:#252e3c;--border2:#36425440;--border-strong:#3a465a;
  --text:#e9edf2;--text2:#a6b6c8;--muted:#7f8fa1;--faint:#5a6678;
  --shadow:0 8px 28px rgba(0,0,0,.40);--shadow-lg:0 24px 60px rgba(0,0,0,.55);
  --tint:.17;--tint2:.10;
  color-scheme:dark;
}
/* ----- LIGHT ----- */
[data-theme=light]{
  --bg:#eef1f5;--surface:#ffffff;--surface2:#f6f8fa;--surface3:#eef1f5;--surface4:#e4e9ef;
  --border:#e3e8ee;--border2:#dfe5ec;--border-strong:#cdd6e0;
  --text:#16202e;--text2:#445166;--muted:#697789;--faint:#9aa6b4;
  --shadow:0 6px 22px rgba(20,30,48,.08);--shadow-lg:0 22px 54px rgba(20,30,48,.14);
  --tint:.13;--tint2:.08;
  color-scheme:light;
}

html,body{height:100%}
body{background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.5;
  -webkit-font-smoothing:antialiased;transition:background .3s,color .3s}
button{font-family:inherit}
::selection{background:rgba(59,130,246,.3)}
/* scrollbars */
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:6px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background:var(--muted);background-clip:padding-box}

/* ============ APP SHELL ============ */
.app{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh}

/* ----- SIDEBAR ----- */
.sidebar{background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;overflow:hidden}
.brand{display:flex;align-items:center;gap:11px;padding:18px 18px 16px}
.brand-mark{width:34px;height:34px;border-radius:9px;background:linear-gradient(135deg,var(--blue),#2563eb);
  display:grid;place-items:center;color:#fff;font-weight:700;font-size:15px;flex-shrink:0;box-shadow:0 4px 12px rgba(59,130,246,.35)}
.brand-text{line-height:1.15}
.brand-text b{font-size:14.5px;font-weight:600;letter-spacing:-.2px;display:block}
.brand-text span{font-size:11px;color:var(--muted);font-family:var(--mono)}
.nav-scroll{flex:1;overflow-y:auto;padding:4px 12px 12px}
.nav-label{font-size:10.5px;font-weight:600;color:var(--faint);text-transform:uppercase;letter-spacing:.7px;padding:14px 10px 7px}
.nav-item{display:flex;align-items:center;gap:11px;padding:9px 11px;border-radius:var(--radius);color:var(--text2);
  font-size:13.5px;font-weight:500;cursor:pointer;transition:background .14s,color .14s;position:relative;border:1px solid transparent}
.nav-item:hover{background:var(--surface2);color:var(--text)}
.nav-item.active{background:var(--surface3);color:var(--text);border-color:var(--border)}
.nav-item.active .nav-ic{color:var(--accent,var(--blue))}
.nav-ic{width:18px;height:18px;flex-shrink:0;color:var(--muted);display:grid;place-items:center}
.nav-item .dot{width:9px;height:9px;border-radius:50%;flex-shrink:0}
.nav-count{margin-left:auto;font-size:11px;color:var(--muted);background:var(--surface3);
  padding:1px 8px;border-radius:20px;font-family:var(--mono);min-width:24px;text-align:center}
.nav-item.active .nav-count{background:var(--surface4)}
.nav-sub{padding-left:8px}
.sidebar-foot{border-top:1px solid var(--border);padding:11px 14px;display:flex;flex-direction:column;gap:8px}

/* ----- MAIN ----- */
.main{display:flex;flex-direction:column;min-width:0;min-height:100vh}
.topbar{height:60px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--surface) 80%,transparent);
  backdrop-filter:blur(10px);position:sticky;top:0;z-index:50;display:flex;align-items:center;gap:16px;padding:0 26px}
.crumb{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);min-width:0}
.crumb b{color:var(--text);font-weight:600;font-size:15px;letter-spacing:-.2px}
.crumb .sep{color:var(--faint)}
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:9px}

/* ---- Firebase sync status indicator ---- */
.sync-status{display:flex;align-items:center;gap:5px;padding:5px 10px;border-radius:20px;border:1px solid var(--border);background:var(--surface2);cursor:pointer;font-size:12px;font-family:var(--font);color:var(--text2);transition:all .2s;white-space:nowrap}
.sync-status:hover{border-color:var(--border-strong);background:var(--surface3)}
.ss-icon{font-size:14px;line-height:1}
.ss-label{font-size:11.5px}
.ss-ok{border-color:rgba(34,197,94,.3);color:var(--green)}
.ss-ok .ss-icon{animation:none}
.ss-syncing .ss-icon{display:inline-block;animation:spin .8s linear infinite}
.ss-error{border-color:rgba(239,68,68,.3);color:var(--red)}
.ss-offline{border-color:var(--border);color:var(--muted)}
.ss-config{border-color:rgba(245,158,11,.3);color:var(--amber)}
.auth-off{border-color:rgba(127,143,161,.35);color:var(--muted)}
.auth-on{border-color:rgba(34,197,94,.4);color:var(--green);background:rgba(34,197,94,.08)}
@keyframes spin{to{transform:rotate(360deg)}}
.content{flex:1;padding:24px 26px 44px;max-width:1480px;width:100%}
.page{display:none}
.page.active{display:block}

/* ----- PILL TABS (sub-nav) ----- */
.subtabs{display:flex;gap:3px;background:var(--surface2);padding:4px;border-radius:11px;border:1px solid var(--border);
  margin-bottom:22px;width:fit-content;max-width:100%;overflow-x:auto;flex-wrap:nowrap}
.subtab{padding:7px 15px;border-radius:8px;font-size:13px;font-weight:500;color:var(--text2);cursor:pointer;
  white-space:nowrap;transition:all .15s;border:none;background:transparent;display:flex;align-items:center;gap:7px}
.subtab:hover{color:var(--text)}
.subtab.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm);font-weight:600}

/* ============ BUTTONS ============ */
.btn{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);
  padding:8px 14px;font-size:13px;font-weight:500;cursor:pointer;transition:all .15s;display:inline-flex;
  align-items:center;gap:7px;white-space:nowrap;line-height:1}
.btn:hover{border-color:var(--border-strong);background:var(--surface3)}
.btn:active{transform:translateY(.5px)}
.btn svg{width:15px;height:15px}
.btn-primary{background:var(--blue);border-color:var(--blue);color:#fff;box-shadow:0 3px 10px rgba(59,130,246,.32)}
.btn-primary:hover{background:#2f74e6;border-color:#2f74e6}
.btn-ghost{background:transparent;border-color:transparent}
.btn-ghost:hover{background:var(--surface2)}
.btn-sm{padding:5px 10px;font-size:12px}
.btn-icon{padding:8px;border-radius:var(--radius)}
.btn-icon svg{width:16px;height:16px}
.btn-danger:hover{border-color:var(--red);color:var(--red)}
.qo-fc-locked{display:flex;align-items:center;gap:7px;padding:9px 11px;border:1px dashed var(--border);
  border-radius:var(--radius);background:var(--surface2);font-size:12px;color:var(--muted);min-height:38px}
.qo-fc-locked svg{width:14px;height:14px;flex-shrink:0}
.qo-fc-locked b{margin-left:auto;color:var(--cyan);font-size:13px}
.btn-warn{border-color:var(--amber);color:var(--amber)}
.btn-warn:hover{background:color-mix(in srgb,var(--amber) 14%,transparent)}
.icon-toggle{display:inline-flex;background:var(--surface2);border:1px solid var(--border);border-radius:9px;padding:3px}
.icon-toggle button{border:none;background:transparent;color:var(--muted);padding:6px 8px;border-radius:6px;cursor:pointer;display:grid;place-items:center}
.icon-toggle button.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}
.icon-toggle button svg{width:16px;height:16px}

/* ============ CARDS / STATS ============ */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg)}
.section-head{display:flex;align-items:center;gap:12px;margin:0 0 14px}
.section-head h2{font-size:16px;font-weight:600;letter-spacing:-.2px}
.section-head .hint{font-size:12.5px;color:var(--muted)}
.section-head .right{margin-left:auto;display:flex;gap:8px;align-items:center}

.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:13px;margin-bottom:22px}
.stat{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px 17px;position:relative;overflow:hidden}
.stat .accent{position:absolute;left:0;top:0;bottom:0;width:3px;border-radius:3px}
.stat-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:11px}
.stat-label{font-size:11.5px;font-weight:500;color:var(--muted);letter-spacing:.2px}
.stat-ic{width:30px;height:30px;border-radius:8px;display:grid;place-items:center}
.stat-ic svg{width:16px;height:16px}
.stat-val{font-size:30px;font-weight:680;line-height:1;letter-spacing:-1px;font-feature-settings:'tnum'}
.stat-sub{font-size:11.5px;color:var(--faint);margin-top:6px}

/* ============ CHARTS ============ */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:16px}
.chart-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:18px 18px 16px}
.chart-card h3{font-size:13.5px;font-weight:600;margin-bottom:3px;display:flex;align-items:center;gap:6px}
.chart-card h3 svg{width:16px;height:16px;flex-shrink:0}
.chart-card .sub{font-size:11.5px;color:var(--muted);margin-bottom:14px}
.chart-wrap{position:relative;height:230px}

/* progress ring + bar */
.prog-bar{height:8px;background:var(--surface3);border-radius:5px;overflow:hidden;margin-top:9px}
.prog-fill{height:100%;border-radius:5px;transition:width .6s cubic-bezier(.4,0,.2,1);background:var(--green)}
.big-prog{display:flex;align-items:center;gap:22px}
.ring{position:relative;width:128px;height:128px;flex-shrink:0}
.ring svg{transform:rotate(-90deg)}
.ring-txt{position:absolute;inset:0;display:grid;place-content:center;text-align:center}
.ring-txt b{font-size:30px;font-weight:680;letter-spacing:-1px;line-height:1}
.ring-txt span{font-size:11px;color:var(--muted)}

/* ============ SYSTEM CARDS (home) ============ */
.sys-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:16px}
.sys-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:20px;
  cursor:pointer;transition:transform .18s,box-shadow .18s,border-color .18s;position:relative;overflow:hidden;text-align:left;width:100%;color:inherit}
.sys-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-lg);border-color:var(--border-strong)}
.sys-card .glow{position:absolute;top:-40px;right:-40px;width:140px;height:140px;border-radius:50%;opacity:.16;filter:blur(8px)}
.sys-card-top{display:flex;align-items:center;gap:13px;margin-bottom:16px;position:relative}
.sys-emblem{width:46px;height:46px;border-radius:12px;display:grid;place-items:center;color:#fff;flex-shrink:0;box-shadow:var(--shadow)}
.sys-emblem svg{width:24px;height:24px}
.sys-card h3{font-size:17px;font-weight:600;letter-spacing:-.3px}
.sys-card .th{font-size:12px;color:var(--muted)}
.sys-card .desc{font-size:12.5px;color:var(--text2);line-height:1.55;margin-bottom:18px;min-height:38px}
.sys-stats{display:flex;gap:20px;margin-bottom:14px}
.sys-stat b{font-size:22px;font-weight:680;letter-spacing:-.5px;display:block;line-height:1}
.sys-stat span{font-size:11px;color:var(--muted)}
.sys-foot{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--muted);
  border-top:1px solid var(--border);padding-top:13px}
.sys-foot .go{color:var(--accent);font-weight:600;display:flex;align-items:center;gap:5px}
.add-sys{border:1.5px dashed var(--border-strong);background:transparent;display:grid;place-items:center;min-height:230px;
  color:var(--muted);gap:10px;cursor:pointer;border-radius:var(--radius-lg);transition:all .18s;font-size:13.5px;font-weight:500}
.add-sys:hover{border-color:var(--blue);color:var(--blue);background:rgba(59,130,246,.04)}
.add-sys .plus{width:42px;height:42px;border-radius:50%;border:1.5px solid currentColor;display:grid;place-items:center;font-size:22px;font-weight:300}

/* ============ FILTER BAR ============ */
.toolbar{display:flex;gap:9px;margin-bottom:16px;flex-wrap:wrap;align-items:center}
.search{position:relative;flex:1;min-width:220px}
.search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted)}
.search input{width:100%;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  color:var(--text);padding:9px 12px 9px 36px;font-size:13.5px;font-family:inherit;outline:none;transition:border .15s}
.search input:focus{border-color:var(--blue)}
select.flt,input.flt{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);
  padding:9px 11px;font-size:13px;font-family:inherit;outline:none;cursor:pointer;transition:border .15s}
select.flt:focus,input.flt:focus{border-color:var(--blue)}
.count-tag{font-size:12.5px;color:var(--muted);margin-left:auto;white-space:nowrap;font-family:var(--mono)}
.fchips{display:flex;flex-wrap:wrap;gap:8px;margin:-4px 0 16px;align-items:center}
.fchip{display:inline-flex;align-items:center;gap:7px;padding:5px 6px 5px 11px;border-radius:20px;font-size:12px;
  background:color-mix(in srgb,var(--blue) 12%,var(--surface));border:1px solid color-mix(in srgb,var(--blue) 35%,var(--border));color:var(--text)}
.fchip b{font-weight:600}
.fchip button{border:none;background:transparent;color:var(--muted);cursor:pointer;display:grid;place-items:center;padding:2px;border-radius:50%;width:18px;height:18px}
.fchip button:hover{background:var(--surface3);color:var(--text)}
.fchip button svg{width:12px;height:12px}
.fchip-clear{border:none;background:transparent;color:var(--muted);font-size:12px;cursor:pointer;text-decoration:underline;font-family:inherit}
.fchip-clear:hover{color:var(--text)}
/* clickable dashboard cues */
.stat.clickable{cursor:pointer;transition:transform .15s,box-shadow .15s,border-color .15s}
.stat.clickable:hover{transform:translateY(-2px);box-shadow:var(--shadow);border-color:var(--border-strong)}
.chart-card .sub .hintclick{color:var(--blue);font-weight:500}

/* ============ TABLE ============ */
.table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface)}
table{width:100%;border-collapse:collapse;font-size:13px}
th{background:var(--surface2);color:var(--muted);font-weight:600;padding:11px 14px;text-align:left;white-space:nowrap;
  border-bottom:1px solid var(--border);font-size:11.5px;text-transform:uppercase;letter-spacing:.4px;position:sticky;top:0}
td{padding:11px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
tr:last-child td{border-bottom:none}
tbody tr{transition:background .12s;cursor:pointer}
tbody tr:hover td{background:var(--surface2)}
.cell-name{font-weight:550;color:var(--text);max-width:320px}
.cell-name .nm{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.35}
.cell-name small{display:block;font-size:11px;color:var(--faint);font-weight:400;margin-top:3px;font-family:var(--mono)}
.row-actions{display:flex;gap:3px;opacity:.55;transition:opacity .12s}
tr:hover .row-actions{opacity:1}

/* ============ BADGES ============ */
.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:7px;font-size:11px;font-weight:600;
  white-space:nowrap;line-height:1.4;letter-spacing:.1px}
.badge .bd{width:6px;height:6px;border-radius:50%;background:currentColor}
.b-blue{background:rgba(59,130,246,var(--tint));color:#5fa0ff}
.b-green{background:rgba(34,197,94,var(--tint));color:#3ddc7f}
.b-amber{background:rgba(245,158,11,var(--tint));color:#fbb03c}
.b-red{background:rgba(239,68,68,var(--tint));color:#ff6b6b}
.b-purple{background:rgba(168,85,247,var(--tint));color:#c084fc}
.b-cyan{background:rgba(6,182,212,var(--tint));color:#22d3ee}
.b-orange{background:rgba(249,115,22,var(--tint));color:#fb923c}
.b-gray{background:var(--surface3);color:var(--muted)}
[data-theme=light] .b-blue{color:#2563eb}[data-theme=light] .b-green{color:#15924c}
[data-theme=light] .b-amber{color:#b9740a}[data-theme=light] .b-red{color:#dc2626}
[data-theme=light] .b-purple{color:#8b3fd6}[data-theme=light] .b-cyan{color:#0a92ad}
[data-theme=light] .b-orange{color:#d35d12}

/* ============ KANBAN ============ */
.kanban{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px;align-items:start}
.kcol{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:12px;min-height:120px;transition:background .15s}
.kcol.drag-over{background:rgba(59,130,246,.08);border-color:var(--blue);border-style:dashed}
.kcol-head{display:flex;align-items:center;gap:8px;margin-bottom:11px;padding:2px 4px}
.kcol-head .dot{width:9px;height:9px;border-radius:50%}
.kcol-head b{font-size:13px;font-weight:600}
.kcol-head .n{margin-left:auto;font-size:11px;color:var(--muted);background:var(--surface);padding:2px 9px;border-radius:20px;font-family:var(--mono)}
.kcard{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:12px 13px;margin-bottom:9px;
  cursor:grab;transition:box-shadow .15s,border-color .15s,transform .12s;border-left:3px solid var(--accent,var(--blue))}
.kcard:hover{box-shadow:var(--shadow);border-color:var(--border-strong)}
.kcard:active{cursor:grabbing}
.kcard.dragging{opacity:.45;transform:scale(.98)}
.kcard .knm{font-size:12.5px;font-weight:550;line-height:1.4;margin-bottom:8px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.kcard .kmeta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px;color:var(--muted)}
.kcard .kplant{font-family:var(--mono);font-size:10.5px}

/* ============ FORECAST ============ */
.fc-banner{background:linear-gradient(135deg,var(--surface),var(--surface2));border:1px solid var(--border-strong);border-radius:var(--radius-lg);padding:22px 28px;margin-bottom:20px;display:flex;align-items:baseline;gap:16px;flex-wrap:wrap}
.fc-banner-label{font-size:13px;color:var(--muted);font-weight:500}
.fc-banner-val{font-size:34px;font-weight:700;color:var(--green);font-family:var(--mono);line-height:1}
.fc-banner-sub{font-size:12px;color:var(--faint);margin-left:auto}
.fc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px;margin-top:4px}
.fc-month-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;transition:border-color .15s}
.fc-month-card.has-data{border-color:rgba(59,130,246,.3)}
.fc-month-card.expanded{border-color:var(--blue)}
.fc-month-head{display:flex;align-items:center;gap:10px;padding:13px 15px;cursor:pointer;user-select:none}
.fc-month-head:hover{background:var(--surface2)}
.fc-month-name{font-weight:700;font-size:14px;min-width:40px}
.fc-month-n{font-size:11.5px;color:var(--muted);flex:1}
.fc-month-amt{font-family:var(--mono);font-size:13px;font-weight:600;color:var(--faint)}
.fc-month-amt.has-amt{color:var(--green)}
.fc-month-head svg{width:15px;height:15px;color:var(--muted);flex-shrink:0;transition:transform .2s}
.fc-month-card.expanded .fc-month-head svg{transform:rotate(90deg)}
.fc-month-body{padding:0 15px 14px;border-top:1px solid var(--border)}
.fc-qo-row td{padding:5px 4px;border-bottom:1px solid var(--border2)}
.fc-qo-row:last-child td{border-bottom:none}
.fc-qo-row{cursor:pointer;transition:background .1s}
.fc-qo-row:hover td{background:var(--surface2)}
/* ── sub-task section (inside QO modal) ── */
.st-section{margin-top:20px;border-top:1px solid var(--border);padding-top:16px}
.st-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.st-section-title{font-weight:700;font-size:13.5px;display:flex;align-items:center;gap:6px}
.st-section-title svg{width:15px;height:15px}
.st-section-hint{display:block;font-size:11px;color:var(--muted);margin-top:3px;line-height:1.4;max-width:480px}
.st-empty{font-size:12.5px;color:var(--faint);padding:12px 0;text-align:center;border:1px dashed var(--border);border-radius:var(--radius)}
.st-table{width:100%;border-collapse:collapse;font-size:12.5px}
.st-table th{padding:6px 8px;background:var(--surface3);font-size:11.5px;font-weight:600;color:var(--muted);text-align:left;white-space:nowrap}
.st-table td{padding:4px 4px;border-bottom:1px solid var(--border2);vertical-align:middle}
.st-table tr:last-child td{border-bottom:none}
.st-inp{width:100%;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);padding:5px 8px;font-size:12px;font-family:inherit;outline:none;min-width:0}
.st-inp:focus{border-color:var(--blue)}
.st-fc{max-width:90px;font-family:var(--mono)}
.st-amt{max-width:100px;font-family:var(--mono)}
/* sub-task badge in project table */
.proj-subs-badge{display:inline-flex;align-items:center;gap:2px;margin-left:7px;padding:1px 6px;border-radius:10px;background:rgba(168,85,247,.15);color:var(--purple);font-size:10.5px;font-weight:600;vertical-align:middle;cursor:default}
.proj-subs-badge svg{flex-shrink:0}
/* project edit modal — read-only info card */
.proj-readonly-card{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:13px 15px;margin-bottom:18px}
.proj-ro-row{display:flex;align-items:baseline;gap:10px;padding:4px 0;border-bottom:1px solid var(--border2)}
.proj-ro-row:last-of-type{border-bottom:none}
.proj-ro-label{font-size:11.5px;color:var(--muted);min-width:100px;flex-shrink:0}
.proj-ro-val{font-size:13px;color:var(--text);line-height:1.4}
.proj-ro-val.mono{font-family:var(--mono)}
/* sub-tasks in detail panel */
.st-panel-list{display:flex;flex-direction:column;gap:6px;margin-bottom:4px}
.st-panel-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:7px 10px;background:var(--surface2);border-radius:var(--radius-sm);font-size:12.5px}
.st-panel-name{flex:1;min-width:80px;font-weight:500;color:var(--text)}
/* unplanned section */
.fc-unplanned{background:var(--surface);border:1.5px solid rgba(245,158,11,.35);border-radius:var(--radius-lg);margin-top:22px;overflow:hidden;transition:border-color .2s}
.fc-unplanned.expanded{border-color:var(--amber)}
.fc-unplanned-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;cursor:pointer;user-select:none;transition:background .15s}
.fc-unplanned-head:hover{background:var(--surface2)}
.fc-unplanned-body{border-top:1px solid var(--border)}
.fc-unplanned-body table{border-collapse:collapse;width:100%}
.fc-unplanned-body tr:not(:last-child) td{border-bottom:1px solid var(--border2)}

/* ============ TIMELINE ============ */
.tl-trend{margin-bottom:6px}
.tl-trend-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
.tl-trend-stats{display:flex;gap:26px;flex-wrap:wrap;margin:14px 0 6px;padding-bottom:14px;border-bottom:1px solid var(--border)}
.tl-tstat{display:flex;flex-direction:column;gap:2px}
.tl-tstat b{font-size:19px;font-weight:700;line-height:1.1}
.tl-tstat span{font-size:11.5px;color:var(--muted)}
.tl-month-n{font-weight:500;color:var(--muted);text-transform:none;letter-spacing:0;font-size:11px;margin-left:6px}
.tl{position:relative;padding-left:8px}
.tl-month{font-size:12px;font-weight:700;color:var(--accent);text-transform:uppercase;letter-spacing:.5px;margin:22px 0 12px;padding-left:24px}
.tl-month:first-child{margin-top:0}
.tl-item{display:flex;gap:16px;padding:0 0 4px 0;position:relative}
.tl-rail{position:absolute;left:5px;top:0;bottom:0;width:2px;background:var(--border)}
.tl-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0;margin-top:14px;z-index:1;border:2px solid var(--bg);box-shadow:0 0 0 2px var(--border)}
.tl-body{flex:1;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:13px 15px;margin-bottom:10px;cursor:pointer;transition:border-color .15s,box-shadow .15s}
.tl-body:hover{border-color:var(--border-strong);box-shadow:var(--shadow-sm)}
.tl-nm{font-size:13px;font-weight:550;line-height:1.4;margin-bottom:6px}
.tl-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:11.5px;color:var(--muted)}

/* ---- DATE RANGE PICKER ---- */
.tl-daterange{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;margin-bottom:16px}
.tl-dr-label{display:inline-flex;align-items:center;gap:5px;font-size:12.5px;font-weight:600;color:var(--text2)}
.tl-dr-label svg{width:14px;height:14px;color:var(--muted)}
.tl-dr-input{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:6px 10px;color:var(--text);font-size:12.5px;font-family:var(--mono)}
.tl-dr-input:focus{outline:none;border-color:var(--accent)}
.tl-dr-sep{font-size:12px;color:var(--muted)}

/* ---- HORIZONTAL TIMELINE ---- */
.htl-wrap{overflow-x:auto;overflow-y:hidden;padding:6px 0 12px;margin-bottom:8px}
.htl-track{display:flex;align-items:stretch;position:relative;height:460px}
.htl-node{position:relative;width:220px;flex:0 0 220px;cursor:pointer}
.htl-seg{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);height:9px;background:var(--c);opacity:.92}
.htl-node:first-child .htl-seg{border-radius:6px 0 0 6px}
.htl-node:last-child .htl-seg{border-radius:0 6px 6px 0}
.htl-dot{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:17px;height:17px;border-radius:50%;background:var(--c);border:3px solid var(--surface);box-shadow:0 0 0 1px var(--c);z-index:3}
.htl-stem{position:absolute;left:50%;width:2px;background:var(--c);opacity:.45;height:60px;transform:translateX(-50%);z-index:1}
.htl-node.up .htl-stem{bottom:50%}
.htl-node.down .htl-stem{top:50%}
.htl-card{position:absolute;left:50%;transform:translateX(-50%);width:190px;background:var(--surface);border:1px solid var(--border);border-top:3px solid var(--c);border-radius:10px;padding:10px 12px;z-index:2;transition:border-color .15s,box-shadow .15s,transform .15s}
.htl-node.up .htl-card{bottom:calc(50% + 64px)}
.htl-node.down .htl-card{top:calc(50% + 64px)}
.htl-node:hover .htl-card{border-color:var(--c);box-shadow:0 6px 20px rgba(0,0,0,.22);z-index:5}
.htl-node:hover .htl-dot{transform:translate(-50%,-50%) scale(1.2)}
.htl-date{font-family:var(--mono);font-size:11.5px;font-weight:700;color:var(--c);margin-bottom:5px}
.htl-name{font-size:12.5px;font-weight:600;color:var(--text);line-height:1.35;margin-bottom:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.htl-plant{font-size:11px;color:var(--muted);font-family:var(--mono);margin-bottom:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.htl-badges{display:flex;gap:5px;flex-wrap:wrap}

/* ============ BY-PLANT ============ */
.plant-group{margin-bottom:14px;border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;background:var(--surface)}
.plant-head{display:flex;align-items:center;gap:12px;padding:13px 17px;cursor:pointer;user-select:none;background:var(--surface2);transition:background .12s}
.plant-head:hover{background:var(--surface3)}
.plant-head .chev{transition:transform .2s;color:var(--muted)}
.plant-head.open .chev{transform:rotate(90deg)}
.plant-head b{font-size:14px;font-weight:600}
.plant-head .pmeta{margin-left:auto;display:flex;align-items:center;gap:8px}
.plant-mini{height:6px;width:90px;background:var(--surface4);border-radius:4px;overflow:hidden;display:flex}
.plant-body{display:none}
.plant-body.open{display:block}

/* ============ DETAIL PANEL ============ */
.scrim{position:fixed;inset:0;background:rgba(6,9,14,.55);z-index:140;opacity:0;pointer-events:none;transition:opacity .25s;backdrop-filter:blur(2px)}
.scrim.show{opacity:1;pointer-events:auto}
.panel{position:fixed;right:0;top:0;bottom:0;width:480px;max-width:94vw;background:var(--surface);border-left:1px solid var(--border);
  z-index:150;overflow-y:auto;transform:translateX(102%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:var(--shadow-lg)}
.panel.open{transform:translateX(0)}
.panel-head{padding:20px 22px 16px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);z-index:2}
.panel-head .topline{display:flex;align-items:flex-start;gap:12px}
.panel-head h2{font-size:15.5px;font-weight:600;line-height:1.35;flex:1}
.panel-head .id-tag{font-family:var(--mono);font-size:11px;color:var(--muted);margin-bottom:7px}
.panel-body{padding:20px 22px 40px}
.badges-row{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:18px}
.kv{display:grid;grid-template-columns:120px 1fr;gap:12px;padding:9px 0;border-bottom:1px solid var(--border);font-size:13px}
.kv .k{color:var(--muted);font-size:12.5px}
.kv .v{color:var(--text)}
.kv .v.mono{font-family:var(--mono);font-size:12px}
.sec-label{font-size:11px;font-weight:700;color:var(--faint);text-transform:uppercase;letter-spacing:.6px;margin:22px 0 10px}
.sec-label svg{width:13px;height:13px;vertical-align:middle;margin-right:2px}
.tl-meta svg{width:12px;height:12px;flex-shrink:0;vertical-align:middle}
.desc-box{font-size:12.5px;color:var(--text2);line-height:1.65;white-space:pre-wrap;background:var(--surface2);border:1px solid var(--border);
  border-radius:var(--radius);padding:13px 15px;max-height:280px;overflow-y:auto;font-family:var(--mono)}

/* activity log */
.log{position:relative;padding-left:18px;margin-top:4px}
.log::before{content:'';position:absolute;left:4px;top:6px;bottom:6px;width:2px;background:var(--border)}
.log-empty{font-size:12px;color:var(--faint);padding-left:0}
.log-item{position:relative;padding:0 0 14px}
.log-item:last-child{padding-bottom:0}
.log-item .ld{position:absolute;left:-18px;top:4px;width:10px;height:10px;border-radius:50%;background:var(--accent,var(--blue));border:2px solid var(--surface)}
.log-item .lt{font-size:12.5px;color:var(--text);line-height:1.5}
.lm-row{display:flex;align-items:center;gap:6px;margin-top:3px}
.log-item .lm{font-size:11px;color:var(--faint);font-family:var(--mono)}
.log-acts{display:flex;gap:2px;margin-left:auto;opacity:0;transition:opacity .15s}
.log-item:hover .log-acts{opacity:1}
.log-act-btn{background:none;border:none;cursor:pointer;color:var(--muted);display:flex;align-items:center;padding:2px 4px;border-radius:4px;transition:color .15s,background .15s}
.log-act-btn:hover{color:var(--blue);background:rgba(59,130,246,.1)}
.log-act-btn svg{width:13px;height:13px}
.log-act-del:hover{color:var(--red);background:rgba(239,68,68,.1)}
/* image in log */
.log-img-wrap{margin-top:7px}
.log-img{max-width:100%;max-height:180px;border-radius:7px;cursor:zoom-in;border:1px solid var(--border);object-fit:cover}
.log-img-preview{display:flex;align-items:center;margin-top:7px;gap:6px}
.log-add{display:flex;gap:8px;margin-top:12px;align-items:stretch}
.log-add input{flex:1;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);color:var(--text);padding:8px 11px;font-size:13px;font-family:inherit;outline:none}
.log-add input:focus{border-color:var(--blue)}
.log-img-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 10px;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);color:var(--muted);transition:color .15s,border-color .15s}
.log-img-btn:hover{color:var(--blue);border-color:var(--blue)}
.log-img-btn svg{width:18px;height:18px}
/* table note column */
.cell-note{font-size:12.5px;color:var(--text2);max-width:180px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* status quick changer */
.quick-status{display:flex;gap:8px;margin-top:10px}

/* ============ MODAL ============ */
.modal-scrim{position:fixed;inset:0;background:rgba(6,9,14,.6);z-index:200;display:flex;align-items:flex-start;
  justify-content:center;padding:40px 20px;opacity:0;pointer-events:none;transition:opacity .2s;backdrop-filter:blur(3px);overflow-y:auto}
.modal-scrim.show{opacity:1;pointer-events:auto}
.modal{background:var(--surface);border:1px solid var(--border-strong);border-radius:16px;width:100%;max-width:680px;
  box-shadow:var(--shadow-lg);transform:translateY(-14px) scale(.98);transition:transform .22s;margin:auto}
.modal-scrim.show .modal{transform:none}
.modal-head{padding:20px 24px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-head h2{font-size:16px;font-weight:600}
.modal-head .sub{font-size:12px;color:var(--muted);margin-top:2px}
.modal-body{padding:22px 24px;max-height:64vh;overflow-y:auto}
.modal-foot{padding:16px 24px;border-top:1px solid var(--border);display:flex;gap:9px;justify-content:flex-end;align-items:center}

/* ----- FORM ----- */
.fg{margin-bottom:15px}
.fg label{display:block;font-size:12px;font-weight:600;color:var(--text2);margin-bottom:6px}
.fg label .req{color:var(--red)}
.fg input,.fg select,.fg textarea{width:100%;background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);
  color:var(--text);padding:9px 11px;font-size:13.5px;font-family:inherit;outline:none;transition:border .15s,box-shadow .15s}
.fg input:focus,.fg select:focus,.fg textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(59,130,246,.12)}
.fg textarea{min-height:86px;resize:vertical;line-height:1.55}
.fg .hint{font-size:11px;color:var(--muted);margin-top:5px}
.frow{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.frow-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}
.qo-lookup{display:flex;gap:8px;align-items:flex-end}
.qo-lookup .fg{flex:1;margin-bottom:0}
.autofill-note{font-size:11.5px;padding:8px 12px;border-radius:var(--radius);margin-top:8px;display:none;align-items:center;gap:8px}
.autofill-note svg{width:14px;height:14px;flex-shrink:0}
.autofill-note.ok{background:rgba(34,197,94,var(--tint2));color:var(--green);display:flex}
.autofill-note.miss{background:rgba(245,158,11,var(--tint2));color:var(--amber);display:flex}

/* ============ EMPTY / MISC ============ */
.empty{text-align:center;padding:64px 20px;color:var(--muted)}
.empty .ic{width:32px;height:32px;border-radius:8px;background:var(--surface2);display:grid;place-items:center;margin:0 auto 10px}
.empty .ic svg{width:16px;height:16px;color:var(--faint)}
.empty b{display:block;font-size:14px;color:var(--text);font-weight:600;margin-bottom:4px}
.empty span{font-size:12.5px}

/* toast */
.toast{position:fixed;bottom:26px;left:50%;transform:translateX(-50%) translateY(80px);background:var(--surface);
  border:1px solid var(--border-strong);border-radius:11px;padding:12px 18px;font-size:13.5px;font-weight:500;z-index:300;
  display:flex;align-items:center;gap:10px;box-shadow:var(--shadow-lg);opacity:0;transition:all .3s cubic-bezier(.4,0,.2,1)}
.toast.show{transform:translateX(-50%) translateY(0);opacity:1}
.toast .ti{width:20px;height:20px;flex-shrink:0}
.toast.ok .ti{color:var(--green)}.toast.err .ti{color:var(--red)}.toast.info .ti{color:var(--blue)}

.theme-toggle{display:flex;background:var(--surface2);border:1px solid var(--border);border-radius:9px;padding:3px;gap:2px}
.theme-toggle button{flex:1;border:none;background:transparent;color:var(--muted);padding:6px;border-radius:6px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;gap:6px;font-size:12px;font-weight:500;transition:all .15s}
.theme-toggle button.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}
.theme-toggle button svg{width:15px;height:15px}

.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:20px;font-size:12px;font-weight:500;
  background:var(--surface2);border:1px solid var(--border);color:var(--text2)}

/* segmented dashboard variant switcher */
.dash-controls{display:inline-flex;align-items:center;gap:10px;flex-wrap:wrap}
.year-sel{min-width:96px}
.seg{display:inline-flex;background:var(--surface2);border:1px solid var(--border);border-radius:9px;padding:3px;gap:2px}
.seg button{border:none;background:transparent;color:var(--muted);padding:6px 13px;border-radius:6px;cursor:pointer;font-size:12.5px;font-weight:500;transition:all .15s}
.seg button.active{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm);font-weight:600}

/* spotlight focus cards (dashboard v3) */
.focus-list{display:flex;flex-direction:column;gap:9px}
.focus-row{display:flex;align-items:center;gap:13px;padding:12px 15px;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);cursor:pointer;transition:border-color .15s,box-shadow .15s}
.focus-row:hover{border-color:var(--border-strong);box-shadow:var(--shadow-sm)}
.focus-row .fbar{width:4px;align-self:stretch;border-radius:3px;flex-shrink:0}
.focus-row .fnm{flex:1;min-width:0}
.focus-row .fnm b{font-size:13px;font-weight:550;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.focus-row .fnm span{font-size:11px;color:var(--muted);font-family:var(--mono)}

/* responsive */
@media(max-width:980px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;z-index:160;transform:translateX(-100%);transition:transform .25s;width:280px}
  .sidebar.open{transform:none}
  .grid-2,.grid-3{grid-template-columns:1fr}
  .menu-btn{display:grid!important}
  .frow,.frow-3{grid-template-columns:1fr}
}
.menu-btn{display:none}

/* ============ BY OWNER (supervisor) ============ */
.own-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
.own-chip{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:20px;font-size:12.5px;font-weight:500;
  background:var(--surface);border:1px solid var(--border);color:var(--text2);cursor:pointer;transition:all .14s}
.own-chip:hover{border-color:var(--border-strong);color:var(--text)}
.own-chip .dot{width:9px;height:9px;border-radius:50%;opacity:.5;transition:opacity .14s}
.own-chip .n{font-family:var(--mono);font-size:11px;background:var(--surface3);padding:1px 7px;border-radius:10px;color:var(--muted)}
.own-chip.on{background:color-mix(in srgb,var(--oc) 13%,var(--surface));border-color:var(--oc);color:var(--text)}
.own-chip.on .dot{opacity:1}
.own-chip.on .n{background:color-mix(in srgb,var(--oc) 22%,transparent);color:var(--text)}

.own-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:15px}
.own-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:17px 18px}
.own-top{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.own-av{width:42px;height:42px;border-radius:11px;display:grid;place-items:center;color:#fff;font-weight:700;font-size:15px;flex-shrink:0;font-family:var(--mono)}
.own-name{flex:1;min-width:0}
.own-name b{font-size:14px;font-weight:600;display:block;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.own-name span{font-size:11.5px;color:var(--muted)}
.own-pct{font-size:22px;font-weight:680;letter-spacing:-.5px;font-feature-settings:'tnum'}
.own-pctwrap{text-align:right;flex-shrink:0}
.own-pctlbl{font-size:9.5px;color:var(--muted);letter-spacing:.2px;margin-top:1px}
.own-prog{height:9px;border-radius:5px;overflow:hidden;background:var(--surface3);margin-bottom:14px}
.own-prog-fill{height:100%;border-radius:5px;transition:width .6s cubic-bezier(.4,0,.2,1)}
.own-bar{height:8px;border-radius:5px;overflow:hidden;display:flex;background:var(--surface3);margin-bottom:14px}
.own-bar span{height:100%;transition:width .5s}
.own-metrics{display:flex;gap:18px;padding-bottom:14px;border-bottom:1px solid var(--border);margin-bottom:12px}
.own-metrics b{font-size:18px;font-weight:680;display:block;line-height:1;letter-spacing:-.5px}
.own-metrics span{font-size:10.5px;color:var(--muted)}
.own-list{display:flex;flex-direction:column;gap:2px;max-height:220px;overflow-y:auto;margin:-4px -6px;padding:4px 6px}
.own-row{display:flex;align-items:center;gap:9px;padding:7px 8px;border-radius:7px;cursor:pointer;transition:background .12s}
.own-row:hover{background:var(--surface2)}
.own-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.own-rnm{flex:1;min-width:0;font-size:12.5px;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ============ SCHEDULE PLANNER ============ */
.sched-topbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:18px}
.flip-x{transform:scaleX(-1)}
.sched-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}
.sched-head{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:15px 18px;border-bottom:1px solid var(--border)}
.sched-head h3{font-size:14px;font-weight:600}
.sched-head .sub{font-size:11.5px;color:var(--muted);margin-top:2px}
.sched-scroll{overflow-x:auto}
.sched-tbl{width:100%;border-collapse:collapse;min-width:1040px}
.sched-tbl thead th{position:sticky;top:0;z-index:2;background:var(--surface2);
  font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);
  text-align:left;padding:10px 12px;border-bottom:1px solid var(--border);white-space:nowrap}
.sched-tbl td{padding:6px 12px;border-bottom:1px solid var(--border2);vertical-align:middle}

/* phase row */
.sched-phase{background:color-mix(in srgb,var(--blue) 7%,transparent)}
.sched-phase td{padding:9px 12px;border-bottom:1px solid var(--border)}
.sched-no{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:7px;
  background:var(--blue);color:#fff;font-size:12px;font-weight:600}
.sched-roll{font-size:12px;font-weight:600;color:var(--blue);white-space:nowrap}

/* sub-task row */
.sched-sub:hover{background:var(--surface2)}
.sched-subno{font-size:11.5px;color:var(--muted);font-family:var(--mono)}
.sched-days{font-size:12.5px;color:var(--text2)}

/* inline inputs */
.sched-inp{width:100%;background:transparent;border:1px solid transparent;border-radius:7px;
  color:var(--text);font-family:var(--font);font-size:12.5px;padding:6px 8px;transition:all .15s}
.sched-inp:hover{background:var(--surface2);border-color:var(--border)}
.sched-inp:focus{outline:none;background:var(--surface);border-color:var(--blue)}
.sched-inp-phase{font-size:13.5px;font-weight:600;color:var(--blue);text-transform:uppercase}
.sched-inp-phase::placeholder{color:color-mix(in srgb,var(--blue) 55%,transparent)}
.sched-disc{background:var(--surface2);border-color:var(--border);font-size:11.5px;font-weight:600;
  text-transform:uppercase;text-align:center;color:var(--cyan)}
.sched-date{font-family:var(--mono);font-size:12px;color-scheme:dark}
[data-theme="light"] .sched-date{color-scheme:light}
.sched-num{text-align:center;font-family:var(--mono);font-size:12px}
.sched-num::-webkit-outer-spin-button,.sched-num::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.sched-num{-moz-appearance:textfield}
.sched-pct{width:48px;flex:0 0 48px;padding:6px 2px}
.sched-pctsym{font-size:11px;color:var(--muted)}

/* row actions */
.sched-del{width:26px;height:26px;display:grid;place-items:center;border-radius:7px;border:1px solid transparent;
  background:transparent;color:var(--muted);cursor:pointer;transition:all .15s}
.sched-del svg{width:13px;height:13px}
.sched-del:hover{background:color-mix(in srgb,var(--red) 15%,transparent);color:var(--red);border-color:var(--red)}
.sched-addrow td{padding:6px 12px 10px;border-bottom:1px solid var(--border)}
.sched-add{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;border-radius:8px;
  border:1px dashed var(--border-strong);background:transparent;color:var(--muted);
  font-family:var(--font);font-size:12px;cursor:pointer;transition:all .15s}
.sched-add svg{width:13px;height:13px}
.sched-add:hover{border-color:var(--blue);color:var(--blue);background:color-mix(in srgb,var(--blue) 8%,transparent)}

/* ---- Schedule Planner: auto Gantt timeline ---- */
.tlg-scroll{overflow-x:auto;padding:6px 18px 4px}
.tlg-inner{min-width:760px}
.tlg-row{display:flex;align-items:center;gap:10px;height:34px}
.tlg-label{width:210px;flex:0 0 210px;display:flex;align-items:center;gap:8px;
  font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tlg-label span:last-child{overflow:hidden;text-overflow:ellipsis}
.tlg-track{position:relative;flex:1;height:22px;display:flex}
.tlg-days{width:44px;flex:0 0 44px;text-align:right;font-size:11px;color:var(--muted);font-family:var(--mono)}
.tlg-head{height:28px;border-bottom:1px solid var(--border)}
.tlg-months{display:flex;height:100%}
.tlg-col{flex-shrink:0;font-size:10px;font-weight:600;letter-spacing:.04em;color:var(--muted);
  text-align:center;border-left:1px solid var(--border2);line-height:26px;overflow:hidden}
.tlg-grid{flex:1;border-left:1px solid var(--border2)}
.tlg-today{position:absolute;top:-6px;bottom:-6px;width:2px;background:var(--red);z-index:3;border-radius:1px}
.tlg-bar{position:absolute;top:4px;height:14px;border-radius:4px;background:var(--blue);z-index:2;
  display:flex;align-items:center;overflow:hidden;min-width:4px}
.tlg-bar.done{background:var(--green)}
.tlg-bar.late{background:var(--red)}
.tlg-bar.soon{background:var(--amber)}
.tlg-fill{position:absolute;left:0;top:0;bottom:0;background:rgba(255,255,255,.42);border-radius:4px 0 0 4px}
.tlg-pct{position:relative;z-index:1;font-size:9px;font-weight:700;color:#fff;padding-left:5px;white-space:nowrap}
.tlg-legend{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:11px 18px 14px;
  border-top:1px solid var(--border);font-size:11.5px;color:var(--text2)}
.tlg-legend span{display:inline-flex;align-items:center;gap:6px}
.tlg-legend i{width:9px;height:9px;border-radius:50%}
.tlg-legend-sep{color:var(--muted);border-left:1px solid var(--border);padding-left:16px}

/* ---- delay summary cards on the list page ---- */
.sch-alert{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-bottom:16px}
.sch-alert-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);
  padding:14px 16px;border-left:3px solid var(--border-strong)}
.sch-alert-card.late{border-left-color:var(--red)}
.sch-alert-card.soon{border-left-color:var(--amber)}
.sch-alert-card.ok{border-left-color:var(--green)}
.sch-alert-card .n{font-size:24px;font-weight:700;line-height:1.2}
.sch-alert-card .t{font-size:12px;color:var(--text2);margin-top:2px}
.sch-alert-card .s{font-size:11px;color:var(--muted);margin-top:1px}
.sch-late-list{margin-bottom:18px}
.sch-late-item{display:flex;align-items:center;gap:10px;padding:9px 14px;border-bottom:1px solid var(--border2);
  font-size:12.5px;cursor:pointer}
.sch-late-item:last-child{border-bottom:none}
.sch-late-item:hover{background:var(--surface2)}
.sch-late-item>.badge:first-child{flex:0 0 118px;text-align:center;justify-content:center}
.sch-late-task{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sch-late-proj{font-size:11px;color:var(--muted);margin-top:1px}
.sch-late-due{font-family:var(--mono);font-size:11.5px;white-space:nowrap}
.sched-days{max-width:52px}
.sched-head h3{display:flex;align-items:center;gap:6px}
.sched-head h3 svg{width:15px;height:15px;flex-shrink:0}

/* ---- Schedule Planner: S-Curve ---- */
.sc-dd{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text2);white-space:nowrap}
.sc-dd input{width:150px}
.sc-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px;margin-bottom:16px}
.sc-card{display:flex;align-items:center;gap:12px;background:var(--surface2);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:13px 15px}
.sc-ic{width:34px;height:34px;flex-shrink:0;border-radius:9px;display:grid;place-items:center}
.sc-ic svg{width:17px;height:17px}
.sc-t{font-size:11.5px;color:var(--muted)}
.sc-v{font-size:19px;font-weight:700;line-height:1.25;margin-top:1px}
.sc-v-sm{font-size:12.5px;font-weight:600}
.sc-chart-wrap{position:relative;height:340px}
.sc-tbl table{font-size:11.5px}
.sc-tbl th{font-size:10.5px;white-space:nowrap;padding:6px 8px;background:var(--surface2)}
.sc-tbl td{padding:5px 8px;white-space:nowrap}
.sc-tbl tr.sc-total td{font-weight:700;background:var(--surface2);border-top:1.5px solid var(--border-strong)}

/* ---- overdue list: row picker + scroll ---- */
.sch-rows{display:flex;align-items:center;gap:9px;font-size:12px;color:var(--text2);white-space:nowrap}
.sch-rows select.flt{padding:5px 9px;font-size:12px}
.sch-late-scroll{max-height:420px;overflow-y:auto;overscroll-behavior:contain}
.sch-late-scroll::-webkit-scrollbar{width:10px}
.sch-late-scroll::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:6px;
  border:2px solid transparent;background-clip:padding-box}
.sch-head-tools{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:flex-end}
.sch-seg button{padding:6px 12px;font-size:12px}
.sch-seg button b{font-weight:700;opacity:.75;margin-left:2px}
.sch-seg button.active b{opacity:1}

/* ============ MASTER TIMELINE ============ */
.mt-head{display:flex;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:16px}
.mt-head h2{font-size:22px;font-weight:700}
.mt-head .hint{display:block;margin-top:2px}
.mt-head-right{margin-left:auto;display:flex;align-items:center;gap:14px;flex-wrap:wrap}

.mt-filters{align-items:flex-end}
.mt-f{display:flex;flex-direction:column;gap:4px}
.mt-f>span{font-size:11px;color:var(--muted)}
.mt-f select.flt{min-width:150px}
.mt-range{display:flex;align-items:center;gap:6px}
.mt-range input{font-family:var(--mono);font-size:12px}
.mt-range i{color:var(--muted);font-style:normal}

.mt-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-bottom:18px}
.mt-stat{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:14px 16px;transition:border-color .15s}
.mt-stat.on{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue) inset}
.mt-stat[onclick]:hover{border-color:var(--border-strong)}
.mt-stat-ic{width:40px;height:40px;flex-shrink:0;border-radius:11px;display:grid;place-items:center}
.mt-stat-ic svg{width:19px;height:19px}
.mt-stat-l{font-size:11.5px;color:var(--text2);line-height:1.3}
.mt-stat-n{font-size:24px;font-weight:700;line-height:1.15}
.mt-stat-s{font-size:11px;color:var(--muted)}
.mt-work{flex-direction:column;align-items:stretch;grid-column:span 2}
.mt-work-bars{display:flex;align-items:flex-end;gap:3px;overflow-x:auto;padding-bottom:2px}
.mt-wb{display:flex;flex-direction:column;align-items:center;gap:2px;min-width:22px;flex:1}
.mt-wb b{font-size:9.5px;color:var(--text2);font-weight:600}
.mt-wb span{width:100%;max-width:16px;background:var(--purple);border-radius:3px 3px 0 0;display:block}
.mt-wb i{font-size:8.5px;color:var(--muted);font-style:normal;letter-spacing:.02em}

.mt-grid-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);
  overflow:auto;max-height:70vh}
.mt-grid{min-width:max-content}
.mt-row{display:flex;align-items:stretch;border-bottom:1px solid var(--border2);cursor:pointer}
.mt-row:last-child{border-bottom:none}
.mt-row:not(.mt-hrow):hover{background:var(--surface2)}
.mt-hrow{position:sticky;top:0;z-index:5;background:var(--surface2);border-bottom:1px solid var(--border);cursor:default}
.mt-left{position:sticky;left:0;z-index:4;display:flex;align-items:center;gap:10px;flex-shrink:0;
  width:660px;padding:8px 12px;background:inherit;border-right:1px solid var(--border)}
.mt-hrow .mt-left{background:var(--surface2)}
.mt-row:not(.mt-hrow) .mt-left{background:var(--surface)}
.mt-row:not(.mt-hrow):hover .mt-left{background:var(--surface2)}
.mt-no{width:22px;height:22px;flex-shrink:0;border-radius:6px;display:grid;place-items:center;
  color:#fff;font-size:11px;font-weight:700}
.mt-proj{flex:1;min-width:0}
.mt-codes{display:flex;align-items:center;gap:6px;font-size:11px;font-family:var(--mono);color:var(--blue)}
.mt-codes i{color:var(--border-strong);font-style:normal}
.mt-codes span{color:var(--muted)}
.mt-name{font-size:11.5px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
.mt-owner{width:110px;flex-shrink:0;font-size:11.5px;color:var(--text2)}
.mt-plant{width:110px;flex-shrink:0;font-size:11.5px;color:var(--text2)}
.mt-prog{width:56px;flex-shrink:0;display:grid;place-items:center}
.mt-ring{width:42px;height:42px}
.mt-th{font-size:10.5px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted);
  background:none!important;height:auto;display:flex;align-items:center}
.mt-no.mt-th{color:var(--muted);background:none;justify-content:center}

.mt-track{position:relative;flex-shrink:0;display:flex;min-height:46px}
.mt-gl{border-right:1px solid var(--border2);flex-shrink:0}
.mt-mohead{min-height:46px}
.mt-mo{flex-shrink:0;border-right:1px solid var(--border);text-align:center}
.mt-mo-t{font-size:10px;font-weight:700;letter-spacing:.04em;color:var(--text2);padding:5px 0 3px}
.mt-wk{display:flex;border-top:1px solid var(--border2)}
.mt-wk span{font-size:8px;color:var(--muted);padding:2px 0;flex-shrink:0;border-right:1px solid var(--border2)}
.mt-wk span:last-child{border-right:none}

/* day/week axis header — a slim month band above the day/week ticks */
.mt-mohead-stack{display:flex;flex-direction:column;width:100%}
.mt-band-row,.mt-unit-row{display:flex}
.mt-band{flex-shrink:0;text-align:center;font-size:9.5px;font-weight:700;letter-spacing:.04em;
  color:var(--text2);padding:4px 0 3px;border-right:1px solid var(--border);border-bottom:1px solid var(--border2)}
.mt-u{flex-shrink:0;text-align:center;border-right:1px solid var(--border2)}
.mt-u-t{font-size:10.5px;font-weight:700;color:var(--text2);padding:4px 0 1px}
.mt-u-s{font-size:8px;color:var(--muted);padding:0 0 3px}
.mt-u.today{background:color-mix(in srgb,var(--red) 12%,transparent)}
.mt-u.today .mt-u-t{color:var(--red)}
.mt-u.wknd{background:color-mix(in srgb,var(--surface4) 45%,transparent)}

.mt-today{position:absolute;top:0;bottom:0;width:0;border-left:1.5px dashed var(--red);z-index:3}
.mt-today-head i{position:absolute;top:4px;left:50%;transform:translateX(-50%);
  background:var(--red);color:#fff;font-size:9px;font-style:normal;font-weight:700;
  padding:1px 6px;border-radius:4px;white-space:nowrap}
.mt-bar{position:absolute;top:50%;transform:translateY(-50%);height:22px;border-radius:5px;
  display:flex;align-items:center;overflow:hidden;z-index:2;padding:0 5px}
.mt-bar span{font-size:9.5px;font-weight:600;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-bar.done{background:var(--green)}
.mt-bar.run{background:var(--blue)}
.mt-bar.risk{background:var(--amber)}
.mt-bar.late{background:var(--red)}
.mt-bar.upcoming{background:var(--surface3);border:1px solid var(--border-strong)}
.mt-bar.upcoming span{color:var(--muted)}

.mt-foot{display:flex;align-items:center;gap:16px;flex-wrap:wrap;justify-content:space-between;
  padding:12px 4px 0;font-size:11.5px;color:var(--text2)}
.mt-foot-l{display:flex;align-items:center;gap:10px}
.mt-foot-l select.flt{padding:4px 8px;font-size:11.5px}
.mt-legend{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.mt-legend span{display:inline-flex;align-items:center;gap:6px}
.mt-legend i{width:9px;height:9px;border-radius:50%}

/* ---- drag to reorder phases ---- */
.sched-nocell{white-space:nowrap}
.sched-grip{display:inline-flex;align-items:center;vertical-align:middle;margin-right:4px;
  color:var(--muted);cursor:grab;opacity:.4;transition:opacity .15s,color .15s}
.sched-grip svg{width:13px;height:13px}
.sched-grip svg circle{fill:currentColor;stroke:none}
.sched-phase:hover .sched-grip{opacity:1}
.sched-grip:hover{color:var(--blue)}
.sched-grip:active{cursor:grabbing}
.sched-phase.dragging{opacity:.45}
.sched-phase.drop-above td{box-shadow:inset 0 2px 0 0 var(--blue)}
.sched-phase.drop-below td{box-shadow:inset 0 -2px 0 0 var(--blue)}

/* ---- overdue list: grouped by project ---- */
.sch-late-group{font-weight:500}
.sch-late-projname{display:flex;align-items:center;gap:7px}
.sch-late-chev{display:inline-flex;color:var(--muted);transition:transform .15s;flex-shrink:0}
.sch-late-chev svg{width:13px;height:13px}
.sch-late-group.open .sch-late-chev{transform:rotate(90deg);color:var(--text)}
.sch-late-count{font-size:10.5px;padding:1px 7px}
.sch-late-children{background:var(--surface2);border-bottom:1px solid var(--border2)}
.sch-late-sub{padding-left:38px;cursor:pointer}
.sch-late-sub .sch-late-proj{color:var(--muted)}
.sch-late-openproj{padding:8px 14px 10px 38px}
.sch-late-openproj .btn{font-size:11.5px;padding:6px 12px}

/* ============ CONFIGURE PAGE ============ */
.rot-up{transform:rotate(-90deg)}
.rot-down{transform:rotate(90deg)}
.cfg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(232px,1fr));gap:14px;margin-bottom:18px}
.cfg-card{position:relative;padding:16px;border-radius:14px;border:1px solid var(--border);
  background:var(--surface);cursor:pointer;transition:transform .12s,border-color .12s,box-shadow .12s;overflow:hidden}
.cfg-card:hover{transform:translateY(-2px);border-color:var(--tone,var(--blue));box-shadow:0 8px 22px rgba(0,0,0,.18)}
.cfg-card::before{content:'';position:absolute;inset:0;background:var(--tone,var(--blue));opacity:.06;pointer-events:none}
.cfg-ic{position:relative;width:40px;height:40px;border-radius:11px;display:grid;place-items:center;
  background:color-mix(in srgb,var(--tone,var(--blue)) 18%,transparent);color:var(--tone,var(--blue));margin-bottom:11px}
.cfg-ic svg{width:20px;height:20px}
.cfg-nm{position:relative;font-size:15px;font-weight:600;margin-bottom:3px}
.cfg-ds{position:relative;font-size:12px;color:var(--muted);line-height:1.5;min-height:34px}
.cfg-ft{position:relative;display:flex;align-items:center;justify-content:space-between;
  margin-top:9px;padding-top:9px;border-top:1px solid var(--border2);font-size:12px;color:var(--text2)}
.cfg-ft svg{width:15px;height:15px;color:var(--tone,var(--blue))}
.cfg-card.tone-blue{--tone:var(--blue)}      .cfg-card.tone-green{--tone:var(--green)}
.cfg-card.tone-purple{--tone:var(--purple)}  .cfg-card.tone-amber{--tone:var(--amber)}
.cfg-card.tone-cyan{--tone:var(--cyan)}      .cfg-card.tone-pink{--tone:#ec4899}
.cfg-card.tone-orange{--tone:var(--orange)}  .cfg-card.tone-teal{--tone:#14b8a6}
.cfg-card.tone-slate{--tone:#64748b}         .cfg-card.tone-indigo{--tone:#6366f1}
.cfg-note{display:flex;gap:11px;align-items:flex-start;padding:13px 15px;border-radius:12px;
  background:color-mix(in srgb,var(--blue) 9%,transparent);border:1px solid color-mix(in srgb,var(--blue) 26%,transparent)}
.cfg-note svg{width:17px;height:17px;color:var(--blue);flex-shrink:0;margin-top:1px}
.cfg-note b{display:block;font-size:13px;font-weight:600;margin-bottom:2px}
.cfg-note span{font-size:12px;color:var(--muted)}
.cfg-list{border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;background:var(--surface)}
.cfg-row{display:flex;align-items:center;gap:12px;padding:9px 14px;border-bottom:1px solid var(--border2)}
.cfg-row:last-child{border-bottom:none}
.cfg-row:hover{background:var(--surface2)}
.cfg-idx{flex:0 0 30px;font-family:var(--mono);font-size:11px;color:var(--faint);text-align:right}
.cfg-val{flex:1;min-width:0}
.cfg-val .nm{font-size:13px;font-weight:500}
.cfg-val .em{font-size:11px;color:var(--muted);font-family:var(--mono)}
.cfg-use{flex:0 0 auto;font-size:11px;color:var(--faint);white-space:nowrap}
.cfg-use.on{color:var(--cyan)}
.cfg-row .row-actions{flex:0 0 auto;display:flex;gap:2px}
.cfg-row .btn[disabled]{opacity:.25;pointer-events:none}
.section-head h2 .btn-icon{margin-right:2px;vertical-align:middle}
@media(max-width:640px){
  .cfg-grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
  .cfg-use{display:none}
}
/* header icons must not stretch — bare svg in a heading has no intrinsic size */
.section-head h2{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}
.section-head h2>svg{width:19px;height:19px;flex:0 0 19px}
.section-head h2 .btn-icon svg{width:16px;height:16px;flex:none}

/* ============ SCHEDULE DASHBOARD ============
   Ring colours are status (validated per theme); state is always repeated as text. */
[data-theme=dark]{--ring-done:#22c55e;--ring-run:#3b82f6;--ring-soon:#f59e0b;--ring-late:#ef4444}
[data-theme=light]{--ring-done:#16a34a;--ring-run:#2563eb;--ring-soon:#ca8a04;--ring-late:#dc2626}
.dsh{margin-bottom:18px}
.dsh .st-idle{--st:var(--faint)}
.dsh .st-done{--st:var(--ring-done)}
.dsh .st-run{--st:var(--ring-run)}
.dsh .st-soon{--st:var(--ring-soon)}
.dsh .st-late{--st:var(--ring-late)}
.dsh-body{padding:14px 16px 16px}
.dsh-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px}
.dsh-sec{font-size:11px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;color:var(--text2);margin:16px 0 9px}
.dsh-sec span{font-weight:400;text-transform:none;letter-spacing:0;color:var(--muted)}
.dsh-tile{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);
  padding:10px 10px 9px;display:flex;flex-direction:column;align-items:center;text-align:center;
  min-width:0;outline:none;cursor:default;transition:border-color .12s,background .12s}
.dsh-tile:hover,.dsh-tile:focus-visible{border-color:var(--st);background:var(--surface3)}
.dsh-title{align-self:stretch;text-align:left;font-size:10.5px;font-weight:600;letter-spacing:.3px;
  text-transform:uppercase;color:var(--text2);line-height:1.35;min-height:28px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.dsh-ring{position:relative;width:84px;height:84px;margin:6px 0 5px}
.dsh-ring svg{width:100%;height:100%;transform:rotate(-90deg);display:block}
.dsh-ring .trk{fill:none;stroke:color-mix(in srgb,var(--st) 16%,var(--surface3));stroke-width:8}
.dsh-ring .val{fill:none;stroke:var(--st);stroke-width:8;stroke-linecap:round}
.dsh-ring b{position:absolute;inset:0;display:grid;place-items:center;font-size:19px;font-weight:600;color:var(--text)}
.dsh-state{display:flex;align-items:center;justify-content:center;gap:5px;font-size:11px;color:var(--text2);line-height:1.3}
.dsh-state i,.dsh-kv i{flex:0 0 7px;width:7px;height:7px;border-radius:50%;background:var(--st)}
.dsh-foot{font-size:11px;color:var(--muted);margin-top:2px}
.dsh-num{align-items:stretch;text-align:left}
.dsh-num .dsh-state{justify-content:flex-start;margin-bottom:7px}
.dsh-big{font-size:26px;font-weight:600;color:var(--text);margin:8px 0 3px;line-height:1.1}
.dsh-kv{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:11.5px;color:var(--text2);padding:2px 0}
.dsh-kv span{display:flex;align-items:center;gap:5px;min-width:0}
.dsh-kv b{color:var(--text);font-variant-numeric:tabular-nums;font-weight:600}
.dsh-tip{position:fixed;z-index:9999;pointer-events:none;background:var(--surface);border:1px solid var(--border-strong);
  border-radius:8px;padding:7px 10px;font-size:12px;line-height:1.5;color:var(--text2);white-space:pre-line;
  box-shadow:var(--shadow);max-width:260px}
.dsh-tip::first-line{color:var(--text);font-weight:600}
@media(max-width:640px){.dsh-grid{grid-template-columns:repeat(auto-fill,minmax(112px,1fr))}.dsh-ring{width:72px;height:72px}}

/* ============ ISSUE TRACKING & CHANGE REQUEST ============ */
.cfg-grp{font-size:11px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;color:var(--text2);margin:6px 0 9px}
.ctl-crumb-a{cursor:pointer;color:var(--text2)}
.ctl-crumb-a:hover{color:var(--text)}
.ctl-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg)}
.ctl-card-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:13px 16px 10px}
.ctl-card-h h3{font-size:14px;font-weight:600}
.ctl-card-h span{font-size:11.5px;color:var(--muted)}
.ctl-dash,.ctl-none{color:var(--faint);font-size:12px}
.ctl-none{padding:6px 0}
.ctl-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;align-items:start}
.ctl-layout.has-sel{grid-template-columns:minmax(0,1fr) 440px}
.ctl-main{display:flex;flex-direction:column;gap:12px;min-width:0}

/* header */
.ctl-head{display:flex;gap:16px;padding:16px 18px;align-items:flex-start}
.ctl-head-ic{flex:0 0 52px;height:52px;border-radius:12px;display:grid;place-items:center;
  background:color-mix(in srgb,var(--c) 16%,transparent);color:var(--c)}
.ctl-head-ic svg{width:26px;height:26px}
.ctl-head-main{flex:1;min-width:0}
.ctl-head-top{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:flex-start}
.ctl-crumb{font-size:11px;color:var(--muted);margin-bottom:2px}
.ctl-head h2{font-size:19px;font-weight:600;line-height:1.3}
.ctl-head-act{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.ctl-meta{display:flex;flex-wrap:wrap;gap:8px 26px;margin-top:12px}
.ctl-meta>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.ctl-meta span{font-size:11px;color:var(--muted)}
.ctl-meta b{font-size:13.5px;font-weight:600}
.ctl-prog{flex:1;min-width:200px}
.ctl-prog>div{display:flex;align-items:center;gap:10px}
.ctl-prog b{font-size:20px;line-height:1}
.ctl-prog i{flex:1;height:8px;border-radius:4px;background:color-mix(in srgb,var(--blue) 18%,var(--surface3));overflow:hidden;display:block}
.ctl-prog em{display:block;height:100%;background:var(--blue);border-radius:4px}

/* filters */
.ctl-filters{display:flex;flex-wrap:wrap;gap:10px;padding:12px 14px;align-items:flex-end}
.ctl-f{display:flex;flex-direction:column;gap:4px;min-width:112px}
.ctl-f>span{font-size:11px;font-weight:600;color:var(--text2)}
.ctl-f select.flt{min-width:112px;max-width:170px}
.ctl-date>div{display:flex;align-items:center;gap:5px}
.ctl-date input{width:136px}
.ctl-date em{color:var(--faint);font-style:normal}
.ctl-q{flex:1;min-width:180px}
.ctl-q .search{min-width:0}
.ctl-actions{display:flex;gap:8px;margin-left:auto}
.ctl-chk{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--text2);cursor:pointer;white-space:nowrap}

/* KPI tiles */
.ctl-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.section-head+.ctl-kpis{margin-bottom:14px}
.ctl-kpi{display:flex;align-items:center;gap:12px;padding:13px 14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg)}
.ctl-kpi.click{cursor:pointer}
.ctl-kpi.click:hover,.ctl-kpi.on{border-color:var(--k)}
.ctl-kpi.on{background:color-mix(in srgb,var(--k) 8%,var(--surface))}
.ctl-kpi span{display:block;font-size:12px;color:var(--text2)}
.ctl-kpi b{display:block;font-size:22px;font-weight:600;line-height:1.2;font-variant-numeric:tabular-nums}
.ctl-kpi-ic{flex:0 0 40px;height:40px;border-radius:11px;display:grid;place-items:center;
  background:color-mix(in srgb,var(--k) 15%,transparent);color:var(--k)}
.ctl-kpi-ic svg{width:19px;height:19px}
.t-blue{--k:var(--blue)}.t-green{--k:var(--green)}.t-amber{--k:var(--amber)}.t-red{--k:var(--red)}
.t-cyan{--k:var(--cyan)}.t-purple{--k:var(--purple)}.t-orange{--k:var(--orange)}.t-gray{--k:var(--muted)}

/* register + side */
.ctl-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:12px;align-items:start}
.has-sel .ctl-grid{grid-template-columns:minmax(0,1fr)}
.has-sel .ctl-side{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
.ctl-side{display:flex;flex-direction:column;gap:12px;min-width:0}
.ctl-register{overflow:hidden;min-width:0}
.ctl-tbl-wrap{overflow-x:auto;border-top:1px solid var(--border)}
.ctl-tbl{font-size:12.5px}
.ctl-tbl th{font-size:11px;padding:9px 11px}
.ctl-tbl td{padding:9px 11px}
.ctl-tbl tbody tr{cursor:pointer}
.ctl-tbl tbody tr:hover td{background:var(--surface2)}
.ctl-tbl tbody tr.sel td{background:color-mix(in srgb,var(--blue) 10%,var(--surface))}
.ctl-tbl tbody tr.sel td:first-child{box-shadow:inset 3px 0 0 var(--blue)}
.ctl-tbl .num{text-align:right;font-variant-numeric:tabular-nums}
.ctl-tbl .nowrap{white-space:nowrap}
.ctl-tbl .mono{font-family:var(--mono);font-size:12px;white-space:nowrap}
.ctl-title{min-width:170px;max-width:280px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.ctl-go svg{width:15px;height:15px;color:var(--faint)}
.ctl-late{display:flex;align-items:center;gap:4px;font-size:10.5px;color:var(--text2);margin-top:2px;white-space:nowrap}
.ctl-late i,.ctl-entry-s .flag i{width:6px;height:6px;border-radius:50%;background:var(--red);display:inline-block}
.ctl-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:10px 14px;border-top:1px solid var(--border);font-size:12px;color:var(--muted)}
.ctl-pages{display:flex;align-items:center;gap:4px}
.ctl-pages .btn{min-width:30px;justify-content:center}
.ctl-pages .btn[disabled]{opacity:.35;pointer-events:none}
.ctl-pages em{font-style:normal;padding:0 3px;color:var(--faint)}
.ctl-pages select{margin-left:6px}

.ctl-hbars{padding:4px 16px 16px;display:flex;flex-direction:column;gap:9px}
.ctl-hbar{display:grid;grid-template-columns:minmax(70px,108px) 1fr 30px;align-items:center;gap:10px;font-size:12.5px}
.ctl-hbar span{color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctl-hbar .trk{height:18px;background:color-mix(in srgb,var(--blue) 10%,var(--surface2));border-radius:4px;overflow:hidden}
.ctl-hbar .trk i{display:block;height:100%;background:var(--blue);border-radius:0 4px 4px 0}
.ctl-hbar.muted .trk i{background:var(--muted)}
.ctl-hbar b{text-align:right;font-variant-numeric:tabular-nums}
.ctl-vbars{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;padding:4px 18px 16px;height:190px}
.ctl-vbar{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0}
.ctl-vbar b{font-size:14px}
.ctl-vbar .col{flex:1;width:100%;max-width:56px;display:flex;align-items:flex-end;border-bottom:1px solid var(--border-strong)}
.ctl-vbar .col i{display:block;width:100%;background:var(--blue);border-radius:4px 4px 0 0}
.ctl-vbar span{font-size:11.5px;color:var(--text2);white-space:nowrap}
.ctl-nochart{padding:18px 16px 22px;color:var(--faint);font-size:12px;text-align:center}
.ctl-sum{display:flex;justify-content:space-between;gap:10px;padding:10px 16px;border-top:1px solid var(--border2);font-size:12.5px;color:var(--text2)}
.ctl-sum b{color:var(--text);font-variant-numeric:tabular-nums}
.ctl-sum.good span::before,.ctl-sum.warn span::before,.ctl-sum.mute span::before{content:'';display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px;vertical-align:1px}
.ctl-sum.good span::before{background:var(--green)}.ctl-sum.warn span::before{background:var(--amber)}.ctl-sum.mute span::before{background:var(--muted)}
.ctl-sum:last-child{padding-bottom:14px}

/* detail panel */
.ctl-scrim{display:none}
.ctl-panel{position:sticky;top:0;max-height:calc(100vh - 110px);display:flex;flex-direction:column;overflow:hidden}
.ctl-p-head{display:flex;gap:12px;align-items:flex-start;padding:15px 14px 10px 16px}
.ctl-p-ic{flex:0 0 38px;height:38px;border-radius:50%;display:grid;place-items:center;background:color-mix(in srgb,var(--k) 16%,transparent);color:var(--k)}
.ctl-p-ic svg{width:18px;height:18px}
.ctl-p-t{flex:1;min-width:0}
.ctl-p-t .mono{font-family:var(--mono);font-size:12px;color:var(--muted)}
.ctl-p-t h3{font-size:15px;font-weight:600;line-height:1.35}
.ctl-p-bar{display:flex;gap:6px;align-items:center;padding:0 16px 10px;flex-wrap:wrap}
.ctl-p-bar label{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text2)}
.ctl-p-bar .grow{flex:1}
.ctl-tabs{display:flex;gap:2px;padding:0 10px;border-bottom:1px solid var(--border);overflow-x:auto}
.ctl-tabs button{border:0;background:none;color:var(--muted);font:inherit;font-size:12.5px;font-weight:500;padding:9px 9px;white-space:nowrap;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}
.ctl-tabs button:hover{color:var(--text)}
.ctl-tabs button.active{color:var(--text);border-bottom-color:var(--blue);font-weight:600}
.ctl-p-body{overflow-y:auto;padding:12px 16px 18px;display:flex;flex-direction:column;gap:14px}
.ctl-p-note{font-size:11.5px;color:var(--muted)}
.ctl-kv{display:grid;grid-template-columns:132px 1fr;gap:7px 12px;font-size:12.5px;align-items:center}
.ctl-kv>span{color:var(--muted)}
.ctl-kv>div{color:var(--text);min-width:0;overflow-wrap:anywhere}
.ctl-strong{font-weight:600}
.ctl-block{display:flex;flex-direction:column;gap:8px}
.ctl-block-h{display:flex;align-items:center;gap:7px;font-size:13px}
.ctl-block-h svg{width:15px;height:15px;color:var(--text2)}
.ctl-add{margin-left:auto;border:0;background:none;color:var(--blue);font:inherit;font-size:12px;cursor:pointer;display:flex;align-items:center;gap:3px}
.ctl-add svg{width:13px;height:13px;color:var(--blue)}
.ctl-text{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:9px 11px;font-size:12.5px;line-height:1.55;white-space:pre-wrap;color:var(--text)}
.ctl-text.empty{color:var(--faint)}
.ctl-2col{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.ctl-2col .ctl-kv{grid-template-columns:minmax(90px,auto) 1fr}
.ctl-basic{display:grid;grid-template-columns:1fr 1fr 1fr;gap:9px 12px;font-size:12.5px}
.ctl-basic span{display:block;font-size:11px;color:var(--muted);margin-bottom:2px}
.ctl-basic b{font-weight:600;overflow-wrap:anywhere}
.ctl-basic .wide{grid-column:1/-1}
.ctl-basic p{white-space:pre-wrap;line-height:1.5}
.ctl-links{display:flex;flex-direction:column;gap:6px}
.ctl-link{display:flex;align-items:center;gap:8px;font-size:12.5px}
.ctl-link-ref{border:0;background:none;padding:0;font:inherit;font-family:var(--mono);font-size:12px;font-weight:600;color:var(--blue);cursor:pointer;white-space:nowrap}
.ctl-link-ref.gone{color:var(--faint);text-decoration:line-through;cursor:default}
.ctl-link-t{flex:1;min-width:0;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctl-more{border:0;background:none;color:var(--blue);font:inherit;font-size:12px;cursor:pointer;text-align:left;padding:2px 0}
.ctl-form-inline{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-top:4px}
.ctl-form-inline .flt{flex:1;min-width:120px}
.ctl-form-inline select.flt:first-child{flex:0 0 auto;min-width:0}
.ctl-files{display:flex;flex-direction:column;gap:6px}
.ctl-file{display:flex;align-items:center;gap:8px;font-size:12.5px}
.ctl-file>svg{width:15px;height:15px;color:var(--text2);flex-shrink:0}
.ctl-file a{flex:1;min-width:0;color:var(--blue);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctl-file span{font-size:11px;color:var(--muted);white-space:nowrap}
.ctl-comments{display:flex;flex-direction:column;gap:8px}
.ctl-cmt{background:var(--surface2);border:1px solid var(--border);border-radius:var(--radius);padding:8px 10px}
.ctl-cmt-h{display:flex;align-items:center;gap:8px;font-size:12px}
.ctl-cmt-h span{color:var(--muted);font-size:11px;flex:1}
.ctl-cmt p{font-size:12.5px;line-height:1.5;white-space:pre-wrap;margin-top:3px}
.ctl-cmt-form{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.ctl-cmt-form textarea{resize:vertical;font:inherit;font-size:12.5px}
.ctl-cmt-form .btn{align-self:flex-end}
.ctl-hist{display:flex;flex-direction:column;border-left:2px solid var(--border);margin-left:5px}
.ctl-hist>div{position:relative;padding:0 0 11px 14px}
.ctl-hist i{position:absolute;left:-6px;top:4px;width:10px;height:10px;border-radius:50%;background:var(--surface);border:2px solid var(--blue)}
.ctl-hist span{font-size:11px;color:var(--muted)}
.ctl-hist p{font-size:12.5px;line-height:1.45;overflow-wrap:anywhere}
.ctl-appr{display:grid;grid-template-columns:1fr auto;gap:4px 10px;padding:9px 0;border-top:1px solid var(--border2);align-items:center}
.ctl-appr>div:first-child{display:flex;align-items:center;gap:8px;font-size:13px}
.ctl-appr-meta{font-size:11px;color:var(--muted);grid-column:1}
.ctl-appr select{grid-column:2;grid-row:1/3}
.ctl-chips{display:flex;flex-wrap:wrap;gap:6px}
.ctl-chips label{display:flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:var(--surface2);cursor:pointer;font-size:12.5px;font-weight:500;color:var(--text)}
.ctl-chips input{width:auto;margin:0}
.ctl-chips label:has(input:checked){border-color:var(--blue);background:color-mix(in srgb,var(--blue) 12%,var(--surface2))}

/* entry cards inside Schedule Planner */
.ctl-entry{display:grid;grid-template-columns:repeat(auto-fit,minmax(420px,1fr));gap:12px;margin-bottom:18px}
.ctl-entry-card{display:flex;align-items:center;gap:14px;padding:14px 16px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);cursor:pointer;transition:border-color .12s,transform .12s}
.ctl-entry-card:hover,.ctl-entry-card:focus-visible{border-color:var(--blue);transform:translateY(-1px);outline:none}
.ctl-entry-card>svg{width:16px;height:16px;color:var(--faint);flex-shrink:0}
.ctl-entry-t{flex:1;min-width:0}
.ctl-entry-t b{display:block;font-size:14.5px;font-weight:600}
.ctl-entry-t span{font-size:12px;color:var(--muted)}
.ctl-entry-s{display:flex;gap:18px}
.ctl-entry-s>div{text-align:right}
.ctl-entry-s b{display:block;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums;line-height:1.2}
.ctl-entry-s span{display:flex;align-items:center;justify-content:flex-end;gap:4px;font-size:11px;color:var(--muted);white-space:nowrap}

@media(max-width:1400px){
  .ctl-layout.has-sel{grid-template-columns:minmax(0,1fr)}
  .ctl-scrim{display:block;position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:60}
  .ctl-panel{position:fixed;top:0;right:0;bottom:0;width:min(480px,100vw);max-height:none;border-radius:0;z-index:61;box-shadow:var(--shadow-lg)}
  .has-sel .ctl-grid{grid-template-columns:minmax(0,1fr) 300px}
  .has-sel .ctl-side{display:flex}
}
@media(max-width:1100px){
  .ctl-grid,.has-sel .ctl-grid{grid-template-columns:minmax(0,1fr)}
  .ctl-side,.has-sel .ctl-side{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
}
@media(max-width:640px){
  .ctl-entry{grid-template-columns:1fr}
  .ctl-entry-card{flex-wrap:wrap}
  .ctl-entry-s{width:100%;justify-content:space-between}
  .ctl-2col,.ctl-basic{grid-template-columns:1fr}
  .ctl-actions{margin-left:0}
}

/* ---- default WBS picker ---- */
.wbs-list{display:flex;flex-direction:column;gap:10px}
.wbs-row{display:grid;grid-template-columns:1fr 240px;gap:8px 12px;align-items:center;
  padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface2)}
.wbs-chk{display:flex;align-items:center;gap:8px;cursor:pointer;min-width:0}
.wbs-chk input{width:auto;margin:0}
.wbs-chk b{font-size:13px;font-weight:600}
.wbs-chk span{font-size:11.5px;color:var(--muted)}
.wbs-row .wbs-target{max-width:240px}
.wbs-subs{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:5px;max-height:84px;overflow-y:auto}
.wbs-subs span{display:inline-flex;align-items:center;gap:5px;font-size:11px;color:var(--text2);
  background:var(--surface);border:1px solid var(--border2);border-radius:6px;padding:3px 7px}
.wbs-subs i{font-style:normal;font-size:10px;font-weight:600;color:var(--blue)}
@media(max-width:640px){.wbs-row{grid-template-columns:1fr}.wbs-row .wbs-target{max-width:none}}

/* WT % is optional; Progress is the field people actually fill */
.sched-tbl th small{display:block;font-size:9.5px;font-weight:500;letter-spacing:0;
  text-transform:none;color:var(--faint);margin-top:1px}
.sched-tbl th.sched-th-prog small{color:var(--blue)}
.sched-inp.sched-wt{color:var(--muted);opacity:.7}
.sched-inp.sched-wt:focus{color:var(--text);opacity:1}
.sched-tip{font-weight:600;color:var(--text2)}

/* QO amount + currency picker */
.qo-amt{display:flex;gap:6px}
.qo-amt input{flex:1;min-width:0}
.qo-amt select{width:84px;flex:0 0 84px}
.qo-cur{display:block;font-size:10px;color:var(--faint);font-family:var(--font);margin-top:1px}

/* ---- issue / CR pictures ---- */
.ctl-imgs{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}
.ctl-img{position:relative;aspect-ratio:4/3;border-radius:8px;overflow:hidden;cursor:zoom-in;
  background:var(--surface2);border:1px solid var(--border)}
.ctl-img img{width:100%;height:100%;object-fit:cover;display:block}
.ctl-img.loading{background:linear-gradient(90deg,var(--surface2),var(--surface3),var(--surface2));background-size:200% 100%;animation:ctlShimmer 1.2s linear infinite}
.ctl-img.missing::after{content:'โหลดรูปไม่ได้';position:absolute;inset:0;display:grid;place-items:center;font-size:11px;color:var(--faint)}
@keyframes ctlShimmer{to{background-position:-200% 0}}
.ctl-img-del{position:absolute;top:4px;right:4px;width:22px;height:22px;border-radius:6px;border:0;display:grid;place-items:center;
  background:rgba(0,0,0,.55);color:#fff;cursor:pointer;opacity:0;transition:opacity .12s}
.ctl-img:hover .ctl-img-del,.ctl-img-del:focus-visible{opacity:1}
.ctl-img-del svg{width:13px;height:13px}
.ctl-drop{display:flex;align-items:center;gap:9px;padding:12px 13px;border:1.5px dashed var(--border-strong);border-radius:var(--radius);
  font-size:12px;color:var(--text2);cursor:pointer;transition:border-color .12s,background .12s}
.ctl-drop:hover,.ctl-drop.over{border-color:var(--blue);background:color-mix(in srgb,var(--blue) 7%,transparent)}
.ctl-drop svg{width:18px;height:18px;color:var(--blue);flex-shrink:0}
.ctl-drop b{color:var(--text);font-weight:600}
.ctl-img-note{font-size:11px;color:var(--muted)}
.ctl-img-more{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  background:rgba(8,12,20,.62);color:#fff;font-size:16px;font-weight:700;pointer-events:none}
.ctl-lb{position:fixed;inset:0;z-index:10000;background:rgba(5,8,14,.9);display:flex;align-items:center;justify-content:center;gap:12px;padding:24px}
.ctl-lb figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:10px;max-width:calc(100vw - 150px)}
.ctl-lb img{max-width:100%;max-height:calc(100vh - 110px);border-radius:8px;box-shadow:0 20px 60px rgba(0,0,0,.6);background:#fff;min-width:60px;min-height:60px}
.ctl-lb figcaption{color:#cbd5e1;font-size:12.5px}
.ctl-lb button{border:0;background:rgba(255,255,255,.1);color:#fff;border-radius:50%;width:40px;height:40px;display:grid;place-items:center;cursor:pointer;flex-shrink:0}
.ctl-lb button:hover{background:rgba(255,255,255,.2)}
.ctl-lb button svg{width:18px;height:18px}
.ctl-lb .ctl-lb-x{position:absolute;top:16px;right:16px}

/* the hidden attribute loses to author display rules — make it win for these */
.ctl-lb[hidden],.ctl-lb button[hidden],.ctl-drop input[hidden],.dsh-tip[hidden]{display:none!important}
