/* Sevionin sovellusnäkymät (tiimi ja asiakas). Tyyli: sävytetty kehys ja valkoinen työpinta (framed-sheet).
   Värit ja fontti Sevionin brändistä (sevion-site/BRAND.md): sininen datassa, koralli yhdessä toimintonapissa, navy tekstissä. */
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('/fonts/poppins-600.woff2') format('woff2'); }
:root {
  --frame: #edf3f9; --sheet: #fff; --edge: #e2e9f1; --rule: #edf1f5; --control: #d3dce6;
  --text: #0e2a47; --muted: #4a5f75; --faint: #7a8a9b;
  --data: #3283be; --action: #fd614b; --action-d: #c23a26;
  --ok-bg: #e2f5ec; --ok: #12805a; --warn-bg: #fdf1dc; --warn: #8a5a0b; --bad-bg: #ffeae6; --bad: #b0301d; --n-bg: #eef2f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/1.5 'Poppins', system-ui, sans-serif; color: var(--text); background: var(--frame); font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font: inherit; }

.shell { display: grid; grid-template-columns: 228px 1fr; grid-template-rows: 48px 1fr; min-height: 100vh; }
.side { grid-row: 1 / 3; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-weight: 600; font-size: 17px; text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.nav a, .nav button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { color: var(--text); background: #e3ebf3; }
.nav a[aria-current] { color: var(--text); background: #dfe8f1; font-weight: 500; }
.side .foot { margin-top: auto; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 16px; color: var(--muted); font-size: 13px; }
.sheet { background: var(--sheet); border: 1px solid var(--edge); border-radius: 16px; margin: 0 8px 8px 0; padding: 24px; min-width: 0; }

.titlerow { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.titlerow h1 { font-size: 24px; font-weight: 600; margin: 0; line-height: 1.25; }
.titlerow p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--control); background: #fff; color: var(--text); font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c6d3; }
.btn.primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn.primary:hover { background: var(--action-d); border-color: var(--action-d); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:focus-visible, .nav a:focus-visible, a:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: default; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 24px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--edge); border-radius: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; border-left: 1px solid var(--edge); }
.kpi:first-child { border-left: 0; }
.kpi .l { color: var(--muted); font-size: 14px; }
.kpi .v { font-size: 26px; font-weight: 500; line-height: 1.2; margin-top: 2px; }
.kpi .v.hot { color: var(--data); }
.kpi .c { color: var(--faint); font-size: 12px; margin-top: 2px; }

.card { border: 1px solid var(--edge); border-radius: 12px; margin-bottom: 16px; }
.card > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.card > header h2 { font-size: 16px; font-weight: 600; margin: 0; }
.card > header span { color: var(--muted); font-size: 13px; }
.rail h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.rail section { margin-bottom: 20px; }

.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 12px 16px; border-top: 1px solid var(--rule); align-items: center; }
.item b { font-weight: 500; }
.item .meta { color: var(--muted); font-size: 13px; }
.item .why { color: var(--muted); font-size: 13px; grid-column: 1 / -1; margin-top: -2px; }
.item .acts { display: flex; gap: 6px; }
.rail .item { padding: 10px 0; }
.empty { padding: 14px 16px 18px; color: var(--muted); border-top: 1px solid var(--rule); }
.rail .empty { padding: 10px 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 8px 12px; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--rule); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
td.n, th.n { text-align: right; }
td.n.zero { color: var(--faint); }
td .sub { display: block; color: var(--muted); font-size: 12px; }
.links { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; font-size: 13px; }
.links a, .links button { color: var(--data); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.links a:hover, .links button:hover { text-decoration: underline; }
.more { padding: 10px 16px 14px; border-top: 1px solid var(--rule); }

.pill { display: inline-block; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 99px; background: var(--n-bg); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }

.banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 20px; }
.status { padding: 10px 0; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 12px; }
.status span { color: var(--muted); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(14, 42, 71, .2); display: none; }
.toast.on { display: block; }

@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { display: block; }
  .side { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 2px; flex-wrap: wrap; }
  .side .foot, .topbar { display: none; }
  .sheet { margin: 0; border-radius: 16px 16px 0 0; padding: 18px 14px; min-height: calc(100vh - 48px); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--edge); }
  .hide-m { display: none; }
  .item { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
