@font-face{font-family:Inter;src:url(inter.woff2) format('woff2');font-display:swap}
@font-face{font-family:"Space Grotesk";src:url(space-grotesk.woff2) format('woff2');font-display:swap}

:root{
  --blue:#141A2F;
  --blue-2:#1C2340;
  --red:#DB0018;
  --cream:#F6F1E8;
  --cream-2:#EFE8DA;
  --gold:#B8956A;
  --gold-soft:#E4D4B8;
  --paper:#FFFcf7;
  --line:#E4DDD0;
  --muted:#4A5060;
  --chip:#EEF0F5;
  --shadow:0 8px 28px rgba(20,26,47,.08);
  --shadow-hover:0 14px 36px rgba(20,26,47,.14);
  --radius:16px;
  --ok-green:#1F6B4A;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{
  font:16px/1.55 Inter,system-ui,sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(184,149,106,.12), transparent 50%),
    radial-gradient(900px 400px at -10% 0, rgba(20,26,47,.05), transparent 45%),
    var(--cream);
  color:var(--blue);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{font-family:"Space Grotesk",Inter,sans-serif;font-weight:600;letter-spacing:-.02em;margin:0}
.hidden{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}

/* TESZT banner – compact, always visible */
.testbar{
  display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;
  background:var(--red);color:#fff;padding:5px 14px;font-size:12.5px;line-height:1.3;
}
.testbar-badge{
  display:inline-block;background:#fff;color:var(--red);
  font-weight:800;letter-spacing:.08em;font-size:10px;
  padding:2px 7px;border-radius:4px;
}
.testbar-text{font-weight:500;opacity:.95}

/* Login */
.login-wrap{
  min-height:calc(100vh - 32px);
  display:flex;align-items:center;justify-content:center;
  padding:28px 16px 48px;
  background:
    radial-gradient(800px 400px at 50% -20%, rgba(184,149,106,.18), transparent 55%),
    var(--cream);
}
.login-card{
  width:100%;max-width:420px;
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:20px;
  padding:36px 32px 32px;
  box-shadow:var(--shadow);
  display:flex;flex-direction:column;gap:12px;
  position:relative;
}
.login-card::before{
  content:"";position:absolute;left:32px;right:32px;top:0;height:3px;
  background:linear-gradient(90deg,var(--gold),var(--red),var(--gold));
  border-radius:0 0 3px 3px;
}
.login-card .logo{
  height:48px;align-self:flex-start;
  background:var(--blue);border-radius:10px;padding:8px 14px;
}
.login-card h1{font-size:1.7rem;margin-top:8px}
.login-card .lead{margin:0 0 8px;color:var(--muted);font-size:15px}
label{display:flex;flex-direction:column;gap:6px;font-weight:600;font-size:13px;color:var(--blue)}
input,select{
  font:inherit;padding:11px 13px;border:1px solid var(--line);
  border-radius:10px;background:#fff;color:var(--blue);
}
input:focus,select:focus,button:focus-visible{
  outline:2px solid var(--gold);outline-offset:2px;
}
.btn{
  background:var(--red);color:#fff;border:0;border-radius:10px;
  padding:12px 16px;font-weight:700;cursor:pointer;font-size:16px;
  margin-top:4px;
}
.btn:hover{filter:brightness(.94)}
.err{color:var(--red);min-height:1.2em;margin:0;font-size:13px;font-weight:600}

/* App chrome */
.top{
  background:var(--blue);color:#fff;
  display:flex;justify-content:space-between;align-items:center;
  gap:16px;padding:12px 28px;
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.top .logo.sm{height:32px;display:block}
.brand-label{
  font-family:"Space Grotesk",Inter,sans-serif;
  font-size:13px;letter-spacing:.14em;text-transform:uppercase;
  color:var(--gold-soft);border-left:1px solid rgba(228,212,184,.35);padding-left:12px;
}
.who{display:flex;gap:10px;align-items:center;font-size:14px;min-width:0}
.who-name{font-weight:600;white-space:nowrap}
.who-email{color:rgba(255,255,255,.65);font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:240px}
.link{
  background:transparent;border:1px solid rgba(255,255,255,.3);color:#fff;
  border-radius:8px;padding:7px 12px;cursor:pointer;font:inherit;font-size:13px;font-weight:600;
  flex-shrink:0;
}
.link:hover{border-color:#fff;background:rgba(255,255,255,.08)}
.link:focus-visible{outline-color:var(--gold-soft)}

.tabs{
  display:flex;gap:2px;padding:0 28px;
  background:rgba(255,252,247,.86);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(8px);
  overflow-x:auto;
}
.tabs button{
  background:none;border:0;border-bottom:2px solid transparent;
  padding:14px 16px;font:inherit;font-weight:600;cursor:pointer;
  color:var(--muted);white-space:nowrap;
}
.tabs button.on{color:var(--blue);border-color:var(--red)}
.tabs button:hover{color:var(--blue)}

main{max-width:1120px;margin:0 auto;padding:28px 28px 80px}

/* Hero */
.hero{
  display:flex;justify-content:space-between;align-items:flex-end;
  gap:20px;flex-wrap:wrap;margin-bottom:24px;
}
.hero-text h2{font-size:clamp(1.6rem,2.4vw,2.05rem);line-height:1.2}
.today{margin:6px 0 0;color:var(--muted);font-size:15px}
.co-switch{display:flex;gap:8px;flex-wrap:wrap}
.co-chip{
  appearance:none;border:1px solid var(--line);background:var(--paper);
  color:var(--blue);border-radius:999px;padding:8px 16px;
  font:inherit;font-size:14px;font-weight:600;cursor:pointer;
}
.co-chip[aria-pressed="true"]{
  background:var(--blue);color:#fff;border-color:var(--blue);
}
.co-chip:disabled{opacity:.4;cursor:not-allowed}
.co-chip:hover:not(:disabled):not([aria-pressed="true"]){border-color:var(--gold)}

/* Preview bar */
.preview{
  background:linear-gradient(180deg,#FBF6EA,#F7F0E0);
  border:1px solid var(--gold-soft);
  border-radius:14px;padding:14px 16px;margin-bottom:22px;
  display:grid;grid-template-columns:auto 1fr;gap:6px 14px;align-items:center;
}
.preview label{font-size:13px}
.preview select{max-width:360px}
.preview .hint{grid-column:1/-1;margin:0;color:var(--muted);font-size:13px}

/* Tiles */
.tiles{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
  gap:20px;
}
.tile{
  display:flex;flex-direction:column;gap:10px;
  text-decoration:none;color:inherit;
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:22px 22px 18px;
  min-height:220px;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
  animation:rise .45s ease both;
}
.tile::after{
  content:"";position:absolute;left:0;right:0;top:0;height:3px;
  background:linear-gradient(90deg,var(--gold),var(--red));
}
.tile.off::after{background:var(--gold-soft)}
a.tile:hover,a.tile:focus-visible{
  transform:translateY(-3px);
  box-shadow:var(--shadow-hover);
  border-color:var(--gold-soft);
}
.tile-icon{
  width:44px;height:44px;border-radius:12px;
  background:var(--cream);
  border:1px solid var(--gold-soft);
  color:var(--blue);
  display:grid;place-items:center;flex-shrink:0;
}
.tile-icon svg{width:24px;height:24px}
.tile h3{font-size:1.25rem;margin-top:4px}
.tile .desc{margin:0;color:var(--muted);font-size:14.5px;line-height:1.45;flex:1}
.tile .stats{
  display:flex;gap:16px;flex-wrap:wrap;
  padding-top:8px;margin-top:4px;
  border-top:1px solid var(--line);
}
.stat{display:flex;flex-direction:column;gap:0;min-width:90px}
.stat-value{
  font-family:"Space Grotesk",Inter,sans-serif;
  font-size:1.55rem;font-weight:600;letter-spacing:-.03em;line-height:1.15;
  color:var(--blue);
}
.stat-label{font-size:12px;color:var(--muted);font-weight:600}
.stat.ph{min-width:0;flex:1}
.stat.ph .stat-label{font-weight:600;color:var(--blue);font-size:12.5px}
.stat.ph .stat-value{font-size:13px;font-weight:500;color:var(--muted);letter-spacing:0;font-family:Inter,system-ui,sans-serif;line-height:1.4}
.meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:2px}
.chip{
  font-size:11.5px;font-weight:650;border-radius:99px;
  padding:3px 9px;background:var(--chip);color:var(--blue);
}
.chip.status-elo{background:#E8F6EE;color:var(--ok-green)}
.chip.status-teszt{background:#F4E9C8;color:#6B4E16}
.chip.status-tervezett{background:#EEECE8;color:#5A5A5A}
.chip.role-admin{background:#FDE5E8;color:var(--red)}
.chip.role-sales{background:#E8EEF8;color:#1E3A6E}
.chip.role-finance{background:#F4E9C8;color:#6B4E16}
.chip.role-dispatcher{background:#E4F0EA;color:#1F6B4A}
.chip.role-fleet_manager{background:#E8EEF8;color:#1E3A6E}
.chip.role-warehouse{background:#EEE8DF;color:#4A3B28}
.chip.role-driver{background:#ECECEC;color:#333}
.chip.role-logistics{background:#E4F0EA;color:#1F6B4A}
.chip.co{background:var(--cream-2);color:var(--blue)}
.tile.off{opacity:.88}
.tile .soon{margin:0;color:var(--muted);font-size:13px}

.empty{
  background:var(--paper);border:1px dashed var(--line);border-radius:14px;
  padding:28px;text-align:center;color:var(--muted);
}

.panel{
  background:var(--paper);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow);padding:0;
  overflow:auto;
}
#tab-rights h2,#tab-admin h2{margin-bottom:14px;font-size:1.45rem}
.sub{font-weight:500;color:var(--muted);font-size:.85em;letter-spacing:0}
.hint{color:var(--muted);font-size:13.5px;margin:12px 2px 0}
table{border-collapse:separate;border-spacing:0;width:100%;font-size:14px}
th,td{padding:10px 14px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
th{
  background:var(--cream);
  font-size:11px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--muted);font-weight:700;
}
.matrix-wrap{max-height:min(78vh,820px);overflow:auto}
#matrix thead th{
  position:sticky;top:0;z-index:2;
  background:var(--cream);
  box-shadow:0 1px 0 var(--line);
  white-space:normal;line-height:1.3;vertical-align:bottom;
  max-width:130px;
}
#matrix thead th:first-child,#matrix tbody td:first-child{
  position:sticky;left:0;z-index:1;background:var(--paper);
  min-width:180px;max-width:220px;
}
#matrix thead th:first-child{z-index:3;background:var(--cream)}
#matrix tbody tr:hover td{background:#FBF6EA}
#matrix tbody tr:hover td:first-child{background:#F7F0E0}
.cell{white-space:nowrap}
.cell .chips{display:flex;flex-direction:column;align-items:flex-start;gap:4px}
.who-cell{display:flex;flex-direction:column;gap:1px}
.who-cell .nm{font-weight:600}
.who-cell .em{font-size:12px;color:var(--muted)}

@keyframes rise{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:none}
}
.tiles .tile:nth-child(1){animation-delay:.03s}
.tiles .tile:nth-child(2){animation-delay:.08s}
.tiles .tile:nth-child(3){animation-delay:.13s}
.tiles .tile:nth-child(4){animation-delay:.18s}
.tiles .tile:nth-child(5){animation-delay:.23s}

@media (prefers-reduced-motion:reduce){
  .tile,a.tile:hover{animation:none;transform:none}
}

@media (max-width:640px){
  .top{padding:10px 14px;align-items:flex-start}
  .brand-label{display:none}
  .who{flex-wrap:wrap;justify-content:flex-end;gap:6px 10px}
  .who-name{font-size:13px}
  .who-email{max-width:100%;flex-basis:100%;text-align:right;order:3}
  .tabs{padding:0 8px}
  .tabs button{padding:12px 12px;font-size:14px}
  main{padding:20px 14px 64px}
  .hero{align-items:flex-start}
  .hero-text h2{font-size:1.55rem}
  .tiles{grid-template-columns:1fr;gap:14px}
  .tile{min-height:0;padding:18px}
  .login-card{padding:28px 20px}
  .preview{grid-template-columns:1fr}
  .preview select{max-width:none}
  #matrix thead th:first-child,#matrix tbody td:first-child{min-width:150px}
  .testbar{justify-content:flex-start;padding:5px 10px}
  .testbar-text{font-size:12px}
}

.matrix-cards{display:none}
@media (max-width:800px){
  .matrix-wrap{display:none}
  .matrix-cards{display:flex;flex-direction:column;gap:12px;background:transparent;border:0;box-shadow:none;padding:0}
  .mcard{
    background:var(--paper);border:1px solid var(--line);border-radius:14px;
    box-shadow:var(--shadow);padding:14px 16px;
  }
  .mcard .who-cell{margin-bottom:10px;padding-bottom:8px;border-bottom:1px solid var(--line)}
  .mrow{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;padding:6px 0;font-size:13.5px}
  .mrow .mlab{color:var(--muted);font-weight:600;flex:0 0 42%}
  .mrow .mval{flex:1;display:flex;flex-wrap:wrap;gap:4px;justify-content:flex-end}
}
@media (max-width:640px){
  .top{
    display:grid;
    grid-template-columns:1fr auto;
    grid-template-areas:"brand logout" "who who";
    align-items:center;
    gap:8px 12px;
    padding:10px 14px 12px;
  }
  .brand{grid-area:brand}
  .top .link{grid-area:logout;justify-self:end}
  .who{
    grid-area:who;
    display:flex;flex-direction:column;align-items:flex-start;
    gap:1px;justify-content:flex-start;
  }
  .who-name{font-size:14px}
  .who-email{max-width:100%;text-align:left;order:unset;flex-basis:auto;color:rgba(255,255,255,.78)}
  .testbar{align-items:flex-start}
}

.toast{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:50;
  max-width:min(92vw,520px);background:var(--blue);color:#fff;
  border-radius:12px;padding:12px 18px;font-size:14.5px;line-height:1.4;
  box-shadow:0 12px 32px rgba(20,26,47,.35);
}
.toast.err{background:#7A0010}
.chip.sso{background:#E8F6EE;color:var(--ok-green)}
a.tile.busy{opacity:.7;pointer-events:none}
.tile.inert{cursor:not-allowed}

.chip.role-approver{background:#E4F0EA;color:#1F6B4A}

.linkbtn{background:none;border:0;color:#7A1020;text-decoration:underline;font:inherit;font-size:.9rem;cursor:pointer;padding:10px 0;min-height:44px}

.stat.go{cursor:pointer}
.tile .stats{pointer-events:auto}

