/* Linksen dashboards: minimal cards on a quiet surface. Brand colours from the logo. */
:root {
  color-scheme: light;
  --brand: #127179; --brand-light: #57bcbf; --brand-ink: #393f4b;
  --bg: #f4f5f6; --card: #ffffff; --border: #e3e5e8; --hover: #f0f6f6;
  --text: #1d2129; --text-2: #5b616e; --muted: #8a909c;
  --ok: #1a7f37; --ok-bg: #e6f4ea; --late: #b35900; --late-bg: #fdf0e3;
  --none: #6b7280; --none-bg: #eef0f2;
  --radius: 10px; --sidebar: 210px; --topbar: 56px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }

/* Top bar and menu */
.topbar { position: sticky; top: 0; z-index: 1000; height: var(--topbar); display: flex;
          align-items: center; gap: 16px; padding: 0 20px; background: var(--card);
          border-bottom: 1px solid var(--border); }
.topbar img { height: 28px; display: block; }
.topbar .product { color: var(--text-2); font-size: 13px; border-left: 1px solid var(--border);
                   padding-left: 16px; }
.menu-toggle { display: none; margin-left: auto; }
.layout { display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar { width: var(--sidebar); flex: none; padding: 16px 10px; background: var(--card);
           border-right: 1px solid var(--border); }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
             border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.sidebar a:hover { background: var(--hover); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--hover); color: var(--brand);
                                  box-shadow: inset 3px 0 0 var(--brand); }
.sidebar svg { width: 18px; height: 18px; flex: none; }
.sidebar .foot { margin-top: 24px; padding: 0 12px; color: var(--muted); font-size: 11px; }
main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.subtitle { color: var(--text-2); margin: 0 0 16px; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 16px; min-width: 0; }
.card h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; color: var(--brand-ink); }
.card h2 .hint { font-weight: 400; color: var(--muted); margin-left: 6px; }

/* Filters: one row above the charts */
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
select, input, button { font: inherit; color: var(--text); background: var(--card);
                        border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--brand-light);
                                                  outline-offset: 1px; }
button { cursor: pointer; }
button:hover { background: var(--hover); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 6px 12px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2);
     border-bottom: 1px solid var(--border); padding: 8px 10px; white-space: nowrap; }
td { border-bottom: 1px solid var(--border); padding: 8px 10px; white-space: nowrap; }
td.num, th.num { text-align: right; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover, tbody tr.selected { background: var(--hover); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
         font-size: 12px; font-weight: 500; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.late { color: var(--late); background: var(--late-bg); }
.badge.none { color: var(--none); background: var(--none-bg); }

/* Key-value sheets (configuration) */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0;
           overflow-wrap: anywhere; }
.unset { color: var(--muted); font-style: italic; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
           overflow-x: auto; margin: 8px 0 0; font-size: 12px; }
.copy { padding: 1px 8px; font-size: 11px; color: var(--text-2); white-space: nowrap; flex: none; }

.muted { color: var(--muted); }
.note { color: var(--text-2); font-size: 12px; margin: 8px 0 0; }
#status-line { min-height: 1.4em; color: var(--text-2); margin-bottom: 8px; }
.chart { width: 100%; }
.placeholder { display: flex; align-items: center; justify-content: center; text-align: center;
               color: var(--muted); background: var(--bg); border: 1px dashed var(--border);
               border-radius: 8px; padding: 16px; }

@media (max-width: 760px) {
  .menu-toggle { display: inline-block; }
  .topbar .product { display: none; }
  .sidebar { display: none; position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 999; }
  body.menu-open .sidebar { display: block; }
  main { padding: 16px; }
}

/* Buttons and forms */
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.primary:hover { background: #0e5c63; }
.save-bar { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
dl.kv dd input, dl.kv dd select { padding: 4px 8px; }
span.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }

/* Status */
a.icon-link { display: inline-flex; padding: 4px; border-radius: 6px; color: var(--text-2); }
a.icon-link:hover { background: var(--hover); color: var(--brand); }
tr.detail > td { background: #fafbfb; padding: 10px 10px 14px; }
table.compact td, table.compact th { padding: 4px 8px; font-size: 12.5px; }
tr.warn td { color: var(--late); }

/* Profiles */
.profile-top { display: grid; gap: 16px; grid-template-columns: minmax(280px, 1fr) 330px 330px; }
.profile-bottom { display: grid; gap: 16px; grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.5fr);
                  margin-top: 16px; }
.profile-chart { height: 640px; }
.map-size { height: 640px; border-radius: 8px; }
.legend-strip { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; margin-top: 10px;
                padding: 8px 14px; background: var(--card); border: 1px solid var(--border);
                border-radius: var(--radius); font-size: 12px; color: var(--text-2); }
.legend-strip span { display: inline-flex; align-items: center; gap: 8px; }
.axes-icon { background: none; border: 0; }
@media (max-width: 1200px) {
  .profile-top { grid-template-columns: 1fr 1fr; }
  .profile-top .map-card { grid-column: 1 / -1; }
  .map-size { height: 360px; }
  .profile-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 760px) { .profile-top { grid-template-columns: 1fr; } }
.flatpickr-input[readonly] { background: var(--card); cursor: pointer; }
input.flatpickr-input { width: 130px; }
dl.kv dd input.flatpickr-input { width: 220px; }

/* Sign in / out */
.topbar .signout { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .signout + .menu-toggle { margin-left: 0; }
@media (max-width: 760px) { .topbar .signout .muted { display: none; } }
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh;
             padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px 24px; }
.login-card img { height: 32px; display: block; margin-bottom: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.login-card input { width: 100%; }
.login-card button { padding: 8px 12px; }
.login-error { margin: 0; color: #b42318; }
