/* ==========================================
   AVES STAFF – wygląd panelu personelu
   ========================================== */
:root {
    --bg: #12151C; --bg2: #171A22; --card: #1B1F29; --card2: #222734; --line: #2A3040; --line2: #3A4256;
    --text: #ECEAE4; --text2: #C9CCD3; --muted: #8B92A1; --gold: #D9B45A; --gold2: #EBD08C; --gold-soft: rgba(217,180,90,.12);
    --green: #4CC38A; --red: #E5676B; --blue: #6CA8E0; --r: 14px;
    --grad: linear-gradient(135deg, #EBD08C 0%, #D9B45A 50%, #B8923E 100%);
    --font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif; --head: 'Manrope', 'Inter', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--gold2); }
h1, h2, h3 { font-family: var(--head); letter-spacing: -.01em; }
code { background: var(--card2); padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; margin: .2rem 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: .65rem 1.1rem; border-radius: 10px; border: 1px solid transparent; font: 600 .9rem var(--font); cursor: pointer; text-decoration: none; transition: .18s; white-space: nowrap; }
.btn-gold { background: var(--grad); color: #1A1508; box-shadow: 0 6px 18px rgba(217,180,90,.18); }
.btn-gold:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text2); border-color: var(--line); }
.btn-ghost:hover { background: var(--card2); color: #fff; }
.btn-ghost.danger, .btn.danger { color: #F0959A; border-color: rgba(229,103,107,.45); }
.btn-ghost.danger:hover { background: rgba(229,103,107,.12); }
.btn-green { background: rgba(76,195,138,.15); color: #7EE0B0; border-color: rgba(76,195,138,.45); }
.btn-green:hover { background: rgba(76,195,138,.25); }
.btn.block { width: 100%; padding: .85rem; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text2); cursor: pointer; display: inline-grid; place-items: center; transition: .18s; }
.icon-btn:hover { color: #fff; background: var(--card2); }
.icon-btn.danger:hover { color: #fff; background: var(--red); border-color: var(--red); }
.link { background: none; border: 0; color: var(--gold2); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------- formularze ---------- */
.form { display: flex; flex-direction: column; gap: .9rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--text2); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea { width: 100%; padding: .75rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: 400 .95rem var(--font); transition: .18s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,180,90,.15); }
input[type=color] { width: 100%; height: 44px; padding: 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pw-meter { height: 5px; border-radius: 99px; background: var(--card2); overflow: hidden; margin-top: -.5rem; }
.pw-meter b { display: block; height: 100%; width: 0; transition: .25s; }
.sel { width: auto; min-width: 150px; padding: .55rem .7rem; }

/* ---------- komunikaty ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: .8rem 1rem; border-radius: 12px; font-size: .9rem; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: rgba(76,195,138,.1); border-color: rgba(76,195,138,.35); color: #8FE3BB; }
.flash.err { background: rgba(229,103,107,.1); border-color: rgba(229,103,107,.35); color: #F2A9AC; }
.flash.info { background: rgba(108,168,224,.1); border-color: rgba(108,168,224,.35); color: #A9CCEE; }
.flash i { margin-top: 3px; }

/* ---------- ekrany logowania ---------- */
body.auth { min-height: 100vh; background: radial-gradient(900px 500px at 15% -10%, rgba(217,180,90,.12), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(108,168,224,.08), transparent 60%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 16px; }
.auth-card { width: 100%; max-width: 440px; background: rgba(27,31,41,.92); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 20px; padding: 2rem; box-shadow: 0 30px 80px rgba(0,0,0,.45); backdrop-filter: blur(10px); }
.auth-card h1 { font-size: 1.45rem; margin: 0 0 .4rem; }
.auth-card > .muted { margin: 0 0 1.2rem; font-size: .9rem; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 1.6rem; }
.auth-brand img { width: 44px; height: 44px; }
.auth-brand strong { display: block; font-family: var(--head); font-size: 1.1rem; }
.auth-brand span { font-size: .78rem; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.auth-alt { text-align: center; color: var(--muted); font-size: .88rem; margin: 1.2rem 0 0; }
.auth-foot { color: #5D6474; font-size: .78rem; margin-top: 1.4rem; }

/* ---------- układ panelu ---------- */
body.app { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 50; transition: transform .25s ease; }
.side-brand { display: flex; gap: 11px; align-items: center; padding: 1.2rem 1.2rem 1rem; border-bottom: 1px solid var(--line); }
.side-brand img { width: 38px; height: 38px; }
.side-brand strong { display: block; font-family: var(--head); }
.side-brand span { font-size: .68rem; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.side-nav { flex: 1; padding: .9rem .7rem; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: .7rem .85rem; border-radius: 10px; color: var(--text2); text-decoration: none; font-weight: 500; font-size: .92rem; transition: .15s; }
.side-nav a i { width: 18px; text-align: center; color: var(--muted); transition: .15s; }
.side-nav a:hover { background: var(--card); color: #fff; }
.side-nav a.on { background: var(--gold-soft); color: var(--gold2); box-shadow: inset 3px 0 0 var(--gold); }
.side-nav a.on i { color: var(--gold); }
.side-nav a span { flex: 1; }
.side-nav a em { font-style: normal; font-size: .72rem; font-weight: 800; background: var(--red); color: #fff; border-radius: 99px; padding: 1px 8px; }
.side-me { display: flex; align-items: center; gap: 8px; padding: .8rem; border-top: 1px solid var(--line); }
.me-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: .45rem; border-radius: 10px; text-decoration: none; color: inherit; }
.me-card:hover, .me-card.on { background: var(--card); }
.me-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-txt strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; background: var(--grad); color: #1A1508; font-weight: 800; font-family: var(--head); }
.avatar.lg { width: 46px; height: 46px; font-size: 1.1rem; }
.main { flex: 1; min-width: 0; margin-left: 260px; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 1rem 1.8rem; background: rgba(18,21,28,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.25rem; margin: 0; }
.menu-btn { display: none; }
.content { padding: 1.6rem 1.8rem 3rem; max-width: 1200px; width: 100%; }
.side-backdrop { display: none; }

/* ---------- elementy ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card.narrow { max-width: 560px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 1rem; }
.card-head h3 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: 9px; }
.card-head h3 i { color: var(--gold); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head > .muted { margin: 0; max-width: 680px; font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 75%, #fff); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); width: fit-content; white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip.muted { --c: #7A8191; color: var(--muted); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.badge.green { background: rgba(76,195,138,.15); color: #7EE0B0; }
.badge.red { background: rgba(229,103,107,.15); color: #F2A9AC; }
.badge.gray { background: rgba(255,255,255,.07); color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line2); border-radius: var(--r); color: var(--muted); }
.empty > i { font-size: 2.2rem; color: var(--gold); margin-bottom: .6rem; }
.empty h2 { color: var(--text); font-size: 1.2rem; margin: .2rem 0 .3rem; }
.lock { color: var(--muted); padding: 0 .4rem; }
.you { font-size: .65rem; font-weight: 800; background: var(--gold-soft); color: var(--gold2); padding: 1px 6px; border-radius: 6px; vertical-align: middle; }

/* pulpit */
.hello h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.hello p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 1.4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 1.2rem; }
.stat { display: flex; gap: 14px; align-items: center; padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: inherit; transition: .18s; }
.stat:hover { border-color: var(--gold); transform: translateY(-2px); }
.stat > i { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-size: 1.1rem; }
.stat.hot > i { background: rgba(229,103,107,.15); color: var(--red); }
.stat strong { display: block; font-size: 1.5rem; font-family: var(--head); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 1rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: .18s; }
.tile:hover { border-color: var(--gold); }
.tile i { color: var(--gold); font-size: 1.2rem; margin-bottom: .3rem; }
.tile span { color: var(--muted); font-size: .84rem; }
.info { display: grid; grid-template-columns: 160px 1fr; gap: .6rem 1rem; margin: 0 0 1.4rem; }
.info dt { color: var(--muted); font-size: .88rem; }
.info dd { margin: 0; }

/* role */
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 1.4rem; }
.role-card { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r); padding: 1rem 1.1rem; }
.role-top { display: flex; align-items: center; gap: 10px; margin-bottom: .9rem; }
.role-top form { margin: 0; }
.role-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 20%, transparent); }
.role-name { flex: 1; min-width: 0; }
.role-name strong { display: block; }
.role-name span { font-size: .78rem; color: var(--muted); }
.perm-list { display: flex; flex-direction: column; gap: 5px; }
.perm { font-size: .84rem; color: #6B7280; display: flex; align-items: center; gap: 8px; }
.perm i { width: 14px; }
.perm.on { color: var(--text2); }
.perm.on i { color: var(--green); }
.lbl { font-size: .82rem; font-weight: 600; color: var(--text2); margin: 1rem 0 .5rem; }
.perm-pick, .role-pick { display: flex; flex-direction: column; gap: 6px; }
.pick { flex-direction: row; align-items: center; gap: 12px; padding: .7rem .85rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-weight: 500; }
.pick:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.pick input { accent-color: var(--gold); width: 17px; height: 17px; flex-shrink: 0; }
.pick > i { color: var(--gold); width: 18px; text-align: center; }
.pick span { display: flex; flex-direction: column; }
.pick small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.role-pick .pick small { margin-left: auto; text-align: right; }
.role-row { grid-template-columns: 1fr 110px; }
.log { display: flex; flex-direction: column; font-size: .86rem; }
.log > div { display: flex; gap: 12px; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.log > div:last-child { border-bottom: 0; }
.log-when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 78px; }
.log em { color: var(--muted); font-style: normal; }

/* wnioski */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--r); }
.req-who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.req-who strong { font-size: 1.02rem; }
.req-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .83rem; color: var(--muted); margin-top: 3px; }
.req-meta i { width: 14px; color: var(--gold); opacity: .8; }
.req-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; align-items: center; margin: 0; }

/* tabele */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg2); white-space: nowrap; }
.tbl td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255,255,255,.015); }
.tbl td small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.tbl td small.warn { color: #E0A951; }
.tbl tr.dim td { opacity: .62; }
.tbl .acts { text-align: right; width: 60px; }
.who { display: flex; gap: 10px; align-items: center; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fbtn { padding: .5rem .85rem; border-radius: 99px; border: 1px solid var(--line); color: var(--text2); text-decoration: none; font-size: .85rem; font-weight: 600; }
.fbtn em { font-style: normal; color: var(--muted); font-size: .76rem; margin-left: 3px; }
.fbtn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold2); }
.search { position: relative; min-width: 260px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.search input { padding-left: 2.2rem; }

/* menu akcji */
.menu { position: relative; display: inline-block; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; padding: 5px; box-shadow: 0 18px 40px rgba(0,0,0,.45); display: none; z-index: 40; text-align: left; }
.menu.open .menu-pop { display: block; }
.menu.up .menu-pop { top: auto; bottom: calc(100% + 6px); }
.menu-pop form { margin: 0; }
.menu-pop button { width: 100%; display: flex; align-items: center; gap: 10px; padding: .6rem .75rem; border: 0; background: none; color: var(--text2); font: 500 .87rem var(--font); border-radius: 8px; cursor: pointer; text-align: left; }
.menu-pop button i { width: 16px; color: var(--muted); }
.menu-pop button:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-pop button.danger { color: #F0959A; }
.menu-pop button.danger i { color: #F0959A; }
.menu-pop button.danger:hover { background: rgba(229,103,107,.14); }

/* okna */
.modal, .dlg { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(8,10,14,.7); backdrop-filter: blur(6px); }
.modal.show, .dlg.show { display: flex; animation: fade .15s ease; }
.dlg { z-index: 120; }
.modal-box, .dlg-box { position: relative; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line2); border-radius: 18px; padding: 1.5rem; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
.modal-box h3 { margin: 0 2rem 1rem 0; font-size: 1.15rem; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.modal-x:hover { color: #fff; background: var(--card2); }
.modal-actions, .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.3rem; flex-wrap: wrap; }
.dlg-head { display: flex; gap: 12px; align-items: center; margin-bottom: .7rem; }
.dlg-head h3 { margin: 0; font-size: 1.08rem; }
.dlg-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); flex-shrink: 0; }
.dlg.danger .dlg-ic { background: rgba(229,103,107,.14); color: var(--red); }
.dlg.danger #dlgOk { background: linear-gradient(135deg, #E5676B, #B8404A); color: #fff; box-shadow: none; }
.dlg-box p { color: var(--text2); margin: 0; white-space: pre-line; }
#dlgField:not(:empty) { margin-top: 1rem; }
.copy-row { display: flex; gap: 8px; margin: 1rem 0 .3rem; }
.copy-row input { font: 700 1.15rem ui-monospace, Consolas, monospace; letter-spacing: .06em; text-align: center; color: var(--gold2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px); background: #1F3A2C; color: #B8F0D2; border: 1px solid rgba(76,195,138,.5); padding: .6rem 1.1rem; border-radius: 99px; font-size: .88rem; opacity: 0; transition: .25s; z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- telefon / tablet ---------- */
@media (max-width: 900px) {
    .side { transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,.6); }
    body.menu-open .side { transform: none; }
    body.menu-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }
    .main { margin-left: 0; }
    .menu-btn { display: inline-grid; }
    .topbar { padding: .8rem 16px; }
    .content { padding: 1.2rem 16px 3rem; }
    .search { min-width: 0; width: 100%; }
    .tbl.accounts thead { display: none; }
    .tbl.accounts, .tbl.accounts tbody, .tbl.accounts tr, .tbl.accounts td { display: block; width: 100%; }
    .tbl.accounts tr { position: relative; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
    .tbl.accounts td { border: 0; padding: .2rem 0; }
    .tbl.accounts .acts { position: absolute; top: .8rem; right: 1rem; width: auto; }
}
@media (max-width: 560px) {
    .row2, .role-row { grid-template-columns: 1fr; }
    .auth-card { padding: 1.5rem 1.2rem; }
    .info { grid-template-columns: 1fr; gap: .1rem; }
    .info dd { margin-bottom: .6rem; }
    .req-acts, .req-acts form { width: 100%; }
    .req-acts .sel { flex: 1; }
}
