/* Tau pipeline. One hand-written stylesheet, no framework.
   Dark navy carries structure, a warm amber marks the one thing that wants attention. */

:root {
  --navy: #12243d;
  --navy-2: #1d3557;
  --ink: #16202c;
  --body: #3d4b5c;
  --muted: #71818f;
  --line: #e0e5ea;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --warm: #c8781f;
  --warm-soft: #fdf3e6;
  --good: #2f7a54;
  --bad: #a83a34;
  --radius: 7px;
  --shadow: 0 1px 2px rgba(18, 36, 61, .07), 0 4px 14px rgba(18, 36, 61, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
  color: var(--body);
  background: var(--bg);
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); font-weight: 600; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1.page { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
.muted, .sub { color: var(--muted); }
.sub { font-size: .8rem; }
.right { text-align: right; }
.mt { margin-top: 1.5rem; }
.empty { color: var(--muted); font-style: italic; padding: .5rem 0; }

/* ---- shell ---- */

.topbar {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: var(--navy); color: #eef2f7;
  padding: .6rem 1.25rem;
}
.brand { color: #fff; font-weight: 600; letter-spacing: .02em; }
.brand span { color: #9fb4cc; font-weight: 400; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #c7d5e5; padding: .35rem .7rem; border-radius: var(--radius); font-size: .9rem;
}
.nav a:hover { background: rgba(255, 255, 255, .09); text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .15); color: #fff; }
.badge {
  background: var(--warm); color: #fff; border-radius: 999px;
  padding: 0 .4rem; font-size: .72rem; margin-left: .3rem; font-weight: 600;
}
.logout button {
  background: none; border: 1px solid rgba(255, 255, 255, .25); color: #c7d5e5;
  border-radius: var(--radius); padding: .3rem .7rem; font: inherit; font-size: .85rem;
  cursor: pointer;
}
.logout button:hover { background: rgba(255, 255, 255, .1); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.wrap.wide { max-width: 1600px; }

.foot {
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between;
  border-top: 1px solid var(--line); padding: .8rem 1.25rem;
  color: var(--muted); font-size: .78rem;
}

/* ---- login ---- */

.loginpage {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--navy);
}
.loginbox {
  background: var(--panel); padding: 2rem; border-radius: 10px; box-shadow: var(--shadow);
  width: min(360px, 92vw);
}
.loginbox h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.loginbox h1 span { color: var(--muted); font-weight: 400; }
.loginbox label { display: block; font-size: .82rem; color: var(--muted); margin: 1rem 0 .3rem; }
.loginbox input {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit;
}
.loginbox input:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.loginbox button {
  width: 100%; margin-top: 1rem; background: var(--navy); color: #fff; border: 0;
  border-radius: var(--radius); padding: .65rem; font: inherit; font-weight: 600; cursor: pointer;
}
.loginbox button:hover { background: var(--navy-2); }
.error {
  color: var(--bad); background: #fbeceb; border-radius: var(--radius);
  padding: .5rem .6rem; font-size: .85rem; margin: .75rem 0 0;
}

/* ---- tiles and panels ---- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; display: block; color: var(--body);
}
.tile:hover { text-decoration: none; border-color: var(--navy-2); }
.tile.accent { background: var(--warm-soft); border-color: #f0dcc0; }
.tile .num { display: block; font-size: 1.7rem; font-weight: 600; color: var(--ink); line-height: 1.1; }
.tile.accent .num { color: var(--warm); }
.tile .lab { font-size: .8rem; color: var(--muted); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem;
        margin-top: 1rem; align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.list { margin: 0; padding-left: 1.1rem; }
.list li { margin-bottom: .3rem; }
.list.tight li { margin-bottom: .15rem; font-size: .85rem; }

/* ---- tables ---- */

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid.dense th, table.grid.dense td { padding: .35rem .5rem; font-size: .88rem; }
table.grid tbody tr:hover { background: #fbfcfd; }
table.grid th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; white-space: nowrap;
}
table.grid th a { color: var(--muted); }
table.grid th.sorted a { color: var(--ink); }
.arrow { font-size: .6rem; margin-left: .2rem; }
.w-score { width: 3rem; }
.w-date { width: 8rem; white-space: nowrap; }

.score {
  display: inline-block; min-width: 2rem; text-align: center; border-radius: var(--radius);
  padding: .1rem .35rem; font-size: .8rem; font-weight: 600;
  background: #eef1f5; color: var(--navy);
}
.score.s4, .score.s5 { background: #e2f0e8; color: var(--good); }
.score.s3 { background: var(--warm-soft); color: var(--warm); }
.score.none { background: #f2f4f6; color: var(--muted); font-weight: 400; }

.pill {
  display: inline-block; border-radius: 999px; padding: .08rem .55rem;
  font-size: .74rem; background: #eef1f5; color: var(--navy-2); white-space: nowrap;
}
.pill.new { background: var(--warm-soft); color: var(--warm); }
.pill.won, .pill.success { background: #e2f0e8; color: var(--good); }
.pill.lost, .pill.declined, .pill.failed { background: #fbeceb; color: var(--bad); }

/* ---- filters and buttons ---- */

.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input, .filters select {
  padding: .4rem .55rem; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: .9rem; background: #fff;
}
.filters input[type=search] { flex: 1; min-width: 200px; }
button, .btn {
  background: var(--navy); color: #fff; border: 1px solid var(--navy); cursor: pointer;
  border-radius: var(--radius); padding: .4rem .8rem; font: inherit; font-size: .9rem;
}
.btn:hover { text-decoration: none; background: var(--navy-2); }
.btn.ghost { background: #fff; color: var(--body); border-color: var(--line); }
.btn.ghost:hover { background: #f1f3f6; }

.pager { display: flex; gap: .25rem; margin-top: 1rem; flex-wrap: wrap; }
.pager a { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: var(--radius);
           background: #fff; font-size: .85rem; }
.pager a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- kanban ---- */

.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; }
.column { flex: 0 0 240px; background: #eef0f3; border-radius: var(--radius); padding: .6rem; }
.column h2 {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  margin-bottom: .5rem;
}
.column .count { background: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .72rem; }
.dropzone { min-height: 60px; display: flex; flex-direction: column; gap: .5rem; }
.dropzone.over { outline: 2px dashed var(--warm); outline-offset: 2px; border-radius: var(--radius); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .55rem .65rem; box-shadow: var(--shadow); cursor: grab;
}
.card:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.card.dragging { opacity: .45; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.card h3 { font-size: .87rem; margin: 0 0 .2rem; line-height: 1.3; }
.card .org { font-size: .8rem; margin: 0; color: var(--body); }
.card .meta { font-size: .75rem; margin: .2rem 0 0; color: var(--muted); }
.deadline { font-size: .74rem; color: var(--muted); }
.deadline.soon { color: var(--warm); font-weight: 600; }

.flash {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: .5rem .9rem; border-radius: var(--radius);
  font-size: .87rem; box-shadow: var(--shadow); z-index: 20;
}
.flash.bad { background: var(--bad); }

/* ---- mobile ---- */

@media (max-width: 760px) {
  .wrap { padding: 1rem .8rem 2rem; }
  .topbar { padding: .5rem .8rem; gap: .6rem; }
  /* brand left, log out right, the nav on its own row underneath */
  .brand { order: 1; margin-right: auto; }
  .logout { order: 2; }
  .nav { order: 3; width: 100%; flex: 1 0 100%; }
  .cols { grid-template-columns: 1fr; }
  .board { flex-direction: column; }
  .column { flex: 1 1 auto; width: 100%; }
  /* stacked columns: an empty one should not cost half a screen */
  .column .dropzone:empty { min-height: 0; }
  .column:has(.dropzone:empty) { padding: .45rem .6rem; }
  /* the table scrolls inside its own box rather than pushing the page sideways */
  .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.grid.dense td:nth-child(6),
  table.grid.dense th:nth-child(6),
  table.grid.dense td:nth-child(7),
  table.grid.dense th:nth-child(7),
  table.grid.dense td:nth-child(8),
  table.grid.dense th:nth-child(8) { display: none; }
  .filters input[type=search] { min-width: 100%; }
}

/* A phone shows title, status, fit and deadline. The organisation is one tap away on the
   card itself and was the column that pushed the table off the screen. */
@media (max-width: 480px) {
  table.grid.dense td:nth-child(2),
  table.grid.dense th:nth-child(2) { display: none; }
  table.grid.dense th, table.grid.dense td { padding: .35rem .35rem; }
}

/* ---- phase 1c: detail page, forms, documents ---- */

.topsearch { order: 3; }
.topsearch input {
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08);
  color: #eef2f7; border-radius: var(--radius); padding: .3rem .6rem; font-size: .85rem;
  width: 180px;
}
.topsearch input::placeholder { color: #9fb4cc; }
.topsearch input:focus { outline: 2px solid #9fb4cc; background: rgba(255, 255, 255, .14); }

.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }

.opp-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.opp-score { text-align: center; }
.opp-score .lab { display: block; font-size: .7rem; color: var(--muted); }

.opp-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.colmain, .colside { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.triage { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; gap: .35rem; align-items: center; margin: 0; }
form.stack { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
form.stack input, form.stack textarea, form.stack select { width: 100%; }
.mt-s { margin-top: .75rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 120px; }

input[type=text], input[type=url], input[type=email], input[type=number], input[type=date],
input[type=search], input[type=file], textarea, select {
  font: inherit; padding: .35rem .5rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink); max-width: 100%;
}
textarea { font: inherit; line-height: 1.45; }
button { font: inherit; }
.btn.tiny { padding: .1rem .45rem; font-size: .75rem; }
.btn.danger { color: var(--bad); border-color: #e9cfcd; }
.btn.danger:hover { background: #fbeceb; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.bad-text { color: var(--bad); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { border-bottom: 1px solid var(--line); padding: .3rem 0; }
.checklist li:last-child { border-bottom: 0; }
.tick { display: flex; gap: .55rem; align-items: baseline; }
.tickbox {
  flex: 0 0 auto; width: 1.15rem; height: 1.15rem; border: 1px solid var(--line);
  border-radius: 4px; background: #fff; color: var(--good); cursor: pointer; line-height: 1;
  padding: 0;
}
.tickbox.on { background: #e2f0e8; border-color: #b7d8c6; }
.checklist .done { color: var(--muted); text-decoration: line-through; }

.notes { list-style: none; margin: .5rem 0 0; padding: 0; }
.notes li { border-top: 1px solid var(--line); padding: .45rem 0; }
.notes li:first-child { border-top: 0; }
.notes p { margin: .1rem 0 0; }

.fields td:first-child { color: var(--muted); width: 32%; }
.barcell { width: 40%; }
.bar { display: block; height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--navy-2); }

.tag {
  display: inline-block; background: #eef0f3; border-radius: 999px; padding: 0 .5rem;
  font-size: .72rem; margin: 0 .2rem .2rem 0;
}
.live { word-break: break-all; }
tr.off { opacity: .6; }

.quickadd { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem 1rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.quickadd .row { margin-top: .35rem; }
.quickadd input { flex: 3; }
.quickadd .btn { flex: 0 0 auto; }

.settings { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.settings .panel { width: 100%; }
.settings label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.settings label input, .settings label textarea { display: block; width: 100%; margin-top: .2rem;
  color: var(--ink); }

pre.doc {
  white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0;
  color: var(--ink); line-height: 1.55;
}
pre.doc.small { font-size: .8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 860px) {
  .opp-grid { grid-template-columns: 1fr; }
  /* the move-to row ran off the right edge on a phone */
  form.inline { flex-wrap: wrap; width: 100%; }
  form.inline select, form.inline input[type=text] { flex: 1 1 100%; }
  .topsearch { order: 4; width: 100%; }
  .topsearch input { width: 100%; }
}

/* Touch drag on the board. A finger held on a card lifts a floating copy; pan-y keeps
   ordinary vertical scrolling working until the lift, and no-scroll stops the page
   stealing the gesture once a card is in the air. */
#board .card { position: relative; }
#board .grip {
  position: absolute;
  top: 0; right: 0;
  padding: .45rem .6rem;
  color: var(--muted, #667085);
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}
#board .grip:active { cursor: grabbing; }
html.no-scroll, body.no-scroll, body.no-scroll #board { overflow: hidden; touch-action: none; }
.card.ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: .92;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .28);
  transform: rotate(1.5deg);
}
.card.dragging { opacity: .35; }
