:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #fff;
  --amber: #b45309;
  --ok: #047857;
  --bad: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: .8rem 0 .2rem; }
.top {
  display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line); padding: .7rem 1rem;
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; gap: .5rem; align-items: center; color: var(--ink); font-weight: 650; }
.mark {
  background: var(--blue); color: #fff; font-weight: 700; letter-spacing: .04em;
  border-radius: 8px; padding: .2rem .45rem; font-size: .85rem;
}
nav { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; }
nav a { color: var(--ink); }
.out { margin-left: auto; display: flex; gap: .75rem; align-items: center; }
.out form { margin: 0; }
.settings-nav { margin: 0 0 .8rem; }
button, .btn {
  background: var(--blue); color: #fff; border: 0; border-radius: 8px;
  padding: .45rem .8rem; font: inherit; cursor: pointer;
}
.btn.ghost, a.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.on, a.btn.on { border-color: var(--blue); color: var(--blue); }
button.link, .link { background: none; color: var(--muted); border: 0; padding: 0; cursor: pointer; font: inherit; }
main { padding: 1rem; max-width: 1180px; margin: 0 auto; }
.page-head, .pager, .actions, .inline, .filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.page-head { justify-content: space-between; margin-bottom: 1rem; }
.muted { color: var(--muted); margin: .2rem 0; }
.card, details.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .9rem 1rem; margin: 0 0 .8rem;
}
.stack > * { display: block; margin-bottom: .55rem; }
label { font-size: .92rem; color: #374151; }
input, select, textarea {
  display: block; width: 100%; margin-top: .2rem; padding: .45rem .55rem;
  border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; }
.span { grid-column: 1 / -1; }
.check { display: flex; gap: .4rem; align-items: center; }
.check input { width: auto; margin: 0; }
.flash { background: #ecfdf5; border: 1px solid #a7f3d0; padding: .55rem .7rem; border-radius: 8px; }
.flash.bad { background: #fef2f2; border-color: #fecaca; color: var(--bad); }
.empty { background: #fff; border: 1px dashed var(--line); padding: 1rem; border-radius: 12px; }
.split { display: grid; grid-template-columns: 1fr 280px; gap: .8rem; }
.cal .dow, .cal .week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .dow span { font-size: .75rem; color: var(--muted); padding: .2rem; }
.day { min-height: 92px; border-top: 1px solid var(--line); padding: .2rem; background: #fff; }
.day.out { background: #f9fafb; color: #9ca3af; }
.day.is-today .num { background: var(--blue); color: #fff; border-radius: 99px; padding: 0 .35rem; }
.ev { display: block; font-size: .72rem; border-radius: 4px; padding: .05rem .25rem; margin-top: .15rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.due { background: var(--blue); }
.ev.review { background: #6b7280; }
.ev.follow { background: var(--amber); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table.rows { width: 100%; border-collapse: collapse; background: #fff; }
table.rows th, table.rows td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem; }
table.rows th.num, table.rows td.num { text-align: right; }
.sub { display: none; color: var(--muted); font-size: .85rem; }
.pill { border-radius: 99px; padding: .05rem .45rem; background: #eef2ff; color: var(--blue-dark); font-size: .8rem; }
.pill.s-won { background: #d1fae5; color: var(--ok); }
.pill.s-lost, .pill.s-no-bid { background: #f3f4f6; color: #4b5563; }
.tabs { display: flex; gap: .4rem; margin-bottom: .8rem; flex-wrap: wrap; }
.tabs a { padding: .35rem .7rem; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.tabs a.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.files { list-style: none; padding: 0; }
.files li { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; padding: .3rem 0; }
.files form { display: inline; }
pre.note, textarea[readonly] {
  white-space: pre-wrap; font: inherit; background: #f9fafb; padding: .6rem; border-radius: 8px;
}
.ages { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; }
.ages div { background: #f9fafb; border-radius: 8px; padding: .5rem; display: flex; flex-direction: column; }
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(420px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; }
.status-form { display: flex; gap: .4rem; align-items: end; }
.status-form select { width: auto; }
.warn { color: var(--amber); }
summary { cursor: pointer; font-weight: 650; }
details.acc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 .55rem;
}
details.acc > summary {
  list-style: none;
  padding: .7rem .9rem;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before {
  content: "+";
  color: var(--blue);
  display: inline-block;
  width: 1.1rem;
  font-weight: 700;
}
details.acc[open] > summary::before { content: "–"; }
details.acc > .acc-body { padding: 0 .9rem .85rem; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; }
.sheet h2, .sheet h3 { color: var(--blue); }
.sheet-head { display: flex; gap: 1rem; align-items: center; border-bottom: 1px solid var(--blue); padding-bottom: .6rem; }
.sheet-logo { height: 64px; width: auto; }
.sheet-kicker { margin-left: auto; text-align: right; font-weight: 700; }
.sheet-total { text-align: right; font-weight: 700; border-top: 1px solid var(--blue); padding-top: .4rem; }
.sheet ul { margin: .2rem 0 .6rem; }
#takeoff { display: grid; grid-template-columns: 280px 1fr; gap: .6rem; min-height: calc(100vh - 150px); }
.tk-side { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem; overflow: auto; }
.tk-tools, .tk-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.tk-tools button, .tk-actions .btn { font-size: .85rem; padding: .3rem .5rem; }
.tk-tools button.on { outline: 2px solid var(--blue); }
.tk-view { display: flex; flex-direction: column; min-width: 0; min-height: 70vh; }
.tk-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: end; margin-bottom: .4rem; }
.tk-bar label { min-width: 8rem; }
.tk-bar select, .tk-bar input { width: 100%; }
#viewer { flex: 1; overflow: auto; background: #e5e7eb; border: 1px solid var(--line); border-radius: 12px; min-height: 420px; touch-action: none; }
#stage { position: relative; margin: 12px; }
#sheet { display: block; background: #fff; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#thumbs { display: flex; gap: .4rem; overflow-x: auto; padding: .4rem 0; }
#thumbs button { background: #fff; color: var(--ink); border: 1px solid var(--line); padding: .2rem; }
#thumbs button.on { border-color: var(--blue); }
#thumbs canvas { display: block; height: 72px; width: auto; }
.meas-hit { cursor: pointer; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; }
fieldset.card { border: 1px solid var(--line); }
fieldset.card legend { padding: 0 .3rem; }
@media (max-width: 900px) {
  #takeoff { grid-template-columns: 1fr; }
  #viewer { min-height: 55vh; }
}
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  .day { min-height: 64px; }
  table.rows thead { display: none; }
  table.rows tr { display: block; border-bottom: 1px solid var(--line); padding: .35rem 0; }
  table.rows td { display: none; border: 0; padding: .15rem .2rem; }
  table.rows td.line { display: block; font-weight: 600; }
  table.rows td.line .sub { display: block; font-weight: 400; }
  table.rows tr.open td { display: block; }
  table.rows tr.open td::before {
    content: attr(data-label);
    display: inline-block; min-width: 6.5rem; color: var(--muted); font-weight: 500;
  }
  .top nav { width: 100%; }
}
