/* Command Center — monday-style: full-width grouped tables, inline editing. */
:root {
  --bg: #f6f7f9;
  --bg2: #ffffff;
  --row-hover: #f4f6f9;
  --line: #e4e6ec;
  --line2: #eef0f4;
  --text: #1a1c28;
  --muted: #626880;
  --faint: #9aa0b4;
  --internal: #2f6fed;
  --portfolio: #ef8b1a;
  --sarah: #e0479e;
  --personal: #8b5cf6;
  --urgent: #e5484d;
  --thisweek: #17915a;
  --next2: #d63c93;
  --later: #d98a00;
  --nodeadline: #2f6fed;
  --done: #17915a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: Inter, "Helvetica Neue", system-ui, -apple-system, sans-serif; font-size: 14px; }

/* toolbar */
.toolbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.tb-left { display: flex; align-items: baseline; gap: 12px; }
.tb-left strong { font-size: 15px; }
.freshness { color: var(--faint); font-size: 12px; }
.new-btn { border: none; background: var(--internal); color: #fff; font: inherit; font-weight: 700; padding: 8px 15px; border-radius: 8px; cursor: pointer; }
.new-btn:hover { filter: brightness(1.06); }

/* tabs */
.tabs { position: sticky; top: 49px; z-index: 19; display: flex; gap: 2px; padding: 6px 24px 0; background: var(--bg2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: none; background: none; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); padding: 9px 15px; border-radius: 8px 8px 0 0; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--bg); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab.tab-internal-ops.active { border-bottom-color: var(--internal); }
.tab.tab-portfolio-ops.active { border-bottom-color: var(--portfolio); }
.tab.tab-sarah-support.active { border-bottom-color: var(--sarah); }
.tab.tab-personal.active { border-bottom-color: var(--personal); }

/* view + groups */
.view { padding: 14px 24px 100px; }
.grp { margin-bottom: 26px; }
.grp-head { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; padding: 3px 2px 7px; }
.grp-head .caret { color: var(--faint); font-size: 11px; transition: transform .12s; }
.grp.collapsed .caret { transform: rotate(-90deg); }
.grp.collapsed .tbl-wrap, .grp.collapsed .res-bar { display: none; }
.grp-title { font-weight: 800; font-size: 15px; }
.grp-title.g-urgent { color: var(--urgent); } .grp-title.g-thisweek { color: var(--thisweek); }
.grp-title.g-next2 { color: var(--next2); } .grp-title.g-later { color: var(--later); }
.grp-title.g-nodeadline { color: var(--nodeadline); } .grp-title.g-done { color: var(--done); }
.grp-count { color: var(--faint); font-weight: 700; font-size: 12.5px; }

/* resources bar */
.res-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.res-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin-right: 4px; }
.res-link { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--internal); text-decoration: none; }
.res-link:hover { border-color: var(--internal); }
.res-link.empty { color: var(--faint); border-style: dashed; }

/* tables */
.tbl-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg2); box-shadow: 0 1px 2px rgba(0,0,0,0.04); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 700; padding: 9px 12px; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody td { padding: 0; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.mrow:hover { background: var(--row-hover); }
.mrow.is-done .pname { text-decoration: line-through; color: var(--faint); }
.c-check { width: 40px; padding-left: 12px !important; }
.c-exp { width: 26px; }
.c-name { min-width: 260px; }
.c-date { width: 150px; } .c-status { width: 130px; } .c-conn { width: 170px; } .c-cat { width: 140px; }
.c-category, .c-priority, .c-source { width: 130px; } .c-text { min-width: 160px; }

/* cells */
.cell, .c-name, .c-check, .c-exp, .c-date, .c-status, .c-conn, .c-cat { padding: var(--cellpad, 24px) 14px; }
.cell { cursor: pointer; color: var(--ink, var(--text)); }
.cell:hover { background: rgba(47,111,237,0.06); box-shadow: inset 0 0 0 1px var(--line); }
.cell-empty { color: var(--faint); }
.cell input, .cell select { width: 100%; font: inherit; padding: 6px 7px; border: 1px solid var(--internal); border-radius: 6px; background: var(--bg2); color: var(--text); }
.pname { font-weight: var(--name-weight, 500); color: var(--ink, var(--text)); cursor: text; }
.st-name { color: var(--ink, var(--text)); }

/* pastel label pill (editable colors) */
.cpill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 7px; white-space: nowrap; }
.grp-chip { font-weight: 600; font-size: 14px; padding: 4px 13px; border-radius: 8px; }
.ghost-btn { border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-weight: 600; padding: 8px 13px; border-radius: 8px; cursor: pointer; margin-right: 8px; }
.ghost-btn:hover { background: var(--row-hover); }
.pname.link { color: var(--internal); cursor: pointer; }
.name-wrap { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.name-wrap input { font: inherit; font-weight: 600; padding: 4px 6px; border: 1px solid var(--internal); border-radius: 6px; width: 60%; }
.row-sub { color: var(--faint); font-size: 12px; display: inline-flex; gap: 6px; }
.mini-chip { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line2); border-radius: 999px; padding: 1px 8px; }
.exp-btn { display: inline-block; color: var(--faint); cursor: pointer; transition: transform .12s; font-size: 12px; }
.exp-btn.open { transform: rotate(90deg); color: var(--text); }

/* pills */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; white-space: nowrap; }
.spill { color: #fff; }
.spill.st-done { background: var(--done); } .spill.st-progress { background: var(--internal); }
.spill.st-blocked { background: var(--urgent); } .spill.st-waiting { background: var(--later); color: #201400; }
.spill.st-none { background: #e2e5ec; color: var(--muted); }
.pill.hat-internal { background: var(--internal); color: #fff; } .pill.hat-portfolio { background: var(--portfolio); color: #201400; }
.pill.hat-sarah { background: var(--sarah); color: #fff; } .pill.hat-personal { background: var(--personal); color: #fff; }
.connect-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--bg); cursor: pointer; }
.connect-pill:hover { border-color: var(--muted); color: var(--text); }
.date-cell { font-variant-numeric: tabular-nums; }
.date-cell.overdue { color: var(--urgent); font-weight: 700; }
.date-cell.soon { font-weight: 700; }

/* checkbox */
.cbx { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--faint); display: inline-grid; place-items: center; cursor: pointer; }
.cbx.sm { width: 15px; height: 15px; }
.cbx.checked { background: var(--done); border-color: var(--done); }
.cbx.checked::after { content: "✓"; color: #fff; font-size: 11px; font-weight: 800; }

/* add row */
.addrow td { padding: 6px 12px; }
.addrow input { width: 100%; border: none; background: none; font: inherit; color: var(--muted); outline: none; }
.addrow input::placeholder { color: var(--faint); }

/* detail (inline expand: sub-tasks + files) */
.detailrow td { padding: 0; background: #fafbfd; border-bottom: 1px solid var(--line); }
.detail { padding: 12px 16px 14px 60px; }
.detail-h { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin: 8px 0 6px; }
.subtable { display: flex; flex-direction: column; gap: 5px; }
.st-row { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.st-row.st-done { opacity: 0.6; } .st-row.st-done .st-name { text-decoration: line-through; }
.st-name { flex: 1; font-size: 13px; cursor: text; }
.st-name input { width: 100%; font: inherit; padding: 3px 5px; border: 1px solid var(--internal); border-radius: 5px; }
.st-bits { display: flex; align-items: center; gap: 6px; }
.st-add input { width: 100%; font: inherit; padding: 7px 10px; border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--muted); }
.files-list { display: flex; flex-direction: column; gap: 5px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.file-link { font-size: 12.5px; font-weight: 600; color: var(--internal); text-decoration: none; word-break: break-word; }
.file-link:hover { text-decoration: underline; }
.file-add { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.file-add input { flex: 1 1 120px; font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; }
.file-add button, .st-add button { border: none; background: var(--internal); color: #fff; border-radius: 7px; padding: 0 13px; font-weight: 700; cursor: pointer; }
.mini-x { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 13px; padding: 2px 5px; }
.mini-x:hover { color: var(--urgent); }
.detail-actions { margin-top: 12px; }
.detail-actions .danger { border: 1px solid var(--line); background: var(--bg2); color: var(--urgent); border-radius: 8px; padding: 7px 13px; font: inherit; font-weight: 600; cursor: pointer; }

.empty-note { color: var(--faint); font-style: italic; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1a1c28; color: #fff; padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; z-index: 50; }

/* login gate */
.login-scrim { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 100; }
.login-card { width: 340px; max-width: 90vw; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.12); text-align: center; }
.login-title { font-size: 18px; font-weight: 800; }
.login-sub { color: var(--muted); font-size: 13px; margin: 6px 0 16px; }
.login-card input { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); }
.login-err { color: var(--urgent); font-size: 12.5px; min-height: 16px; margin: 8px 0; }
.login-btn { width: 100%; border: none; background: var(--internal); color: #fff; font: inherit; font-weight: 700; padding: 11px; border-radius: 9px; cursor: pointer; }
.login-btn:hover { filter: brightness(1.06); }

/* color editor modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.28); z-index: 60; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 560px; max-width: 94vw; max-height: 84vh; background: var(--bg2); border-radius: 14px; z-index: 61; box-shadow: 0 20px 50px rgba(0,0,0,0.25); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; }
.ce-sect { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin: 16px 0 8px; }
.ce-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.ce-row > .cpill, .ce-row > .cell-empty { min-width: 140px; }
.ce-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.ce-sw { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.ce-sw:hover { border-color: var(--muted); }
.ce-sw.cur { border-color: var(--text); }
.ce-name { min-width: 110px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ce-row input[type="range"] { flex: 1; max-width: 260px; }
.ce-row input[type="color"] { width: 44px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; padding: 2px; }
.mini-btn { border: 1px solid var(--line); background: var(--bg2); color: var(--muted); border-radius: 7px; padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.mini-btn:hover { background: var(--row-hover); }
.wt-btn { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 7px; padding: 6px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.wt-btn:hover { background: var(--row-hover); }
.wt-btn.cur { border-color: var(--internal); background: rgba(47,111,237,0.08); }
