/* ui.css — Botterin yhteinen design-järjestelmä (dashboard, admin, signup).
   Kaikki värit ovat tokeneita, jotta tumma tila toimii yhdellä ylikirjoituksella. */

:root {
  --brand: #5B3DF5;
  --brand-hover: #4A2DE0;
  --brand-soft: #EEEBFF;
  --brand-ink: #3D22C9;

  --bg: #F6F6F9;
  --surface: #FFFFFF;
  --surface-2: #F9F9FB;
  --surface-3: #F1F1F5;
  --border: #E6E6EC;
  --border-strong: #D4D4DD;

  --text: #16161D;
  --text-2: #50505E;
  --text-3: #83838F;

  --good: #18794E;
  --good-soft: #E6F6EC;
  --warn: #8A5A00;
  --warn-soft: #FFF3D6;
  --bad: #B42318;
  --bad-soft: #FDECEA;
  --info: #1D5FD0;
  --info-soft: #E6EFFD;

  --code-bg: #15151F;
  --code-text: #D7D9F5;

  --shadow-sm: 0 1px 2px rgba(16, 16, 29, .05);
  --shadow: 0 1px 2px rgba(16, 16, 29, .04), 0 4px 16px rgba(16, 16, 29, .06);
  --shadow-lg: 0 12px 40px rgba(16, 16, 29, .18);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --sidebar-w: 248px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #7C64FF;
    --brand-hover: #9582FF;
    --brand-soft: #25204A;
    --brand-ink: #B7AAFF;
    --bg: #0E0E13;
    --surface: #17171E;
    --surface-2: #1C1C24;
    --surface-3: #23232C;
    --border: #2A2A34;
    --border-strong: #393945;
    --text: #EDEDF2;
    --text-2: #B0B0BD;
    --text-3: #7D7D8A;
    --good: #4ACB8A; --good-soft: #10291D;
    --warn: #F0B94A; --warn-soft: #2C220C;
    --bad: #FF7B6E; --bad-soft: #321614;
    --info: #74A6FF; --info-soft: #14213A;
    --code-bg: #0A0A10;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #7C64FF;
  --brand-hover: #9582FF;
  --brand-soft: #25204A;
  --brand-ink: #B7AAFF;
  --bg: #0E0E13;
  --surface: #17171E;
  --surface-2: #1C1C24;
  --surface-3: #23232C;
  --border: #2A2A34;
  --border-strong: #393945;
  --text: #EDEDF2;
  --text-2: #B0B0BD;
  --text-3: #7D7D8A;
  --good: #4ACB8A; --good-soft: #10291D;
  --warn: #F0B94A; --warn-soft: #2C220C;
  --bad: #FF7B6E; --bad-soft: #321614;
  --info: #74A6FF; --info-soft: #14213A;
  --code-bg: #0A0A10;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Ikonit ---------- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- Painikkeet ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  font: 600 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-hover); }
.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible, .chip:focus-visible, .swatch:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn .spinner { width: 14px; height: 14px; }

/* ---------- Lomakkeet ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-3); }
.help { font-size: 12.5px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: 14px var(--font);
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2383838F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input-group { display: flex; gap: 8px; }
.input-group > .input { flex: 1; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.char-count { font-size: 12px; color: var(--text-3); text-align: right; }

/* ---------- Kortit ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 0; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; }
.card-head p { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.card-body { padding: 18px 20px 20px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-foot .status-text { margin-right: auto; font-size: 13px; color: var(--text-3); }

/* ---------- Badget ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-3); color: var(--text-2); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- Ilmoitukset / bannerit ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert strong { display: block; margin-bottom: 2px; }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; align-self: center; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert.good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.alert.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.alert.info { background: var(--brand-soft); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.error .icon { color: #FF8A80; }
.toast.success .icon { color: #5BE0A0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modaali ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 20, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 900; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; animation: pop .18s ease-out; }
.modal-head { padding: 20px 22px 4px; }
.modal-head h3 { font-size: 17px; }
.modal-head p { color: var(--text-2); margin-top: 6px; font-size: 13.5px; }
.modal-body { padding: 16px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }

/* ---------- Spinner & skeleton ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tyhjä tila ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.empty h4 { font-size: 14.5px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }

/* ---------- Sovelluksen runko (sivupalkki + sisältö) ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.app-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 750; font-size: 17px; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #9B7BFF); display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-mark .icon { width: 17px; height: 17px; stroke-width: 2.2; }
.app-brand .tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-3); padding: 2px 6px; border-radius: 5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-weight: 550; font-size: 13.5px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-family: inherit;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; }
.nav-item.active .count { background: var(--surface); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.account { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); }
.avatar-initials { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.account .who { min-width: 0; flex: 1; }
.account .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .who span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 32px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 8px 32px 56px; max-width: 1180px; }

.page-intro { color: var(--text-2); margin: -2px 0 20px; font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- KPI-tiilet ---------- */
.stat { padding: 16px 18px; }
.stat .stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.stat .stat-label .icon { color: var(--text-3); width: 16px; height: 16px; }
.stat .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .stat-value small { font-size: 14px; font-weight: 550; color: var(--text-3); letter-spacing: 0; }
.stat .stat-foot { font-size: 12.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.delta { font-weight: 650; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s; }
.progress.warn > span { background: var(--warn); }
.progress.bad > span { background: var(--bad); }

/* ---------- Kaaviot ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--brand); transition: opacity .12s; }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 8px;
  font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; box-shadow: var(--shadow); z-index: 5;
}
.chart-tip b { display: block; font-size: 13px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }

/* ---------- Taulukot ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Segmentit / chipit ---------- */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--text-2); font: 600 12.5px var(--font); height: 28px; padding: 0 11px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 550 12.5px var(--font); cursor: pointer; }
.chip:hover { border-color: var(--text-3); color: var(--text); }

/* ---------- Koodilohko ---------- */
.code-block { position: relative; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); padding: 16px 16px; font: 13px/1.6 var(--mono); overflow-x: auto; white-space: pre; }
.code-block .copy { position: absolute; top: 8px; right: 8px; }
.code-block .btn.secondary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; box-shadow: none; }
.code-block .btn.secondary:hover { background: rgba(255,255,255,.16); }

/* ---------- Kirjautumis-/signup-näkymät ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at -10% -10%, #8B6DFF 0%, transparent 55%), radial-gradient(900px 500px at 120% 110%, #2A1A9E 0%, transparent 60%), #4A2DE0;
}
.auth-side .app-brand { color: #fff; padding: 0; }
.auth-side .brand-mark { background: rgba(255,255,255,.18); }
.auth-side h2 { font-size: 34px; font-weight: 750; letter-spacing: -.03em; line-height: 1.12; margin-top: auto; max-width: 460px; }
.auth-side .lede { font-size: 16px; opacity: .85; margin-top: 14px; max-width: 440px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.auth-points .icon { background: rgba(255,255,255,.18); border-radius: 50%; padding: 3px; width: 22px; height: 22px; stroke-width: 2.4; }
.auth-side .mock { margin-top: 36px; margin-bottom: auto; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-2); margin: 6px 0 26px; font-size: 14.5px; }
.auth-card .foot { margin-top: 22px; text-align: center; font-size: 13px; color: var(--text-3); }
.auth-card .foot a { font-weight: 600; text-decoration: none; }

.industry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.industry-option { position: relative; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 550; background: var(--surface); color: var(--text); text-align: left; font-family: inherit; }
.industry-option:hover { border-color: var(--text-3); }
.industry-option.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); box-shadow: 0 0 0 1px var(--brand); }
.industry-option .emoji { font-size: 17px; }

/* ---------- Responsiivisuus ---------- */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10,10,20,.4); z-index: 150; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 8px 16px 48px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .topbar h1 { font-size: 17px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .card-foot { padding: 12px 16px; flex-wrap: wrap; }
}
