* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
}

/* ── Layout ── */

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Topbar ── */

.topbar {
    height: 56px;
    background: #111;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    flex-shrink: 0;
}

.topbar-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: 0.3s;
}

/* ── Sidebar ── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    background: #111;
    border-right: 1px solid #222;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
}

.sidebar-logo span {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    letter-spacing: 0.04em;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar nav > a {
    color: #aaa;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.sidebar nav > a:hover {
    background: #1a1a1a;
    color: white;
}

.sidebar nav > a.active {
    background: #1a1a1a;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-bottom button {
    background: none;
    border: 1px solid #333;
    color: #aaa;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
}

.sidebar-bottom button:hover {
    border-color: #666;
    color: white;
}

/* ── Content ── */

.content {
    flex: 1;
    padding: 40px;
    background: #000;
    overflow-y: auto;
    color: white;
}

.dashboard h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.dashboard p {
    color: #aaa;
    font-size: 1rem;
}

/* ── Auth / Login ── */

.auth-body {
    background: #000;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.login-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.login-bg {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.15;
    pointer-events: none;
}

.login-bg img {
    width: 100%;
    max-width: 1200px;
    object-fit: contain;
}

.login-box {
    position: relative;
    z-index: 1;
    background: #111;
    border: 1px solid #333;
    padding: 40px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 45%;
    box-shadow: 0 4px 40px rgba(0,0,0,0.6);
}

.login-box.two-factor-box {
    width: 480px;
    max-width: 95%;
}

.login-box input[type="radio"] {
    width: 10% !important;
    height: auto;
    display: inline-block;
    margin-right: 0;
    margin-left: 8px;
    cursor: pointer;
    vertical-align: middle;
    padding: 0;
    background: none;
    border: none;
}

.login-box input[type="checkbox"] {
    width: 10% !important;
    height: auto;
    display: inline-block;
    margin-right: 8px;
    cursor: pointer;
    vertical-align: middle;
    padding: 0;
    background: none;
    border: none;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
}

.login-box h1 {
    font-size: 1.6rem;
    color: white;
    letter-spacing: 0.05em;
}

.login-box p {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.login-box label {
    color: #aaa;
    font-size: 0.85rem;
}

.login-box input {
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    color: white;
}

.login-box input:focus {
    outline: none;
    border-color: #666;
}

.login-box button {
    padding: 10px;
    background: white;
    color: black;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.login-box button:hover {
    background: #ddd;
}

/* ── Form Inputs ── */
.form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
    background-color: #111;
    background-clip: padding-box;
    border: 1px solid #333;
    border-radius: 6px;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-input:focus {
    color: #fff;
    background-color: #1a1a1a;
    border-color: #666;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.1);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
}

textarea.form-input {
    min-height: 120px;
    font-family: inherit;
}

.form-input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* ── Markdown Content Typography ── */
.markdown-content {
    line-height: 1.7;
    font-size: 1.05rem;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3, 
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    color: #fff;
    margin-top: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
}
.markdown-content h1 { font-size: 1.8rem; border-bottom: 1px solid #333; padding-bottom: 0.3rem; }
.markdown-content h2 { font-size: 1.4rem; border-bottom: 1px solid #222; padding-bottom: 0.2rem; }
.markdown-content h3 { font-size: 1.2rem; }
.markdown-content p {
    margin-bottom: 1rem;
}
.markdown-content a {
    color: #38bdf8;
    text-decoration: underline;
}
.markdown-content a:hover {
    color: #7dd3fc;
}
.markdown-content blockquote {
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
    color: #aaa;
    border-left: 0.25rem solid #555;
    background: #111;
}
.markdown-content code {
    font-family: var(--bs-font-monospace, monospace);
    background-color: #1a1a1a;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #f43f5e;
    font-size: 0.9em;
}
.markdown-content pre {
    background-color: #111;
    border: 1px solid #333;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}
.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    color: #f8f9fa;
}
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    border: 1px solid #333;
}
.markdown-content table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: collapse;
}
.markdown-content th, .markdown-content td {
    padding: 0.75rem;
    border: 1px solid #333;
}
.markdown-content th {
    background-color: #111;
    color: #fff;
}
.markdown-content ul, .markdown-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

/* Hover effects */
.hover-glow {
    transition: transform 0.2s, box-shadow 0.2s;
}
.hover-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}
.link-primary-hover:hover {
    color: #0d6efd !important;
}

/* ── Django Admin Overrides ── */
body.admin-body {
    --primary: #111;
    --primary-fg: #fff;
    --body-bg: #000;
    --body-fg: #fff;
    --body-quiet-color: #888;
    --border-color: #222;
    --breadcrumbs-bg: #111;
    --breadcrumbs-link-fg: #0d6efd;
    --breadcrumbs-fg: #888;
    --link-color: #0d6efd;
    --link-hover-color: #0b5ed7;
    --accent: #ffd166;
    --button-bg: #0d6efd;
    --button-hover-bg: #0b5ed7;
    --message-success-bg: rgba(25, 135, 84, 0.15);
    --message-success-fg: #198754;
    --message-warning-bg: rgba(255, 193, 7, 0.15);
    --message-warning-fg: #ffc107;
    --message-error-bg: rgba(220, 53, 69, 0.15);
    --message-error-fg: #dc3545;
    
    background-color: #000 !important;
    color: #fff !important;
}

/* Ensure branding alignment */
#header.admin-header, #header {
    background: var(--primary) !important;
    color: var(--primary-fg) !important;
    border-bottom: 1px solid var(--border-color) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

#header a {
    color: var(--primary-fg) !important;
}

#header a:hover {
    color: var(--link-color) !important;
}

.breadcrumbs {
    background: var(--breadcrumbs-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--breadcrumbs-fg) !important;
}

.breadcrumbs a {
    color: var(--breadcrumbs-link-fg) !important;
}

/* Theme all admin modules to dark background */
.module, .app-accounts, .app-drinks, .app-core, .app-auth, #changelist-filter {
    background: #111 !important;
    border: 1px solid #222 !important;
    border-radius: 8px !important;
}

.module h2, .module caption, #changelist-filter h2 {
    background: #1a1a1a !important;
    color: #fff !important;
    border-bottom: 1px solid #222 !important;
}

/* Override input styling inside admin forms */
.admin-body input[type=text], 
.admin-body input[type=password], 
.admin-body input[type=email], 
.admin-body input[type=number], 
.admin-body select, 
.admin-body textarea {
    background-color: #111 !important;
    color: #fff !important;
    border: 1px solid #333 !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
}

.admin-body input[type=text]:focus, 
.admin-body select:focus, 
.admin-body textarea:focus {
    border-color: #666 !important;
    outline: none !important;
}

/* Adjust tables inside admin */
.admin-body table thead th {
    background: #161616 !important;
    color: #aaa !important;
    border-bottom: 1px solid #222 !important;
}

.admin-body tr.row1 {
    background: #111 !important;
}

.admin-body tr.row2 {
    background: #141414 !important;
}

.admin-body tr:hover td {
    background: #1c1c1c !important;
}

/* Align submit rows */
.admin-body .submit-row {
    background: #111 !important;
    border: 1px solid #222 !important;
    border-radius: 8px !important;
}

.admin-body .submit-row input[type=submit] {
    background: var(--button-bg) !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
}

.admin-body .submit-row input[type=submit]:hover {
    background: var(--button-hover-bg) !important;
}

.admin-body .submit-row input[type=submit].default {
    background: var(--accent) !important;
    color: #000 !important;
}

.admin-body .submit-row input[type=submit].default:hover {
    background: #e5b842 !important;
}

/* Hamburger transition */
.admin-hamburger span {
    transition: background-color 0.2s ease;
}
.admin-hamburger:hover span {
    background-color: #0d6efd !important;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.inv-filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.search-input {
    padding: 8px 12px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    flex: 1;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #666;
}

.form-control {
    padding: 8px 12px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.form-control:hover {
    border-color: #666;
    color: white;
}

.form-control:focus {
    outline: none;
    border-color: #666;
}
.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.inv-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: white;
    transition: border-color 0.2s;
}

.inv-card:hover {
    border-color: #555;
}

.inv-card-img {
    position: relative;
    width: 100%;
    height: 130px;
}

.inv-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.inv-card-no-img {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.8rem;
}

.inv-card-img .inv-status {
    position: absolute;
    bottom: 8px;
    left: 8px;
}

.inv-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inv-number {
    font-size: 0.7rem;
    color: #555;
    font-family: monospace;
}

.inv-card-body h3 {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-location {
    font-size: 0.75rem;
    color: #666;
}

.inv-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
}

.inv-status.benutzbar { background: #1a2e1a; color: #4caf50; }
.inv-status.defekt    { background: #2e1a1a; color: #f44336; }
.inv-status.verliehen { background: #2e2a1a; color: #ff9800; }
.inv-status.verloren  { background: #2a1a2e; color: #9c27b0; }

.inv-empty {
    color: #555;
    grid-column: 1 / -1;
}

/* Detail */

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.detail-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    overflow: hidden;
}

.detail-img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.detail-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-body h1 {
    font-size: 1.6rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-field label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-field span {
    font-size: 0.95rem;
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-section label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-section p {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Form */

.form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.form-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 32px;
    max-width: 640px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    color: #aaa;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #666;
}

.form-error {
    color: #f44336;
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* Buttons */

.btn-primary {
    padding: 8px 16px;
    background: white;
    color: black;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover { background: #ddd; }

.btn-danger {
    padding: 8px 16px;
    background: #2e1a1a;
    color: #f44336;
    border: 1px solid #f44336;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-danger:hover { background: #3e2a2a; }

.btn-back {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-back:hover { color: white; }

/* Gallery */

.gallery {
    display: flex;
    flex-direction: column;
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 320px;
    background: #0a0a0a;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.gallery-btn:hover { background: rgba(255,255,255,0.15); }
.gallery-btn.prev { left: 12px; }
.gallery-btn.next { right: 12px; }

.gallery-thumbs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #0d0d0d;
    overflow-x: auto;
}

.gallery-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.gallery-thumb.active,
.gallery-thumb:hover {
    opacity: 1;
    border-color: white;
}

/* Stronger specificity to ensure nav-sub link styles win in the cascade (Firefox inspector) */
.sidebar nav .nav-sub a {
    color: #aaa;
    text-decoration: none;
    padding: 8px 12px 8px 28px;
    border-radius: 6px;
    font-size: 0.88rem;
}
.sidebar nav .nav-sub a:hover {
    background: #1a1a1a;
    color: white;
}

/* Image formset */

.form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    color: #555;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #222;
}

.image-form {
    border: 1px solid #222;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.image-preview {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.delete-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #f44336;
    font-size: 0.85rem;
    margin-top: 8px;
    cursor: pointer;
}

/* ── Inventory Update── */

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-group a {
    padding-left: 20px;
    font-size: 0.9rem;
}

/* Make the group label look and behave like other sidebar links */
.nav-group-label {
    color: #aaa;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    background: transparent;
    border: none;
    text-align: left;
    width: 100%;
    cursor: pointer;
    text-transform: none; /* show normal case */
    font-family: inherit;  /* inherit main font */
    letter-spacing: 0.02em; /* normalize spacing slightly */
}
.nav-group-label:hover {
    background: #1a1a1a;
    color: white;
}

/* Ensure nav-sub supports both custom JS open class and Bootstrap's collapse/show */
.nav-sub.show {
    display: flex;
}
.nav-sub a {
    color: #aaa;
    text-decoration: none;
    padding: 8px 12px 8px 28px; /* slightly indented */
    border-radius: 6px;
}
.nav-sub a:hover {
    background: #1a1a1a;
    color: white;
}

/* Gegenstand Table */

.gegenstand-table {
    overflow-x: auto;
}

.gegenstand-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.gegenstand-table th {
    text-align: left;
    padding: 10px 14px;
    color: #555;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #222;
}

.gegenstand-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #1a1a1a;
    color: #ccc;
    vertical-align: middle;
}

.gegenstand-table tr:hover td {
    background: #111;
}

.gegenstand-table code {
    font-family: monospace;
    font-size: 0.8rem;
    color: #888;
}

.inv-count {
    font-size: 0.75rem;
    color: #555;
}

.extra-fields {
    display: none;
}

.nav-sub {
    display: none;
    flex-direction: column;
    gap: 2px;
}

.nav-sub.open {
    display: flex;
}

.nav-sub a {
    padding: 8px 12px 8px 28px; /* ensure indentation matches earlier rule */
    font-size: 0.88rem;
    color: #aaa;
    text-decoration: none;
    border-radius: 6px;
}
.nav-sub a:hover {
    background: #1a1a1a;
    color: white;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 32px 0 16px;
}

.uebersicht-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inv-meta {
    font-size: 0.78rem;
    color: #666;
}

/* QR Scanner */

.qr-scanner-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 0;
}

.qr-scanner-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: #0a0a0a;
    border: 1px solid #222;
}

#qr-video {
    width: 100%;
    display: block;
}

.qr-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.qr-frame {
    width: 200px;
    height: 200px;
    border: 2px solid white;
    border-radius: 12px;
    opacity: 0.6;
}

.qr-status {
    color: #aaa;
    font-size: 0.9rem;
}

/* Button secondary */

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: white;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: border-color 0.2s;
}

.btn-secondary:hover {
    border-color: #aaa;
}

/* ── Calendar ── */

.calendar-page {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.calendar-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calendar-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.calendar-nav-btn {
    padding: 10px 20px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
}

.calendar-nav-btn:hover {
    border-color: #666;
    background: #1a1a1a;
}

.calendar-month-year {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    min-width: 200px;
    text-align: center;
}

.calendar-grid {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: #1a1a1a;
    border-bottom: 1px solid #222;
}

.calendar-weekday {
    padding: 16px 12px;
    text-align: center;
    font-weight: 600;
    color: #aaa;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-right: 1px solid #222;
}

.calendar-weekday:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    min-height: 480px;
}

.calendar-day {
    min-height: 120px;
    padding: 12px;
    border-right: 1px solid #222;
    border-bottom: 1px solid #222;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #0a0a0a;
    transition: background-color 0.2s;
}

.calendar-day:hover:not(.empty) {
    background: #151515;
}

.calendar-day.today {
    background: #1a2a1a;
    border: 1px solid #2d5a2d;
}

.calendar-day.today .calendar-day-number {
    color: #4caf50;
    font-weight: 700;
}

.calendar-day.empty {
    background: #000;
}

.calendar-day-number {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
}

.calendar-event {
    display: flex;
    align-items: center;
}

.event-badge {
    padding: 3px 8px;
    background: #0d6efd;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.event-badge.all-day {
    background: #6366f1;
}

.event-more {
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Events list */

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calendar-events-list h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.events-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.event-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.event-card:hover {
    border-color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.event-card-header {
    padding: 16px 20px;
    background: #1a1a1a;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.event-card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    margin: 0;
    flex: 1;
}

.event-badge-all-day {
    padding: 4px 12px;
    background: #6366f1;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.event-card-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card-body p {
    margin: 0;
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.5;
}

.event-date {
    color: #aaa;
}

.event-location {
    color: #999;
    font-size: 0.9rem;
}

.event-description {
    color: #bbb;
    font-size: 0.9rem;
}

.calendar-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 1rem;
}
