:root {
  --ink: #1a2330; --muted: #6b7785; --line: #e2e8f0; --card: #fff;
  --brand: #0b62d6; --brand-ink: #fff;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: #f4f6f9; }

/* Környezet-banner (staging/local) — éles rendszeren nem jelenik meg. */
.env-banner { position: sticky; top: 0; z-index: 50; text-align: center; font-weight: 800;
  font-size: .8rem; letter-spacing: .04em; padding: 6px 12px; color: #3a2c00;
  background: repeating-linear-gradient(45deg,#ffd84d,#ffd84d 14px,#ffcf1f 14px,#ffcf1f 28px);
  border-bottom: 2px solid #e0a800; }
.env-banner.env-local { color: #06314f;
  background: repeating-linear-gradient(45deg,#9bd2ff,#9bd2ff 14px,#7fc6ff 14px,#7fc6ff 28px);
  border-bottom-color: #3a93d6; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand-wrap { display: flex; align-items: baseline; gap: .5rem; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.commit { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .72rem;
  color: var(--muted); background: #ebecf0; border-radius: 6px; padding: 1px 6px; }
.topnav { display: flex; align-items: center; gap: 1rem; }
.who { color: var(--muted); font-size: .9rem; }
.btn-link { color: var(--brand); text-decoration: none; font-size: .9rem; }

.container { max-width: 640px; margin: 2rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.5rem; box-shadow: var(--shadow); }
.card.center { text-align: center; }
.card h1 { margin: .25rem 0 .75rem; font-size: 1.5rem; }
.muted { color: var(--muted); }
.alert { background: #fdecec; color: #8f2727; border: 1px solid #f5c6c6; border-radius: 8px;
  padding: 8px 12px; margin: 10px 0; font-size: .9rem; }
.btn-primary { display: inline-block; margin-top: 12px; background: var(--brand); color: var(--brand-ink);
  text-decoration: none; font-weight: 600; padding: 10px 18px; border-radius: 8px; }

/* --- Board (3 oszlop) --- */
.board-page { max-width: none; margin: 0; padding: 1rem 1.5rem 2.5rem; }
.ph-head { text-align: center; margin: .5rem 0 1.25rem; }
.ph-title { font-size: 1.5rem; font-weight: 700; margin: 0; white-space: nowrap; }
.ph-total { display: inline-block; vertical-align: middle; margin-left: 10px; min-width: 1.6em;
  padding: 2px 12px; border-radius: 999px; font-size: 1.05rem; font-weight: 800;
  color: #6b4e12; background: #fbeec2; border: 1px solid #f0d98a; }

.board { display: flex; gap: 14px; align-items: stretch; justify-content: safe center;
  overflow-x: auto; padding-bottom: 8px; }
.column { flex: 0 0 280px; border-radius: 12px; padding: 8px; background: #eef2f7; }
.col-uj { background: #fbf4d6; }
.col-kda_feldolgozas { background: #d8f0ec; }
.col-problemas { background: #fbe6e6; }
.column-head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; font-weight: 700; font-size: .95rem; }
.col-uj .column-head { color: #6b5d12; }
.col-kda_feldolgozas .column-head { color: #1c6b62; }
.col-problemas .column-head { color: #8f2727; }
.column-count { background: #fff; border-radius: 999px; padding: 0 8px; color: var(--muted); font-weight: 600; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; margin-top: 6px; }

.card { position: relative; }
.column-body .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 12px 14px; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-order { font-weight: 700; font-size: .92rem; }
.copy-btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  cursor: pointer; color: var(--muted); padding: 1px; border-radius: 4px; margin-left: 2px; }
.copy-btn:hover { color: var(--brand); background: #eef2f8; }
.copy-btn.copied { color: #137333; }
.copy-btn svg { display: block; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted);
  font-size: .8rem; margin: 4px 0; align-items: center; }
.card-date { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem;
  font-weight: 600; color: #1a1a1a; --dot-color: #16a34a; }
.card-date::after { content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot-color); flex: 0 0 auto; }
.card-date.age-fresh { --dot-color: #16a34a; }
.card-date.age-warn { --dot-color: #f59e0b; }
.card-date.age-urgent { --dot-color: #f97316; }
.card-date.age-critical { --dot-color: #dc2626; }
@keyframes ds-dot-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .28; transform: scale(1.18); } }
.card-date.age-warn::after { animation: ds-dot-pulse 3s ease-in-out infinite; }
.card-date.age-urgent::after { animation: ds-dot-pulse 1.9s ease-in-out infinite; }
.card-date.age-critical::after { animation: ds-dot-pulse 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .card-date::after { animation: none !important; } }
.card-ship { font-size: .76rem; color: var(--muted); margin: 2px 0 4px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; }
.card-items { position: relative; }
.card-comments { position: relative; color: var(--muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px; }
.icon-comment { width: 13px; height: 13px; }
/* Olvasatlan hozzászólás: KÉK, TELE (fill) ikon + szám (a részlet megnyitásáig). */
.card-comments.unread { color: var(--brand); font-weight: 700; }
.card-comments.unread .icon-comment { fill: currentColor; }
.card-items.has-peek, .card-comments.has-peek { cursor: help; }

.status-tag { display: inline-block; margin-top: 8px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em; color: #fff; padding: 2px 8px; border-radius: 999px; }
.st-uj { background: #f2cc0c; color: #1b1f24; }
.st-kda_feldolgozas { background: #12a89a; }
.st-problemas { background: #d63a3a; }
.empty-hint { color: var(--muted); font-size: .82rem; text-align: center; padding: 10px 0; }

/* Gyorsnézet popupok (tétel / komment) */
/* A megjelenítést/pozicionálást JS vezérli (position:fixed → nem vágja le az overflow). */
.items-peek, .comments-peek { display: none; position: fixed; z-index: 1000;
  flex-direction: column; gap: 5px; min-width: 220px; max-width: 300px; text-align: left;
  white-space: normal; overflow-wrap: anywhere; pointer-events: none;
  max-height: 60vh; overflow-y: auto;
  background: #11233d; color: #e6eef9; border: 1px solid #21395b; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16,24,40,.3); padding: 10px 12px; }
.items-peek-title { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  color: #7b94b5; margin-bottom: 2px; }
.items-peek-row, .comment-peek-row { font-size: .82rem; line-height: 1.35; }
.items-peek-qty { color: #86acd9; font-weight: 600; }
.comment-peek-meta { display: block; color: #86acd9; font-size: .72rem; }

@media (max-width: 720px) { .board { flex-direction: column; } .column { flex: 1 1 auto; } }

/* --- Rendelés-részlet --- */
.detail-wrap { max-width: 720px; margin: 1.5rem auto; padding: 0 1rem; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--brand); text-decoration: none; font-weight: 600; font-size: .9rem; }
/* Útjelző-alakú „Vissza" gomb (a hub board-jával egyező). Az alakot háttér-SVG rajzolja. */
.ds-sidenav {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  width: 100px; height: 38px; margin-bottom: 12px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: .9rem;
  background-repeat: no-repeat; background-position: center; background-size: 100% 100%;
  filter: drop-shadow(0 1px 2px rgba(16, 24, 40, .25));
}
.ds-sidenav:hover { filter: drop-shadow(0 1px 2px rgba(16, 24, 40, .25)) brightness(.95); }
.ds-sidenav-left {
  padding: 0 8px 0 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 38' preserveAspectRatio='none'%3E%3Cpath d='M7 19 L27 6 L93 6 L93 32 L27 32 Z' fill='%230b62d6' stroke='%230b62d6' stroke-width='9' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.detail-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.detail-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.detail-head h1 { margin: 0; font-size: 1.4rem; }
.detail-grid { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.detail-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.detail-row dt { flex: 0 0 140px; color: var(--muted); font-size: .85rem; margin: 0; }
.detail-row dd { margin: 0; font-size: .9rem; }
.items-list { display: flex; flex-direction: column; gap: 6px; }
.item-row { font-size: .9rem; }
.item-row .qty { color: var(--brand); font-weight: 600; margin-right: 4px; }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfc; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.comment-author { font-weight: 600; font-size: .85rem; }
.comment-time { color: var(--muted); font-size: .78rem; }
.comment-body { font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.kda-badge { display: inline-block; background: #12a89a; color: #fff; font-size: .6rem; font-weight: 700;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }

/* Reverse-sync (F3.5): kártya-húzás + KDA-komment form */
/* A kártya elsődlegesen kattintható (részletre nyit) → normál pointer; a „grabbing"
   csak TÉNYLEGES húzás közben (SortableJS chosen/fallback osztályok). */
.column-body .card { cursor: pointer; }
/* A natív link/kép-húzás ne szívja el a gesztust a SortableJS elől (a kártyát kitöltő <a>). */
.column-body .card, .column-body .card * { -webkit-user-drag: none; user-select: none; }
.card-link { cursor: inherit; }
.sortable-ghost { opacity: .4; }
.sortable-chosen, .sortable-drag, .sortable-fallback { cursor: grabbing !important; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.comment-form textarea { flex: 1; resize: vertical; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .9rem; }
.comment-form textarea:focus { outline: none; border-color: var(--brand); }
.btn-send { background: var(--brand); color: var(--brand-ink); border: none; border-radius: 8px;
  padding: 9px 18px; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.btn-send:hover { filter: brightness(1.05); }

/* Felhasználók (partner-admin) */
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fafbfc; }
.user-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name { font-weight: 600; font-size: .92rem; }
.user-email { font-size: .8rem; color: var(--muted); }
.user-meta { font-size: .78rem; color: var(--muted); }
.role-badge { display: inline-block; background: var(--brand); color: #fff; font-size: .6rem; font-weight: 700;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px; vertical-align: middle; letter-spacing: .04em; }
.self-badge { display: inline-block; background: #e6eef8; color: #1f4e7a; font-size: .6rem; font-weight: 700;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.ustatus { font-weight: 600; }
.ustatus-pending { color: #8a6d1a; } .ustatus-active { color: #1c6b62; } .ustatus-inactive { color: #8f2727; }
.user-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.btn-user { font: inherit; font-size: .82rem; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); white-space: nowrap; }
.btn-user:hover { background: #eef2f8; border-color: var(--brand); }
.btn-approve { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-approve:hover { filter: brightness(1.05); background: var(--brand); }
.btn-danger { color: #8f2727; border-color: #e6bcbc; }
.btn-danger:hover { background: #fbe6e6; border-color: #8f2727; }

/* Csillagozás (partner-oldali, a belső boarddal egyezően) */
.card-star { position: absolute; top: 6px; right: 6px; z-index: 3; display: inline-flex; padding: 4px;
  margin: 0; border: none; border-radius: 6px; background: transparent; color: #b6bfc9; cursor: pointer; line-height: 0; }
.card-star svg { display: block; fill: none; }
.card-star:hover { color: #f1b211; background: rgba(0,0,0,.05); }
.card-star.on { color: #f1b211; }
.card-star.on svg { fill: #f1b211; }
.column-body .card.is-starred { border-color: #f1b211; box-shadow: 0 2px 8px rgba(16,24,40,.12); background: #fffdf3; }
.card-star .star-peek { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  white-space: nowrap; font-size: .72rem; font-weight: 600; color: #e6eef9; background: #11233d;
  border: 1px solid #21395b; border-radius: 8px; padding: 5px 8px; box-shadow: 0 8px 24px rgba(16,24,40,.3); }
.card-star:hover .star-peek, .card-star:focus-visible .star-peek { display: block; }
