:root {
  --green:#0b5c3f; --green-2:#0e7350; --ink:#131a20; --muted:#5f6b76;
  --line:#dfe5ea; --bg:#f4f6f8; --card:#fff;
  --amber:#b8860b; --amber-bg:#fdf6e3; --red:#a32020; --red-bg:#fdeeee;
  --blue:#1a5f9c; --blue-bg:#eef5fb; --ok:#15704a; --ok-bg:#e9f5ef;
  --radius:10px; --shadow:0 1px 3px rgba(16,24,32,.07), 0 4px 14px rgba(16,24,32,.05);
}
* { box-sizing:border-box; }
/* Author `display:` rules outrank the UA's [hidden] rule; make hidden mean hidden. */
[hidden] { display:none !important; }
body { margin:0; background:var(--bg); color:var(--ink);
  font:14px/1.55 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
h1,h2,h3 { margin:0 0 .4em; line-height:1.25; }
h1 { font-size:22px; } h2 { font-size:17px; } h3 { font-size:14px; }
a { color:var(--green-2); }

/* ---------- top bar ---------- */
.topbar { display:flex; align-items:center; gap:18px; flex-wrap:wrap;
  background:var(--green); color:#fff; padding:calc(8px + env(safe-area-inset-top)) 18px 8px; position:sticky; top:0; z-index:30; }
.brand { display:flex; align-items:center; gap:10px; }
.brand strong { display:block; font-size:15px; letter-spacing:.2px; }
.brand small { display:block; opacity:.75; font-size:11.5px; }
.mark { width:26px; height:26px; border-radius:5px; background:#fff; flex:0 0 auto;
  clip-path:polygon(50% 0, 100% 100%, 0 100%); }
.tabs { display:flex; gap:2px; flex-wrap:wrap; margin-left:auto; align-items:center; }
.tabs .sep { width:1px; height:20px; background:rgba(255,255,255,.25); margin:0 6px; }
.tabs button { font:inherit; font-size:13px; color:#dbe9e2; background:transparent;
  border:0; padding:7px 12px; border-radius:6px; cursor:pointer; }
.tabs button:hover { background:rgba(255,255,255,.12); color:#fff; }
.tabs button.active { background:#fff; color:var(--green); font-weight:600; }
.tabs button[hidden] { display:none; }
.userbox { display:flex; align-items:center; gap:12px; }
.ghost { color:#dbe9e2; font-size:12.5px; text-decoration:none; white-space:nowrap; }
.ghost:hover { color:#fff; text-decoration:underline; }
.ghost-btn { background:rgba(255,255,255,.14); border:0; color:#fff; border-radius:99px;
  width:30px; height:30px; cursor:pointer; font-size:14px; }

main { padding:20px; max-width:1500px; margin:0 auto; }
.loading { color:var(--muted); padding:40px; text-align:center; }

/* ---------- layout ---------- */
.grid { display:grid; gap:16px; }
.cols-4 { grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); }
.cols-3 { grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); }
.cols-2 { grid-template-columns:repeat(auto-fit,minmax(380px,1fr)); }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px 18px; box-shadow:var(--shadow); }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom:12px; flex-wrap:wrap; }
.stat .n { font-size:30px; font-weight:650; letter-spacing:-.5px; }
.stat .l { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.6px; }
.stat .sub { color:var(--muted); font-size:12px; margin-top:2px; }
.stat.clickable { cursor:pointer; } .stat.clickable:hover { border-color:var(--green-2); }

/* ---------- tables ---------- */
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); vertical-align:middle; }
th { font-size:11.5px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted);
  font-weight:600; white-space:nowrap; }
tbody tr:hover { background:#fafcfd; }
tbody tr.rowlink { cursor:pointer; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
.mono { font-family:Consolas, "SF Mono", monospace; font-size:12.5px; }
.empty { color:var(--muted); padding:22px; text-align:center; font-style:italic; }

/* ---------- pills ---------- */
.pill { display:inline-block; padding:2px 9px; border-radius:99px; font-size:11.5px;
  font-weight:600; white-space:nowrap; }
.pill.available, .pill.returned, .pill.ok, .pill.won, .pill.completed { background:var(--ok-bg); color:var(--ok); }
.pill.on_hire, .pill.booked, .pill.contacted, .pill.quoted, .pill.open { background:var(--blue-bg); color:var(--blue); }
.pill.quote, .pill.new, .pill.crew { background:#f1f3f5; color:#4a5560; }
.pill.maintenance, .pill.reserved_internal, .pill.warn, .pill.manager { background:var(--amber-bg); color:var(--amber); }
.pill.broken, .pill.retired, .pill.lost, .pill.cancelled, .pill.danger { background:var(--red-bg); color:var(--red); }
.pill.admin { background:var(--green); color:#fff; }

/* ---------- forms & buttons ---------- */
button, .btn { font:inherit; font-size:13px; padding:7px 14px; border-radius:7px; cursor:pointer;
  border:1px solid var(--green); background:var(--green); color:#fff; font-weight:500; text-decoration:none; display:inline-block; }
button:hover, .btn:hover { background:var(--green-2); border-color:var(--green-2); }
button.sec, .btn.sec { background:#fff; color:var(--ink); border-color:var(--line); }
button.sec:hover, .btn.sec:hover { background:#f3f6f8; border-color:#c9d2d9; }
button.sm, .btn.sm { padding:4px 10px; font-size:12px; }
button.danger { background:var(--red); border-color:var(--red); }
button.icon { background:none; border:none; color:inherit; font-size:17px; padding:2px 6px; }
button:disabled { opacity:.5; cursor:not-allowed; }

label { display:block; font-size:12px; color:var(--muted); margin:9px 0 3px; font-weight:500; }
input, select, textarea { font:inherit; font-size:13px; width:100%; padding:7px 9px;
  border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--ink); }
input:focus, select:focus, textarea:focus { outline:2px solid #b9dccb; outline-offset:-1px; border-color:var(--green-2); }
textarea { min-height:64px; resize:vertical; }
.row { display:flex; gap:12px; flex-wrap:wrap; }
.row > * { flex:1; min-width:150px; }
.toolbar { display:flex; gap:8px; align-items:flex-end; flex-wrap:wrap; margin-bottom:14px; }
.toolbar label { margin:0 0 3px; }
.toolbar > div { min-width:150px; }
.check { display:flex; align-items:center; gap:8px; margin:10px 0; }
.check input { width:auto; }
.check label { margin:0; font-size:13px; color:var(--ink); }

/* ---------- notes ---------- */
.note { border-left:4px solid var(--blue); background:var(--blue-bg); padding:10px 13px;
  border-radius:0 7px 7px 0; margin:10px 0; font-size:13px; }
.note.warn { border-color:var(--amber); background:var(--amber-bg); }
.note.danger { border-color:var(--red); background:var(--red-bg); }
.note.ok { border-color:var(--ok); background:var(--ok-bg); }
.note strong { display:block; margin-bottom:2px; }

/* ---------- asset headline ---------- */
.headline { padding:12px 14px; border-radius:9px; font-size:15px; font-weight:600; margin:10px 0; }
.headline.here { background:var(--ok-bg); color:var(--ok); }
.headline.person { background:var(--blue-bg); color:var(--blue); }
.headline.hire { background:var(--amber-bg); color:var(--amber); }
.headline.bad { background:var(--red-bg); color:var(--red); }
.facts { display:grid; grid-template-columns:auto 1fr; gap:4px 14px; font-size:13px; margin:8px 0; }
/* Photos of an asset: a thumbnail in the list, a strip on its page (first one large). */
.thumb { width:46px; height:46px; object-fit:cover; border-radius:6px; background:#eef1f0; display:block; }
.thumb.none { display:inline-block; }
.photos { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 4px; }
.photos a { display:flex; flex-direction:column; gap:3px; width:96px; text-decoration:none; color:var(--muted); font-size:11px; }
.photos a.main { width:220px; }
.photos img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:8px; background:#eef1f0; border:1px solid var(--line); }
.photos a.main img { aspect-ratio:4/3; }
.photos a span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.facts dt { color:var(--muted); } .facts dd { margin:0; }
.subtabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin:14px 0 10px; flex-wrap:wrap; }
.subtabs button { background:none; border:0; border-bottom:2px solid transparent; color:var(--muted);
  border-radius:0; padding:6px 10px; }
.subtabs button.active { color:var(--green); border-bottom-color:var(--green); font-weight:600; }
.doc { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; }
.doc:last-child { border-bottom:0; }
.doc a { flex:1; }

/* ---------- modal ---------- */
.modal-backdrop { position:fixed; inset:0; background:rgba(12,20,26,.5);
  display:flex; align-items:flex-start; justify-content:center; padding:4vh 16px; z-index:50; overflow:auto; }
.modal { background:#fff; border-radius:12px; width:min(820px,100%); box-shadow:0 18px 50px rgba(0,0,0,.3); }
.modal.wide { width:min(1000px,100%); }
.modal > header { display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border-bottom:1px solid var(--line); }
.modal > header h2 { margin:0; }
.modal > div { padding:18px; }
.modal-actions { display:flex; gap:9px; justify-content:flex-end; margin-top:18px; padding-top:14px; border-top:1px solid var(--line); flex-wrap:wrap; }

/* ---------- toast ---------- */
.toast { position:fixed; bottom:22px; left:50%; transform:translateX(-50%);
  background:var(--ink); color:#fff; padding:11px 18px; border-radius:9px;
  box-shadow:0 8px 26px rgba(0,0,0,.28); z-index:100; max-width:min(560px,92vw); font-size:13px; }
.toast.err { background:var(--red); }
.toast.ok { background:var(--ok); }

.muted { color:var(--muted); }
.small { font-size:12px; }
.right { text-align:right; }
.nowrap { white-space:nowrap; }
.spread { display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; }
.bar { height:7px; background:#e8edf1; border-radius:99px; overflow:hidden; margin-top:8px; }
.bar > span { display:block; height:100%; background:var(--green-2); }
.tree li { list-style:none; } .tree ul { padding-left:18px; margin:2px 0; }
.tree .node { display:flex; align-items:center; gap:8px; padding:5px 8px; border-radius:6px; }
.tree .node:hover { background:#f3f6f8; }
.kv { font-size:13px; } .kv b { display:inline-block; min-width:120px; color:var(--muted); font-weight:500; }
pre.code { background:#f4f6f8; padding:10px 12px; border-radius:7px; overflow-x:auto; font-size:12px; }
.drop { border:2px dashed var(--line); border-radius:10px; padding:26px; text-align:center; cursor:pointer; }
.drop.over { border-color:var(--green-2); background:var(--ok-bg); }
@media (max-width:760px) { main { padding:12px; } .tabs button { padding:6px 9px; font-size:12.5px; } }
