/* Arovio web - colours mirror Themes/Colors.Light.xaml and Colors.Dark.xaml of the Windows app */
:root {
    --accent: #0F766E; --accent-hover: #115E59; --on-accent: #FFFFFF;
    --nav: #12312E; --nav-hover: #1B4743;
    --page: #F3F5F4; --card: #FFFFFF; --soft: #EEF5F3; --line: #D8DEDC;
    --text: #1C2826; --muted: #5F6F6C; --good: #0F766E; --warn: #B45309;
    --chart-a: #0F766E; --chart-b: #C2410C; --chart-grid: #E3E8E6;
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
    --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
    --series-other: #9AA5A2;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --accent: #14B8A6; --accent-hover: #2DD4BF; --on-accent: #062421;
    --nav: #0C1F1D; --nav-hover: #16332F;
    --page: #141918; --card: #1D2422; --soft: #22302D; --line: #34403D;
    --text: #E6ECEA; --muted: #9FB0AC; --good: #2DD4BF; --warn: #FBBF24;
    --chart-a: #2DD4BF; --chart-b: #FB923C; --chart-grid: #2C3735;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --series-other: #7C8986;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px;
       background: var(--page); color: var(--text); }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 14px; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; color: var(--accent); margin: 14px 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); }
.good { color: var(--good); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { flex: none; vertical-align: -3px; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 230px 1fr; height: 100vh; }
.side { background: var(--nav); color: #D5E3E0; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 16px 20px 18px; }
.brand-name { font-size: 22px; font-weight: 600; color: #fff; line-height: 1.1; }
.brand-name span { color: #5EEAD4; }
.brand-sub { font-size: 11px; color: #9DB5B0; }
.nav { flex: 1; overflow-y: auto; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 11px 12px 11px 17px; color: #D5E3E0;
         text-decoration: none; border-left: 3px solid transparent; font-size: 14px; }
.nav a:hover { background: var(--nav-hover); }
.nav a.active { background: var(--nav-hover); border-left-color: #5EEAD4; color: #fff; }
.who { padding: 12px 16px 16px 18px; }
.who-name { color: #fff; font-weight: 600; font-size: 12px; }
.who-role { color: #9DB5B0; font-size: 11px; margin-bottom: 8px; }
.nav-btn { background: transparent; color: #D5E3E0; border-color: #35504C; }
.nav-btn:hover { background: var(--nav-hover); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex;
       justify-content: flex-end; gap: 24px; flex-wrap: wrap; }
.content { flex: 1; overflow: auto; padding: 20px 24px; }

/* ---- controls ---- */
input, select, textarea { font: inherit; color: var(--text); background: var(--card);
    border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; min-height: 32px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[readonly] { background: var(--soft); }
label { display: block; font-size: 12px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 3px; font-size: 14px; }
label.inline { display: flex; align-items: center; gap: 8px; font-size: 14px; }
label.inline select { width: auto; min-width: 200px; margin: 0; }
label.check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; padding: 6px 14px; min-height: 32px;
       border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--text);
       cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; padding: 4px 6px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { min-width: 190px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.soft { background: var(--soft); border-radius: 6px; padding: 12px 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.grid5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.value { font-size: 18px; font-weight: 600; }
.value.accent { color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---- tables ---- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th { position: sticky; top: 0; background: var(--soft); text-align: left; font-weight: 600;
    padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid tbody tr:hover { background: var(--soft); }
table.grid tbody tr.sel { background: color-mix(in srgb, var(--accent) 18%, transparent); }
table.grid td.wrap { white-space: normal; min-width: 220px; }
table.grid td.strong { font-weight: 600; }
table.grid.edit td { padding: 3px 6px; }
table.grid.edit input, table.grid.edit select { min-height: 28px; padding: 3px 6px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { font: inherit; background: transparent; border: 0; border-bottom: 3px solid transparent;
    padding: 8px 14px; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center;
    justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: var(--page); border: 1px solid var(--line); border-radius: 8px; width: min(900px, 100%);
    max-height: 100%; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal.wide { width: min(1280px, 100%); }
.modal.narrow { width: min(520px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
    border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 18px;
    border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.split-list { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.list { border: 1px solid var(--line); border-radius: 6px; background: var(--card); overflow: auto; max-height: 420px; }
.list div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.list div:hover { background: var(--soft); }
.list div.sel { background: color-mix(in srgb, var(--accent) 18%, transparent); font-weight: 600; }
.map { height: 420px; border: 1px solid var(--line); border-radius: 6px; }

/* ---- login ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(420px, 100%); }
.login-card form { display: grid; gap: 12px; }
.login-card h1 { margin-top: 14px; }

/* ---- charts ---- */
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font-family: inherit; }
.pie { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.pie-title { font-weight: 600; margin-bottom: 8px; }
.legend { display: grid; gap: 4px; font-size: 12px; }
.legend-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.legend-row .swatch { width: 10px; height: 10px; border-radius: 2px; }
.legend-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px;
    background: #7c2d12; color: #fff; z-index: 2000; }
#blazor-error-ui .reload { color: #fff; margin-left: 12px; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; height: auto; }
    .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .nav { display: flex; flex-wrap: wrap; overflow: visible; }
    .grid3, .grid4, .grid5, .grid6, .split, .split-list, .pie { grid-template-columns: 1fr 1fr; }
    .content { overflow: visible; }
}
@media (max-width: 560px) {
    .grid2, .grid3, .grid4, .grid5, .grid6, .split, .split-list, .pie { grid-template-columns: 1fr; }
}
