@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');

:root {
    --bg-0: #060a14;
    --bg-1: #0b1120;
    --panel: rgba(30, 41, 59, 0.55);
    --panel-solid: #161f32;
    --panel-border: rgba(148, 163, 184, 0.14);
    --panel-border-hover: rgba(148, 163, 184, 0.28);
    --text: #eef2f8;
    --muted: #93a1b8;
    --accent: #22c55e;
    --accent-2: #16d3c0;
    --accent-grad: linear-gradient(135deg, #22c55e 0%, #16d3c0 100%);
    --danger: #f87171;
    --danger-grad: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-soft: 0 8px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 0 1px rgba(34, 197, 94, 0.15), 0 8px 30px -8px rgba(34, 197, 94, 0.25);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

html { scroll-behavior: smooth; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1100px 550px at 12% -10%, rgba(34, 197, 94, 0.16), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(22, 211, 192, 0.12), transparent 55%),
        radial-gradient(800px 600px at 50% 110%, rgba(34, 197, 94, 0.08), transparent 60%),
        var(--bg-0);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 24px;
    background: rgba(11, 17, 32, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--panel-border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    font-size: 1.08rem;
    letter-spacing: -0.01em;
}
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--accent-grad);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px -2px rgba(34, 197, 94, 0.55);
    flex-shrink: 0;
}
.brand-mark svg { width: 17px; height: 17px; }

.topnav { display: flex; align-items: center; gap: 18px; font-size: 0.9rem; }
.topnav a { color: var(--muted); text-decoration: none; position: relative; transition: color 0.2s var(--ease); }
.topnav a::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1.5px;
    background: var(--accent-grad); transform: scaleX(0); transform-origin: right;
    transition: transform 0.25s var(--ease);
}
.topnav a:hover { color: var(--text); }
.topnav a:hover::after { transform: scaleX(1); transform-origin: left; }
.whoami { color: var(--muted); }
.whoami strong { color: var(--text); }

.container { max-width: 920px; margin: 0 auto; padding: 32px 20px 70px; }

/* ---------- Panels ---------- */
.panel {
    background: var(--panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
    animation: rise 0.55s var(--ease) both;
}
.panel:hover { border-color: var(--panel-border-hover); }
.panel-narrow { max-width: 420px; }
.container > .panel:nth-of-type(1) { animation-delay: 0.02s; }
.container > .panel:nth-of-type(2) { animation-delay: 0.09s; }
.container > .panel:nth-of-type(3) { animation-delay: 0.16s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 1.5rem; margin-top: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }

.panel-header-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 0; margin-bottom: 18px; }
.panel-header-row h2 { flex: 1; margin: 0; }

label { display: block; margin-bottom: 7px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }

input[type=text], input[type=url], input[type=password] {
    width: 100%;
    padding: 12px 14px;
    background: rgba(6, 10, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.98rem;
    margin-bottom: 16px;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder { color: #5b6a85; }

.input-prefix { position: relative; }
.input-prefix::before {
    content: '#';
    position: absolute;
    left: 14px;
    top: 12px;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1;
    pointer-events: none;
}
.input-prefix input { padding-left: 26px; }
input:hover { border-color: var(--panel-border-hover); }
input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(6, 10, 20, 0.85);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 220px; }

/* ---------- Buttons ---------- */
button, .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-grad);
    color: #052013;
    border: none;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease);
    box-shadow: 0 4px 16px -4px rgba(34, 197, 94, 0.45);
}
button:hover, .btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(34, 197, 94, 0.55); filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(0); }

.btn-secondary {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--panel-border);
    color: var(--text);
    box-shadow: none;
}

.btn-block { width: 100%; justify-content: center; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-row input[type=checkbox] { width: auto; margin: 0; }
.checkbox-row label { margin-bottom: 0; }

.code-block {
    display: block;
    background: rgba(6, 10, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.8;
    overflow-x: auto;
}
.btn-secondary:hover { background: rgba(148, 163, 184, 0.14); border-color: var(--panel-border-hover); box-shadow: 0 6px 18px -8px rgba(0,0,0,0.4); }

.btn-danger { background: var(--danger-grad); color: #2a0a0a; box-shadow: 0 4px 16px -4px rgba(239, 68, 68, 0.45); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.inline-form { display: inline; }

.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--danger); font-size: inherit; font-family: inherit;
    text-decoration: none; transition: opacity 0.2s var(--ease);
    box-shadow: none; border-radius: 0;
}
.link-btn:hover { opacity: 0.75; transform: none; box-shadow: none; }

/* ---------- Stats ---------- */
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1; min-width: 170px; padding: 4px 0; }
.stat-icon {
    width: 34px; height: 34px; border-radius: 9px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(34, 197, 94, 0.12); color: var(--accent);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat .value {
    font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em;
    background: linear-gradient(135deg, #f8fafc, #c7d2e0);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    font-variant-numeric: tabular-nums;
}
.stat .label { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.progress-bar {
    position: relative;
    background: rgba(6, 10, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 999px; height: 12px; overflow: hidden; margin: 14px 0 10px;
}
.progress-fill {
    background: var(--accent-grad);
    height: 100%; width: 0;
    border-radius: 999px;
    transition: width 1s var(--ease);
    position: relative;
    overflow: hidden;
}
.progress-fill::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmer 2.2s ease-in-out infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ---------- Banner (batch compleet) ---------- */
.banner {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(22, 211, 192, 0.08));
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-glow);
    animation: rise 0.5s var(--ease) both, glow-pulse 2.6s ease-in-out infinite 0.6s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.banner-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px;
    background: var(--accent-grad); display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px -2px rgba(34, 197, 94, 0.55);
    animation: pop 0.5s var(--ease) 0.15s both;
}
.banner-icon svg { width: 20px; height: 20px; color: #052013; }
@keyframes glow-pulse {
    0%, 100% { box-shadow: var(--shadow-glow); }
    50% { box-shadow: 0 0 0 1px rgba(34,197,94,0.3), 0 8px 36px -6px rgba(34,197,94,0.45); }
}
@keyframes pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--panel-border); }
th {
    color: var(--muted); font-weight: 600; font-size: 0.76rem;
    text-transform: uppercase; letter-spacing: 0.06em;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.18s var(--ease); animation: fade-in 0.4s var(--ease) both; }
tbody tr:hover { background: rgba(148, 163, 184, 0.05); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.badge {
    display: inline-block; background: rgba(148, 163, 184, 0.12);
    border: 1px solid var(--panel-border);
    color: var(--text); border-radius: 999px; padding: 3px 11px; font-size: 0.74rem; font-weight: 600;
}
.badge-accent { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.3); color: #6ee7a0; }

/* ---------- Flash messages ---------- */
.flash {
    display: flex; align-items: center; gap: 10px;
    border-radius: var(--radius-sm); padding: 13px 16px; margin-bottom: 18px;
    font-size: 0.92rem; animation: slide-in 0.4s var(--ease) both;
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.error { color: #fecaca; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); }
.success { color: #bbf7d0; background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.35); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.flash.is-leaving { animation: slide-out 0.35s var(--ease) both; }
@keyframes slide-out { to { opacity: 0; transform: translateY(-8px); } }

.qr-wrap {
    display: inline-block;
    background: #fff;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.qr-wrap img { display: block; width: 200px; height: 200px; max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.small a { overflow-wrap: anywhere; word-break: break-all; }

a.ticket-link { color: var(--accent-2); text-decoration: none; font-weight: 600; }
a.ticket-link:hover { text-decoration: underline; }

/* ---------- Login ---------- */
.login-wrap { max-width: 400px; margin: 10vh auto 0; }
.login-wrap .panel { animation: rise 0.6s var(--ease) both; }
.login-logo {
    width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px;
    background: var(--accent-grad); display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 26px -6px rgba(34, 197, 94, 0.55);
}
.login-logo svg { width: 26px; height: 26px; color: #052013; }
.login-wrap h1 { text-align: center; }
.login-wrap .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: -8px; margin-bottom: 22px; }

@media (max-width: 600px) {
    .container { padding: 20px 14px 50px; }
    .login-wrap { margin-top: 6vh; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { border-bottom: 1px solid var(--panel-border); padding: 10px 0; }
    td { border: none; padding: 4px 0; text-align: left !important; }
    td::before { content: attr(data-label) ": "; color: var(--muted); }
}
