/* Rally Manager - Dark Theme (matches Silicon Valley UI system) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0:      #141412;
  --bg1:      #1a1917;
  --bg2:      #222120;
  --bg3:      #2a2927;
  --border:   rgba(255,255,255,.07);
  --border-md:rgba(255,255,255,.12);
  --text:     #f0ede8;
  --text2:    #9b9891;
  --text3:    #5c5a56;
  --accent:   #e8380d;
  --accent-s: rgba(232,56,13,.12);
  --blue:     #4a9de0;
  --blue-s:   rgba(74,157,224,.15);
  --green:    #5ba831;
  --green-s:  rgba(91,168,49,.15);
  --amber:    #d4920a;
  --amber-s:  rgba(212,146,10,.15);
  --purple:   #8b7ee8;
  --purple-s: rgba(139,126,232,.15);
  --danger:   #cc2222;
  --r:        8px;
  --r-lg:     12px;
  --shadow:   0 1px 3px rgba(0,0,0,.4),0 1px 2px rgba(0,0,0,.3);
  --font:     system-ui,-apple-system,'Segoe UI',sans-serif;
}

html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg1); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

input, textarea, select {
  background: var(--bg2); border: 0.5px solid var(--border-md); color: var(--text);
  border-radius: var(--r); padding: .5rem .85rem; width: 100%; font-size: .9rem;
  font-family: var(--font); transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,56,13,.12);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--bg2); color: var(--text); }
label { display: block; font-size: .72rem; color: var(--text2); margin-bottom: .3rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* Buttons */
.btn { display:inline-flex; align-items:center; gap:.4rem; padding:.45rem 1rem; border-radius:var(--r); border:0.5px solid transparent; cursor:pointer; font-size:.84rem; font-weight:500; font-family:var(--font); transition:background .12s; text-decoration:none; white-space:nowrap; line-height:1; }
.btn:hover { text-decoration: none; }
.btn-primary  { background:var(--accent); color:#fff; border-color:var(--accent); }
.btn-primary:hover  { background:#c72e08; color:#fff; }
.btn-danger   { background:var(--danger); color:#fff; border-color:var(--danger); }
.btn-danger:hover   { background:#991a1a; color:#fff; }
.btn-success  { background:var(--green);  color:#fff; }
.btn-ghost    { background:transparent; color:var(--text2); border-color:var(--border-md); }
.btn-ghost:hover    { background:var(--bg3); color:var(--text); border-color:var(--border-md); }
.btn-sm { padding:.3rem .75rem; font-size:.8rem; }
.btn-xs { padding:.2rem .55rem; font-size:.74rem; }

/* Navbar */
.navbar {
  background: var(--bg0); border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; padding: 0 1.25rem;
  height: 50px; gap: .5rem;
}
.brand { display:flex; align-items:center; gap:.6rem; color:var(--text); font-size:.92rem; font-weight:600; text-decoration:none; padding-right:1rem; border-right:0.5px solid var(--border); }
.brand:hover { text-decoration:none; color:var(--text); }
.brand-flag { width:22px; height:22px; background:var(--accent); border-radius:5px; flex-shrink:0; }
.nav-links { display:flex; align-items:center; flex:1; height:100%; }
.nav-links a { display:flex; align-items:center; height:100%; padding:0 .85rem; font-size:.83rem; font-weight:500; color:var(--text2); text-decoration:none; border-bottom:2px solid transparent; transition:color .12s; }
.nav-links a:hover { color:var(--text); text-decoration:none; }
.nav-links a.active { color:var(--text); border-bottom-color:var(--accent); }
.sep { width:0.5px; height:20px; background:var(--border-md); margin:0 .25rem; flex-shrink:0; }
.nav-user { font-size:.8rem; color:var(--text2); font-weight:500; white-space:nowrap; }

/* Layout */
.container { width:100%; max-width:1440px; margin:0 auto; padding:1.5rem; flex:1; }
.footer { text-align:center; padding:.85rem; color:var(--text3); font-size:.75rem; border-top:0.5px solid var(--border); background:var(--bg0); }

/* Page header */
.page-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:1.5rem; gap:1rem; flex-wrap:wrap; }
.page-title { font-size:1.1rem; font-weight:500; letter-spacing:-.2px; color:var(--text); }
.page-title::before { content:''; display:block; width:20px; height:2px; background:var(--accent); margin-bottom:.4rem; border-radius:1px; }
.page-sub { color:var(--text2); font-size:.82rem; margin-top:.2rem; }
.page-actions { display:flex; gap:.5rem; flex-wrap:wrap; align-items:center; }

/* Cards */
.card { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); padding:1.25rem; box-shadow:var(--shadow); }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:.85rem; }
.card-title { font-size:.84rem; font-weight:500; color:var(--text); }

/* Badges */
.badge { display:inline-flex; align-items:center; font-size:.7rem; font-weight:500; padding:.2rem .55rem; border-radius:20px; border:0.5px solid; }
.p-low    { background:var(--bg3);    color:var(--text2); border-color:var(--border-md); }
.p-medium { background:var(--amber-s); color:var(--amber); border-color:rgba(212,146,10,.3); }
.p-high   { background:var(--accent-s); color:#f07050; border-color:rgba(232,56,13,.3); }
.p-urgent { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }
.s-todo        { background:var(--bg3);    color:var(--text2); border-color:var(--border-md); }
.s-in_progress { background:var(--blue-s); color:var(--blue);  border-color:rgba(74,157,224,.3); }
.s-review      { background:var(--amber-s); color:var(--amber); border-color:rgba(212,146,10,.3); }
.s-done        { background:var(--green-s); color:var(--green); border-color:rgba(91,168,49,.3); }
.s-blocked     { background:rgba(204,34,34,.15); color:#e07070; border-color:rgba(204,34,34,.3); }
.s-waiting     { background:var(--purple-s); color:var(--purple); border-color:rgba(139,126,232,.3); }

/* Avatars */
.avatar { display:inline-flex; align-items:center; justify-content:center; border-radius:50%; font-size:.65rem; font-weight:700; color:#fff; flex-shrink:0; border:1.5px solid var(--bg1); width:26px; height:26px; }
.avatar-stack { display:flex; }
.avatar-stack .avatar { margin-left:-5px; }
.avatar-stack .avatar:first-child { margin-left:0; }
.avatar-chip { display:inline-flex; align-items:center; gap:.4rem; background:var(--bg2); border:0.5px solid var(--border-md); border-radius:20px; padding:.2rem .65rem .2rem .25rem; font-size:.8rem; }

/* Tables */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { font-size:.72rem; color:var(--text2); font-weight:600; text-transform:uppercase; letter-spacing:.06em; padding:.6rem .9rem; border-bottom:0.5px solid var(--border-md); background:var(--bg2); text-align:left; }
td { padding:.65rem .9rem; border-bottom:0.5px solid var(--border); font-size:.88rem; color:var(--text); vertical-align:middle; }
tr:hover td { background:var(--bg2); }

/* Modals */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:200; align-items:center; justify-content:center; padding:1rem; }
.modal-overlay.open { display:flex; }
.modal { background:var(--bg0); border:0.5px solid var(--border-md); border-radius:var(--r-lg); width:100%; max-width:700px; max-height:92vh; overflow-y:auto; padding:1.75rem; box-shadow:0 24px 64px rgba(0,0,0,.6); }
.modal-sm { max-width:480px; }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1.25rem; padding-bottom:.85rem; border-bottom:0.5px solid var(--border); }
.modal-title { font-size:.95rem; font-weight:500; letter-spacing:-.1px; }
.modal-close { background:none; border:none; color:var(--text2); font-size:1.3rem; cursor:pointer; line-height:1; padding:.25rem; border-radius:var(--r); transition:background .12s; }
.modal-close:hover { background:var(--bg3); color:var(--text); }

/* Alerts */
.alert { padding:.75rem 1rem; border-radius:var(--r); margin-bottom:1rem; font-size:.87rem; border:0.5px solid; }
.alert-danger  { background:rgba(204,34,34,.12); border-color:rgba(204,34,34,.3); color:#e07070; }
.alert-success { background:var(--green-s); border-color:rgba(91,168,49,.3); color:var(--green); }
.alert-info    { background:var(--blue-s); border-color:rgba(74,157,224,.3); color:var(--blue); }

/* Login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:1.5rem; background:var(--bg1); }
.login-box { background:var(--bg0); border:0.5px solid var(--border-md); border-radius:var(--r-lg); padding:2.5rem 2.25rem; width:100%; max-width:400px; box-shadow:0 8px 40px rgba(0,0,0,.5); }
.login-logo { text-align:center; font-size:1rem; font-weight:600; letter-spacing:-.1px; }
.login-logo-bar { width:28px; height:2px; background:var(--accent); margin:.4rem auto; border-radius:1px; }
.login-sub { text-align:center; color:var(--text2); font-size:.78rem; margin-bottom:1.75rem; }

/* Tabs */
.tabs { display:flex; border-bottom:0.5px solid var(--border-md); margin-bottom:1.5rem; }
.tab { padding:.55rem 1rem; font-size:.8rem; font-weight:500; color:var(--text2); border-bottom:2px solid transparent; cursor:pointer; background:none; border-top:none; border-left:none; border-right:none; transition:color .12s; }
.tab.active { color:var(--text); border-bottom-color:var(--accent); }
.tab:hover { color:var(--text); }

/* Forms */
.form-group  { margin-bottom:1rem; }
.form-row    { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.form-row3   { display:grid; grid-template-columns:1fr 1fr 1fr; gap:1rem; }
.form-actions { display:flex; gap:.6rem; margin-top:1.25rem; }
.checkbox-row { display:flex; align-items:center; gap:.55rem; }
.checkbox-row input[type=checkbox] { width:auto; cursor:pointer; accent-color:var(--accent); }
.checkbox-row label { margin:0; text-transform:none; font-size:.88rem; color:var(--text); letter-spacing:0; font-weight:400; }
.multi-select-box { border:0.5px solid var(--border-md); border-radius:var(--r); max-height:160px; overflow-y:auto; background:var(--bg2); padding:.35rem; display:flex; flex-direction:column; gap:.15rem; }
.multi-select-box .option { display:flex; align-items:center; gap:.5rem; padding:.3rem .5rem; border-radius:calc(var(--r) - 2px); cursor:pointer; font-size:.86rem; }
.multi-select-box .option:hover { background:var(--bg3); }
.multi-select-box .option input { width:auto; cursor:pointer; accent-color:var(--accent); }

/* Dot */
.dot { width:8px; height:8px; border-radius:2px; display:inline-block; flex-shrink:0; }

/* Filter bar */
.filters, .list-filters { display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1.25rem; align-items:flex-end; }
.filter-select, .list-filters select, .list-filters input { width:auto; min-width:130px; height:30px; padding:0 .75rem; font-size:.8rem; border-radius:20px; }

/* Storyboard dept section */
.dept-section { margin-bottom:1.5rem; }
.dept-header { display:flex; align-items:center; gap:.75rem; padding:.55rem 1rem; background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r); margin-bottom:.75rem; }
.dept-color-bar { width:3px; height:20px; border-radius:2px; flex-shrink:0; }
.dept-header-name { font-size:.87rem; font-weight:500; }
.dept-header-sub { font-size:.75rem; color:var(--text2); }
.dept-header-right { margin-left:auto; display:flex; align-items:center; gap:.75rem; }
.dept-title { font-size:.87rem; font-weight:500; }
.dept-count { margin-left:auto; font-size:.75rem; color:var(--text2); }
.team-row { margin-bottom:1rem; }
.team-header { display:flex; align-items:center; gap:.55rem; margin-bottom:.6rem; padding:.3rem .75rem; border-left:2px solid; border-radius:0 var(--r) var(--r) 0; }
.team-title { font-size:.8rem; font-weight:500; color:var(--text2); }
.task-cards-row { display:flex; gap:.6rem; flex-wrap:wrap; }

/* Task grid (auto-fill) */
.task-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:.6rem; }

/* Task cards - using UI attachment class names */
.task-card { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); overflow:hidden; cursor:pointer; transition:box-shadow .15s,border-color .15s; position:relative; width:250px; flex-shrink:0; }
.task-card:hover { box-shadow:0 4px 16px rgba(0,0,0,.4); border-color:var(--border-md); }
.task-card-waiting, .task-card.waiting { border-style:dashed; opacity:.78; }
.task-card-waiting::after, .task-card.waiting::after { content:'\23F3'; position:absolute; top:36px; right:9px; font-size:.8rem; }

/* Type banner  matches .tc-banner from UI file */
.task-type-banner, .tc-banner { display:flex; align-items:center; gap:.45rem; padding:.32rem .85rem; }
.task-type-symbol, .tc-banner-icon { font-size:.85rem; line-height:1; color:rgba(255,255,255,.9); }
.task-type-label, .tc-banner-label { font-size:.68rem; font-weight:500; color:rgba(255,255,255,.88); text-transform:uppercase; letter-spacing:.05em; }

/* Card body  matches .tc-body */
.task-card-body, .tc-body { padding:.75rem .85rem .8rem; }
.task-card-title, .tc-title { font-size:.88rem; font-weight:500; margin-bottom:.4rem; line-height:1.35; letter-spacing:-.1px; }
.task-card-desc, .tc-desc { font-size:.78rem; color:var(--text3); margin-bottom:.45rem; line-height:1.45; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.task-card-meta, .tc-tags { display:flex; flex-wrap:wrap; gap:.35rem; margin-bottom:.45rem; }
.task-card-due, .tc-due { font-size:.74rem; color:var(--text2); display:flex; align-items:center; gap:.25rem; margin-left:auto; }
.task-card-due.overdue, .tc-due.overdue { color:var(--accent); }
.tc-footer { display:flex; align-items:center; gap:.5rem; }
.tc-avatars { display:flex; }
.tc-av { width:20px; height:20px; border-radius:50%; border:1.5px solid var(--bg0); font-size:8px; font-weight:500; color:#fff; display:flex; align-items:center; justify-content:center; margin-left:-5px; }
.tc-av:first-child { margin-left:0; }
.tc-roles { display:flex; gap:.35rem; flex-wrap:wrap; }
.tc-follow { font-size:.72rem; color:var(--text3); display:flex; align-items:center; gap:.3rem; margin-top:.45rem; padding-top:.45rem; border-top:0.5px solid var(--border); }
.fu-badge { font-size:.72rem; color:var(--purple); font-weight:500; margin-top:.35rem; }
.group-tags { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.45rem; }
.group-tag { font-size:.67rem; font-weight:500; padding:.15rem .5rem; border-radius:20px; color:#fff; }
.role-card-chip, .role-tag { display:inline-flex; align-items:center; gap:.3rem; font-size:.7rem; font-weight:500; padding:.15rem .5rem; border:0.5px solid; border-radius:4px; }
.role-chip { display:inline-flex; align-items:center; gap:.35rem; border:0.5px solid; border-radius:4px; padding:.2rem .6rem; font-size:.75rem; font-weight:500; }
.role-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.role-vacant { border-style:dashed; opacity:.65; }
.type-badge { display:inline-flex; align-items:center; gap:.3rem; padding:.2rem .55rem; font-size:.72rem; font-weight:500; border-radius:4px; border:0.5px solid; }

/* Kanban */
.kanban-board { display:grid; grid-template-columns:repeat(6,1fr); gap:.6rem; align-items:start; }
.kanban-col { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); padding:.85rem; }
.kanban-col-header { font-weight:600; font-size:.74rem; letter-spacing:.04em; color:var(--text2); margin-bottom:.7rem; display:flex; align-items:center; justify-content:space-between; }
.kanban-count { background:var(--accent); color:#fff; padding:.1rem .5rem; border-radius:20px; font-size:.68rem; font-weight:700; }
.kanban-col .task-card { width:auto; margin-bottom:.5rem; }
.kanban-col .task-card:last-child { margin-bottom:0; }

/* Timeline */
.timeline-wrap { overflow-x:auto; }
.timeline-grid { display:grid; min-width:900px; }
.tl-header { display:flex; border-bottom:1px solid var(--accent); margin-bottom:.45rem; opacity:.75; }
.tl-label-col { width:195px; flex-shrink:0; font-size:.7rem; font-weight:600; color:var(--text2); padding:.45rem .75rem; letter-spacing:.05em; text-transform:uppercase; }
.tl-months { display:flex; flex:1; }
.tl-month { flex:1; text-align:center; font-size:.7rem; font-weight:600; color:var(--text2); padding:.45rem .25rem; border-left:0.5px solid var(--border); text-transform:uppercase; letter-spacing:.05em; }
.tl-today-line { position:absolute; top:0; bottom:0; width:1.5px; background:var(--accent); opacity:.7; z-index:5; pointer-events:none; }
.tl-row { display:flex; min-height:28px; align-items:center; margin-bottom:.3rem; position:relative; }
.tl-row-label { width:195px; flex-shrink:0; font-size:.82rem; padding:0 .75rem; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:500; }
.tl-row-track { flex:1; position:relative; height:24px; }
.tl-bar { position:absolute; height:18px; top:3px; cursor:pointer; display:flex; align-items:center; padding:0 .55rem; font-size:.69rem; font-weight:500; color:rgba(255,255,255,.9); overflow:hidden; white-space:nowrap; border-radius:var(--r); z-index:2; transition:filter .12s; min-width:6px; }
.tl-bar:hover { filter:brightness(1.2); }
.tl-milestone { position:absolute; width:12px; height:12px; top:50%; transform:translateY(-50%) rotate(45deg); border-radius:2px; z-index:3; cursor:pointer; transition:filter .12s; }
.tl-milestone:hover { filter:brightness(1.25); }
.tl-section-header .tl-row-label { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.07em; color:var(--text2); }

/* Task detail modal */
.task-detail-grid { display:grid; grid-template-columns:1fr 280px; gap:1.25rem; }
.task-meta-panel { background:var(--bg2); border:0.5px solid var(--border); border-radius:var(--r-lg); padding:1rem; }
.meta-row { display:flex; align-items:flex-start; justify-content:space-between; padding:.45rem 0; border-bottom:0.5px solid var(--border); }
.meta-row:last-child { border-bottom:none; }
.meta-label, .meta-key { font-size:.75rem; color:var(--text3); }
.meta-value, .meta-val { font-size:.82rem; font-weight:500; text-align:right; }
.status-action-row { display:flex; gap:.35rem; flex-wrap:wrap; margin-bottom:1rem; align-items:center; }
.status-action-label { font-size:.7rem; color:var(--text2); font-weight:600; letter-spacing:.07em; text-transform:uppercase; }

/* Comments */
.comments { margin-top:1.25rem; }
.comment { background:var(--bg2); border:0.5px solid var(--border); border-left:2px solid var(--accent); border-radius:0 var(--r) var(--r) 0; padding:.65rem .85rem; margin-bottom:.5rem; }
.comment-meta { font-size:.72rem; color:var(--text2); margin-bottom:.25rem; font-weight:500; }

/* Follow-up / dependency */
.waiting-banner { background:var(--purple-s); border:0.5px solid rgba(139,126,232,.3); border-left:3px solid var(--purple); border-radius:0 var(--r) var(--r) 0; padding:.65rem .9rem; margin-bottom:.85rem; font-size:.84rem; color:var(--purple); display:flex; align-items:flex-start; gap:.6rem; }
.followup-list { display:flex; flex-direction:column; gap:.4rem; margin-top:.4rem; }
.followup-item { background:var(--bg2); border:0.5px solid var(--border); border-left:2px solid var(--accent); border-radius:0 var(--r) var(--r) 0; padding:.55rem .85rem; display:flex; align-items:center; gap:.65rem; font-size:.85rem; }
.followup-item.locked { border-left-color:var(--purple); opacity:.65; }
.followup-lock { font-size:.9rem; flex-shrink:0; }
.dep-chain { display:flex; align-items:center; gap:.3rem; flex-wrap:wrap; font-size:.8rem; color:var(--text2); }

/* Files */
.file-section { margin-top:1.25rem; padding-top:1rem; border-top:0.5px solid var(--border); }
.file-drop-zone { border:1px dashed var(--border-md); border-radius:var(--r); padding:1.25rem; text-align:center; cursor:pointer; transition:border-color .15s,background .15s; }
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color:var(--accent); background:var(--accent-s); }
.file-list { display:flex; flex-direction:column; gap:0; }
.file-item { display:flex; align-items:flex-start; gap:.75rem; padding:.6rem .85rem; border:0.5px solid var(--border); border-bottom:none; background:var(--bg2); transition:background .12s; }
.file-item:first-child { border-radius:var(--r) var(--r) 0 0; }
.file-item:last-of-type { border-bottom:0.5px solid var(--border); border-radius:0 0 var(--r) var(--r); }
.file-item:only-child { border-radius:var(--r); border-bottom:0.5px solid var(--border); }
.file-item:hover { background:var(--bg3); }
.file-icon { font-size:1.2rem; flex-shrink:0; line-height:1; }
.file-info { flex:1; min-width:0; }
.file-name { font-weight:500; font-size:.87rem; color:var(--text); display:block; margin-bottom:.15rem; word-break:break-word; }
.file-name:hover { color:var(--accent); text-decoration:underline; }
.file-meta { font-size:.74rem; color:var(--text2); }
.file-actions { display:flex; gap:.3rem; flex-shrink:0; align-items:flex-start; }

/* Admin */
.admin-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.25rem; }
.color-swatch-row { display:flex; gap:.4rem; flex-wrap:wrap; margin-bottom:.5rem; }
.color-swatch { width:22px; height:22px; border-radius:4px; border:2px solid transparent; cursor:pointer; transition:border-color .12s,transform .12s; }
.color-swatch.sel, .color-swatch:hover { border-color:rgba(255,255,255,.6); transform:scale(1.15); }

/* Misc */
.chip-list { display:flex; flex-wrap:wrap; gap:.4rem; }
.empty { text-align:center; color:var(--text2); padding:3rem 1rem; }
.empty-icon { font-size:2.5rem; margin-bottom:.75rem; }
.due-overdue { color:var(--accent); font-weight:600; }
code { background:var(--bg2); border:0.5px solid var(--border-md); padding:.1rem .4rem; font-size:.84em; color:var(--accent); border-radius:4px; }

/* Quill */
.ql-toolbar { background:var(--bg2) !important; border:0.5px solid var(--border-md) !important; border-bottom:none !important; border-radius:var(--r) var(--r) 0 0 !important; }
.ql-container { background:var(--bg2) !important; border:0.5px solid var(--border-md) !important; color:var(--text) !important; font-family:var(--font) !important; font-size:.9rem !important; min-height:100px; border-radius:0 0 var(--r) var(--r) !important; }
.ql-editor { color:var(--text) !important; min-height:100px; line-height:1.6; }
.ql-editor.ql-blank::before { color:var(--text3) !important; font-style:normal !important; }
.ql-snow .ql-stroke { stroke:var(--text2) !important; }
.ql-snow .ql-fill { fill:var(--text2) !important; }
.ql-snow .ql-picker { color:var(--text2) !important; }
.ql-snow .ql-picker-options { background:var(--bg2) !important; border-color:var(--border-md) !important; }
.ql-snow button:hover .ql-stroke, .ql-snow .ql-active .ql-stroke { stroke:var(--text) !important; }
.ql-snow button:hover .ql-fill, .ql-snow .ql-active .ql-fill { fill:var(--text) !important; }
.task-desc-html p { margin-bottom:.5rem; line-height:1.65; }
.task-desc-html ul, .task-desc-html ol { margin:.5rem 0 .5rem 1.5rem; }
.task-desc-html li { margin-bottom:.25rem; }
.task-desc-html strong { font-weight:600; }
.task-desc-html blockquote { border-left:2px solid var(--border-md); padding-left:.8rem; color:var(--text2); margin:.6rem 0; }

/* Responsive */
@media(max-width:1200px){.kanban-board{grid-template-columns:repeat(3,1fr)}}
@media(max-width:900px){.kanban-board{grid-template-columns:1fr 1fr}.task-detail-grid{grid-template-columns:1fr}.admin-grid{grid-template-columns:1fr}.form-row,.form-row3{grid-template-columns:1fr}}
@media(max-width:600px){.kanban-board{grid-template-columns:1fr}.navbar{padding:0 .75rem}.container{padding:1rem}}

/*  App shell  */
body { display:block; }
.shell { display:grid; grid-template-columns:220px 1fr; min-height:100vh; }

/*  Sidebar  */
.sidebar { background:var(--bg0); border-right:0.5px solid var(--border); display:flex; flex-direction:column; min-height:100vh; position:sticky; top:0; overflow-y:auto; }
.sb-top { padding:14px 14px 12px; border-bottom:0.5px solid var(--border); }
.sb-logo { display:flex; align-items:center; gap:9px; }
.sb-logo-mark { width:28px; height:28px; background:var(--accent); border-radius:6px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:15px; flex-shrink:0; }
.sb-logo-text { font-size:13.5px; font-weight:500; letter-spacing:-.2px; }
.sb-logo-sub  { font-size:11px; color:var(--text3); margin-top:1px; }
.sb-event { margin:10px 0 0; padding:8px 10px; background:var(--bg2); border-radius:var(--r); border:0.5px solid var(--border); }
.sb-event-label { font-size:9.5px; color:var(--text3); text-transform:uppercase; letter-spacing:.06em; margin-bottom:2px; }
.sb-event-name  { font-size:12.5px; font-weight:500; }
.sb-event-date  { font-size:11px; color:var(--accent); margin-top:2px; display:flex; align-items:center; gap:5px; }
.countdown { font-size:10px; background:var(--accent); color:#fff; padding:1px 6px; border-radius:20px; font-weight:500; }
.sb-section { padding:14px 12px 4px; font-size:10px; text-transform:uppercase; letter-spacing:.07em; color:var(--text3); font-weight:600; }
.sb-nav { padding:0 6px; display:flex; flex-direction:column; gap:1px; }
.sb-nav a, .sb-item { display:flex; align-items:center; gap:8px; padding:7px 10px; border-radius:var(--r); cursor:pointer; font-size:12.5px; color:var(--text2); text-decoration:none; transition:background .1s; }
.sb-nav a:hover, .sb-item:hover { background:var(--bg2); text-decoration:none; color:var(--text); }
.sb-nav a.active, .sb-item.active { background:var(--accent-s); color:var(--accent); font-weight:500; }
.sb-badge { margin-left:auto; background:var(--bg2); color:var(--text3); font-size:10px; padding:1px 6px; border-radius:20px; font-weight:500; }
.sb-nav a.active .sb-badge { background:var(--accent-s); color:var(--accent); }
.sb-depts { padding:0 6px; flex:1; overflow-y:auto; }
.dept-row { display:flex; align-items:center; gap:7px; padding:5px 10px; border-radius:6px; cursor:pointer; }
.dept-row:hover { background:var(--bg2); }
.dept-dot  { width:8px; height:8px; border-radius:2px; flex-shrink:0; }
.dept-name { font-size:12px; color:var(--text2); }
.dept-count { margin-left:auto; font-size:10px; color:var(--text3); }
.team-row-sb { display:flex; align-items:center; gap:7px; padding:3px 10px 3px 24px; border-radius:6px; }
.team-row-sb:hover { background:var(--bg2); }
.team-dot  { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.team-name { font-size:11px; color:var(--text3); }
.sb-user { padding:10px 12px; border-top:0.5px solid var(--border); display:flex; align-items:center; gap:8px; }
.avatar-sb { width:28px; height:28px; border-radius:50%; background:var(--accent); display:flex; align-items:center; justify-content:center; font-size:10.5px; font-weight:600; color:#fff; flex-shrink:0; }
.sb-user-name { font-size:12px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sb-user-role { font-size:10.5px; color:var(--text3); }
.sb-user-actions { margin-left:auto; display:flex; gap:3px; flex-shrink:0; }
.icon-btn { width:26px; height:26px; border-radius:6px; border:0.5px solid var(--border); background:transparent; display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--text2); font-size:13px; text-decoration:none; transition:background .1s; }
.icon-btn:hover, .icon-btn.active { background:var(--bg2); color:var(--text); text-decoration:none; }

/*  Main area  */
.main { display:flex; flex-direction:column; min-height:100vh; overflow-x:hidden; }
.container { padding:1.25rem 1.5rem; flex:1; }

/*  Top bar  */
.topbar { background:var(--bg0); border-bottom:0.5px solid var(--border); padding:0 1.5rem; height:48px; display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:50; }
.page-title-bar { font-size:14px; font-weight:500; letter-spacing:-.2px; }
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:6px; }

/*  Stat cards  */
.stats-row { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-bottom:1.25rem; }
.stat-card { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); padding:12px 14px; display:flex; flex-direction:column; gap:3px; }
.stat-label { font-size:11px; color:var(--text3); display:flex; align-items:center; gap:4px; }
.stat-value { font-size:20px; font-weight:500; letter-spacing:-.5px; line-height:1; }
.stat-sub { font-size:10.5px; color:var(--text3); }
.stat-bar { height:3px; background:var(--bg2); border-radius:2px; margin-top:5px; overflow:hidden; }
.stat-bar-fill { height:100%; border-radius:2px; }

/*  Navbar (hidden when sidebar present)  */
.navbar { display:none; }

/*  Filter bar  */
.filterbar { padding:10px 1.5rem; border-bottom:0.5px solid var(--border); display:flex; align-items:center; gap:6px; background:var(--bg0); flex-wrap:wrap; }
.filter-chip { height:26px; padding:0 10px; background:var(--bg0); border:0.5px solid var(--border-md); border-radius:20px; font-size:11.5px; color:var(--text2); display:inline-flex; align-items:center; gap:4px; cursor:pointer; white-space:nowrap; }
.filter-chip:hover { background:var(--bg2); }
.filter-chip.active { background:var(--accent-s); border-color:var(--accent); color:var(--accent); }
.filter-divider { width:1px; height:18px; background:var(--border); margin:0 2px; flex-shrink:0; }
.search-wrap { margin-left:auto; position:relative; }
.search-input { height:26px; padding:0 10px 0 28px; border:0.5px solid var(--border-md); border-radius:20px; background:var(--bg1); font-size:11.5px; color:var(--text); width:170px; font-family:var(--font); }
.search-input:focus { outline:none; border-color:var(--accent); background:var(--bg0); }
.search-icon { position:absolute; left:9px; top:50%; transform:translateY(-50%); font-size:13px; color:var(--text3); pointer-events:none; }

/*  Page header (slimmer inside shell)  */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.1rem; gap:.75rem; flex-wrap:wrap; }
.page-title { font-size:1rem; font-weight:500; letter-spacing:-.2px; }
.page-title::before { width:16px; height:2px; margin-bottom:.35rem; }

/*  Footer  */
.footer { display:none; }

/*  Responsive  */
@media(max-width:900px) {
  .shell { grid-template-columns:1fr; }
  .sidebar { display:none; }
  .navbar { display:flex; }
  .stats-row { grid-template-columns:repeat(3,1fr); }
}
@media(max-width:600px) {
  .stats-row { grid-template-columns:1fr 1fr; }
  .kanban-board { grid-template-columns:1fr; }
}


/*  Checklist  */
.cl-category { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); margin-bottom:.85rem; overflow:hidden; }
.cl-cat-header { display:flex; align-items:center; gap:.75rem; padding:.7rem 1rem; border-bottom:0.5px solid var(--border); }
.cl-cat-name { font-size:.9rem; font-weight:500; letter-spacing:-.1px; }
.cl-cat-sub  { font-size:.75rem; color:var(--text3); margin-top:1px; }
.cl-progress { display:flex; align-items:center; gap:.5rem; font-size:.78rem; color:var(--text3); margin-left:auto; }
.dept-prog-bar { height:4px; background:var(--bg2); border-radius:2px; overflow:hidden; }
.dept-prog-fill { height:100%; border-radius:2px; transition:width .3s; }
.cl-items { display:flex; flex-direction:column; }
.cl-item { display:flex; align-items:flex-start; gap:.65rem; padding:.65rem 1rem; border-bottom:0.5px solid var(--border); transition:background .1s; }
.cl-item:last-child { border-bottom:none; }
.cl-item:hover { background:var(--bg2); }
.cl-ok   { background:rgba(59,109,17,.04); }
.cl-issue { background:rgba(232,56,13,.05); }
.cl-na   { opacity:.55; }
.cl-status-col { flex-shrink:0; padding-top:1px; }
.cl-status-btn { cursor:pointer; width:24px; height:24px; display:flex; align-items:center; justify-content:center; border-radius:4px; transition:background .1s; }
.cl-status-btn:hover { background:var(--bg3); }
.cl-item-body  { flex:1; min-width:0; }
.cl-item-label { font-size:.88rem; font-weight:500; margin-bottom:.15rem; }
.cl-ok   .cl-item-label { text-decoration:line-through; color:var(--text2); }
.cl-item-notes   { font-size:.78rem; color:var(--text3); margin-bottom:.3rem; }
.cl-item-checker { font-size:.72rem; color:var(--text3); margin-top:.2rem; }
.cl-links { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:.4rem; }
.cl-link  { display:inline-flex; align-items:center; gap:.3rem; font-size:.74rem; padding:.15rem .5rem; border-radius:4px; border:0.5px solid; cursor:pointer; transition:background .1s; }
.cl-link-task { border-color:var(--blue); color:var(--blue); background:var(--blue-s); }
.cl-link-task:hover { opacity:.85; }
.cl-link-url  { border-color:var(--border-md); color:var(--text2); text-decoration:none; }
.cl-link-url:hover { border-color:var(--accent); color:var(--accent); text-decoration:none; }
.cl-item-actions { display:flex; gap:.25rem; flex-shrink:0; opacity:0; transition:opacity .1s; }
.cl-item:hover .cl-item-actions { opacity:1; }


/* Checklist team header */
.cl-team-header { display:flex; align-items:center; gap:.6rem; padding:.4rem .85rem; border-left:2px solid; background:var(--bg2); }
.cl-progress { display:flex; align-items:center; gap:.5rem; font-size:.78rem; color:var(--text3); }

/* Item type badges */
.cl-type-badge { display:inline-flex; align-items:center; gap:.25rem; font-size:.68rem; font-weight:500; padding:.1rem .45rem; border-radius:20px; }
.cl-type-resource { background:var(--blue-s); color:var(--blue); }
.cl-type-document { background:var(--amber-s); color:var(--amber); }
.cl-type-person   { background:var(--green-s); color:var(--green); }
.cl-type-material { background:var(--purple-s); color:var(--purple); }
.cl-type-other    { background:var(--bg2); color:var(--text2); }

/* Sidebar user footer - avatar linked to profile */
.sb-user-link { text-decoration:none !important; transition:background .1s; }
.sb-user-link:hover { background:var(--bg2); text-decoration:none; }
.avatar-sb-img { width:28px; height:28px; border-radius:50%; object-fit:cover; flex-shrink:0; border:1.5px solid var(--border-md); }
.sb-bottom-actions { padding:4px 10px 8px; display:flex; }
.sb-signout { font-size:.78rem; color:var(--text3); text-decoration:none; display:flex; align-items:center; gap:.4rem; padding:.3rem .5rem; border-radius:var(--r); transition:color .1s,background .1s; width:100%; }
.sb-signout:hover { color:var(--accent); background:var(--accent-s); text-decoration:none; }

/* Meeting cards */
.meeting-card { background:var(--bg0); border:0.5px solid var(--border); border-radius:var(--r-lg); padding:.85rem 1rem; display:flex; align-items:flex-start; gap:.85rem; transition:box-shadow .12s; }
.meeting-card:hover { box-shadow:var(--shadow); }
.meeting-past { opacity:.65; }
.meeting-date-block { flex-shrink:0; width:44px; text-align:center; border-left:3px solid; padding:.2rem .4rem; border-radius:0 var(--r) var(--r) 0; }
.meeting-day { font-size:1.3rem; font-weight:600; line-height:1; letter-spacing:-.5px; }
.meeting-weekday { font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--text3); }
.meeting-body { flex:1; min-width:0; }
.meeting-actions { display:flex; flex-direction:column; gap:.3rem; flex-shrink:0; opacity:0; transition:opacity .12s; }
.meeting-card:hover .meeting-actions { opacity:1; }

/* App footer */
.app-footer {
  padding: .6rem 1.25rem;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .74rem;
  color: var(--text3);
  background: var(--bg0);
  flex-shrink: 0;
}
.app-footer-copy { font-weight: 600; letter-spacing: .04em; }
.app-footer-sep  { width: 3px; height: 3px; border-radius: 50%; background: var(--border-md); }
.app-footer-app  { opacity: .7; }

/* Sidebar logo image */
.sb-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--r);
  flex-shrink: 0;
}

/* Sidebar event switcher */
.sb-event-select {
  width: 100%;
  background: var(--bg0);
  border: 0.5px solid var(--border-md);
  color: var(--text);
  border-radius: var(--r);
  padding: .3rem .5rem;
  font-size: .82rem;
  font-family: var(--font);
  cursor: pointer;
  margin-bottom: .2rem;
}
.sb-event-select:focus { outline: none; border-color: var(--accent); }

/* Checklist status button - flat, no 3D background */
.cl-status-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .1s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.cl-status-btn:hover {
  background: var(--bg3) !important;
}
.cl-status-btn:active {
  background: var(--bg2) !important;
}

/* Task card done state */
.task-card.tc-done .tc-title { text-decoration: line-through; opacity: .65; }

/* Storyboard dept row */
.sb-dept-row + .sb-dept-row { border-top: 0.5px solid var(--border); padding-top: 1.25rem; }

/*  Timeline  */
.tl-outer { display:flex; flex-direction:column; gap:0; }
.tl-row   { display:flex; align-items:stretch; min-height:28px; }
.tl-row:hover .tl-track { background:var(--bg2); }
.tl-label {
  width:200px; min-width:200px; max-width:200px;
  padding:.3rem .5rem .3rem .75rem;
  font-size:.82rem; color:var(--text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  border-right:0.5px solid var(--border);
  display:flex; align-items:center;
  flex-shrink:0;
}
.tl-track {
  flex:1; position:relative; min-height:26px;
  border-bottom:0.5px solid var(--border);
}
.tl-bar {
  position:absolute; top:4px; bottom:4px;
  border-radius:4px; display:flex; align-items:center;
  padding:0 6px; font-size:.68rem; color:#fff;
  white-space:nowrap; overflow:hidden;
  transition:filter .15s;
}
.tl-bar:hover { filter:brightness(1.15); }
.tl-bar-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* 
   MOBILE LAYOUT  (<=768px)
 */
@media (max-width: 768px) {

  /* Hide desktop sidebar, show mobile chrome */
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  /* When sidebar is open via hamburger */
  .sidebar.mob-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 80vw; max-width: 300px;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .mob-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 199;
  }
  .mob-overlay.active { display: block; }

  /* Top mobile bar */
  .mob-topbar {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    padding: .55rem .85rem;
    background: var(--bg0);
    border-bottom: 0.5px solid var(--border);
    position: sticky; top: 0; z-index: 100;
  }
  .mob-topbar-title {
    flex: 1;
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
  }
  .mob-topbar-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
  }
  .mob-ham {
    background: none; border: none;
    color: var(--text); cursor: pointer;
    font-size: 1.25rem; padding: .25rem .4rem;
    border-radius: var(--r);
    flex-shrink: 0;
  }
  .mob-ham:hover { background: var(--bg2); }

  /* Hide desktop topbar on mobile */
  .topbar { display: none !important; }

  /* Bottom navigation */
  .mob-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg0);
    border-top: 0.5px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mob-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: .5rem .25rem .45rem;
    text-decoration: none;
    color: var(--text3);
    font-size: .6rem;
    font-weight: 500;
    gap: .15rem;
    transition: color .15s;
    border: none; background: none; cursor: pointer;
  }
  .mob-nav-item.active { color: var(--accent); }
  .mob-nav-item .mob-icon { font-size: 1.1rem; line-height: 1; }

  /* Push content above bottom nav */
  .main { padding-bottom: 60px; }

  /* Container padding */
  .container { padding: .75rem; }

  /* Task cards: full width stacked */
  .task-card { width: 100% !important; }

  /* Storyboard dept rows */
  .sb-dept-row > div { flex-direction: column; }

  /* Table: scroll horizontally */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Kanban: single column scroll */
  .container > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: .5rem !important;
  }

  /* Modals: full-screen bottom sheet on mobile */
  .modal-overlay {
    align-items: flex-end;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Hide non-essential elements */
  .filterbar { flex-wrap: wrap; gap: .4rem; }

  /* Timeline: narrower label */
  .tl-label { width: 120px !important; min-width: 120px !important; max-width: 120px !important; font-size: .7rem !important; }

  /* Meeting cards: simpler layout */
  .card > div[style*="display:flex"] { flex-direction: column; gap: .6rem; }

  /* Multi-select boxes */
  .multi-select-box { max-height: 140px !important; }

  /* Form rows: single column */
  .form-row { grid-template-columns: 1fr !important; }

  /* Org report filters: single column */
  .card > form > div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Show mob-topbar and mob-nav only on mobile */
.mob-topbar { display: none; }
.mob-nav    { display: none; }
.mob-overlay { display: none; }

/* Additional mobile helpers */
@media (max-width: 768px) {
  .mob-hide { display: none !important; }
  /* Task cards full-width on mobile */
  .sb-dept-row .task-card,
  .task-card { width: 100% !important; max-width: 100% !important; }
  /* Storyboard dept section */
  .sb-dept-row > div[style*="flex-wrap:wrap"] {
    flex-direction: column !important;
  }
  /* Kanban column full width */
  .tl-outer { min-width: unset !important; }
  /* Compact task card on mobile */
  .tc-body { padding: .55rem .75rem; }
  .tc-title { font-size: .88rem; }
  /* Download page: full width checkboxes */
  .dl-row { flex-wrap: wrap; }
  /* Alert */
  .alert { font-size: .84rem; }
}
