:root {
    --color-primary: #d7430f;
    --color-primary-dark: #b8380c;
    --color-primary-light: #f4956f;
    --color-dark: #1f2937;
    --color-dark-2: #111827;
    --color-accent: #3b82f6;
    --color-bg: #f8fafc;
    --color-border: #e5e7eb;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

a {
    text-decoration: none;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--color-dark);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: var(--topbar-height);
    padding: 0 1.25rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background-color: var(--color-primary);
    color: #fff;
    font-size: 1rem;
}

.sidebar-menu {
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-menu ul li {
    margin-bottom: 0.25rem;
}

.sidebar-menu ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 0.925rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-menu ul li a i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    color: #94a3b8;
    transition: color 0.15s ease;
}

.sidebar-menu ul li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-menu ul li a:hover i {
    color: var(--color-primary-light);
}

.sidebar-menu ul li a.active {
    background-color: var(--color-primary);
    color: #fff;
}

.sidebar-menu ul li a.active i {
    color: #fff;
}

/* ===== Main wrapper ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-height);
    background-color: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.sidebar-toggle {
    border: none;
    background: transparent;
    font-size: 1.15rem;
    color: var(--color-text);
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

.sidebar-toggle:hover {
    background-color: var(--color-bg);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.notif-btn {
    position: relative;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.notif-btn:hover {
    background-color: var(--color-bg);
    color: var(--color-primary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--color-primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
}

.notif-menu {
    min-width: 280px;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
}

.user-btn:hover {
    background-color: var(--color-bg);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

.user-btn i.fa-chevron-down {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* ===== Content ===== */
.content-wrapper {
    padding: 1.75rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-header p {
    color: var(--color-text-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* ===== Stat cards ===== */
.stat-card {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.bg-primary-soft { background-color: var(--color-primary); }
.stat-icon.bg-dark-soft { background-color: var(--color-dark); }
.stat-icon.bg-accent-soft { background-color: var(--color-accent); }

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ===== Cards / Panels ===== */
.panel {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.panel-narrow {
    max-width: 480px;
}

/* ===== Buttons ===== */
.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* `vertical-align` pôsobí len na bunky, nie na <table>, takže samotná
   Bootstrap trieda .align-middle na <table> bunky reálne nezarovná. */
.panel .table > tbody > tr > td {
    vertical-align: middle;
    transition: background-color 0.2s ease;
}

/* Bootstrap maľuje pozadie na jednotlivé <td> cez --bs-table-bg, nie na
   <tr> — pozadie pri hoveri sa preto musí nastaviť priamo na bunkách,
   inak ho prekryje a efekt nie je vidno. */
.panel .table > tbody > tr:hover > td {
    background-color: #f2f2f2;
}

.clickable-row {
    cursor: pointer;
}

/* .table-actions je display:flex priamo na <td>, takže sa bunka prestáva
   správať ako table-cell a `vertical-align` na ňu nepôsobí — zarovnanie
   obsahu pri vyšších riadkoch preto musí riešiť align-items. */
.table-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ===== Forms & Modals ===== */
.nav-tabs .nav-link {
    color: var(--color-text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
}

.nav-tabs .nav-link:hover {
    color: var(--color-primary);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--color-primary);
    background-color: transparent;
    border-bottom-color: var(--color-primary);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}

.form-control,
.form-select {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(215, 67, 15, 0.15);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--color-border);
    opacity: 0.7;
}

.form-control.is-invalid,
.form-select.is-invalid {
    background-color: #fff5f4;
}

.modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(17, 24, 39, 0.25);
}

.modal-header {
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1.1rem 1.5rem;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
}

.form-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

.form-section-title:first-child {
    margin-top: 0;
}

.password-requirements {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0.75rem 0.9rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.password-requirements li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    transition: color 0.15s ease;
}

.password-requirements li i {
    color: var(--color-border);
    transition: color 0.15s ease;
}

.password-requirements li.valid {
    color: var(--color-text);
}

.password-requirements li.valid i {
    color: #16a34a;
}

/* ===== iOS-style prepínač (stav účtu) ===== */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
    margin: 0;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ios-switch-track {
    position: absolute;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ios-switch-track::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.ios-switch input:checked + .ios-switch-track {
    background-color: #34c759;
}

.ios-switch input:checked + .ios-switch-track::before {
    transform: translateX(20px);
}

.ios-switch input:focus-visible + .ios-switch-track {
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.3);
}

.ios-switch input:disabled + .ios-switch-track {
    opacity: 0.5;
    cursor: not-allowed;
}

.account-status-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.account-status-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.account-status-label.is-active {
    color: #16a34a;
}

.account-status-label.is-inactive {
    color: var(--color-text-muted);
}

/* ===== Login page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-2) 100%);
    padding: 1rem;
}

.login-card {
    background-color: #fff;
    border-radius: 14px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.login-brand .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
}

.login-brand span.brand-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-dark);
    letter-spacing: 0.5px;
}

/* ===== Logy ===== */
.log-detail-json {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.8rem;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 1.25rem;
}

/* ===== Profil ===== */
.login-history {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.login-history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.login-history-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.login-history-icon.is-login { background-color: var(--color-accent); }
.login-history-icon.is-logout { background-color: var(--color-text-muted); }

/* ===== Organizácie ===== */
.org-logo-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    background-color: #fff;
}

/* Náhradné "logo" z iniciál plného názvu, zobrazené na štvorci vo farbe
   primary_color organizácie — použité všade tam, kde chýba nahraté logo. */
.org-logo-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.org-logo-preview {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--color-border);
    background-color: #fff;
    padding: 4px;
}

.org-logo-preview-initials {
    font-size: 1.8rem;
    padding: 0;
}

.color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    vertical-align: middle;
    margin-right: 0.3rem;
}

.form-control-color {
    width: 3rem;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.25rem;
}

/* Pilulkový vstup pre Tágy / Správcov: kombinácia už vybraných "pilulkových"
   hodnôt a textového poľa na pridávanie ďalších, s výsuvným autocomplete. */
.pill-input {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.pill-input-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pill-input-field {
    flex: 1 1 160px;
    min-width: 160px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill-static {
    background-color: var(--color-dark);
    margin: 0.1rem 0.25rem 0.1rem 0;
}

.pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.6rem;
    padding: 0;
    line-height: 1;
}

.pill-remove:hover {
    background: rgba(255, 255, 255, 0.45);
}

.pill-input-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.3rem;
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.15);
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.pill-suggestion {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.85rem;
    color: var(--color-text);
}

.pill-suggestion:hover {
    background-color: var(--color-bg);
}

.pagination .page-link {
    color: var(--color-text);
}

.pagination .page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.pagination .page-link:hover {
    color: var(--color-primary);
}

/* ===== File explorer objektu ===== */
.file-dropzone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file-dropzone:hover,
.file-dropzone.is-dragover {
    border-color: var(--color-primary);
    background-color: rgba(215, 67, 15, 0.04);
}

.file-dropzone.is-uploading {
    opacity: 0.6;
    pointer-events: none;
}

/* Klikateľná oblasť je natívny <label for="fileInput">, nie JS handler —
   .trigger('click') na vnorenom inpute by sa cez bublanie vracalo naspäť do
   handlera na tomto obale a nekonečne sa rekurzívne volalo. */
.file-dropzone-label {
    display: block;
    cursor: pointer;
    margin: 0;
}

.file-dropzone-visibility {
    margin-top: 0.75rem;
}

.file-dropzone-switch {
    margin-right: 0.5rem;
    vertical-align: middle;
}

.file-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.file-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.file-breadcrumb a {
    color: var(--color-text-muted);
}

.file-breadcrumb a:hover {
    color: var(--color-primary);
}

.file-breadcrumb .is-current {
    color: var(--color-text);
    font-weight: 600;
}

.file-breadcrumb-sep {
    color: var(--color-border);
}

.folder-card {
    cursor: pointer;
}

.folder-card .file-card-icon {
    color: var(--color-primary);
}

.folder-card:hover {
    border-color: var(--color-primary);
}

.file-card.is-encrypted {
    cursor: pointer;
}

.file-card.is-encrypted .file-card-icon {
    color: #b45309;
}

.file-card.is-encrypted:hover {
    border-color: #b45309;
}

.file-encrypt-badge {
    background-color: #b45309;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}

.file-card {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.75rem;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}

.file-card-preview {
    display: block;
    width: 100%;
}

.file-card-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    background-color: var(--color-bg);
}

.file-card-icon {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    background-color: var(--color-bg);
    border-radius: 6px;
}

.file-card-visibility-toggle {
    cursor: pointer;
}

.file-card-visibility-toggle:hover {
    filter: brightness(0.9);
}

.file-card-visibility-toggle:disabled {
    opacity: 0.6;
    cursor: default;
}

.file-card-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.file-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
}

.file-card-name:hover {
    color: var(--color-primary);
}

.file-card-record-link {
    color: var(--color-text-muted);
    text-decoration: none;
}

.file-card-record-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.file-card-delete {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 28px;
    height: 28px;
    background-color: #fff;
}

/* Prepnutie na zoznamový pohľad — rovnaké karty, len usporiadané do riadkov
   s náhľadom/ikonou naľavo namiesto mriežky. */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-list .file-card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 0.5rem 0.75rem;
    gap: 0.75rem;
}

.file-list .file-card-preview {
    width: auto;
    flex-shrink: 0;
}

.file-list .file-card-thumb,
.file-list .file-card-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.file-list .file-card-body {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 0.6rem;
    text-align: left;
}

.file-list .file-card-delete {
    position: static;
    margin-left: auto;
}

/* ===== Záznamy objektu ===== */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scoped len na stránku Záznamy (.records-page) — .panel je spoločná
   trieda pre panely na viacerých stránkach (Objekty, Používatelia,...),
   takže sa jej farba nemení globálne. */
.records-page .panel {
    background-color: #f2f2f2;
}

.record-item {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem;
    background-color: #fff;
    /* Odkaz na kotvu (z File explorera alebo z Časovej osi) nesmie skryť
       vrch karty pod sticky topbarom. */
    scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

.record-item:target {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(215, 67, 15, 0.15);
}

.record-item-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.record-item-body {
    white-space: pre-wrap;
    word-break: break-word;
}

/* HTML záznam (Quill.js) sa vykresľuje ako skutočné HTML (sanitizované pri
   uložení), nie ako predformátovaný text — pre-wrap by zalomenia z <p>
   zdvojil s vlastnými okrajmi elementov. */
.record-item-body.record-html-content {
    white-space: normal;
}

.record-item-body.record-html-content :last-child {
    margin-bottom: 0;
}

#recordHtmlEditor {
    min-height: 330px;
    background-color: #fff;
}

.record-item-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.record-file-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

.record-file-name {
    color: var(--color-text);
    text-decoration: none;
}

.record-file-name:hover {
    color: var(--color-primary);
}

.btn-record-file-visibility {
    border: 0;
}

.record-file-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

.record-credentials {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.credentials-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.credentials-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    min-width: 220px;
}

.credentials-value {
    font-size: 0.9rem;
    word-break: break-all;
}

.btn-icon-plain {
    border: 0;
    background: none;
    padding: 0.1rem 0.3rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.btn-icon-plain:hover {
    color: var(--color-primary);
}

.timeline {
    position: relative;
}

/* Časová os v Záznamoch je "sticky" — pri posúvaní zoznamu ostáva celá
   viditeľná pod topbarom. Panel nesmie byť vyšší ako okno; pri viac ako 6
   záznamoch sa os posúva vo vnútri (výšku 6 položiek dopočíta JS do
   --timeline-max-height, keďže položky nemajú pevnú výšku). Len od lg
   vyššie — pod tým je panel pod zoznamom a sticky by nedával zmysel. */
@media (min-width: 992px) {
    .timeline-panel {
        position: sticky;
        top: calc(var(--topbar-height) + 1rem);
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - var(--topbar-height) - 2rem);
    }

    .timeline-panel .timeline {
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        /* Bodky presahujú vľavo od čiary — bez odsadenia by ich overflow orezal. */
        padding-left: 0.3rem;
    }
}

.timeline-scrollable {
    max-height: var(--timeline-max-height, none);
    overflow-y: auto;
    overflow-x: hidden;
    padding-left: 0.3rem;
    padding-right: 0.5rem; /* miesto pre scrollbar */
}

.timeline-item {
    position: relative;
    display: block;
    padding: 0 0 1.1rem 1.1rem;
    margin-left: 0.3rem;
    border-left: 2px solid var(--color-border);
    text-decoration: none;
    color: inherit;
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--color-border);
}

.timeline-date {
    font-weight: 600;
    font-size: 0.85rem;
}

.timeline-type {
    display: inline-block;
    margin: 0.25rem 0;
    font-size: 0.7rem;
}

.timeline-author {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.timeline-item:hover .timeline-date {
    color: var(--color-primary);
}

/* ===== Dashboard objektu ===== */
/* Horný riadok v pomere 1/8 · 5/8 · 2/8 — Bootstrap grid má 12 stĺpcov,
   kde sa 1/8 nedá vyjadriť, preto vlastný CSS grid. */
.dashboard-top-row {
    display: grid;
    grid-template-columns: 1fr 5fr 2fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.dashboard-top-row > .panel {
    min-width: 0;
}

.dashboard-photo-panel {
    padding: 0.5rem;
}

.dashboard-photo {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: zoom-in;
}

.dashboard-photo-more-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.2rem 0;
    border: 0;
    background: none;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.dashboard-photo-more-toggle:hover {
    color: var(--color-primary);
}

.dashboard-photo-more-toggle i {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.dashboard-photo-more-toggle:not(.collapsed) i {
    transform: rotate(180deg);
}

.dashboard-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.dashboard-photo-grid .dashboard-photo {
    border-radius: 6px;
}

.dashboard-photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    text-decoration: none;
    text-align: center;
}

.dashboard-photo-empty:hover {
    color: var(--color-primary);
}

/* "Atribút: (tabulátor) hodnota" — prvý stĺpec sa prispôsobí najdlhšiemu
   popisku, hodnoty tak začínajú pod sebou. */
/* Základné údaje v dvoch stĺpcoch — prvá polovica atribútov vľavo, druhá vpravo. */
.dashboard-attributes-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
    row-gap: 0.45rem;
}

.dashboard-attributes {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 2rem;
    row-gap: 0.45rem;
    margin: 0;
    font-size: 0.9rem;
}

.dashboard-attributes dt {
    font-weight: 700;
    color: var(--color-text);
}

.dashboard-attributes dd {
    margin: 0;
    word-break: break-word;
}

.dashboard-attributes dd .badge {
    margin-right: 0.25rem;
}

/* Stĺpec je úzky, preto popisok nad hodnotou (nie vedľa, ako v Záznamoch). */
.dashboard-credentials {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dashboard-credentials .credentials-label {
    min-width: 0;
    font-size: 0.8rem;
}

.dashboard-credentials-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 1.25rem 0.75rem;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    background: none;
    color: var(--color-text);
    text-align: center;
    cursor: pointer;
}

.dashboard-credentials-locked:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Druhý riadok v pomere 7/12 · 5/12 — CSS grid (nie Bootstrap row), aby
   medzera medzi stĺpcami sedela s horným riadkom. */
.dashboard-second-row {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 1.5rem;
    align-items: start;
}

.dashboard-second-row > * {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .dashboard-second-row {
        grid-template-columns: 1fr;
    }
}

/* Vložený File explorer (Dashboard) — menšie karty a náhľady ako v modale,
   aby sa náhľad pri širšom stĺpci nezväčšoval spolu s ním. */
.file-explorer-inline .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 120px));
    gap: 0.6rem;
}

.file-explorer-inline .file-grid .file-card {
    padding: 0.5rem;
}

.file-explorer-inline .file-grid .file-card-thumb,
.file-explorer-inline .file-grid .file-card-icon {
    height: 64px;
}

.file-explorer-inline .file-grid .file-card-icon {
    font-size: 1.6rem;
}

.file-explorer-inline .file-card-name {
    font-size: 0.8rem;
}

/* Posledné záznamy — hlavička je tlačidlo (Bootstrap collapse), detail sa
   rozbalí pod ňou. */
.dashboard-records {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-record + .dashboard-record {
    border-top: 1px solid var(--color-border);
}

.dashboard-record-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 0;
    background: none;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.dashboard-record-header:hover,
.dashboard-record-header:not(.collapsed) {
    background-color: #f8f8f8;
}

.dashboard-record-date {
    font-weight: 600;
    font-size: 0.85rem;
}

.dashboard-record-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}

.dashboard-record-header:not(.collapsed) .dashboard-record-chevron {
    transform: rotate(180deg);
}

.dashboard-record-detail {
    padding: 0.25rem 0.85rem 0.85rem;
    font-size: 0.9rem;
    background-color: #f8f8f8;
}

.dashboard-record-detail .record-credentials .credentials-label {
    min-width: 0;
}

@media (max-width: 1199.98px) {
    .dashboard-top-row {
        grid-template-columns: 1fr 3fr;
    }

    .dashboard-top-row > .panel:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767.98px) {
    .dashboard-top-row {
        grid-template-columns: 1fr;
    }

    .dashboard-photo-panel {
        max-width: 240px;
    }

    .dashboard-attributes-columns,
    .dashboard-attributes {
        grid-template-columns: 1fr;
    }

    .dashboard-attributes dd {
        margin-bottom: 0.4rem;
    }
}

/* ===== Lightbox obrázkov ===== */
/* Obrázok sa zobrazí v pôvodnej veľkosti; len ak presahuje obrazovku, zmenší
   sa (so zachovaným pomerom) tak, aby narazil na šírku alebo výšku — podľa
   toho, čo nastane skôr. Malé obrázky sa nezväčšujú, dialóg sa prispôsobí
   veľkosti obrázka. --lightbox-chrome = hlavička modalu + odsadenie tela. */
.image-lightbox {
    --lightbox-margin: 1rem;
    --lightbox-chrome: 5rem;
}

.image-lightbox .modal-dialog {
    width: fit-content;
    max-width: calc(100vw - 2 * var(--lightbox-margin));
    min-height: calc(100% - 2 * var(--lightbox-margin));
    margin: var(--lightbox-margin) auto;
}

.image-lightbox .modal-content {
    min-width: 280px;
}

.image-lightbox .modal-body {
    padding: 0.5rem;
    text-align: center;
}

.image-lightbox .modal-body img {
    max-width: 100%;
    max-height: calc(100vh - 2 * var(--lightbox-margin) - var(--lightbox-chrome));
    max-height: calc(100dvh - 2 * var(--lightbox-margin) - var(--lightbox-chrome));
    width: auto;
    height: auto;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-wrapper {
        margin-left: 0;
    }

    .user-name {
        display: none;
    }
}
