/* =========================================================
   ALFÖLDFA MESSAGE SYSTEM (AMS)
   Design system — színvilág a szlovák-építő-fenyő fűrészáru
   carousel képből kinyerve (PIL, 8 szín kvantálás):
     #F9DFA0 48%  #E6A662 29%  #B09065 6%  #A2734A 5%
     #6B4C31 4%   #966239 4%   #DCB885 3%  #513723 2%
   + brand zöld #60AF56 (alfoldfa.hu logó — a képen a pántok színe)
   Font: Montserrat (400/600/700) — az alfoldfa.hu betűtípusa
   ========================================================= */

:root {
  /* --- fa-tónusok (a képből) --- */
  --wood-50:   #FDF8EE;
  --wood-100:  #F9EFD8;
  --wood-200:  #F9DFA0;
  --wood-300:  #EFC98A;
  --wood-400:  #E6A662;
  --wood-500:  #C9843F;
  --bark-400:  #B09065;
  --bark-500:  #A2734A;
  --bark-600:  #966239;
  --bark-700:  #6B4C31;
  --bark-800:  #513723;
  --bark-900:  #332214;
  --bark-950:  #241811;

  /* --- brand zöld (logó + pántok) --- */
  --green:     #60AF56;
  --green-dk:  #4E9344;
  --green-lt:  #E6F3E3;

  /* --- semleges --- */
  --paper:     #FFFFFF;
  --ink:       #2A2018;
  --text:      #3A2E24;
  --mute:      #8A7A68;
  --line:      #E9DDCB;
  --line-2:    #D8C7AE;

  /* --- státusz --- */
  --danger:    #C8312B;
  --danger-lt: #FBE9E8;
  --warn:      #D98014;
  --warn-lt:   #FDF0DC;
  --info:      #1F3A5F;

  /* --- rendszer --- */
  --f: 'Montserrat', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(51,34,20,.07);
  --sh-2: 0 4px 14px rgba(51,34,20,.10);
  --sh-3: 0 16px 40px rgba(51,34,20,.18);
  --ease: cubic-bezier(.4,0,.2,1);
  --rail-w: 240px;
  --top-h: 58px;
  --tab-h: 60px;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--f);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--wood-50);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--bark-600); }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- ikonok ---------- */
.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 17px; height: 17px; }
.ico-lg { width: 28px; height: 28px; }

/* =========================================================
   BEJELENTKEZÉS
   ========================================================= */
#login {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(36,24,17,.82), rgba(36,24,17,.62) 40%, rgba(107,76,49,.78)),
    url('../img/wood.jpg') center/cover no-repeat;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  padding: 30px 26px 24px;
  animation: pop .35s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo img { width: 46px; height: 46px; object-fit: contain; }
.login-logo b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--bark-900); display: block; line-height: 1.1; }
.login-logo span { font-size: 11px; color: var(--mute); letter-spacing: .09em; text-transform: uppercase; font-weight: 600; }
.login-card h1 { font-size: 17px; font-weight: 700; color: var(--bark-900); margin-bottom: 4px; }
.login-card .sub { font-size: 12.5px; color: var(--mute); margin-bottom: 18px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--bark-700); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--mute); margin-top: 4px; }
.inp, .sel, .txa {
  width: 100%; padding: 11px 12px;
  background: var(--wood-50);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-size: 14px; color: var(--ink);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.inp:focus, .sel:focus, .txa:focus { outline: 0; border-color: var(--green); background: var(--paper); }
.inp.err, .sel.err { border-color: var(--danger); background: var(--danger-lt); }
.txa { min-height: 84px; resize: vertical; line-height: 1.5; }
.sel { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A7A68' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--wood-100); color: var(--bark-800);
  border: 1.5px solid transparent;
  transition: transform .12s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--wood-200); }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(96,175,86,.32); }
.btn--primary:hover { background: var(--green-dk); }
.btn--wood { background: var(--wood-400); color: var(--bark-900); }
.btn--wood:hover { background: var(--wood-500); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--bark-700); }
.btn--ghost:hover { background: var(--wood-100); }
.btn--danger { background: var(--danger-lt); color: var(--danger); }
.btn--danger:hover { background: #F6D8D6; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.login-err { background: var(--danger-lt); color: var(--danger); font-size: 12.5px; font-weight: 600; padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 12px; }
.login-demo { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 13px; }
.login-demo summary { font-size: 12px; font-weight: 700; color: var(--bark-600); cursor: pointer; }
.login-demo table { width: 100%; border-collapse: collapse; margin-top: 9px; font-size: 11.5px; }
.login-demo td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.login-demo td:first-child { font-weight: 700; color: var(--bark-800); }
.login-demo code { background: var(--wood-100); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--bark-700); margin: 2px 0 16px; cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--green); }

/* =========================================================
   APP VÁZ
   ========================================================= */
#app { display: flex; height: 100%; }

/* --- oldalsáv (desktop) --- */
.rail {
  width: var(--rail-w); flex: none;
  background: var(--bark-900);
  color: var(--wood-100);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--bark-950);
}
.rail__brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rail__brand img { width: 34px; height: 34px; object-fit: contain; }
.rail__brand b { font-size: 15px; font-weight: 700; color: #fff; display: block; line-height: 1.15; letter-spacing: -.01em; }
.rail__brand span { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--wood-400); font-weight: 600; }
.rail__nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.rail__sect { font-size: 9.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--bark-400); padding: 14px 10px 6px; }
.navi {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 11px; border-radius: var(--r);
  color: var(--wood-200); font-size: 13.5px; font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
  text-align: left;
}
.navi:hover { background: rgba(255,255,255,.07); color: #fff; }
.navi.is-active { background: var(--green); color: #fff; box-shadow: 0 2px 10px rgba(96,175,86,.35); }
.navi.is-active .ico { stroke: #fff; }
.navi .badge { margin-left: auto; }
.badge {
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 10px; background: var(--wood-400); color: var(--bark-900);
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.badge--green { background: var(--green); color: #fff; }
.badge--red { background: var(--danger); color: #fff; }
.rail__user { border-top: 1px solid rgba(255,255,255,.08); padding: 10px; display: flex; align-items: center; gap: 10px; }
.rail__user .who { flex: 1; min-width: 0; }
.rail__user .who b { display: block; font-size: 13px; color: #fff; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__user .who span { font-size: 11px; color: var(--bark-400); }
.rail__user button { color: var(--wood-300); padding: 7px; border-radius: 8px; }
.rail__user button:hover { background: rgba(255,255,255,.09); color: #fff; }

.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--bark-600); letter-spacing: .02em;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 52px; height: 52px; font-size: 18px; }
.avatar--online::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--paper);
}
.avatar-wrap { position: relative; flex: none; }

/* --- fő oszlop --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wood-50); }
.topbar {
  height: var(--top-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-1);
  z-index: 20;
}
.topbar h2 { font-size: 15.5px; font-weight: 700; color: var(--bark-900); letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.topbar__btn { padding: 8px; border-radius: 9px; color: var(--bark-700); position: relative; }
.topbar__btn:hover { background: var(--wood-100); }
.topbar__brand { display: none; align-items: center; gap: 8px; }
.topbar__brand img { width: 28px; height: 28px; }
.topbar__brand b { font-size: 15px; color: var(--bark-900); }

.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.view.is-active { display: flex; }

/* --- alsó tabbar (mobil) --- */
.tabbar { display: none; }

/* =========================================================
   CHAT
   ========================================================= */
.chat { display: flex; height: 100%; min-height: 0; }
.convs {
  width: 300px; flex: none; border-right: 1px solid var(--line);
  background: var(--paper); display: flex; flex-direction: column;
}
.convs__search { padding: 10px; border-bottom: 1px solid var(--line); }
.convs__list { flex: 1; overflow-y: auto; }
.conv {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-bottom: 1px solid var(--wood-100);
  text-align: left; transition: background .12s var(--ease);
}
.conv:hover { background: var(--wood-50); }
.conv.is-active { background: var(--green-lt); }
.conv__body { flex: 1; min-width: 0; }
.conv__top { display: flex; align-items: baseline; gap: 8px; }
.conv__name { font-size: 13.5px; font-weight: 700; color: var(--bark-900); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__time { font-size: 10.5px; color: var(--mute); flex: none; }
.conv__last { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.conv .badge { flex: none; }

.thread { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wood-100); position: relative; }
.thread::before {
  content: ''; position: absolute; inset: 0; opacity: .05; pointer-events: none;
  background: url('../img/wood.jpg') center/500px no-repeat;
  background-size: cover;
}
.thread__head {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 2;
}
.thread__head .who b { display: block; font-size: 14px; font-weight: 700; color: var(--bark-900); line-height: 1.2; }
.thread__head .who span { font-size: 11.5px; color: var(--mute); }
.thread__msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 3px; z-index: 1; }
.daysep { align-self: center; margin: 12px 0 8px; background: rgba(255,255,255,.85); color: var(--bark-700); font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px; box-shadow: var(--sh-1); }

.msg { max-width: min(78%, 560px); align-self: flex-start; animation: fadein .18s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }
.msg.mine { align-self: flex-end; }
.msg__bub {
  background: var(--paper); border-radius: 12px 12px 12px 3px;
  padding: 7px 11px 6px; box-shadow: var(--sh-1); position: relative;
}
.msg.mine .msg__bub { background: #DCF3D3; border-radius: 12px 12px 3px 12px; }
.msg__from { font-size: 11.5px; font-weight: 700; color: var(--green-dk); margin-bottom: 2px; }
.msg__txt { font-size: 13.5px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.msg__meta { display: flex; align-items: center; justify-content: flex-end; gap: 5px; font-size: 10.5px; color: var(--mute); margin-top: 2px; }
.msg__meta .ticks { color: var(--green-dk); font-weight: 700; }
.msg__media { display: grid; gap: 3px; margin: 2px 0 4px; border-radius: 8px; overflow: hidden; }
.msg__media.n2 { grid-template-columns: 1fr 1fr; }
.msg__media.n3, .msg__media.n4 { grid-template-columns: 1fr 1fr; }
.msg__media img, .msg__media video { width: 100%; height: 100%; max-height: 260px; object-fit: cover; cursor: zoom-in; background: var(--wood-200); }
.msg__file { display: flex; align-items: center; gap: 9px; padding: 8px; background: var(--wood-50); border-radius: 8px; margin-bottom: 4px; }
.msg__file b { font-size: 12.5px; display: block; color: var(--bark-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__file span { font-size: 11px; color: var(--mute); }
.msg__ref {
  display: block; margin: 2px 0 4px; padding: 8px 10px; border-left: 3px solid var(--green);
  background: var(--wood-50); border-radius: 6px; text-align: left; width: 100%;
}
.msg__ref b { font-size: 11.5px; color: var(--green-dk); display: block; }
.msg__ref span { font-size: 12px; color: var(--bark-700); }

.composer { flex: none; padding: 9px 12px; background: var(--paper); border-top: 1px solid var(--line); z-index: 2; }
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.composer__txt {
  flex: 1; max-height: 120px; min-height: 40px; padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-xl);
  background: var(--wood-50); resize: none; font-size: 14px; line-height: 1.4;
}
.composer__txt:focus { outline: 0; border-color: var(--green); background: var(--paper); }
.composer__btn { width: 42px; height: 42px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--bark-700); }
.composer__btn:hover { background: var(--wood-100); }
.composer__btn--send { background: var(--green); color: #fff; }
.composer__btn--send:hover { background: var(--green-dk); }
.composer__pend { display: flex; gap: 7px; flex-wrap: wrap; padding-bottom: 8px; }
.pend {
  position: relative; width: 62px; height: 62px; border-radius: 8px; overflow: hidden;
  background: var(--wood-200); border: 1px solid var(--line-2);
}
.pend img, .pend video { width: 100%; height: 100%; object-fit: cover; }
.pend .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(36,24,17,.72); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.pend .fx { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 10px; font-weight: 700; color: var(--bark-700); text-align: center; padding: 4px; word-break: break-all; overflow: hidden; }

/* =========================================================
   OPTIMALIZÁLÓ — a különálló bsh-optimalizalo.html beágyazva
   ========================================================= */
.calcframe { flex: 1; width: 100%; border: 0; background: var(--wood-50); }

/* =========================================================
   REKORD LISTÁK (bejövő / kimenő / reklamáció / keresés)
   ========================================================= */
.listview { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.toolbar {
  flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.toolbar .grow { flex: 1; min-width: 140px; }
.chip {
  padding: 6px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: var(--wood-100); color: var(--bark-700); border: 1.5px solid transparent;
}
.chip:hover { background: var(--wood-200); }
.chip.is-on { background: var(--bark-900); color: #fff; }
.scroller { flex: 1; overflow-y: auto; padding: 14px; }
.cards { display: grid; gap: 11px; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); align-content: start; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden; text-align: left; width: 100%;
  transition: box-shadow .15s var(--ease), transform .12s var(--ease), border-color .15s var(--ease);
  display: block;
}
.card:hover { box-shadow: var(--sh-2); transform: translateY(-1px); border-color: var(--line-2); }
.card__top { display: flex; align-items: center; gap: 9px; padding: 11px 13px 8px; }
.card__type { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.card__type--in { background: var(--green-lt); color: var(--green-dk); }
.card__type--out { background: var(--wood-100); color: var(--wood-500); }
.card__type--claim { background: var(--danger-lt); color: var(--danger); }
.card__hd { flex: 1; min-width: 0; }
.card__hd b { display: block; font-size: 14px; font-weight: 700; color: var(--bark-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__hd span { font-size: 11.5px; color: var(--mute); }
.card__body { padding: 0 13px 11px; }
.kv { display: flex; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.kv dt { color: var(--mute); min-width: 92px; flex: none; }
.kv dd { color: var(--bark-800); font-weight: 600; }
.card__thumbs { display: flex; gap: 5px; padding: 0 13px 11px; flex-wrap: wrap; }
.card__thumbs img { width: 52px; height: 52px; border-radius: 7px; object-fit: cover; background: var(--wood-200); }
.card__thumbs .more { width: 52px; height: 52px; border-radius: 7px; background: var(--wood-100); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--bark-700); }
.card__foot { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-top: 1px solid var(--wood-100); background: var(--wood-50); }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px; background: var(--wood-100); color: var(--bark-700);
}
.tag--open { background: var(--green-lt); color: var(--green-dk); }
.tag--closed { background: var(--bark-900); color: var(--wood-200); }
.tag--mail { background: #E3ECF7; color: var(--info); }

.empty { text-align: center; padding: 54px 20px; color: var(--mute); }
.empty .ico { width: 46px; height: 46px; stroke: var(--line-2); stroke-width: 1.4; margin: 0 auto 12px; }
.empty b { display: block; font-size: 15px; color: var(--bark-700); margin-bottom: 5px; }
.empty p { font-size: 13px; max-width: 320px; margin: 0 auto; }

.fab {
  position: absolute; right: 20px; bottom: 20px; z-index: 15;
  height: 52px; padding: 0 20px; border-radius: 26px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgba(96,175,86,.42);
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.fab:hover { background: var(--green-dk); }
.fab:active { transform: scale(.96); }

/* =========================================================
   LAP (sheet) — űrlap / részletek
   ========================================================= */
.sheet-bg {
  position: fixed; inset: 0; z-index: 60; background: rgba(36,24,17,.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s var(--ease); backdrop-filter: blur(2px);
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 620px; max-height: 94vh;
  background: var(--wood-50); border-radius: var(--r-xl) var(--r-xl) 0 0;
  display: flex; flex-direction: column; box-shadow: var(--sh-3);
  animation: up .26s var(--ease);
}
@keyframes up { from { transform: translateY(28px); opacity: .6; } }
.sheet--mid { max-width: 460px; border-radius: var(--r-lg); align-self: center; }
.sheet__head {
  flex: none; display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); background: var(--paper);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.sheet--mid .sheet__head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.sheet__head h3 { flex: 1; font-size: 16px; font-weight: 700; color: var(--bark-900); letter-spacing: -.01em; }
.sheet__head .sub { display: block; font-size: 11.5px; font-weight: 600; color: var(--mute); }
.sheet__body { flex: 1; overflow-y: auto; padding: 16px; }
.sheet__foot { flex: none; display: flex; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--paper); }
.sheet__foot .btn { flex: 1; }
.x-btn { padding: 7px; border-radius: 8px; color: var(--bark-700); }
.x-btn:hover { background: var(--wood-100); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.formsect { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 13px; }
.formsect > h4 { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--green-dk); margin-bottom: 11px; }
.autoval { display: flex; align-items: center; gap: 8px; background: var(--green-lt); border-radius: var(--r); padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--bark-800); }
.autoval .ico { stroke: var(--green-dk); }
.autoval em { font-style: normal; color: var(--mute); font-weight: 600; font-size: 11.5px; margin-left: auto; }

.upl { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.upl__add {
  aspect-ratio: 1; border: 2px dashed var(--line-2); border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--bark-600); font-size: 11px; font-weight: 700; background: var(--wood-50);
}
.upl__add:hover { border-color: var(--green); color: var(--green-dk); background: var(--green-lt); }
.upl__item { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--wood-200); border: 1px solid var(--line-2); }
.upl__item img, .upl__item video { width: 100%; height: 100%; object-fit: cover; }
.upl__item .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(36,24,17,.75); color: #fff; display: flex; align-items: center; justify-content: center; }
.upl__item .n { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(36,24,17,.8)); color: #fff; font-size: 9.5px; font-weight: 700; padding: 8px 4px 3px; text-align: center; }

/* részletek */
.detail__hero { background: var(--paper); border-radius: var(--r); border: 1px solid var(--line); padding: 14px; margin-bottom: 13px; }
.detail__gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 7px; }
.detail__gal img, .detail__gal video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); cursor: zoom-in; background: var(--wood-200); }
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--paper); }
.timeline b { font-size: 12.5px; color: var(--bark-900); display: block; }
.timeline span { font-size: 11.5px; color: var(--mute); }

/* =========================================================
   E-MAIL MODAL
   ========================================================= */
.ask { text-align: center; padding: 8px 0 4px; }
.ask .ico-lg { margin: 0 auto 10px; stroke: var(--green-dk); }
.ask h4 { font-size: 16px; color: var(--bark-900); margin-bottom: 5px; }
.ask p { font-size: 13px; color: var(--mute); }
.rcpt { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--r); margin-bottom: 7px; cursor: pointer; background: var(--paper); }
.rcpt:hover { border-color: var(--line-2); }
.rcpt.is-on { border-color: var(--green); background: var(--green-lt); }
.rcpt input { width: 17px; height: 17px; accent-color: var(--green); flex: none; }
.rcpt .who b { display: block; font-size: 13px; color: var(--bark-900); }
.rcpt .who span { font-size: 11.5px; color: var(--mute); }
.mailprev { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mailprev__row { display: flex; gap: 9px; padding: 8px 11px; border-bottom: 1px solid var(--wood-100); font-size: 12.5px; }
.mailprev__row b { color: var(--mute); min-width: 62px; flex: none; font-weight: 600; }
.mailprev__row span { color: var(--bark-800); word-break: break-word; }
.mailprev__body { padding: 11px; font-size: 12.5px; white-space: pre-wrap; color: var(--text); max-height: 190px; overflow-y: auto; line-height: 1.55; }

/* =========================================================
   ADMIN
   ========================================================= */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px 0; background: var(--paper); border-bottom: 1px solid var(--line); flex: none; }
.tab { padding: 9px 13px; font-size: 13px; font-weight: 700; color: var(--mute); border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--bark-700); }
.tab.is-on { color: var(--green-dk); border-bottom-color: var(--green); }
.panel { display: none; }
.panel.is-on { display: block; }

.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-1); font-size: 13px; }
.tbl th { background: var(--wood-100); color: var(--bark-800); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; text-align: left; padding: 9px 11px; white-space: nowrap; }
.tbl td { padding: 9px 11px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: var(--wood-50); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl .act button { padding: 5px; border-radius: 6px; color: var(--bark-600); }
.tbl .act button:hover { background: var(--wood-100); color: var(--bark-900); }
.tbl .act button.del:hover { background: var(--danger-lt); color: var(--danger); }
.tblwrap { overflow-x: auto; border-radius: var(--r); }
.sectionhead { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.sectionhead h3 { font-size: 15px; font-weight: 700; color: var(--bark-900); flex: 1; }
.note {
  background: var(--warn-lt); border-left: 3px solid var(--warn); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 12.5px; color: var(--bark-800); margin-bottom: 13px;
}
.note b { color: var(--bark-900); }

/* statisztika */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; margin-bottom: 16px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 13px; box-shadow: var(--sh-1); }
.stat b { display: block; font-size: 27px; font-weight: 700; color: var(--bark-900); line-height: 1.1; letter-spacing: -.02em; }
.stat span { font-size: 11.5px; color: var(--mute); font-weight: 600; }
.stat .delta { font-size: 11.5px; font-weight: 700; color: var(--green-dk); }
.chartbox { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 13px; box-shadow: var(--sh-1); }
.chartbox h4 { font-size: 12.5px; font-weight: 700; color: var(--bark-900); margin-bottom: 12px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 118px 1fr 44px; align-items: center; gap: 9px; font-size: 12px; }
.bar__lbl { color: var(--bark-700); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 9px; background: var(--wood-100); border-radius: 5px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--green); border-radius: 5px; transition: width .5s var(--ease); }
.bar__fill--wood { background: var(--wood-400); }
.bar__fill--bark { background: var(--bark-600); }
.bar__fill--red { background: var(--danger); }
.bar__val { text-align: right; font-weight: 700; color: var(--bark-900); }
.cols { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding-top: 8px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.col__stack { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 5px 5px 0 0; overflow: hidden; }
.col__seg { width: 100%; transition: height .5s var(--ease); }
.col__seg--in { background: var(--green); }
.col__seg--out { background: var(--wood-400); }
.col__seg--claim { background: var(--danger); }
.col__lbl { font-size: 10.5px; color: var(--mute); font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 11px; font-size: 11.5px; color: var(--bark-700); font-weight: 600; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* napló */
.log { font-size: 12.5px; }
.log__row { display: flex; gap: 10px; padding: 8px 11px; border-bottom: 1px solid var(--line); background: var(--paper); }
.log__row:first-child { border-radius: var(--r) var(--r) 0 0; }
.log__ts { color: var(--mute); font-size: 11.5px; flex: none; width: 118px; }
.log__who { font-weight: 700; color: var(--bark-800); flex: none; width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log__what { flex: 1; color: var(--text); }
.log__what code { background: var(--wood-100); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

/* =========================================================
   TOAST / LIGHTBOX
   ========================================================= */
#toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--bark-900); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 17px; border-radius: 22px; box-shadow: var(--sh-3);
  display: flex; align-items: center; gap: 9px; animation: up .2s var(--ease);
  max-width: 90vw;
}
.toast .ico { stroke: var(--green); }
.toast--err .ico { stroke: #FF8A84; }

#lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(24,16,10,.94); display: flex; align-items: center; justify-content: center; padding: 22px; }
#lightbox img, #lightbox video { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: var(--r); }
#lightbox .close { position: absolute; top: 16px; right: 16px; color: #fff; padding: 9px; border-radius: 50%; background: rgba(255,255,255,.14); }
#lightbox .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--wood-200); font-size: 12.5px; }

/* =========================================================
   RESPONSIVE — mobil (a raktárban telefonon használják)
   ========================================================= */
@media (max-width: 900px) {
  .rail { display: none; }
  .topbar__brand { display: flex; }
  .tabbar {
    display: flex; flex: none; height: var(--tab-h);
    background: var(--paper); border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(51,34,20,.06); z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabi {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--mute); font-size: 9.5px; font-weight: 700; position: relative;
    padding: 0 2px; text-align: center; line-height: 1.1;
  }
  .tabi .ico { width: 20px; height: 20px; }
  .tabi.is-active { color: var(--green-dk); }
  .tabi .badge { position: absolute; top: 5px; left: 50%; margin-left: 4px; min-width: 17px; height: 17px; font-size: 10px; }
  .convs { width: 100%; }
  .chat.show-thread .convs { display: none; }
  .chat:not(.show-thread) .thread { display: none; }
  .cards { grid-template-columns: 1fr; }
  .sheet { max-width: 100%; max-height: 96vh; }
  .sheet--mid { align-self: flex-end; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .sheet--mid .sheet__head { border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .fab { right: 16px; bottom: 16px; }
  .sheet__foot { flex-wrap: wrap; }
  .sheet__foot .btn { flex: 1 1 44%; }
  .grid2, .grid3 { grid-template-columns: 1fr 1fr; }
  .bar { grid-template-columns: 92px 1fr 38px; }
  .log__ts { width: 92px; font-size: 10.5px; }
  .log__who { width: 78px; }
  .log__row { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .grid3 { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .back-btn { display: none !important; }
}

/* =========================================================
   SZERVERES VERZIÓ — küldés alatt lévő üzenet
   ========================================================= */
.msg.is-pending{opacity:.62}
.msg.is-pending .msg__bub{box-shadow:none}
.pend .fx{display:flex;align-items:center;justify-content:center;height:100%;font-size:11px;font-weight:700;color:var(--bark-700);text-align:center;padding:4px;word-break:break-all}
