/* Oculus OS — Commercial. D'Oculus Pte Ltd. */

:root {
  --paper: #eef1f4; --surface: #fbfcfd; --sunk: #e4e8ed; --ink: #14181d;
  --muted: #67717d; --rule: #dde3ea; --hair: #eceff3; --accent: #646b63;
  --accent-ink: #fff;
  --ok: #2f7a4b; --ok-bg: #e6f3ea; --warn: #8a4712; --warn-bg: #fdf1e6;
  --bad: #a12a2a; --bad-bg: #fbe9e9; --info: #2b5c8a; --info-bg: #e7eff8;
  --ui: ui-sans-serif, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1116; --surface: #151a21; --sunk: #1c222a; --ink: #e4e9ef;
    --muted: #8b96a3; --rule: #262e38; --hair: #1e252d; --accent: #99a09a;
    --accent-ink: #141618;
    --ok: #7fc99a; --ok-bg: #16281d; --warn: #e8b98c; --warn-bg: #2a1d12;
    --bad: #f0a0a0; --bad-bg: #2e1616; --info: #9cc1e6; --info-bg: #14212e;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--ui); font-size: 14px; line-height: 1.4; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 15px; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
#side { background: var(--surface); border-right: 1px solid var(--rule); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand-name { font-weight: 700; letter-spacing: 0.12em; font-size: 13px; }
.brand-sub { color: var(--muted); font-size: 12px; }
#projectPick { width: 100%; padding: 7px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); }
.allprojects { display: block; padding: 7px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.allprojects:hover { background: var(--hair); }
.allprojects.on { background: var(--accent); color: var(--accent-ink); }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
#nav a:hover { background: var(--hair); }
#nav a.on { background: var(--accent); color: var(--accent-ink); }
#nav a .n { font-size: 11px; background: var(--sunk); color: var(--muted); border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center; }
#nav a.on .n { background: rgba(255,255,255,.25); color: inherit; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
#main { padding: 22px 28px 60px; min-width: 0; }
.empty { color: var(--muted); padding: 40px; text-align: center; }

.head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 200px; }
.head .sub { color: var(--muted); margin-top: 3px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { padding: 7px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--hair); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.tile .k { color: var(--muted); font-size: 12px; }
.tile .v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tile.good .v { color: var(--ok); } .tile.warn .v { color: var(--warn); } .tile.bad .v { color: var(--bad); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; min-width: 0; }
.card > h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card > h2 .actions { font-weight: 400; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.row { cursor: pointer; } tr.row:hover td { background: var(--hair); }
/* Drag to arrange the sequence of works. The grip arms the row, so an
   ordinary click still opens the drawer (Tina 2026-10-14). */
/* In the first cell, beside the checkbox, so it is visible without
   scrolling a wide register sideways (Tina 2026-10-19). */
tr.row .grip { cursor: grab; color: var(--muted); padding: 0 4px 0 0; user-select: none; font-size: 15px; vertical-align: middle; }
tr.row .grip:active { cursor: grabbing; }
tr.row:hover .grip { color: var(--ink); }
tr.row.dragging td { opacity: 0.4; }
tr.row.drop-above td { box-shadow: inset 0 2px 0 0 var(--accent); }
tr.row.drop-below td { box-shadow: inset 0 -2px 0 0 var(--accent); }
tr.group td { background: var(--sunk); font-weight: 600; font-size: 12.5px; }
tr.total td { font-weight: 600; border-top: 1px solid var(--rule); }
td.wrap { white-space: normal; max-width: 420px; }
td.dim { color: var(--muted); }
.neg { color: var(--bad); } .pos { color: var(--ok); }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }

.bar { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.over { background: var(--bad); }
.bar > i.ok { background: var(--ok); }

.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hair); align-items: flex-start; }
.alerts li a { color: inherit; text-decoration: none; }
.alerts li a:hover { text-decoration: underline; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { padding: 5px 11px; border: 1px solid var(--rule); background: var(--surface); border-radius: 14px; cursor: pointer; font-size: 12.5px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; white-space: pre-wrap; }

.events li { padding: 6px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.events time { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }

/* modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 10px; width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.modal-head .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.form { padding: 14px 18px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 13.5px; }
.form textarea { min-height: 64px; resize: vertical; }
.form .hint { font-size: 11px; color: var(--muted); }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--rule); }
.grow { flex: 1; }
.err { color: var(--bad); font-size: 12.5px; }

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  #side { position: static; height: auto; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  #main { padding: 14px; }
  .form { grid-template-columns: 1fr; }
}

/* ---- v2: actions, drawer, toolbar, toasts, dropzone ---------------------- */
td.acts, th.acts { white-space: nowrap; text-align: right; width: 1%; }
td.acts .btn { margin-left: 4px; }
td.sel, th.sel { width: 1%; padding-right: 2px; }
td.sel input, th.sel input { margin: 0; cursor: pointer; }
.btn.ok { color: var(--ok); border-color: var(--ok); background: transparent; }
.btn.warn { color: var(--warn); border-color: var(--warn); background: transparent; }
.btn.icon { padding: 3px 7px; line-height: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable .dir { font-size: 10px; margin-left: 3px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .search { padding: 6px 10px; border: 1px solid var(--rule); border-radius: 16px; background: var(--paper); min-width: 200px; }
.toolbar .count { color: var(--muted); font-size: 12.5px; }
.bulk { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--info-bg); color: var(--info); border-radius: 6px; margin-bottom: 10px; font-size: 13px; flex-wrap: wrap; }
.bulk select { padding: 4px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.helpline { color: var(--muted); font-size: 12.5px; margin: -6px 0 12px; }
tr.row.selected td { background: var(--info-bg); }

.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 8; }
.drawer-mask[hidden] { display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); border-left: 1px solid var(--rule); z-index: 9; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.18); }
.drawer[hidden] { display: none; }
.drawer-head { padding: 14px 18px; border-bottom: 1px solid var(--rule); display: flex; gap: 10px; align-items: flex-start; }
.drawer-head h3 { flex: 1; }
.drawer-body { padding: 14px 18px; overflow: auto; flex: 1; }
.drawer-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.drawer .kv { grid-template-columns: 130px 1fr; }
.drawer .kv dd { word-break: break-word; }
.drawer h4 { margin: 18px 0 8px; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; font-size: 13px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastin .18s ease-out; }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } }

.dropzone { border: 2px dashed var(--rule); border-radius: 8px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 14px; }
.dropzone.over { border-color: var(--accent); background: var(--hair); color: var(--ink); }
.form .preview { grid-column: 1 / -1; background: var(--hair); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.form .preview b { color: var(--ink); }
.form .withbtn { display: flex; gap: 6px; }
.form .withbtn input { flex: 1; min-width: 0; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); min-width: 200px; z-index: 5; padding: 4px; }
.menu-list[hidden] { display: none; }
.menu-list button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.menu-list button:hover { background: var(--hair); }
.menu-list button.danger { color: var(--bad); }
.menu-list a { display: block; padding: 7px 10px; text-decoration: none; color: inherit; border-radius: 5px; font-size: 13px; }
.menu-list a:hover { background: var(--hair); }
kbd { font-size: 11px; background: var(--sunk); border-radius: 3px; padding: 0 4px; }

/* ---- v3: status bar, attachments, comments, users ------------------------- */
.whoami { font-size: 12.5px; color: var(--muted); padding: 8px 4px; border-top: 1px solid var(--rule); margin-bottom: 4px; line-height: 1.6; }
.whoami b { color: var(--ink); }
.statusbar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--sunk); margin-bottom: 8px; }
.statusbar i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 11.5px; font-weight: 600; color: #fff; min-width: 0; overflow: hidden; }
.sb-none { background: #a9b1ba; } .sb-commenced { background: #5b8fd6; } .sb-progress { background: #d69a3a; } .sb-pending { background: #b565c9; } .sb-done { background: #3c9a5f; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend b { color: var(--ink); }
td.meta, th.meta { white-space: nowrap; width: 1%; font-size: 11.5px; }
tr.row.current td { background: var(--ok-bg); }
.attgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 6px 0; }
.att { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--paper); font-size: 11.5px; }
.att img { width: 100%; height: 90px; object-fit: cover; display: block; }
.att .file { display: block; padding: 22px 8px; text-align: center; color: var(--ink); text-decoration: none; word-break: break-all; }
.att-meta { display: flex; align-items: center; gap: 4px; padding: 4px 6px; color: var(--muted); }
.att-meta span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-meta .x, .c-head .x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }
.comments .comment { padding: 8px 0; border-bottom: 1px solid var(--hair); }
.comments .c-head { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.comments .c-head .x { margin-left: auto; }
.comments .c-text { white-space: pre-wrap; margin-top: 3px; font-size: 13px; }
.c-new textarea { width: 100%; min-height: 56px; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); margin-top: 10px; resize: vertical; }
.c-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; }
.drawer h4 .btn { margin-left: 8px; text-transform: none; letter-spacing: 0; }

/* ---- projects dashboard ------------------------------------------------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pcard { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.pcard:hover { border-color: var(--accent); }
.pc-top { display: flex; align-items: baseline; gap: 8px; }
.pc-top b { font-size: 15px; flex: 1; min-width: 0; }
.pc-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pc-figs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin: 12px 0 10px; }
.pc-figs > div { display: flex; flex-direction: column; }
.pc-figs span { color: var(--muted); font-size: 11.5px; }
.pc-figs b { font-size: 15px; font-variant-numeric: tabular-nums; }
.pc-figs b.neg { color: var(--bad); }
.pc-figs i { color: var(--muted); font-size: 11.5px; font-style: normal; font-variant-numeric: tabular-nums; }
.pc-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hair); font-size: 12px; }

/* ---- progress: work packages ------------------------------------------- */
.pkg { border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: var(--paper); }
.pkg-head { display: flex; align-items: center; gap: 8px; }
.pkg-head .grow { flex: 1; }
.pkg-warn { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.stage { border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.stage .s-l { font-size: 12px; color: var(--muted); }
.stage .s-d { font-size: 13px; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.stage .s-d .neg { color: var(--bad); }
.stage.done { border-left-color: var(--ok); }
.stage.on_track { border-left-color: var(--info); }
.stage.at_risk { border-left-color: var(--warn); background: var(--warn-bg); }
.stage.overdue { border-left-color: var(--bad); background: var(--bad-bg); }
.stage.pending { opacity: .7; }

/* Transmittal purposes: the five tick-boxes from the paper form */
.multi { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); }
.multi .cbx { display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; color: var(--ink); cursor: pointer; }
.multi .cbx input { width: auto; margin: 0; }

/* Red, amber, green at a glance: a job is red the moment something is
   overdue, amber while something sits inside its own buffer (Tina
   2026-10-19). The same three colours the chips already use. */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

/* ---- a phone ------------------------------------------------------------
   A register is a wide table by nature - the Programme is fifteen columns,
   1302px, on a 375px screen. Below 720px each row becomes a card and each
   cell prints its own column heading, so nothing is scrolled sideways and
   nothing is hidden. The markup is identical; only the display changes. */
@media (max-width: 720px) {
  .tbl-wrap { overflow-x: visible; }
  table, tbody, tr, td { display: block; width: auto; }
  thead { display: none; }

  tr.row { border: 1px solid var(--rule); border-radius: 9px; margin: 9px 0;
           padding: 4px 0 6px; background: var(--surface); }
  tr.row:hover td { background: transparent; }
  tr.row.selected { border-color: var(--info); }

  tr.row td { border: 0; padding: 3px 11px; display: flex; gap: 10px;
              align-items: baseline; text-align: left; }
  tr.row td::before { content: attr(data-label); color: var(--muted);
                      font-size: 11.5px; flex: 0 0 38%; min-width: 0; }
  tr.row td.blank { display: none; }
  tr.row td.num { text-align: left; }
  tr.row td.wrap { display: block; }
  tr.row td.wrap::before { display: block; margin-bottom: 1px; }

  /* the first cell is the checkbox and the drag handle: no label, and the
     handle gets a real tap target rather than a 9px glyph */
  tr.row td.sel { justify-content: flex-start; gap: 14px; padding-top: 7px; }
  tr.row td.sel::before, tr.row td.meta::before, tr.row td.acts::before { content: none; }
  tr.row td.sel .grip { font-size: 22px; padding: 2px 6px; }
  tr.row td.meta.blank, tr.row td.acts:empty { display: none; }

  /* td.acts and td.sel are width:1% on a desktop so they hug their
     buttons. In a card that makes the flex row one button wide and every
     button lands on its own line. */
  tr.row td.acts, tr.row td.sel { width: auto; white-space: normal; }
  tr.row td.acts { justify-content: flex-start; flex-wrap: wrap; gap: 6px;
                   padding-top: 7px; }
  td.acts .btn { margin-left: 0; min-height: 34px; }

  tr.group td { background: var(--sunk); font-weight: 600; border-radius: 7px;
                padding: 7px 11px; margin: 14px 0 2px; }
  tr.total td, tr.subtotal td { display: flex; gap: 10px; }
  tr.total td.blank, tr.subtotal td.blank { display: none; }

  /* comfortable thumbs */
  .btn { min-height: 34px; }
  .tabs button { min-height: 34px; }
  .tiles { grid-template-columns: 1fr 1fr; }
}
