/* Racco arculat: erdőzöld + menta + krém, Plus Jakarta Sans */
:root {
  --forest: #1a312c;
  --forest-deep: #132622;
  --mint: #89d7b7;
  --mint-dark: #6cc4a0;
  --sage: #428475;
  --cream: #fff4e1;
  --cream-light: #fffbf3;
  --sand: #e8dcc6;
  --text: #1a312c;
  --muted: #5f726c;
  --line: #e8dcc6;
  --radius: 24px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--text); font-size: 15px; line-height: 1.55; }
a { color: var(--sage); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 800; color: var(--forest); letter-spacing: -.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.loading { text-align: center; margin-top: 30vh; color: var(--muted); }

/* Layout */
#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > main { flex: 1; width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 32px 18px 40px; display: grid; gap: 18px; }
.card { background: var(--cream-light); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.empty { text-align: center; color: var(--muted); padding: 36px; }

/* Topbar – sötét erdőzöld, mint a racco.hu fejléce */
.topbar { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 14px 26px; background: var(--forest-deep); color: var(--cream-light); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.3rem; text-decoration: none; color: var(--cream-light); letter-spacing: -.02em; }
.brand span, .login h1 span { color: var(--mint); }
.topbar nav { display: flex; gap: 4px; align-items: center; }
.topbar nav .btn { margin-right: 8px; }
.topbar nav a:not(.btn), .topbar .user > a { text-decoration: none; color: #c8ddd4; font-weight: 600; padding: 7px 14px; border-radius: 999px; }
.topbar nav a:not(.btn):hover, .topbar .user > a:hover { color: var(--cream-light); background: rgba(255, 244, 225, .08); }
.topbar nav a.active, .topbar .user > a.active { color: var(--forest); background: var(--mint); }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .who { color: var(--cream-light); font-weight: 600; }

/* Gombok – pirula forma */
.btn { display: inline-block; border: 1px solid var(--sand); background: var(--cream); color: var(--forest); padding: 10px 20px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { border-color: var(--sage); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--mint); border-color: var(--mint); color: var(--forest); }
.btn.primary:hover { background: var(--mint-dark); border-color: var(--mint-dark); }
.btn.dark { background: var(--forest); border-color: var(--forest); color: var(--cream-light); }
.btn.ghost { background: transparent; }
.topbar .btn.ghost { color: var(--cream-light); border-color: rgba(255, 244, 225, .45); }
.topbar .btn.ghost:hover { background: rgba(255, 244, 225, .08); }
.btn.small { padding: 7px 15px; font-size: .9rem; }
.btn.tiny { padding: 2px 9px; font-size: .8rem; }
.btn:disabled { opacity: .6; cursor: wait; }

/* Mezők */
input, select, textarea { font: inherit; padding: 10px 14px; border: 1px solid var(--sand); border-radius: 14px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(137, 215, 183, .45); border-color: var(--sage); }
input[type=checkbox] { width: auto; accent-color: var(--sage); transform: scale(1.3); cursor: pointer; }
label { display: grid; gap: 5px; font-weight: 700; font-size: .9rem; color: var(--forest); }
.form { display: grid; gap: 16px; max-width: 720px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.back { text-decoration: none; color: var(--sage); font-weight: 600; }

/* Belépés – sötét, erdős hero hangulat */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px;
  background: radial-gradient(ellipse at center, #24443c 0%, var(--forest-deep) 70%); }
.login { width: 100%; max-width: 400px; display: grid; gap: 16px; border-radius: 28px; padding: 32px; border: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login h1 { font-size: 1.8rem; }

/* Oldalfej + szűrők */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; border-radius: 999px; }

/* Táblázat */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 6px 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sage); font-weight: 800; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--cream); }
.table td a { color: var(--forest); font-weight: 700; text-decoration: none; }
.table td a:hover { color: var(--sage); text-decoration: underline; }
.table tr.done td a { color: var(--muted); text-decoration: line-through; font-weight: 600; }
.table tfoot th { color: var(--forest); border-top: 1px solid var(--line); border-bottom: 0; font-size: .85rem; }
.table.compact th, .table.compact td { padding: 8px 10px; }
.chk { width: 56px; text-align: center !important; }

/* Címkék */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.type-hiba { background: #f6dcd3; color: #8f3b24; }
.type-kerdes { background: #dce9f0; color: #2c5a72; }
.type-feladat { background: var(--sand); color: var(--forest); }
.status-nyitott { background: #fbe7bf; color: #7a5300; }
.status-folyamatban { background: #d4ebe2; color: var(--sage); }
.status-kesz { background: var(--forest); color: var(--mint); }

/* Feladat oldal */
.ticket-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.desc { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.status-ctl { display: flex; gap: 10px; align-items: center; }
.status-ctl select { width: auto; border-radius: 999px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 700; cursor: pointer; }
.thread { display: grid; gap: 10px; margin: 12px 0 18px; }
.msg { padding: 12px 16px; border-radius: 18px; background: var(--cream); max-width: 85%; border: 1px solid var(--line); }
.msg.from-admin { background: var(--forest); color: var(--cream-light); border-color: var(--forest); }
.msg.from-admin .msg-meta { color: #9fb8ae; }
.msg.from-admin .msg-meta strong { color: var(--mint); }
.msg.mine { margin-left: auto; }
.msg-meta { font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.reply { display: grid; gap: 10px; }

/* Csak admin – menta keretes, jól elkülönül */
.private { background: #eef7f2; border: 1.5px dashed var(--sage); }
.private-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.private .table th, .private .table td { border-color: #cfe5db; }
.private .table tbody tr:hover { background: transparent; }
.time-form { display: grid; grid-template-columns: 160px 85px 85px 1fr auto; gap: 10px; align-items: end; margin-top: 16px; }

/* Statisztika */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { padding: 20px 22px; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--forest); line-height: 1.1; }
.stat.private { background: var(--forest); border: 0; }
.stat.private .stat-num { color: var(--mint); }
.stat.private .muted { color: #c8ddd4; }

/* Lábléc */
.foot { text-align: center; padding: 22px; color: #9fb8ae; background: var(--forest-deep); font-size: .85rem; }
.foot a { color: var(--mint); text-decoration: none; font-weight: 700; }

/* Avatar, olvasatlan, prioritás, határidő */
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .66rem; font-weight: 800; margin-right: 7px; vertical-align: middle; flex: none; letter-spacing: 0; }
.topbar .who { display: inline-flex; align-items: center; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #c8642c; color: #fff; font-size: .72rem; font-weight: 800; margin-left: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c8642c; margin-right: 7px; vertical-align: middle; }
.table td a.unread { font-weight: 800; }
.prio-surgos { background: #c8642c; color: #fff; }
.overdue { color: #a12a1c; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.status-ctl { flex-wrap: wrap; justify-content: flex-end; }
.status-ctl input[type=date] { width: auto; border-radius: 999px; }
.filters input[type=search] { width: 200px; border-radius: 999px; }
@media (max-width: 720px) { .row2 { grid-template-columns: 1fr; } .filters input[type=search] { width: 100%; } }

/* Csapat */
.assign { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 10px; }
.team-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Képek */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 100%; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); display: block; background: #fff; }
.gallery figure .btn { position: absolute; top: 6px; right: 6px; background: var(--cream-light); }
.upload-btn { width: fit-content; margin-top: 10px; }

/* Kétlépcsős azonosítás */
.login.wide { max-width: 460px; }
.code-input { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-weight: 700; }
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr img { background: #fff; padding: 10px; border-radius: 16px; border: 1px solid var(--line); }
.secret { word-break: break-all; background: var(--cream); padding: 2px 6px; border-radius: 6px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.enroll-form { display: grid; gap: 12px; margin-top: 10px; }

/* Értesítés */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--forest); color: var(--cream-light); padding: 11px 20px; border-radius: 999px; font-weight: 600; z-index: 50; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 90vw; }
.toast.error { background: #8f3b24; }

@media (max-width: 720px) {
  .topbar { padding: 12px 14px; gap: 10px; }
  .user { margin-left: 0; width: 100%; }
  .who { display: none; }
  .time-form { grid-template-columns: 1fr 1fr; }
  .time-form .grow, .time-form button { grid-column: 1 / -1; }
  .msg { max-width: 100%; }
  .card { padding: 18px; }
}

@media print {
  .topbar, .no-print, .back, .foot { display: none !important; }
  body { background: #fff; }
  .card { border-color: #ccc; break-inside: avoid; }
  .stat.private { background: #fff; border: 1px solid #ccc; }
  .stat.private .stat-num { color: var(--forest); }
  .container { padding: 0; }
  a { color: inherit; text-decoration: none; }
}
