/* ===========================================================================
   kpime — base design system
   Light professional SaaS theme. All pages build on these tokens + primitives.
   =========================================================================== */

/* ---- Fonts (self-hosted, latin subset, variable) --------------------------- */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/Inter.woff2) format("woff2");
}

/* Headings use Inter's purpose-built display sibling rather than a quirky
   geometric face — same superfamily as the body text, so the whole product
   reads as one neutral, professional system. */
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/InterTight.woff2) format("woff2");
}

:root {
  /* Warm paper palette — off-white with a hint of warmth, deep warm ink,
     and a confident evergreen brand accent that harmonizes with the report
     charts (which draw in green/blue). */
  --bg: #f5f4ef;
  --surface: #fcfbf7;
  --ink: #17160f;
  --ink-2: #4c4a42;
  --muted: #8a877d;
  --hairline: #e5e2d8;
  --border: rgba(23, 22, 15, 0.11);

  --accent: #0f7a52;
  --accent-ink: #0b5b3d;
  --accent-soft: rgba(15, 122, 82, 0.10);
  --accent-2: #c56a2a;
  --good: #0ca30c;
  --good-text: #036b2f;
  --bad: #c23b34;
  --warn: #c98a00;

  --radius: 12px;

  --shadow-sm: 0 1px 2px rgba(23, 22, 15, 0.05);
  --shadow-md: 0 1px 3px rgba(23, 22, 15, 0.06), 0 6px 18px rgba(23, 22, 15, 0.05);
  --shadow-lg: 0 4px 10px rgba(23, 22, 15, 0.07), 0 16px 40px rgba(23, 22, 15, 0.09);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ---- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ---- Typography ------------------------------------------------------------ */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--ink);
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p {
  color: var(--ink-2);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

small,
.text-small {
  font-size: 0.82rem;
}

.text-muted {
  color: var(--muted);
}

.text-ink-2 {
  color: var(--ink-2);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ---- Layout ----------------------------------------------------------------- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.stack > * + * {
  margin-top: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 16px;
}

/* ---- Cards ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card + .card {
  margin-top: 16px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ---- Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 3px);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color 120ms ease, border-color 120ms ease,
    box-shadow 120ms ease, transform 60ms ease;
  user-select: none;
  text-decoration: none;
}

.btn:hover {
  background: #f3f3f0;
  border-color: rgba(11, 11, 11, 0.18);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.btn-danger {
  background: var(--surface);
  border-color: rgba(208, 59, 59, 0.4);
  color: var(--bad);
}

.btn-danger:hover {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.82rem;
}

/* ---- Forms ------------------------------------------------------------------ */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
/* type=search was missing here, so the widget filters fell back to the
   browser's search-field styling: 2px border, no radius, 2px padding and a
   smaller font than everything around them. */
input[type="search"],
select,
textarea {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) - 3px);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.field {
  margin-bottom: 14px;
}

.form-error {
  color: var(--bad);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ---- Tables ------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg);
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: rgba(11, 11, 11, 0.02);
}

.table td.num,
.table th.num,
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- Badges -------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.7;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-good {
  color: var(--good-text);
  background: rgba(12, 163, 12, 0.10);
  border-color: rgba(12, 163, 12, 0.25);
}

.badge-muted {
  color: var(--ink-2);
  background: rgba(11, 11, 11, 0.05);
  border-color: var(--border);
}

.badge-bad {
  color: var(--bad);
  background: rgba(208, 59, 59, 0.08);
  border-color: rgba(208, 59, 59, 0.28);
}

/* Neither good nor bad — "dropped out", "couldn't check" and similar. */
.badge-warn {
  color: #92400e;
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(180, 83, 9, 0.28);
}

.badge-warn {
  color: #8a5c00;
  background: rgba(237, 161, 0, 0.12);
  border-color: rgba(237, 161, 0, 0.35);
}

/* ---- Utilities -------------------------------------------------------------------- */

.hairline {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 16px 0;
}

.hidden {
  display: none !important;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.tabular {
  font-variant-numeric: tabular-nums;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.good { color: var(--good-text); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

/* ---- Responsive -------------------------------------------------------------------- */

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 14px;
  }

  .card {
    padding: 16px;
  }

  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }
}
