/* ============================================================
   Karlix QMS — standardi i zahtjevi (stablo)
   Dopuna uz qms.css i qms-codebooks.css. Učitava se poslije njih.
   ============================================================ */

/* ------------------------------------------------------------
   1. STABLO
   Norma nije ravan popis: 8.5.1 je pod 8.5, koje je pod 8.
   ------------------------------------------------------------ */

.qms-tree {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}

.qms-tnode {
    display: flex; align-items: center; gap: 11px;
    box-sizing: border-box;
    padding: 10px 20px; min-height: 40px;
    border-bottom: 1px solid var(--line-soft);
    color: inherit; text-decoration: none;
}
.qms-tnode:last-of-type { border-bottom: 0; }
.qms-tnode:hover { background: var(--surface-2); text-decoration: none; color: inherit; }

/* uvlačenje po razini — pet razina pokriva i 7.1.5.2 */
.qms-tnode[data-level="0"] { padding: 13px 20px; min-height: 46px; background: var(--surface-2); }
.qms-tnode[data-level="0"]:hover { background: var(--surface-2); }

.qms-tindent { flex: 0 0 auto; }
.qms-tnode[data-level="0"] .qms-tindent { width: 0; }
.qms-tnode[data-level="1"] .qms-tindent { width: 14px; }
.qms-tnode[data-level="2"] .qms-tindent { width: 32px; }
.qms-tnode[data-level="3"] .qms-tindent { width: 50px; }
.qms-tnode[data-level="4"] .qms-tindent { width: 68px; }

.qms-ticon { flex: 0 0 auto; font-size: 11px; color: var(--ink-4); }
.qms-tnode[data-level="0"] .qms-ticon { font-size: 13px; color: var(--accent-text); }

/* šifra točke: monospace radi poravnanja, akcent jer vodi na nalaze */
.qms-tcode {
    flex: 0 0 auto;
    font-family: var(--mono); font-size: 12px;
    color: var(--accent-text);
}
.qms-tnode[data-level="0"] .qms-tcode { width: 126px; font-size: 13px; color: var(--ink-strong); }
.qms-tnode[data-level="1"] .qms-tcode { width: 58px; font-size: 12.5px; }
.qms-tnode[data-level="2"] .qms-tcode { width: 64px; }
.qms-tnode[data-level="3"] .qms-tcode { width: 72px; }
.qms-tnode[data-level="4"] .qms-tcode { width: 76px; }

.qms-ttitle {
    min-width: 0;
    font-size: 13px; color: var(--ink-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qms-tnode[data-level="0"] .qms-ttitle { font-size: 14px; font-weight: 600; color: var(--ink-strong); }
.qms-tnode[data-level="1"] .qms-ttitle { font-size: 13.5px; font-weight: 500; }

.qms-ttail { margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 14px; }
.qms-tchildren { font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* neaktivna točka — bez statusne kolone, stanje se vidi iz retka */
.qms-tnode.is-inactive { background: var(--surface-2); }
.qms-tnode.is-inactive .qms-tcode,
.qms-tnode.is-inactive .qms-ttitle { color: var(--ink-3); }

/* ------------------------------------------------------------
   2. BROJ NALAZA UZ TOČKU
   Razlog zbog kojeg se šifrarnik održava.
   ------------------------------------------------------------ */

.qms-tfind {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 22px; padding: 0 7px;
    border-radius: 6px;
    background: var(--warn-soft); color: var(--warn-text);
    font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
    text-decoration: none;
}
.qms-tfind:hover { text-decoration: none; }
.qms-tfind.is-many { background: var(--bad-soft); color: var(--bad-text); }

/* ------------------------------------------------------------
   3. UVOZ NORME
   ------------------------------------------------------------ */

.qms-import-note {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--surface);
    font-size: 12.5px; line-height: 1.6; color: var(--ink-2);
}
.qms-import-note i { font-size: 13px; color: var(--accent-text); margin-top: 2px; }

.qms-tree-foot {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 20px;
    background: var(--surface-2);
    font-size: 12.5px; color: var(--ink-3);
}
.qms-tree-foot .qms-num { font-variant-numeric: tabular-nums; }

/* Uredi i ugasi uz točku stoje u jednom redu (prije umetnut stil u pogledu). */
.qms-tactions { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------
   3a. IZDANJA I KO (plan 323)

   Izdanje stoji uz ime norme samo kad norma ima više izdanja — ISO 9001:2015
   ima izdanje već u imenu. KO zahtjev nosi svoj broj iz norme („KO 5“):
   nesukladnost na njemu ruši certifikat, pa ga oznaka ne smije pokazati
   blaže od toga.
   ------------------------------------------------------------ */

.qms-tedition {
    flex: 0 0 auto;
    padding: 1px 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 11px; font-weight: 500; color: var(--ink-3);
}
.qms-tedition.is-off { border-style: dashed; }

.qms-ko {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bad-soft); color: var(--bad-text);
    font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
    white-space: nowrap;
}

.qms-izdanje { border-top: 1px solid var(--line-soft); }
.qms-izdanje-tekst { color: var(--ink-3); }
.qms-izdanje-obrazac { display: inline-flex; align-items: center; gap: 8px; }
.qms-izdanje-obrazac .form-select { width: auto; min-width: 220px; }

.qms-druga-izdanja > summary {
    cursor: pointer;
    display: flex; align-items: baseline; gap: 10px;
    padding: 6px 2px;
    font-weight: 600; color: var(--ink-2);
}
.qms-druga-izdanja > .qms-tree { margin-top: 8px; }

/* ------------------------------------------------------------
   4. RESPONZIVNO
   ------------------------------------------------------------ */

@media (max-width: 900px) {
    .qms-tnode { flex-wrap: wrap; padding-left: 15px; padding-right: 15px; }
    .qms-tnode[data-level="3"] .qms-tindent,
    .qms-tnode[data-level="4"] .qms-tindent { width: 32px; }
    .qms-ttail { width: 100%; margin-left: 0; padding-left: 32px; padding-top: 6px; }
}

@media print {
    .qms-tnode { break-inside: avoid; }
    .qms-ttail .qms-iconbtn { display: none; }
}
