/* Nexstar LD Mods — the sheet, minus the spreadsheet. */

:root {
  --ink: #10151c;
  --ink-2: #4a5566;
  --ink-3: #7b8797;
  --line: #dfe3e8;
  --line-2: #eef1f4;
  --bg: #f5f6f8;
  --panel: #fff;
  --brand: #1a4b8c;
  --brand-2: #2f6fc4;

  /* Straight from the sheet's own palette, so a row looks like it always did. */
  --green: #d9ead3;
  --green-dark: #274e13;
  --red: #f4cccc;
  --yellow: #fff2cc;
  --sent: #d9ead3;

  --row-h: 38px;
  --shadow: 0 1px 2px rgba(16,21,28,.06), 0 6px 20px rgba(16,21,28,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- topbar */

.top {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; letter-spacing: -.01em; }
.brand img { height: 30px; width: auto; display: block; }
.brand-bar { width: 1px; height: 22px; background: var(--line); display: inline-block; }
.brand span { color: var(--ink-2); font-weight: 600; }
.brand small { color: var(--ink-3); font-weight: 500; }

/* A row arrived at from an email deep link: pulse it so the eye lands on it. */
@keyframes urHilite {
  0%, 78% { background: #fff7d6; box-shadow: inset 0 0 0 2px #efc200; }
  100%    { background: transparent; box-shadow: inset 0 0 0 2px transparent; }
}
tr.hilite > td { animation: urHilite 6s ease-out; }
.card.hilite { animation: urHilite 6s ease-out; }

.search {
  flex: 1; max-width: 380px; position: relative;
}
.search input {
  width: 100%; padding: 7px 11px 7px 30px; border: 1px solid var(--line);
  border-radius: 7px; background: #fbfcfd; outline: none;
}
.search input:focus { border-color: var(--brand-2); background: #fff; }
.search::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%);
  color: var(--ink-3); font-size: 15px;
}

.spacer { flex: 1; }

/* account button + sign-in gate */
.acct {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fbfcfd; border-radius: 999px; padding: 5px 12px; cursor: pointer;
  color: var(--ink); font-weight: 600; font-size: 12px; max-width: 200px;
}
.acct:hover { border-color: var(--ink-3); }
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-caret { color: var(--ink-3); }
.acctpop .head { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.acctpop .opt.danger { color: #8c2f22; }

.gate {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  background: linear-gradient(160deg, #eef2f7, #f5f6f8 60%); padding: 20px;
}
.gatecard {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 26px 26px 22px; text-align: center;
}
.gatelogo { height: 46px; width: auto; margin-bottom: 10px; }
.gatetitle { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.gatesub { color: var(--ink-3); margin: 3px 0 16px; }
.gatestep { text-align: left; }
.gatesearch, .gatepw {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  outline: none; font: inherit; box-sizing: border-box;
}
.gatesearch:focus, .gatepw:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47,111,196,.12); }
.gatelist { margin-top: 10px; max-height: 46vh; overflow: auto; border: 1px solid var(--line-2); border-radius: 10px; }
.gatename {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  border: 0; border-bottom: 1px solid var(--line-2); background: none; text-align: left;
  padding: 10px 12px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.gatename:last-child { border-bottom: 0; }
.gatename:hover { background: #f2f5f9; color: var(--brand); }
.gaterole { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.gatehint { padding: 16px; text-align: center; color: var(--ink-3); font-size: 13px; }
.gateback { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0 0 10px; font-size: 12px; }
.gatewho { margin-bottom: 12px; font-size: 16px; }
.gatewho b { display: block; }
.gatewho span { color: var(--ink-3); font-size: 12px; }
.gatepw { margin-bottom: 10px; }
.gatego { width: 100%; padding: 10px; }
.gateerr { color: #8c2f22; font-size: 13px; margin-bottom: 8px; }

@media (max-width: 760px) { .acct { max-width: 130px; } }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: #fbfcfd; color: var(--ink-2); font-size: 12px; cursor: pointer;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); font-style: normal; }
.pill.s-live i { background: #29a35a; }
.pill.s-sync i { background: #d9a300; }
.pill.s-off  i { background: #cc4b37; }
.who { color: var(--ink-3); font-size: 12px; }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 7px 12px; cursor: pointer; font-weight: 550;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn:disabled { opacity: .5; cursor: default; }

/* ------------------------------------------------------------------ grid */

.wrap { padding: 12px 16px 80px; }
.gridbox {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 92px);
}
table { border-collapse: separate; border-spacing: 0; min-width: 1560px; width: 100%; }

thead th {
  position: sticky; top: 0; z-index: 30;
  background: #f7f9fb; border-bottom: 1px solid var(--line);
  padding: 8px 8px; text-align: center; font-size: 11px; font-weight: 650;
  color: var(--ink-2); line-height: 1.25; vertical-align: bottom;
  white-space: normal;
}
thead th.l { text-align: left; }
th.sticky-l, td.sticky-l { position: sticky; left: 0; z-index: 20; background: var(--panel); }
thead th.sticky-l { z-index: 40; background: #f7f9fb; }

/* The two frozen columns need identical widths in the head and the body, or
   the header for the next column gets clipped underneath them. */
th.sticky-n, td.sticky-n {
  position: sticky; left: 0; z-index: 20; background: var(--panel);
  width: 58px; min-width: 58px; max-width: 58px;
}
thead th.sticky-n { z-index: 40; background: #f7f9fb; }
th.sticky-h, td.sticky-h {
  position: sticky; left: 58px; z-index: 20; background: var(--panel);
  box-shadow: 1px 0 0 var(--line);
  width: 210px; min-width: 210px; max-width: 210px;
}
thead th.sticky-h { z-index: 40; background: #f7f9fb; }

tbody td {
  border-bottom: 1px solid var(--line-2); padding: 4px 8px; vertical-align: middle;
  height: var(--row-h);
}
tbody tr:hover td { background: #f9fbfd; }
tbody tr:hover td.sticky-n, tbody tr:hover td.sticky-h { background: #f9fbfd; }
td.c { text-align: center; }

/* The sheet painted column A green / red / dark green. Here it is a spine on
   the row number, which reads the same at a glance without the noise. */
td.num { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px;
  text-align: right; padding-right: 10px; position: relative; }
td.num::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent;
}
tr.st-active   td.num::before { background: #7fb069; }
tr.st-declined td.num::before { background: #d1655a; }
tr.st-completed td.num::before { background: var(--green-dark); }
tr.st-approved_paid td.num::before { background: #3f7d3f; }

td.house { font-weight: 600; }
td.desc  { min-width: 340px; max-width: 520px; color: var(--ink-2); }
td.house .cellin, td.desc .cellin {
  display: block; width: 100%; border: 1px solid transparent; background: transparent;
  border-radius: 5px; padding: 3px 5px; resize: none; overflow: hidden;
  min-height: 24px; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
  font: inherit; cursor: text; outline: none;
}
td.house .cellin:hover, td.desc .cellin:hover { border-color: var(--line); }
td.house .cellin:focus, td.desc .cellin:focus {
  border-color: var(--brand-2); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(47,111,196,.12);
}

/* checkbox cells */
.cb {
  appearance: none; width: 17px; height: 17px; border: 1.5px solid #b9c2cd;
  border-radius: 4px; background: #fff; cursor: pointer; display: inline-block;
  vertical-align: middle; position: relative; transition: background .1s, border-color .1s;
}
.cb:hover { border-color: var(--brand-2); }
.cb:checked { background: var(--brand); border-color: var(--brand); }
.cb:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}
.cb:disabled { opacity: .35; cursor: not-allowed; }

/* multi-select cells */
.chips {
  display: flex; flex-wrap: wrap; gap: 3px; align-items: center; cursor: pointer;
  min-height: 24px; padding: 2px 4px; border: 1px solid transparent; border-radius: 5px;
  min-width: 130px;
}
.chips:hover { border-color: var(--line); background: #fff; }
.chip {
  background: #eaf1fa; color: var(--brand); border-radius: 4px;
  padding: 1px 6px; font-size: 11px; white-space: nowrap; font-weight: 550;
}
.chips.empty::before { content: "—"; color: #c3cbd5; }
td.rec { min-width: 200px; max-width: 260px; }
td.rep { min-width: 140px; max-width: 190px; }
tr.sent td.rec .chips { background: var(--sent); border-color: #bcd6b4; }

/* chat + files + send */
.iconbtn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 3px 8px; cursor: pointer; font-size: 12px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.iconbtn:hover { border-color: var(--brand-2); color: var(--brand); }
.iconbtn.has { background: var(--yellow); border-color: #e6d9a8; color: #6b5600; }
.iconbtn.send { font-weight: 600; }
.iconbtn.send:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

td.files { min-width: 190px; max-width: 260px; }
.filelist { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.filechip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 150px;
  background: #f1f3f6; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; font-size: 11px; text-decoration: none; color: var(--ink-2);
}
.filechip:hover { border-color: var(--brand-2); color: var(--brand); }
.filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

td.stamp { min-width: 150px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
td.stamp b { color: var(--ink); font-weight: 600; }
td.stamp .cl { color: var(--brand); font-weight: 600; }

/* The whole send record for one row, on hover of its stamp cell. Sits above
   the sticky header and the drawer scrim but below modals. */
.sendpop {
  position: fixed; z-index: 310;
  width: 340px; max-height: min(460px, calc(100vh - 24px)); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow); font-size: 12px; color: var(--ink-2);
  white-space: normal; line-height: 1.4;
}
.sp-top {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 12px; background: #f7f9fb; border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-top b { color: var(--ink); }
.sp-send { padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.sp-send:last-of-type { border-bottom: 0; }
.sp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sp-head b { color: var(--ink); font-size: 12.5px; font-weight: 650; }
.sp-head span { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.sp-by { color: var(--ink-3); font-size: 11px; margin-top: 1px; }
.sp-cl { margin-top: 6px; color: var(--brand); font-weight: 600; font-size: 11.5px; }
.sp-sibs {
  margin-top: 4px; padding: 5px 8px;
  background: #f4f7fb; border-left: 2px solid var(--brand-2); border-radius: 0 6px 6px 0;
}
.sp-sibs div { color: var(--ink-2); font-size: 11px; padding: 1px 0; }
.sp-sibs b { color: var(--brand); font-weight: 650; }
.sp-line { display: flex; gap: 8px; margin-top: 5px; }
.sp-line > span {
  flex: 0 0 22px; color: var(--ink-3); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-top: 1px;
}
.sp-line > div { flex: 1; color: var(--ink); overflow-wrap: anywhere; }
.sp-legacy { margin-top: 5px; color: var(--ink-3); font-size: 10.5px; font-style: italic; }
.sp-foot {
  position: sticky; bottom: 0;
  padding: 7px 12px; background: #f7f9fb; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 10.5px; text-align: center;
}

/* ------------------------------------------------------- section banding */

tr.band td {
  /* --head-h is measured from the real header, which wraps to different
     heights depending on the width available. */
  position: sticky; top: var(--head-h, 86px); z-index: 25;
  background: #eef2f7; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 7px 12px; font-weight: 700; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-2); cursor: pointer;
}
tr.band td .n { color: var(--ink-3); font-weight: 600; margin-left: 8px; text-transform: none;
  letter-spacing: 0; }
tr.band td .caret { display: inline-block; width: 12px; color: var(--ink-3); }
tr.band.pending td { background: #f0f2f5; }
tr.band.active td { background: #e8f2e4; color: #33591f; }
tr.band.approved_paid td { background: #e2eede; color: #2c5220; }
tr.band.declined td { background: #f9e6e4; color: #8c3a30; }
tr.band.completed td { background: #dde9d8; color: var(--green-dark); }

/* ------------------------------------------------------------- new request */

.newrow td { background: #fffdf3; border-bottom: 2px solid #e8dfb8; }
.newrow .cellin { border-color: var(--line); background: #fff; }
.newbar {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: #fffdf3; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 45; font-size: 12px; color: #6b5600;
}

/* ------------------------------------------------------------------ popover */

.pop {
  position: fixed; z-index: 300; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 240px;
  max-height: 340px; overflow: auto;
}
.pop .opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  cursor: pointer;
}
.pop .opt:hover { background: #f2f5f9; }
.pop .opt.on { background: #eaf1fa; color: var(--brand); font-weight: 600; }
.pop .opt .tick { width: 14px; color: var(--brand); }
.pop .opt .sub { color: var(--ink-3); font-size: 11px; font-weight: 400; margin-left: auto; }
.pop .head { padding: 6px 8px 4px; color: var(--ink-3); font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; }

/* ------------------------------------------------------------------ drawer */

.scrim { position: fixed; inset: 0; background: rgba(16,21,28,.28); z-index: 280; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--panel); z-index: 290; display: flex; flex-direction: column;
  box-shadow: -8px 0 28px rgba(16,21,28,.16);
}
.drawer header {
  padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px;
  align-items: flex-start;
}
.drawer header .t { font-weight: 650; }
.drawer header .s { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.drawer header .x {
  margin-left: auto; border: none; background: none; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--ink-3); padding: 0 2px;
}
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button {
  border: none; background: none; padding: 7px 11px; cursor: pointer; border-radius: 7px 7px 0 0;
  color: var(--ink-3); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.dbody { flex: 1; overflow: auto; padding: 14px 16px; }
.dfoot { border-top: 1px solid var(--line); padding: 10px 12px; }
.dfoot textarea {
  width: 100%; min-height: 62px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; resize: vertical; outline: none;
}
.dfoot textarea:focus { border-color: var(--brand-2); }

.msg { background: #f2f4f7; border-radius: 10px; padding: 8px 10px; margin-bottom: 9px;
  position: relative; }
.msg .m { font-size: 11px; font-weight: 650; color: var(--ink-2); }
.msg .m .when { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.msg .b { white-space: pre-wrap; margin-top: 3px; }
.msg .del { position: absolute; top: 5px; right: 7px; border: none; background: none;
  color: #c3cbd5; cursor: pointer; font-size: 12px; }
.msg:hover .del { color: #cc4b37; }
.msg.mine { background: #eaf1fa; }

.hist { font-size: 12px; }
.hist li { list-style: none; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.hist .n { font-weight: 650; }
.hist .cl { color: var(--brand); font-weight: 600; }
.hist .to { color: var(--ink-3); }

.drop {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center;
  color: var(--ink-3); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--brand-2); color: var(--brand); background: #f7fafe; }

/* ------------------------------------------------------------------ modal */

.modal {
  position: fixed; z-index: 320; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100% - 32px)); max-height: 84vh; overflow: auto;
  background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 20px 22px;
}
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal .sub { color: var(--ink-3); margin-bottom: 14px; }
.modal .grp { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; }
.modal .grp h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); }
.modal .addr { font-size: 12px; padding: 2px 0; }
.modal .addr .role { font-weight: 600; }
.modal .warn { background: #fff6e5; border-color: #eddcb4; color: #7a5a00; }
/* one-of-N choice in a modal — e.g. which home a mismatched ChainLink uses */
.modal .pickone {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer; font-size: 13px;
}
.modal .pickone:first-of-type { margin-top: 0; }
.modal .pickone:hover { background: var(--line-2); }
.modal .pickone input { accent-color: #1e3a5f; margin: 0; flex: none; }
.modal .pickone span { font-weight: 600; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* --------------------------------------------------------------- ask panel */

.askfab {
  position: fixed; right: 20px; bottom: 20px; z-index: 260;
  border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 650; font-size: 13px;
  box-shadow: 0 4px 14px rgba(26,75,140,.32);
}
.askfab:hover { background: var(--brand-2); }
.askfab::before { content: "✦ "; }

.askwrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 265;
  width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 100px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(16,21,28,.22); display: flex; flex-direction: column;
  overflow: hidden;
}
.askhead { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px;
  border-bottom: 1px solid var(--line); }
.askhead .t { font-weight: 650; }
.askhead .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.askhead .x { margin-left: auto; border: 0; background: none; font-size: 20px;
  line-height: 1; cursor: pointer; color: var(--ink-3); }
.asklog { flex: 1; overflow: auto; padding: 14px 16px; }
.askfoot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; }
.askfoot textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  resize: none; outline: none; font: inherit;
}
.askfoot textarea:focus { border-color: var(--brand-2); }

.askmsg { margin-bottom: 12px; font-size: 13px; line-height: 1.5; }
.askmsg.user {
  background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 12px 12px 3px 12px;
  margin-left: auto; max-width: 85%; width: fit-content; white-space: pre-wrap;
}
.askmsg.bot { background: #f2f4f7; padding: 9px 12px; border-radius: 12px 12px 12px 3px;
  max-width: 92%; width: fit-content; }
.askmsg.thinking { color: var(--ink-3); font-style: italic; }
.askev { margin-top: 8px; max-height: 190px; overflow: auto;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.askev table { min-width: 0; width: 100%; font-size: 11px; }
.askev th {
  position: sticky; top: 0; background: #f7f9fb; text-align: left; padding: 5px 7px;
  font-weight: 650; color: var(--ink-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.askev td { padding: 4px 7px; border-bottom: 1px solid var(--line-2); vertical-align: top;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.askev tr:last-child td { border-bottom: 0; }
.askevmore { padding: 5px 7px; font-size: 11px; color: var(--ink-3); }
.askmeta { font-size: 11px; color: var(--ink-3); margin-top: 6px;
  display: flex; gap: 8px; align-items: center; }
.asksql { border: 0; background: none; color: var(--brand); cursor: pointer;
  font-size: 11px; padding: 0; text-decoration: underline; }
.askpre {
  margin: 8px 0 0; background: #10151c; color: #d7e0ea; padding: 8px 10px;
  border-radius: 7px; font-size: 11px; overflow-x: auto; white-space: pre-wrap;
  word-break: break-word;
}
.askhint-t { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.askchip {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  border: 1px solid var(--line); background: #fbfcfd; border-radius: 9px;
  padding: 8px 11px; cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.askchip:hover { border-color: var(--brand-2); color: var(--brand); background: #fff; }

@media (max-width: 760px) {
  .askwrap { right: 8px; left: 8px; bottom: 8px; width: auto; height: min(70vh, 520px); }
  .askfab { right: 12px; bottom: 12px; padding: 11px 17px; }
}

/* ---------------------------------------------------------------- history */

.histbox { margin-bottom: 12px; }
.hist-search { max-width: none; margin-bottom: 10px; }
.evlist { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.ev { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.ev:last-child { border-bottom: 0; }
.evicon {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: #eef1f4; font-size: 12px; color: var(--ink-2);
}
.ev.k-create  .evicon { background: #e6f0e2; color: #2c5220; }
.ev.k-delete  .evicon { background: #fbeae7; color: #8c2f22; }
.ev.k-restore .evicon { background: #e6f0e2; color: #2c5220; }
.ev.k-send    .evicon { background: #eaf1fa; color: var(--brand); }
.ev.k-people  .evicon { background: #f3ecfa; color: #5b3d8c; }
.evbody { min-width: 0; flex: 1; }
.evhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.evlink {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--brand);
  font-weight: 650; font-variant-numeric: tabular-nums; font-size: 12px;
}
.evlink:hover { text-decoration: underline; }
.evhouse { font-size: 12px; font-weight: 600; color: var(--ink-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.evtext { font-size: 13px; color: var(--ink); word-break: break-word; }
.evwhen { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.evempty { padding: 22px 14px; color: var(--ink-3); text-align: center; font-size: 12.5px; }
.dbody .evlist { max-height: none; border: 0; }
.dbody .hist-search { display: none; }

/* ----------------------------------------------------------- people panel */

.modal.wide { width: min(780px, calc(100% - 32px)); }
.tabs.plain { border-bottom: 1px solid var(--line); margin-bottom: 14px; padding-left: 0; }

.peoplelist { max-height: 46vh; overflow: auto; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 9px; }
.prow {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
}
.prow:last-child { border-bottom: 0; }
.prow.tall { align-items: flex-start; }
.pname { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pinput {
  width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 5px 7px;
  background: transparent; font-weight: 600; outline: none;
}
.pinput:hover { border-color: var(--line); background: #fff; }
.pinput:focus { border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,196,.12); }
.pinput.mail { font-weight: 400; font-size: 12px; color: var(--ink-2); }
.pmeta { width: 140px; flex: none; font-size: 12px; color: var(--ink-3); }
.cclabel { display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.pacts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  min-width: 190px; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: #8c2f22; border-color: #e6c6c0; }
.btn.danger:hover { background: #8c2f22; border-color: #8c2f22; color: #fff; }
.confirm { font-size: 12px; color: var(--ink-2); display: flex; align-items: center;
  gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.addbox .prow { border: 0; padding: 0; }
.addbox .prow.tall { flex-direction: column; align-items: stretch; }
.addbox .pinput { border-color: var(--line); background: #fff; }

/* the drawer's destructive action, kept away from the tabs */
.dbar { padding: 8px 16px 0; display: flex; justify-content: flex-end; }

/* ------------------------------------------------------------------ toast */

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 400;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #10151c; color: #fff; padding: 9px 14px; border-radius: 8px;
  box-shadow: var(--shadow); max-width: 460px; font-size: 12.5px;
}
.toast.err { background: #8c2f22; }
.toast.ok  { background: #1e6b3f; }
.toast .undo {
  margin-left: 12px; background: rgba(255,255,255,.16); border: 0; color: #fff;
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-weight: 650; font-size: 12px;
}
.toast .undo:hover { background: rgba(255,255,255,.28); }

td.num { cursor: pointer; }
td.num:hover { color: var(--brand); text-decoration: underline; }
.card .id { cursor: pointer; }

/* ------------------------------------------------------------------ phone */

/* A seventeen-column spreadsheet is not a phone screen. Below 760px the same
   rows render as cards — every field is still there and still editable, just
   stacked instead of scrolled sideways. */
.cards { display: none; }

.cardband {
  position: sticky; top: 0; z-index: 25;
  padding: 8px 12px; font-weight: 700; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-2); background: #eef2f7;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer;
}
.cardband .caret { display: inline-block; width: 15px; color: var(--ink-3); }
.cardband .n { color: var(--ink-3); font-weight: 600; margin-left: 8px; text-transform: none; letter-spacing: 0; }
.cardband.active { background: #e8f2e4; color: #33591f; }
.cardband.approved_paid { background: #e2eede; color: #2c5220; }
.cardband.declined { background: #f9e6e4; color: #8c3a30; }
.cardband.completed { background: #dde9d8; color: var(--green-dark); }

.card { border-bottom: 1px solid var(--line-2); padding: 12px 14px 12px 16px; position: relative; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.card.st-active::before { background: #7fb069; }
.card.st-declined::before { background: #d1655a; }
.card.st-completed::before { background: var(--green-dark); }
.card.st-approved_paid::before { background: #3f7d3f; }

.card .id { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.card .h { font-weight: 650; font-size: 15px; margin: 1px 0 4px; }
.card .d { color: var(--ink-2); margin-bottom: 9px; white-space: pre-wrap; }
.card .h .cellin, .card .d .cellin { padding: 2px 4px; border-radius: 5px; }
.card .h .cellin:focus, .card .d .cellin:focus { background: #fff; }

.flags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.flag {
  border: 1px solid var(--line); background: #fbfcfd; border-radius: 999px;
  padding: 4px 11px; font-size: 12px; color: var(--ink-3); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.flag.on { background: #e6f0e2; border-color: #a8c79c; color: #2c5220; font-weight: 600; }
.flag.on::before { content: "✓ "; }

.card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px;
  color: var(--ink-3); margin-bottom: 9px; }
.card .meta b { color: var(--ink-2); font-weight: 600; }
.card .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.card .acts .iconbtn { padding: 6px 12px; }

@media (max-width: 760px) {
  .wrap { padding: 0; }
  .gridbox { max-height: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  table { display: none; }
  .cards { display: block; }
  .top { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .brand small { display: none; }
  .brand span { font-size: 14px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .who { display: none; }
  #addBtn { padding: 7px 10px; }
  .drawer { width: 100%; }
  .modal { width: calc(100% - 20px); padding: 16px; }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .wrap { padding: 8px; }
  .gridbox { max-height: calc(100vh - 76px); border-radius: 8px; }
  .brand small { display: none; }
}

/* ------------------------------------------------ roles, users & messages */

/* a checkbox this person isn't allowed to touch */
td.locked { opacity: .45; cursor: not-allowed; }
td.locked .cb { cursor: not-allowed; }

/* the ✕ that only the owner sees on a History entry */
.evdel {
  flex: none; align-self: center; border: 1px solid transparent; background: none;
  color: var(--ink-3); font-size: 11px; padding: 3px 6px; border-radius: 6px; cursor: pointer;
}
.ev:hover .evdel { border-color: var(--line); }
.evdel:hover { background: #fbeae7; border-color: #e6bdb5; color: #8c2f22; }
.evdel.armed { background: #c0392b; border-color: #c0392b; color: #fff; font-size: 10.5px; }

/* ---- the user dashboard ---- */

.userbox { margin: 12px 0; }
.ulist { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.urow {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-2);
}
.urow:last-child { border-bottom: 0; }
.uwho { flex: 1; min-width: 0; }
.uname { font-weight: 600; font-size: 13px; }
.umeta {
  color: var(--ink-3); font-size: 11.5px; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usel {
  flex: none; border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 8px; background: #fbfcfd; font-size: 12px; cursor: pointer; max-width: 210px;
}
.usel:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 3px rgba(47,111,196,.12); }
.usel:disabled { opacity: .55; }
.utag {
  flex: none; display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef2f7; color: var(--ink-2); font-size: 11px; font-weight: 600;
}
.utag.locked { background: #f2f4f7; color: var(--ink-3); }
.uname .utag { margin-left: 6px; font-weight: 600; }
.uhint { flex: none; color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.rolerow .uwho { padding-right: 6px; }
.ownernote { flex: 1; color: var(--ink-3); font-size: 11.5px; text-align: left; }

/* ---- the role editor ---- */

.roleedit { margin: 10px 0 2px; }
.rl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 600; margin: 12px 0 4px;
}
.rl:first-child { margin-top: 0; }
.roleedit .gatepw { margin-bottom: 0; }
.pgroup {
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  margin: 12px 0 4px; padding-top: 8px; border-top: 1px solid var(--line-2);
}
.pcheck {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.pcheck:hover { background: var(--line-2); }
.pcheck input { accent-color: #1e3a5f; margin: 0; flex: none; }
.pcheck.off { color: var(--ink-3); cursor: not-allowed; }
.pcheck.off:hover { background: none; }
.roleedit-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.attnote {
  margin: 8px 0 0; padding: 6px 10px; border-radius: 7px;
  background: #fff7d6; color: #6b5600; font-size: 11.5px;
}
.linkbtn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--brand); font-weight: 600; text-decoration: underline; font-size: inherit;
}


/* the People tab's toolbar, and the sections inside the list */
.ubar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.ubar .search { flex: 1; margin-bottom: 0; }
.ubar .btn { flex: none; }
.ufoot { margin-top: 8px; font-size: 11.5px; }
.usect {
  padding: 7px 12px; background: #f7f9fb;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 600;
}
.urow.gone .uname, .urow.gone .umeta { color: var(--ink-3); }
.urow.gone .uname { text-decoration: line-through; text-decoration-color: var(--line); }
.utag.warn { background: #fff2cc; color: #6b5600; }
.hintline { color: var(--ink-3); font-size: 11px; margin-top: 4px; }
.fixedhead {
  padding: 9px 11px; margin-bottom: 4px; border-radius: 8px;
  background: #eef2f7; color: var(--ink-2); font-size: 12px;
}
.fixedhead b { color: var(--ink); }
.roleedit .attnote { margin-top: 8px; }

/* ------------------------------------------------- who else is on the board */

.here { display: flex; align-items: center; gap: -2px; }
.here[hidden] { display: none; }
.face {
  display: grid; place-items: center;
  width: 26px; height: 26px; margin-left: -6px; border-radius: 50%;
  background: var(--ink-3); color: #fff; border: 2px solid var(--panel);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  cursor: default; user-select: none; transition: transform .12s ease;
}
.face:first-child { margin-left: 0; }
.face:hover { transform: translateY(-1px) scale(1.08); z-index: 2; }
.face.you { box-shadow: 0 0 0 2px var(--brand-2); }
.face.more { background: #e7ebf0; color: var(--ink-2); font-size: 10px; }

/* The name, the instant you point at a face. The browser's own tooltip makes
   you wait about a second for it, which is long enough to give up. */
.face { position: relative; }
.face::after {
  content: attr(data-name);
  position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  z-index: 90; padding: 5px 9px; border-radius: 7px;
  background: var(--ink); color: #fff;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0; line-height: 1.35;
  white-space: nowrap; text-transform: none;
  box-shadow: 0 4px 14px rgba(16,21,28,.22);
  opacity: 0; pointer-events: none; transition: opacity .1s ease;
}
/* the little pointer up to the circle */
.face::before {
  content: ""; position: absolute; top: calc(100% + 4px); left: 50%;
  margin-left: -5px; border: 5px solid transparent; border-bottom-color: var(--ink);
  z-index: 91; opacity: 0; pointer-events: none; transition: opacity .1s ease;
}
.face:hover::after, .face:hover::before { opacity: 1; }
/* the "+3" chip names everyone it stands for, so it needs room to wrap */
.face.wide::after { white-space: normal; width: max-content; max-width: 210px; text-align: center; }

@media (max-width: 720px) {
}
