/* Felületi irányelvek: docs/ui-guidelines.md – vizuális minta: docs/ui-preview.html. */

/* 3. Tipográfia: Red Hat Display, helyben kiszolgálva (Google Fonts, OFL-licenc: ../fonts/OFL.txt).
   Változó betűtípus 300–800 vastagsággal; a latin-ext a magyar ő, ű miatt kell. */
@font-face {
  font-family: "Red Hat Display";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/red-hat-display-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Red Hat Display";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/red-hat-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 2. Színek */
:root {
  /* Márka */
  --brand-orange: #e95a1a;        /* Corporate Orange – logó, kiemelő sáv, ikon, nagy (≥24px) cím */
  --brand-orange-strong: #c0450f; /* gomb háttér, link, fókuszkeret – 5,1:1 kontraszt fehéren */
  --brand-orange-tint: #fdeee6;   /* halvány narancs háttér (aktív menü, kiemelt sor) */
  --brand-yellow: #f8b133;        /* Corporate Yellow – csak a gradiensben és figyelmeztetés-jelzésben */
  --brand-gradient: linear-gradient(-30deg, #e95a1a 20%, #f8b133 80%);

  /* Semleges */
  --ink: #1a1a1a;
  --muted: #5f6368;
  --border: #e3e3e6;
  --bg: #f6f6f7;
  --surface: #ffffff;

  /* Jelentés (sosem narancs, hogy ne keveredjen a márkaszínnel) */
  --info-fg: #174ea6;    --info-bg: #e8f0fe;
  --success-fg: #1b5e20; --success-bg: #e8f5e9;
  --warning-fg: #7a4d00; --warning-bg: #fef3dc;
  --danger-fg: #b3261e;  --danger-bg: #fdecea;
  --neutral-fg: #3c4043; --neutral-bg: #eceff1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Red Hat Display", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--brand-orange-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--brand-orange-strong);
  outline-offset: 2px;
}

h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 300;
  line-height: 1.25;
}

h1 b {
  font-weight: 800;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}

h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

h1 + .meta {
  margin-top: 0;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.err {
  margin-top: 4px;
  color: var(--danger-fg);
  font-size: 13px;
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* 4. Elrendezés – fejléc: fehér, 64px, alatta 4px márka-gradiens sáv */
.site-header {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
}

.site-logo {
  display: flex;
  align-items: center;
}

.site-logo img {
  display: block;
  width: auto;
  height: 40px; /* 10. a márka minimuma */
}

.site-nav {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.site-nav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-weight: 600;
}

.site-nav a:hover {
  background: var(--bg);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--brand-orange);
  color: var(--brand-orange-strong);
}

.site-user {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-size: 14px;
}

.site-user small {
  color: var(--muted);
  font-size: 13px;
}

.site-strip {
  height: 4px;
  background: var(--brand-gradient);
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.site-main:focus {
  outline: none;
}

.site-footer {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  color: var(--muted);
  font-size: 13px;
}

section + section {
  margin-top: 32px;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Kártya és kétoszlopos adatlap-rács (fő tartalom ~2/3, döntési panel ~1/3) */
.card {
  margin-bottom: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.card dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 6px 16px;
  margin: 0;
}

.card dt {
  color: var(--muted);
  font-size: 14px;
}

.card dd {
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

.sticky {
  position: sticky;
  top: 16px;
}

/* 1024px alatt egyoszlopos, a döntési panel felül */
@media (max-width: 1023.98px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .grid > .sticky {
    position: static;
    order: -1;
  }
}

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

/* 6. Állapotcímkék: háttér + szöveg a jelentés-színpárból, mindig szöveggel */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.info,
.bar.info {
  background: var(--info-bg);
  color: var(--info-fg);
}

.pill.success,
.bar.success {
  background: var(--success-bg);
  color: var(--success-fg);
}

.pill.warning,
.bar.warning {
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.pill.danger,
.bar.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.pill.neutral {
  background: var(--neutral-bg);
  color: var(--neutral-fg);
}

.pill.brand {
  background: var(--brand-orange-tint);
  color: #8a3410;
}

/* A CRM-ből jött adat csak olvasható, szürke „CRM” címkével */
.crm {
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-size: 12px;
  font-weight: 700;
}

/* 5.4 Visszajelzés: sáv a tartalom tetején */
.bar {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
}

.bar:focus {
  outline: none;
}

.bar[hidden] {
  display: none;
}

.bar.info {
  border-left: 4px solid var(--info-fg);
}

.bar.success {
  border-left: 4px solid var(--success-fg);
}

.bar.warning {
  border-left: 4px solid #c98a00;
}

.bar.danger {
  border-left: 4px solid var(--danger-fg);
}

/* 6. Gombok: 40px, 0 18px, 6px lekerekítés */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:not(:disabled):hover {
  background: var(--bg);
  text-decoration: none;
}

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

.btn.primary:not(:disabled):hover {
  border-color: #a83c0d;
  background: #a83c0d;
}

.btn.danger {
  border-color: var(--danger-fg);
  color: var(--danger-fg);
}

/* Megerősítés lépésében a veszélyes gomb teli */
.btn.danger.confirm {
  background: var(--danger-fg);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.block {
  width: 100%;
}

/* 6. Űrlapelemek: címke a mező fölött, 40px magas mező, fókuszban narancs keret */
label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

input:not([type="checkbox"], [type="radio"], [type="hidden"]),
select,
textarea {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

textarea {
  width: 100%;
  height: auto;
  min-height: 96px;
  padding: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-orange-strong);
  outline: none;
  box-shadow: 0 0 0 1px var(--brand-orange-strong);
}

.invalid {
  border-color: var(--danger-fg);
}

.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* 5.2 Adatlap: fejblokk (cím és meta balra, állapot- és eszkalációs címke jobbra) */
.page-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.pills {
  display: flex;
  gap: 8px;
}

/* Felsorolás jelölő nélkül (pl. számlázási tételek a CRM-kártyán) */
.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ADT-10: a számlázási egység csatolmányai a megnevezés alatt */
.attachments {
  margin-top: 4px;
  font-size: 13px;
}

/* 5.3 Indoklást igénylő döntés: a gombra kattintva nyíló szövegmező a panelben */
details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details[open] > summary {
  margin-bottom: 10px;
}

/* 1.2, 5.3: a kinyitott indoklás-űrlapon a „Küldés” az egyetlen elsődleges gomb – a jóváhagyás másodlagosként jelenik meg */
.decision:has(> details[open]) > form > .btn.primary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

/* 1.2, 5.3 (handover, D-064): a kinyitott „Handover hiányos” űrlapon a „Küldés” az egyetlen elsődleges gomb – az indoklás
   ugyanabban az űrlapban van, mint a „Handover rendben” */
#handover-panel form:has(> details[open]) > .btn.primary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

/* 1.2, 5.3: a kinyitott megszakítás-megerősítésnél a döntés a veszélyes gombé – a panelen nem marad narancs kiemelés */
.decision-card:has(#cancel-panel details[open]) .btn.primary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

/* 5.3 Kiosztás: választható személyek (rádiógomb, jelölőnégyzet) csoportcímmel, alattuk a hozzárendeléseik (FK-309) */
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: baseline;
}

.choice + .choice {
  margin-top: 8px;
}

.choice > label {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
}

.choice > .hint {
  grid-column: 2;
}

/* 5.3: „Küldés” / „Mégse” gombpár */
.form-actions {
  display: flex;
  gap: 8px;
}

/* 5.2 Checklist: ikon és szöveg együtt */
.chk {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chk li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.chk li:last-child {
  border-bottom: 0;
}

.chk .ok,
.chk .no,
.chk .opt {
  flex: 0 0 120px;
}

.chk .ok {
  color: var(--success-fg);
  font-weight: 700;
}

.chk .no {
  color: var(--danger-fg);
  font-weight: 700;
}

.chk .opt {
  color: var(--muted);
}

/* 5.1 Lista: táblázat */
table {
  width: 100%;
  border: 1px solid var(--border);
  border-collapse: separate;
  border-radius: 8px;
  border-spacing: 0;
  background: var(--surface);
  overflow: hidden;
}

th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

tbody tr {
  height: 48px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--bg);
}

td small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

/* 5.3: a sorban kinyíló megerősítés (pl. a naptár-kivétel törlése) gombjai is jobbra igazítva */
td.actions .form-actions {
  justify-content: flex-end;
}

/* D-078 (T14b-2): a felhasználó egy szerepköre – a név és az elvétel kétlépéses gombja egy sorban (5.3). */
.role-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Összegek táblázatban (pl. a számlázási egységek várt összege): jobbra igazítva, tördelés nélkül. */
th.num,
td.num {
  text-align: right;
  white-space: nowrap;
}

tfoot th,
tfoot td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

td .bar {
  margin: 0;
}

/* Határidő: lejárt / 1 munkanapon belül */
.late {
  color: var(--danger-fg);
  font-weight: 700;
}

.soon {
  color: var(--warning-fg);
  font-weight: 600;
}

/* 5.1 Üres állapot: középre igazított szürke szöveg */
.empty {
  margin: 0;
  padding: 32px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

/* 5.2 Előzmények: idővonal, legújabb felül */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  padding: 10px 0 10px 18px;
  border-left: 2px solid var(--border);
}

.timeline li::before {
  position: absolute;
  top: 16px;
  left: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-orange);
  content: "";
}

/* 9. Belépőoldal: teljes képernyős galaxis-háttér sötétítés nélkül, középen fehér kártya,
   bal alsó sarokban a fehér logó */
.entrance {
  position: relative;
  background: #0b0b1e url("../img/brand/login-background.jpg") center / cover no-repeat;
}

.entrance-main {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 88px;
}

.entrance-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 32px;
  border-radius: 12px;
  background: var(--surface);
}

.entrance-logo {
  display: block;
  width: auto;
  height: 40px;
  margin-bottom: 8px;
}

.entrance-title {
  margin: 4px 0 2px;
  font-size: 20px;
  font-weight: 700;
}

.entrance-card h2 {
  margin: 16px 0 8px;
  font-size: 16px;
}

.entrance-corner {
  position: absolute;
  bottom: 20px;
  left: 24px;
  width: auto;
  height: 40px;
}

.user-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.user-list form {
  height: 100%;
  margin: 0;
}

.user-list .btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  width: 100%;
  height: 100%;
  padding: 6px 12px;
  line-height: 1.3;
  text-align: left;
}

.user-list .btn small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
