:root {
  color-scheme: light;
  --ground: #f5f8f7;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --border: #dbe5e2;
  --border-strong: #c3d2ce;
  --ink: #16211f;
  --muted: #5c6b68;
  --faint: #82918e;
  --accent: #0b6e63;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ed;
  --accent-border: #b5d6cf;
  --danger: #b42318;
  --danger-soft: #fdf0ee;
  --danger-border: #f0c4be;
  --warn: #8a5a00;
  --warn-soft: #fdf4e3;
  --warn-border: #ecd9ae;
  --info: #2859a6;
  --info-soft: #edf3ff;
  --shadow: 0 1px 2px rgba(22, 33, 31, 0.05), 0 4px 16px rgba(22, 33, 31, 0.06);
  --shadow-pop: 0 10px 36px rgba(22, 33, 31, 0.18);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0f1514;
    --surface: #171f1d;
    --surface-2: #1e2927;
    --border: #293532;
    --border-strong: #374642;
    --ink: #e7eeec;
    --muted: #9cadaa;
    --faint: #71827e;
    --accent: #4ccfbc;
    --accent-ink: #08302b;
    --accent-soft: #163531;
    --accent-border: #2a5950;
    --danger: #f2867a;
    --danger-soft: #34201d;
    --danger-border: #57302b;
    --warn: #e5b567;
    --warn-soft: #322a19;
    --warn-border: #55452a;
    --info: #92b4ff;
    --info-soft: #172541;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.24);
    --shadow-pop: 0 10px 36px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0f1514;
  --surface: #171f1d;
  --surface-2: #1e2927;
  --border: #293532;
  --border-strong: #374642;
  --ink: #e7eeec;
  --muted: #9cadaa;
  --faint: #71827e;
  --accent: #4ccfbc;
  --accent-ink: #08302b;
  --accent-soft: #163531;
  --accent-border: #2a5950;
  --danger: #f2867a;
  --danger-soft: #34201d;
  --danger-border: #57302b;
  --warn: #e5b567;
  --warn-soft: #322a19;
  --warn-border: #55452a;
  --info: #92b4ff;
  --info-soft: #172541;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.24);
  --shadow-pop: 0 10px 36px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f5f8f7;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --border: #dbe5e2;
  --border-strong: #c3d2ce;
  --ink: #16211f;
  --muted: #5c6b68;
  --faint: #82918e;
  --accent: #0b6e63;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ed;
  --accent-border: #b5d6cf;
  --danger: #b42318;
  --danger-soft: #fdf0ee;
  --danger-border: #f0c4be;
  --warn: #8a5a00;
  --warn-soft: #fdf4e3;
  --warn-border: #ecd9ae;
  --info: #2859a6;
  --info-soft: #edf3ff;
  --shadow: 0 1px 2px rgba(22, 33, 31, 0.05), 0 4px 16px rgba(22, 33, 31, 0.06);
  --shadow-pop: 0 10px 36px rgba(22, 33, 31, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }

/*
 * The Qlik Sense client stylesheet loads AFTER this one and sets
 *   body, button, input, select, textarea { font-family: inherit }
 * at element specificity, so it beats `body { font: ... }` and resolves to the
 * UA default — rendering the whole extension in Times. Declaring the stack on
 * <html> makes that `inherit` resolve to ours instead, and the class-scoped
 * rules in admin.css beat Qlik's element selectors outright. Do not remove
 * either half; the extension re-serifs itself the moment one goes.
 */
html { font-family: var(--sans); }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { color: var(--ink); }
p { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre { font-family: var(--mono); }

input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  outline: none;
}

textarea { min-height: 110px; resize: vertical; }

:is(button, input, select, textarea, a, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

a { color: var(--accent); }

/* Managed assets use the existing knowledge-base controls and spacing. */
.kb-settings [data-limits] { display: grid; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border, #30423e); }
.kb-browser-tools [data-upload] { display: grid; gap: 12px; margin-top: 12px; }
.kb-browser-tools [data-upload][hidden] { display: none; }
.kb-document [data-asset] { padding: 24px; }
.kb-document [data-asset][hidden] { display: none; }

.kb-file-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-file-actions button { margin: 0; }
