.tcf-app {
    --tcf-red: #c41a1a;
    --tcf-red-dark: #a01515;
    --tcf-ink: #1a1610;
    --tcf-muted: #6b6560;
    --tcf-soft: #f7f6f4;
    --tcf-line: #e8e5e0;
    --tcf-gold: #9b722d;
    color: var(--tcf-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tcf-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--tcf-line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(26, 22, 16, .08);
}

.tcf-topbar,
.tcf-section-head,
.tcf-actions,
.tcf-layout {
    display: flex;
    align-items: center;
}

.tcf-topbar {
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--tcf-line);
}

.tcf-kicker {
    margin: 0 0 4px;
    color: var(--tcf-red);
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 800;
}

.tcf-topbar h2,
.tcf-section-head h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.tcf-topbar h2 {
    font-size: 30px;
    line-height: 1.2;
}

.tcf-section-head {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.tcf-section-head h3 {
    font-size: 22px;
}

.tcf-primary,
.tcf-secondary,
.tcf-side button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.tcf-primary {
    background: var(--tcf-red);
    color: #ffffff;
}

.tcf-primary:hover {
    background: var(--tcf-red-dark);
    color: #ffffff;
}

.tcf-secondary,
.tcf-side button {
    background: #ffffff;
    color: var(--tcf-ink);
    border-color: var(--tcf-line);
}

.tcf-secondary:hover,
.tcf-side button:hover {
    background: #fbfaf8;
    color: var(--tcf-ink);
    border-color: #d1cdc7;
}

.tcf-status {
    margin: 18px 0;
}

.tcf-banner,
.tcf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.tcf-field {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--tcf-line);
    border-radius: 8px;
    background: var(--tcf-soft);
}

.tcf-field span {
    display: block;
    color: var(--tcf-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tcf-field strong {
    display: block;
    margin-top: 5px;
    color: var(--tcf-ink);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.tcf-layout {
    align-items: flex-start;
    gap: 16px;
}

.tcf-side {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 8px;
    width: 210px;
    flex: 0 0 210px;
}

.tcf-side button {
    justify-content: flex-start;
    text-align: left;
    line-height: 1;
}

.tcf-side button.active {
    background: var(--tcf-ink);
    color: #ffffff;
    border-color: var(--tcf-ink);
}

.tcf-main {
    flex: 1;
    min-width: 0;
}

.tcf-panel {
    display: none;
}

.tcf-panel.active {
    display: block;
}

.tcf-card,
.tcf-empty,
.tcf-loading,
.tcf-locked {
    padding: 16px;
    border: 1px solid var(--tcf-line);
    border-radius: 8px;
    background: #ffffff;
}

.tcf-card {
    margin-top: 12px;
}

.tcf-card h4 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.3;
}

.tcf-card p,
.tcf-card li,
.tcf-meta {
    color: var(--tcf-muted);
    font-size: 13px;
    line-height: 1.55;
}

.tcf-list {
    display: grid;
    gap: 10px;
}

.tcf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tcf-tags span,
.tcf-pill,
.tcf-warning {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 9px;
    background: var(--tcf-soft);
    border: 1px solid var(--tcf-line);
    color: var(--tcf-muted);
    font-size: 12px;
    font-weight: 750;
}

.tcf-pill {
    color: #784500;
    background: #fff7e6;
    border-color: #f0d29a;
}

.tcf-warning {
    margin-top: 8px;
    color: var(--tcf-red-dark);
    background: #fff1f1;
    border-color: #f1c6c6;
}

.tcf-step {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--tcf-ink);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.tcf-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tcf-card textarea,
#tcf-json-import {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--tcf-line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--tcf-ink);
    padding: 11px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: none;
}

#tcf-json-import {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tcf-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tcf-muted);
    font-size: 13px;
    font-weight: 750;
}

.tcf-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99999;
    max-width: 360px;
    padding: 13px 15px;
    border-radius: 8px;
    background: var(--tcf-ink);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(26, 22, 16, .22);
    font-size: 14px;
}

.tcf-settings-box {
    max-width: 1180px;
    margin: 12px auto 18px;
    padding: 14px;
    border: 1px solid var(--tcf-line, #e8e5e0);
    border-radius: 8px;
    background: #ffffff;
}

.tcf-settings-box form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tcf-settings-box label {
    font-weight: 700;
}

.tcf-admin-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tcf-busy {
    opacity: .72;
    pointer-events: none;
}

@media (max-width: 760px) {
    .tcf-shell {
        padding: 16px;
    }

    .tcf-topbar,
    .tcf-section-head,
    .tcf-layout {
        align-items: stretch;
        flex-direction: column;
    }

    .tcf-topbar h2 {
        font-size: 25px;
    }

    .tcf-side {
        position: static;
        width: 100%;
        flex-basis: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── List view ────────────────────────────────────────────────────────────── */
.tcf-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.tcf-list-card {
    background: var(--tcf-soft);
    border: 1px solid var(--tcf-line);
    border-radius: 7px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.tcf-list-card:hover {
    border-color: var(--tcf-gold);
    box-shadow: 0 4px 12px rgba(26,22,16,.08);
    transform: translateY(-1px);
}

.tcf-list-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tcf-list-card-header strong {
    font-size: 14px;
    font-weight: 700;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tcf-list-card-meta {
    margin: 0 0 4px;
    font-size: 12px;
    color: var(--tcf-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tcf-list-card-date {
    margin: 0;
    font-size: 11px;
    color: var(--tcf-muted);
}

/* ── Pill variants ────────────────────────────────────────────────────────── */
.tcf-pill--active {
    background: #fef3e2;
    color: var(--tcf-gold);
    border-color: #f5dfa0;
}

/* ── Highlight animation on casefile load ─────────────────────────────────── */
@keyframes tcf-highlight-pulse {
    0%   { box-shadow: 0 10px 28px rgba(26,22,16,.08); }
    30%  { box-shadow: 0 0 0 4px rgba(155,114,45,.25), 0 10px 28px rgba(26,22,16,.08); }
    100% { box-shadow: 0 10px 28px rgba(26,22,16,.08); }
}

.tcf-shell.tcf-highlight {
    animation: tcf-highlight-pulse .8s ease forwards;
}

/* ── Autosave indicator ───────────────────────────────────────────────────── */
.tcf-note-actions {
    align-items: center;
    gap: 10px;
}

.tcf-autosave-label {
    font-size: 12px;
    color: var(--tcf-muted);
    font-style: italic;
    transition: opacity .3s ease;
}

/* ── History tab (versions + activity) ───────────────────────────────────── */
.tcf-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

.tcf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tcf-table th {
    text-align: left;
    padding: 7px 10px;
    background: var(--tcf-soft);
    border-bottom: 1px solid var(--tcf-line);
    font-weight: 700;
    color: var(--tcf-muted);
    white-space: nowrap;
}

.tcf-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--tcf-line);
    vertical-align: top;
    line-height: 1.4;
}

.tcf-table tr:last-child td {
    border-bottom: none;
}

/* ── Sidebar divider + demoted import tab ────────────────────────────────── */
.tcf-side-divider {
    border: none;
    border-top: 1px solid var(--tcf-line);
    margin: 8px 0;
}

.tcf-side-import {
    color: var(--tcf-muted);
    font-size: 12px;
    font-weight: 600;
}

.tcf-side-import.active,
.tcf-side-import:hover {
    color: var(--tcf-ink);
}

/* ── Toast error variant ─────────────────────────────────────────────────── */
.tcf-toast--error {
    background: var(--tcf-red) !important;
}

/* ── Topbar back button ───────────────────────────────────────────────────── */
.tcf-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Restaurare versiune ──────────────────────────────────────────────────── */
.tcf-btn-restore {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    color: var(--tcf-muted);
    background: var(--tcf-soft);
    border: 1px solid var(--tcf-line);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}

.tcf-btn-restore:hover {
    background: #fff7e6;
    color: #784500;
    border-color: #f0d29a;
}

.tcf-td-date {
    white-space: nowrap;
    color: var(--tcf-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tcf-td-action {
    text-align: right;
    white-space: nowrap;
}

.tcf-card-note {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--tcf-muted);
    line-height: 1.5;
}

.tcf-label-small {
    display: block;
    font-size: 12px;
    color: var(--tcf-muted);
    margin-bottom: 8px;
}
