/* direction "Petrol and lime": colours come only from tokens.css (--c-*), loaded before this file.
   Bricolage Grotesque (headings) and Funnel Sans (text), self-hosted variable fonts; latin-ext carries č, š, ž */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/static/fonts/bricolage-grotesque-latin-ext-standard.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/static/fonts/bricolage-grotesque-latin-standard.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

@font-face {
  font-family: "Funnel Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url("/static/fonts/funnel-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Funnel Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url("/static/fonts/funnel-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  /* no colour here: every colour is a --c-* token of tokens.css */
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Funnel Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  /* --space-* and --radius-pill come from tokens.css, the one scale for the site and the app */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

main.narrow { max-width: 420px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: var(--space-5) 0 var(--space-3); }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }

.muted { color: var(--c-muted); }
.ok { color: var(--c-success); }

/* the petrol bar: brand with its lime mark, then the user and Odjava */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--c-chapter);
  color: var(--c-chapter-fg);
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  margin-right: auto;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--c-accent);
}

.topbar .muted { color: var(--c-chapter-fg); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin: var(--space-4) 0;
}

.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }

label { font-weight: 500; }

/* control edges in the muted text colour: a text colour holds more than 3:1 on the surface (SC 1.4.11);
   16px text keeps a phone from zooming into the field */
input, select {
  font: inherit;
  font-size: 16px;
  min-height: 44px;
  color: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--c-muted);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
}

/* a button is an outlined pill; the primary one is a lime pill; 44px is the touch target */
button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--c-fg);
  cursor: pointer;
}

.topbar button { color: var(--c-chapter-fg); }

button.primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-fg);
}

button.primary:hover { border-color: var(--c-fg); }

button:disabled { opacity: 0.6; cursor: default; }

a { color: var(--c-chapter); }

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

/* on the petrol bar the ink-dark ring would vanish (1.3:1); lime is 10:1 there */
.topbar :focus-visible { outline-color: var(--c-focus-on-dark); }

.status { min-height: 24px; margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); }
.status.error { background: var(--c-surface); border: 1px solid var(--c-danger); color: var(--c-danger); }
.status.success { background: var(--c-surface); border: 1px solid var(--c-success); color: var(--c-success); }
/* an empty message keeps the live region in place but shows no box */
.status:empty { padding: 0; border: 0; background: none; }

/* a load error: the data already shown stays visible below it */
.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-2) 0;
  padding: var(--space-3);
  border: 1px solid var(--c-danger);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  color: var(--c-danger);
}
.alert:empty { padding: 0; border: 0; background: none; }
.alert p { margin: 0; }

.tenant-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tenant-list button { background: var(--c-surface); border-color: var(--c-border); }
.tenant-list button[aria-pressed="true"] { background: var(--c-chapter); border-color: var(--c-chapter); color: var(--c-chapter-fg); }

/* problems read as sentences; the raw path waits behind "Tehnične podrobnosti" */
.problems { list-style: none; padding: 0; margin: 0 0 var(--space-4); }
.problems li { padding: var(--space-3) 0; border-top: 1px solid var(--c-border); }
.problems p { margin: 0; }
.problem-title { font-weight: 600; }
.problems details { margin: var(--space-1) 0 0; color: var(--c-muted); }
.problems summary { cursor: pointer; }
code { font-family: inherit; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

th, td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--c-border); vertical-align: top; }
th { font-weight: 600; }
td.num { text-align: right; }

.table-scroll { overflow-x: auto; margin-bottom: var(--space-4); }
.table-scroll table { margin-bottom: 0; }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }

/* a state is a tag: glyph + word + tone; the tone is never the only cue */
.state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  font-weight: 500;
  white-space: nowrap;
}
.glyph { width: 1em; height: 1em; flex: none; }
.tone-success { color: var(--c-success); background: var(--c-success-bg); }
.tone-danger { color: var(--c-danger); background: var(--c-danger-bg); }
.tone-warning { color: var(--c-warning); background: var(--c-warning-bg); }
/* tokens.css has no neutral tone: the muted text on the tint */
.tone-neutral { color: var(--c-muted); background: var(--c-tint); }
.next { display: block; color: var(--c-muted); font-size: 0.875rem; }

/* counts per state: chips around the state tags, no coloured tiles; a chip sets the state filter */
.count-line { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  /* a control's edge needs 3:1 (SC 1.4.11); --c-border is a divider */
  border-color: var(--c-border-strong);
  background: var(--c-surface);
  font-weight: 500;
}
.chip:hover { border-color: var(--c-fg); }
.chip[aria-pressed="true"] { background: var(--c-chapter); border-color: var(--c-chapter); }

/* a unit's tag: the three unit colours in turn, dark text on each */
.znacka {
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  color: var(--c-fg);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.unit-1 { background: var(--c-unit-1); }
.unit-2 { background: var(--c-unit-2); }
.unit-3 { background: var(--c-unit-3); }
/* the unit's Bentral key: a grey line under its tag; a long key breaks anywhere instead of widening the table */
.unit-key {
  display: block;
  margin-top: var(--space-1);
  color: var(--c-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* the setup checklist at the top of a company: three steps, each Urejeno or not */
.checklist h3 { margin-top: 0; }
.checklist > p { margin: 0 0 var(--space-3); }
.steps { list-style: none; padding: 0; margin: 0; }
.steps > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--c-border);
}
.steps a { font-weight: 600; }
/* a step's own problems take the full width under its name and state; none, no list */
.steps .problems { flex-basis: 100%; margin: 0; }
.steps .problems:empty { display: none; }

.payment-methods { list-style: none; padding: 0; margin: 0 0 var(--space-4); }
.payment-methods li { display: flex; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--c-border); }
.method-code { font-weight: 600; }

/* under 640 px a ledger row becomes label: value pairs; the roles in app.html keep it a table */
@media (max-width: 639.98px) {
  .ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--c-border); }
  .ledger td { padding: var(--space-1) var(--space-3); border-bottom: 0; }
  .ledger td.num { text-align: left; }
  .ledger td::before { content: attr(data-label); display: inline-block; min-width: 8.5rem; font-weight: 600; }

  /* the unit table reflows the same way */
  .unit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .unit-table, .unit-table tbody, .unit-table tr, .unit-table td { display: block; }
  .unit-table td { padding: var(--space-1) var(--space-3); border-bottom: 0; }
  .unit-table td.num { text-align: left; }
  .unit-table td::before { content: attr(data-label); display: inline-block; min-width: 8.5rem; font-weight: 600; }

  /* each row is a card of its own on the page background */
  .ledger, .unit-table { border: 0; background: transparent; }
  .ledger tr, .unit-table tr {
    margin: 0 0 var(--space-3);
    padding: var(--space-2) 0;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
  }
}

[hidden] { display: none !important; }
