:root {
    --bg: #f5f6fa; --card: #fff; --text: #111827; --text-2: #374151; --muted: #6b7280; --faint: #9ca3af;
    --border: #e5e7eb; --border-2: #d1d5db; --hover: #f9fafb;
    --primary: #4f46e5; --primary-d: #4338ca; --primary-l: #eef2ff; --ring: rgba(79, 70, 229, .18);
    --danger: #dc2626; --danger-l: #fef2f2; --success: #16a34a; --success-l: #f0fdf4; --warn: #d97706;
    --radius: 12px; --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 14.5px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }
h1 { font-size: 1.6rem; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 0; }
h3 { font-size: .92rem; margin: 0; }
p { margin: 0 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.prewrap { white-space: pre-wrap; word-break: break-word; margin: 0; color: var(--text-2); }
.overdue { color: var(--danger); font-weight: 600; }

.icon { width: 1.05em; height: 1.05em; flex-shrink: 0; vertical-align: -.15em; }

/* ---------- Layout ---------- */
.topbar { background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .45); }
.brand-logo .icon { width: 20px; height: 20px; }

.container { max-width: 1180px; margin: 1.75rem auto 3rem; padding: 0 1.25rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .88rem; margin-bottom: .9rem; }
.back-link:hover { color: var(--text); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.1rem; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
.card-head h2 .icon, .card-head h3 .icon { color: var(--faint); }
.count { font-size: .78rem; font-weight: 600; color: var(--muted); background: #f3f4f6; padding: .1rem .55rem; border-radius: 999px; }
.subsection { border-top: 1px solid var(--border); margin-top: 1.2rem; padding-top: 1.1rem; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.1rem; align-items: start; }
.form-side { position: sticky; top: 76px; }
@media (max-width: 900px) {
    .layout, .form-layout { grid-template-columns: 1fr; }
    .form-side { position: static; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem .95rem; border: 1px solid var(--border-2); background: #fff; color: var(--text-2);
    border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 600; font-size: .88rem; line-height: 1.2;
    box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, box-shadow .15s, color .15s; white-space: nowrap;
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: var(--danger-l); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: #f3f4f6; color: var(--text); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .7; cursor: progress; }
.btn.loading::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading .icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: #f3f4f6; color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-l); color: var(--danger); }

/* ---------- Forms ---------- */
input[type=text], input[type=search], input[type=date], input[type=password], select, textarea {
    width: 100%; padding: .55rem .75rem; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    font: inherit; color: var(--text); background: #fff; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
select {
    appearance: none; padding-right: 2rem; cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .6rem center / 16px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
::placeholder { color: var(--faint); }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-label { font-weight: 600; font-size: .85rem; color: var(--text-2); }
.field-label em { color: var(--danger); font-style: normal; }
.field-hint { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); }
.field-hint.warn { color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-actions { display: flex; flex-direction: column; gap: .4rem; padding-top: .3rem; border-top: 1px solid var(--border); margin-top: .2rem; padding-top: 1rem; }

form.inline { display: inline; margin: 0; }
.row-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-form input[type=text] { flex: 1 1 160px; width: auto; }
.row-form input.w-owner { flex: 0 1 160px; }
.row-form input[type=date] { width: auto; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.1rem; border: 1px solid; font-size: .9rem; transition: opacity .4s, transform .4s; }
.alert > .icon { margin-top: .15rem; }
.alert span { flex: 1; }
.alert-success { background: var(--success-l); border-color: #bbf7d0; color: #166534; }
.alert-error { background: var(--danger-l); border-color: #fecaca; color: #991b1b; }
.alert.fade { opacity: 0; transform: translateY(-6px); }
.alert-close { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: .1rem; display: grid; }
.alert-close:hover { opacity: 1; }

/* ---------- Badges, chips, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .icon { width: 12px; height: 12px; }
.pri-low      { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.pri-medium   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.pri-high     { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.pri-critical { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.st-open       { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.st-inprogress { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.st-resolved   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.st-closed     { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.overdue-tag   { background: var(--danger); color: #fff; margin-left: .35rem; }

.meta-chips { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 6px; background: #f3f4f6; color: var(--muted); font-size: .78rem; font-weight: 500; }
.chip .icon { width: 13px; height: 13px; }
.chip-danger { background: var(--danger-l); color: var(--danger); }

.avatar {
    --h: 220; display: inline-grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
    background: hsl(var(--h) 70% 93%); color: hsl(var(--h) 55% 35%); font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: .65rem; }
.person { display: inline-flex; align-items: center; gap: .5rem; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; margin-bottom: 1.1rem; }
.stat { --c: #4f46e5; --l: #eef2ff; display: flex; align-items: center; gap: .85rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { border-color: var(--c); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow); }
.stat.active { border-color: var(--c); box-shadow: 0 0 0 3px var(--l); }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--l); color: var(--c); }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-body { display: flex; flex-direction: column; }
.stat-body strong { font-size: 1.5rem; line-height: 1.1; letter-spacing: -.02em; }
.stat-body span { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-open       { --c: #2563eb; --l: #eff6ff; }
.stat-inprogress { --c: #7c3aed; --l: #f5f3ff; }
.stat-resolved   { --c: #059669; --l: #ecfdf5; }
.stat-closed     { --c: #6b7280; --l: #f3f4f6; }
.stat-overdue    { --c: #9ca3af; --l: #f3f4f6; }
.stat-overdue.has-overdue { --c: #dc2626; --l: #fef2f2; }
.stat-overdue.has-overdue strong { color: var(--danger); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .8rem; }
.filters select { width: auto; min-width: 150px; }
.search-field { position: relative; flex: 1 1 260px; }
.search-field .icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-field input { padding-left: 2.3rem; }

.table-card { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem 1.1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f9fafb; }
th.right, td.right { text-align: right; }
tbody tr { transition: background .1s; }
tbody tr[data-href] { cursor: pointer; }
tbody tr:hover { background: #fafaff; }
tr:last-child td { border-bottom: 0; }
tr.is-done .title { color: var(--muted); }
.title { font-weight: 600; color: var(--text); }
.title:hover { color: var(--primary); }
.bug-table .sub { font-size: .78rem; margin-top: .1rem; }
.bug-table td:first-child { min-width: 240px; }
.due-icon { display: none; }
@media (max-width: 820px) {
    .bug-table thead { display: none; }
    .bug-table, .bug-table tbody { display: block; }
    .bug-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--border); }
    .bug-table tr:last-child { border-bottom: 0; }
    .bug-table td { display: block; padding: 0; border: 0; min-width: 0; font-size: .85rem; }
    .bug-table td:first-child { flex-basis: 100%; min-width: 0; margin-bottom: .15rem; font-size: inherit; }
    .bug-table td.is-empty { display: none; }
    .bug-table td.right { margin-left: auto; }
    .due-icon { display: inline; margin-right: .3rem; color: var(--faint); }
}

.empty-state { text-align: center; padding: 3.5rem 1.5rem; }
.empty-state h3 { font-size: 1.05rem; margin: .9rem 0 .3rem; }
.empty-state p { margin-bottom: 1.1rem; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-l); color: var(--primary); }
.empty-icon .icon { width: 26px; height: 26px; }

/* ---------- Bug page ---------- */
.bug-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.bug-head-main { flex: 1 1 400px; min-width: 0; }
.bug-head h1 { margin: .5rem 0 .3rem; word-break: break-word; }
.bug-head p { margin: 0; }
.bug-badges { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.bug-id { font-weight: 600; color: var(--muted); font-size: .85rem; margin-right: .2rem; }
.actions { display: flex; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

.details { margin: 0; display: flex; flex-direction: column; }
.details > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.details > div:last-child { border-bottom: 0; }
.details dt { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .85rem; }
.details dt .icon { color: var(--faint); }
.details dd { margin: 0; font-weight: 500; text-align: right; }

.progress { height: 6px; border-radius: 999px; background: #f3f4f6; overflow: hidden; margin: -.3rem 0 .8rem; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: inherit; transition: width .3s; }

.followups { list-style: none; padding: 0; margin: 0 0 1rem; }
.followups li { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .5rem; margin: 0 -.5rem; border-radius: var(--radius-sm); border-bottom: 1px solid var(--border); }
.followups li:last-child { border-bottom: 0; }
.followups li:hover { background: var(--hover); }
.fu-body { flex: 1; display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.fu-task { font-weight: 500; word-break: break-word; }
.followups li.done .fu-task { text-decoration: line-through; color: var(--faint); }
.fu-actions { display: flex; gap: .1rem; opacity: .55; transition: opacity .15s; }
.followups li:hover .fu-actions { opacity: 1; }
.fu-actions label.icon-btn { margin: 0; }

.check { appearance: none; width: 20px; height: 20px; margin: .1rem 0 0; border: 2px solid var(--border-2); border-radius: 6px; cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check:hover { border-color: var(--success); }
.check:checked { background: var(--success); border-color: var(--success); }
.check:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }

.add-followup { display: flex; flex-direction: column; gap: .6rem; padding-top: 1rem; border-top: 1px solid var(--border); align-items: flex-start; }
.add-followup .row-form { width: 100%; }
.attach-toggle { width: 100%; }
.attach-toggle summary { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; color: var(--muted); font-size: .85rem; font-weight: 500; list-style: none; }
.attach-toggle summary::-webkit-details-marker { display: none; }
.attach-toggle summary:hover { color: var(--primary); }
.attach-toggle[open] summary { margin-bottom: .5rem; color: var(--primary); }

.upload-form { display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; margin-top: .8rem; }
.upload-form .dropzone { width: 100%; }

.comment-form { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .5rem; }
.comment-form .row-form button { margin-left: auto; }
.comments { display: flex; flex-direction: column; }
.comment { display: flex; gap: .8rem; padding: 1rem 0 .2rem; border-top: 1px solid var(--border); margin-top: .8rem; }
.comment-body { flex: 1; min-width: 0; }
.comment header { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.comment header form { margin-left: auto; }
.comment header .icon-btn { opacity: 0; }
.comment:hover header .icon-btn { opacity: 1; }

/* ---------- Image gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; margin: .2rem 0 .4rem; }
.gallery figure { position: relative; margin: 0; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f3f4f6; }
.gallery a { display: block; height: 100%; cursor: zoom-in; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.gallery figure:hover img { transform: scale(1.05); }
.gallery form { position: absolute; top: 5px; right: 5px; margin: 0; opacity: 0; transition: opacity .15s; }
.gallery figure:hover form { opacity: 1; }
.followups .gallery { grid-template-columns: repeat(auto-fill, 72px); }
.thumb-del { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(17, 24, 39, .7); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.thumb-del:hover { background: var(--danger); }
.thumb-del .icon { width: 13px; height: 13px; }
@media (hover: none) { .gallery form, .fu-actions, .comment header .icon-btn { opacity: 1; } }

/* ---------- Drop zone ---------- */
.dropzone { border: 2px dashed var(--border-2); border-radius: var(--radius); background: #fafafa; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-l); }
.dz-area { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem 1rem; text-align: center; cursor: pointer; color: var(--muted); font-size: .88rem; }
.dz-area input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 1px solid var(--border); color: var(--primary); box-shadow: var(--shadow-sm); margin-bottom: .2rem; }
.dz-text strong { color: var(--primary); }
.dz-hint { font-size: .75rem; color: var(--faint); }
.dropzone.compact .dz-area { flex-direction: row; justify-content: center; flex-wrap: wrap; padding: .8rem 1rem; gap: .2rem .6rem; }
.dropzone.compact .dz-icon { width: 30px; height: 30px; margin: 0; }
.dropzone.compact .dz-hint { flex-basis: 100%; }
.dz-previews { display: none; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .5rem; padding: 0 .9rem .9rem; }
.dropzone.has-files .dz-previews { display: grid; }
.dz-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.dz-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz-item .thumb-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; font-size: 14px; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; border-radius: 16px; width: min(400px, calc(100% - 2rem)); box-shadow: var(--shadow-lg); color: var(--text); }
.modal::backdrop { background: rgba(17, 24, 39, .45); backdrop-filter: blur(2px); }
.modal[open] { animation: pop .18s ease-out; }
.modal form { padding: 1.6rem; display: flex; flex-direction: column; gap: .5rem; text-align: center; }
.modal h3 { font-size: 1.1rem; }
.modal p { font-size: .9rem; margin-bottom: .6rem; }
.modal input { text-align: center; font-size: 1.15rem; letter-spacing: .3em; }
.modal-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto .4rem; border-radius: 50%; background: var(--primary-l); color: var(--primary); }
.modal-icon .icon { width: 22px; height: 22px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.modal-actions.solo { grid-template-columns: 1fr; }
#name-dialog input { letter-spacing: normal; font-size: 1rem; }

.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.topbar-inner { gap: 1rem; }
.nav { display: flex; gap: .25rem; margin-right: auto; margin-left: 1rem; }
.nav a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: .88rem; }
.nav a:hover { background: #f3f4f6; color: var(--text); }
.nav a.active { background: var(--primary-l); color: var(--primary); }

/* ---------- Activity log ---------- */
.log-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .8rem; border-bottom: 1px solid var(--border); }
.tab { padding: .55rem .9rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: .88rem; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.log-count { margin-bottom: .2rem; }
.log-day { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2rem 0 .3rem; }
.log-day:first-of-type { margin-top: .6rem; }
.log-list { list-style: none; margin: 0; padding: 0; position: relative; }
.log-item { --c: #4f46e5; --l: #eef2ff; position: relative; display: flex; gap: .85rem; padding: .7rem 0; }
.log-list:not(.compact) .log-item + .log-item::before { content: ""; position: absolute; left: 15px; top: -.7rem; height: 1.4rem; border-left: 2px solid var(--border); }
.log-icon { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--l); color: var(--c); position: relative; z-index: 1; }
.log-icon .icon { width: 15px; height: 15px; }
.log-body { flex: 1; min-width: 0; }
.log-line { margin: .3rem 0 .15rem; word-break: break-word; }
.log-details { margin: .25rem 0 .3rem; padding: .45rem .7rem; background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: .84rem; word-break: break-word; }
.log-meta { font-size: .78rem; color: var(--faint); }
.log-gone { color: var(--muted); text-decoration: line-through; }
.tone-success { --c: #059669; --l: #ecfdf5; }
.tone-info    { --c: #4f46e5; --l: #eef2ff; }
.tone-warn    { --c: #d97706; --l: #fffbeb; }
.tone-danger  { --c: #dc2626; --l: #fef2f2; }
.log-list.compact .log-item { gap: .6rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.log-list.compact .log-item:last-child { border-bottom: 0; }
.log-list.compact .log-icon { width: 26px; height: 26px; }
.log-list.compact .log-icon .icon { width: 13px; height: 13px; }
.log-list.compact .log-line { margin: .15rem 0 0; font-size: .85rem; }
.log-list.compact .log-details { padding: .3rem .5rem; font-size: .78rem; }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; margin-top: .6rem; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
    .nav { margin-left: 0; }
    .nav a span, .user-chip > span:last-child { display: none; }
    .user-chip { padding: .3rem; }
}
.user-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .75rem .3rem .3rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text-2); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; max-width: 200px; }
.user-chip:hover { background: var(--hover); border-color: var(--border-2); }
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; background: rgba(10, 12, 20, .9); animation: fadein .15s; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .75rem; max-width: 100%; max-height: 100%; }
.lightbox img { max-width: min(1200px, 85vw); max-height: 80vh; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); background: #fff; }
.lightbox figcaption { color: #d1d5db; font-size: .85rem; text-align: center; white-space: pre; }
.lb-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; flex-shrink: 0; transition: background .15s; }
.lb-btn:hover { background: rgba(255, 255, 255, .25); }
.lb-btn .icon { width: 22px; height: 22px; }
.lb-close { position: absolute; top: 1rem; right: 1rem; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { visibility: hidden; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    .container { margin-top: 1.1rem; }
    .topbar-inner { padding: .6rem 1rem; }
    .topbar .btn span { display: none; }
    .card { padding: 1rem; }
    h1 { font-size: 1.35rem; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .filters select, .filters .btn { flex: 1 1 auto; }
    .lightbox { padding: 1rem .5rem; gap: .25rem; }
    .lb-btn { width: 36px; height: 36px; }
}
