/* Gillieru Harbour Watch
   Palette drawn from St Paul's Bay: harbour navy, limestone-cool paper,
   and the painted luzzu colours reserved for meaning (priority, price position). */
:root {
  --ink: #10263b;
  --ink-2: #1d3a55;
  --paper: #f3f5f6;
  --surface: #ffffff;
  --line: #d8dfe4;
  --text: #16232e;
  --muted: #5b6b78;
  --sea: #1c6dd0;
  --sea-soft: #e3eefb;
  --yellow: #e2a915;
  --yellow-soft: #fbf1d3;
  --red: #c23b2e;
  --red-soft: #f8e1de;
  --green: #2d7a52;
  --green-soft: #dff0e6;
  --radius: 6px;
  --font: "Albert Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--paper); color: var(--text); font-family: var(--font); line-height: 1.5; font-variant-numeric: tabular-nums; }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 10; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9d6e2; display: flex; flex-direction: column; padding: 0 0 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 1.4rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .1rem; }
.brand strong { color: #fff; font-size: 1.35rem; letter-spacing: -.01em; }
.brand span:not(.gunwale) { font-size: .85rem; color: #93a8bb; }
.gunwale { display: block; height: 5px; width: 64px; margin-bottom: .7rem; border-radius: 2px;
  background: linear-gradient(90deg, var(--sea) 0 40%, var(--yellow) 40% 70%, var(--red) 70% 85%, var(--green) 85%); }
.side nav { display: flex; flex-direction: column; padding: 0 .6rem; }
.side nav a, .me a { color: #d7e2ec; padding: .5rem .65rem; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover, .me a:hover { background: var(--ink-2); text-decoration: none; }
.side nav a.on, .me a.on { background: #fff; color: var(--ink); font-weight: 600; }
.navgroup { font-size: .8rem; color: #7e95aa; padding: 1.1rem .65rem .3rem; }
.me { margin-top: auto; padding: 1rem .6rem 0; border-top: 1px solid var(--ink-2); display: flex; flex-direction: column; }
.me small { color: #93a8bb; font-weight: 400; }
.count { font-style: normal; background: var(--yellow); color: var(--ink); border-radius: 10px; font-size: .75rem; padding: 0 .45rem; font-weight: 700; }
main { padding: 1.75rem 2.25rem 4rem; min-width: 0; }
.menu-toggle { display: none; }

/* type */
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.015em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.lede { color: var(--muted); margin: 0 0 1.5rem; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head .lede { margin-bottom: 0; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.panel > h2:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.25rem; }
.stat { padding: .9rem 1.1rem; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.15; }
.stat span { color: var(--muted); font-size: .87rem; }
.stat.alert b { color: var(--red); }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: .85rem; color: var(--muted); background: #f8fafb; white-space: nowrap; }
tr:hover td { background: #fafcfd; }
td.num, th.num { text-align: right; }
tr.own td { background: var(--sea-soft); }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=url], select, textarea {
  width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid #b9c5ce; border-radius: var(--radius); background: #fff; color: var(--text); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: .9rem; }
.hint { font-size: .83rem; color: var(--muted); margin-top: .2rem; font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 140px; flex: 1 1 140px; }
.filters .field.wide { flex: 2 1 240px; }
.check { display: flex; gap: .45rem; align-items: center; font-weight: 400; }
.btn { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ink-2); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #b9c5ce; }
.btn.ghost:hover { background: #f1f4f6; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* badges */
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .08rem .5rem; border-radius: 10px; background: #e9eef2; color: var(--ink); white-space: nowrap; }
.pr-urgent { background: var(--red); color: #fff; }
.pr-high { background: var(--red-soft); color: #8a2217; }
.pr-medium { background: var(--yellow-soft); color: #6d5000; }
.pr-low { background: #e9eef2; color: var(--muted); }
.st-open { background: var(--sea-soft); color: #0f4d98; }
.st-in_progress { background: var(--yellow-soft); color: #6d5000; }
.st-waiting { background: #efe7f7; color: #5a3d80; }
.st-resolved, .st-closed { background: var(--green-soft); color: #1d5a3a; }
.st-dismissed { background: #eceff1; color: var(--muted); text-decoration: line-through; }
.score { font-weight: 700; padding: 0 .35rem; border-radius: 4px; }
.score-bad { background: var(--red-soft); color: #8a2217; }
.score-mid { background: var(--yellow-soft); color: #6d5000; }
.score-good { background: var(--green-soft); color: #1d5a3a; }
.tag { font-size: .78rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; color: var(--muted); margin-right: .2rem; white-space: nowrap; }
.tag.neg { border-color: #e7b3ad; color: #8a2217; }
.tag.pos { border-color: #a9d3bb; color: #1d5a3a; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.dot.ok { background: var(--green); } .dot.error { background: var(--red); } .dot.not_configured, .dot.missing_id { background: var(--yellow); }
.dot.unavailable, .dot.unsupported, .dot.no_data, .dot.disabled { background: #9aa8b3; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-ok { background: var(--green-soft); border-color: #a9d3bb; }
.flash-error { background: var(--red-soft); border-color: #e7b3ad; }
.flash-warn { background: var(--yellow-soft); border-color: #ecd48b; }

/* reviews */
.review { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.review:last-child { border-bottom: 0; }
.review .meta { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; font-size: .87rem; color: var(--muted); margin-bottom: .3rem; }
.review .meta strong { color: var(--text); }
.review p { margin: .2rem 0 .4rem; max-width: 78ch; white-space: pre-line; }
.quote { border-left: 3px solid var(--line); padding: .2rem 0 .2rem .8rem; color: #33434f; margin: .5rem 0; white-space: pre-line; max-width: 78ch; }

/* tickets */
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.timeline li.system { color: var(--muted); font-size: .9rem; }
.timeline li.action b { color: var(--green); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .8rem; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.ai-note { background: #f6f8fa; border: 1px dashed #b9c5ce; border-radius: var(--radius); padding: .7rem .9rem; font-size: .9rem; }

/* rate calendar — the one bold piece */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .5rem .5rem; min-height: 104px; position: relative; display: flex; flex-direction: column; gap: .15rem; }
a.day { color: inherit; }
a.day:hover { text-decoration: none; border-color: var(--sea); }
.day.blank { background: transparent; border: 0; }
.day.past { opacity: .55; }
.day .d { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; }
.day .us { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
.day .us.none { font-size: .85rem; font-weight: 500; color: var(--muted); }
.day .mkt { font-size: .8rem; color: var(--muted); }
.day .pos { font-size: .78rem; font-weight: 700; border-radius: 4px; padding: 0 .3rem; align-self: flex-start; }
.pos.above { background: var(--red-soft); color: #8a2217; }
.pos.below { background: var(--green-soft); color: #1d5a3a; }
.pos.even { background: #e9eef2; color: var(--muted); }
.range { position: relative; height: 6px; background: #e9eef2; border-radius: 3px; margin-top: auto; }
.range i { position: absolute; top: -3px; width: 4px; height: 12px; border-radius: 2px; background: var(--ink); }
.range b { position: absolute; top: 0; height: 6px; border-radius: 3px; background: #b9c9d6; }
.day.sold .us { color: var(--red); font-size: .9rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: .6rem 0 0; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted); font-weight: 600; }
.tabs a.on { background: var(--surface); border-color: var(--line); color: var(--ink); margin-bottom: -1px; }
.bar { display: inline-block; height: 8px; background: var(--sea); border-radius: 2px; vertical-align: middle; }
.diff-up { color: var(--red); font-weight: 600; }
.diff-down { color: var(--green); font-weight: 600; }
svg.spark { overflow: visible; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 1rem; color: var(--muted); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--ink); padding: 1rem; }
.login .card { background: #fff; width: 100%; max-width: 380px; border-radius: 8px; padding: 2rem; }
.login .gunwale { margin-bottom: 1rem; }

@media (max-width: 1000px) {
  .grid-2, .grid-3, .ticket-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  main { padding: 1rem; }
  .menu-toggle { display: inline-block; margin-bottom: 1rem; font: inherit; padding: .4rem .8rem; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); }
  .day { min-height: 80px; padding: .3rem; }
  .day .us { font-size: .95rem; }
  .day .mkt, .range { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* utilities */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.unread td { font-weight: 600; }
.keyset { font-size: .8rem; color: var(--green); font-weight: 600; }
pre.details { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: .8rem; color: var(--muted); max-width: 48ch; }

/* ---------- reports & print ---------- */
.printonly { display: none; }
.report h2 { font-size: 1.05rem; }
@media print {
  .noprint, .side, .menu-toggle, .skip, .filters, .flash { display: none !important; }
  .shell { display: block; }
  .printonly { display: block; }
  body, .main, main { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .panel { break-inside: avoid; border-color: #ccc; box-shadow: none; }
  .tablewrap { overflow: visible !important; }
  table { font-size: 10pt; }
  a { color: inherit; text-decoration: none; }
}
