:root {
    --bg: #0B0B0F;
    --card: #16161C;
    --card-hover: #1E1E28;
    --accent: #7C6CFF;
    --accent2: #9D91FF;
    --text: #E8E8F0;
    --muted: #8888A0;
    --border: #2A2A3A;
    --danger: #FF4444;
    --success: #44CC88;
    --warning: #FFB444;
    --stat-red: #FF3333;
    --rush-orange: #FF8844;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ──────────────────────────────── TOPNAV ──────────────────────────────── */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(11, 11, 15, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    z-index: 100;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-links a {
    color: var(--muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    position: relative;
}

.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links a.active { color: var(--text); }

/* ──────────────────────────────── ROLE SWITCHER ──────────────────────────────── */
.role-switcher {
    position: relative;
    margin-left: auto;
}

.current-user {
    background: rgba(124, 108, 255, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent2);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 220px;
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    z-index: 200;
}

.dropdown.open { display: block; }

.dropdown form { margin: 0; }

.dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    transition: background 0.15s;
}

.dropdown button:hover { background: rgba(255,255,255,0.06); }
.dropdown .logout-btn { color: var(--danger); }

/* ──────────────────────────────── MAIN ──────────────────────────────── */
main {
    margin-top: 56px;
    padding: 24px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ──────────────────────────────── GENERIC CARD ──────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.card:hover {
    border-color: rgba(124, 108, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* ──────────────────────────────── CASE GRID CARDS ──────────────────────────────── */
.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.case-card {
    display: flex;
    flex-direction: column;
    height: 320px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.case-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(124,108,255,0.15);
    color: inherit;
}

/* STAT card — visually dominant, sorted first */
.case-card--stat {
    border-color: rgba(255,68,68,0.4);
    border-left: 3px solid var(--danger);
    background: linear-gradient(160deg, rgba(255,68,68,0.06) 0%, var(--card) 55%);
}
.case-card--stat:hover {
    border-color: var(--danger);
    box-shadow: 0 12px 40px rgba(255,68,68,0.18);
}

/* RUSH card — elevated but not screaming */
.case-card--rush {
    border-left: 3px solid var(--rush-orange);
}

/* Compact card — no image, auto height */
.case-card--compact {
    height: auto;
    min-height: 0;
}

/* Inline badge (compact cards with no media zone) */
.card-badge--inline {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    align-self: flex-start;
    margin-bottom: 2px;
}

/* Media zone — 170px, edge-to-edge */
.case-card__media {
    position: relative;
    height: 170px;
    flex-shrink: 0;
    background: #0B0B0F;
    overflow: hidden;
}

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

.case-card__media img.xray {
    object-fit: contain;
    background: #0B0B0F;
}

.media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--border);
}

.media-placeholder span {
    font-size: 11px;
    color: var(--border);
}

.media-placeholder--stat {
    background: rgba(255,68,68,0.08);
    color: rgba(255,68,68,0.4);
}

.media-count {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    backdrop-filter: blur(4px);
}

.media-label {
    position: absolute;
    bottom: 8px;
    left: 10px;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Overlay badges on image */
.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.badge-stat    { background: var(--stat-red); color: #fff; animation: pulse-red 2s infinite; }
.badge-rush    { background: var(--rush-orange); color: #fff; }
.badge-new   { background: var(--accent); color: #fff; }
.badge-replied { background: rgba(68,204,136,0.9); color: #fff; }

/* Card body */
.case-card__body {
    flex: 1;
    padding: 12px 14px 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.case-card__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
}

.case-card__meta {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.case-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.specialty-chip {
    background: rgba(124,108,255,0.1);
    color: var(--muted);
    border: 1px solid rgba(124,108,255,0.2);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 11px;
}

.tag-pill {
    background: rgba(124, 108, 255, 0.15);
    color: var(--accent2);
    border: 1px solid rgba(124, 108, 255, 0.3);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

/* Footer row */
.case-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.footer-left, .footer-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.footer-date { font-size: 11px; color: var(--muted); }

.price { font-size: 12px; color: var(--muted); font-weight: 500; }
.date  { font-size: 11px; color: var(--muted); }

/* Footer status label — one muted text signal, no rainbow */
.footer-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.footer-status--warn  { color: #C8A44A; }
.footer-status--alert { color: var(--danger); }

.footer-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Author row */
.case-card__author {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.04);
    flex-shrink: 0;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #9D91FF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.author-name {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ──────────────────────────────── QUICK FILTERS ──────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.quick-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.qf {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.qf:hover      { color: var(--text); border-color: rgba(124,108,255,0.5); }
.qf--active    { color: var(--accent2); border-color: var(--accent); background: rgba(124,108,255,0.1); }
.qf--urgent    { border-color: rgba(255,68,68,0.3); color: #e07070; }
.qf--urgent.qf--active { background: rgba(255,68,68,0.1); border-color: var(--danger); color: var(--danger); }

/* keep old .card-footer for detail page */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
}

/* ──────────────────────────────── STATUS BADGES ──────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-awaiting { background: rgba(255, 180, 68, 0.15); color: var(--warning); border: 1px solid rgba(255,180,68,0.3); }
.status-needsfiles { background: rgba(255, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(255,68,68,0.3); }
.status-replied { background: rgba(68, 204, 136, 0.15); color: var(--success); border: 1px solid rgba(68,204,136,0.3); }
.status-closed { background: rgba(136, 136, 160, 0.15); color: var(--muted); border: 1px solid rgba(136,136,160,0.3); }

.urgency-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.urgency-stat { background: rgba(255, 51, 51, 0.2); color: var(--stat-red); border: 1px solid var(--stat-red); animation: pulse-red 2s infinite; }
.urgency-rush { background: rgba(255, 136, 68, 0.15); color: var(--rush-orange); border: 1px solid rgba(255,136,68,0.3); }
.urgency-standard { background: rgba(68, 204, 136, 0.1); color: var(--success); border: 1px solid rgba(68,204,136,0.2); }

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
}

/* ──────────────────────────────── BUTTONS ──────────────────────────────── */
.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}

.btn-accent:hover { background: var(--accent2); color: white; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    color: var(--accent2);
    border: 1px solid var(--accent);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-outline:hover { background: rgba(124, 108, 255, 0.1); color: var(--accent2); }

.btn-danger {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-danger:hover { background: rgba(255, 68, 68, 0.25); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ──────────────────────────────── FORMS ──────────────────────────────── */
.form-group { margin-bottom: 20px; }

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.12);
}

textarea { resize: vertical; min-height: 100px; }

select option { background: #1E1E28; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ──────────────────────────────── PAGE HEADER ──────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

/* ──────────────────────────────── TABS ──────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
    font-size: 14px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ──────────────────────────────── SEARCH ──────────────────────────────── */
.search-input {
    width: 100%;
    max-width: 420px;
}

/* ──────────────────────────────── CASE WORKSPACE ──────────────────────────────── */
.workspace {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
}

.viewer-pane {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.sidebar-pane {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 480px;
}

.main-viewer {
    flex: 1;
    background: #050508;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.main-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease;
    will-change: transform;
    user-select: none;
}

.thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
}

.thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    background: #0D0D14;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .pdf-icon { font-size: 24px; }

/* ──────────────────────────────── ANNOTATION TOOLBAR ──────────────────────────────── */
.annotation-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(22, 22, 28, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.ann-tool {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
}

.ann-tool:hover, .ann-tool.active { background: rgba(124,108,255,0.2); color: var(--accent2); }

/* ──────────────────────────────── SIDEBAR TABS ──────────────────────────────── */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.sidebar-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-panel { display: none; }
.sidebar-panel.active { display: block; }

/* ──────────────────────────────── COMMENTS ──────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 16px; }

.comment {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

.comment-avatar.specialist { background: #2A5CE8; }

.comment-body { flex: 1; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author { font-weight: 600; font-size: 13px; }
.comment-time { font-size: 11px; color: var(--muted); }

.comment-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.comment-form {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-form textarea {
    min-height: 80px;
}

/* ──────────────────────────────── CONCLUSION PANEL ──────────────────────────────── */
.conclusion-box {
    background: rgba(68, 204, 136, 0.06);
    border: 1px solid rgba(68, 204, 136, 0.25);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.conclusion-box h4 {
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.conclusion-box p {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}

/* ──────────────────────────────── PRIVATE BANNER ──────────────────────────────── */
.private-banner {
    background: rgba(255, 180, 68, 0.1);
    border: 1px solid rgba(255, 180, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--warning);
    margin-bottom: 20px;
}

/* ──────────────────────────────── PRESENCE INDICATOR ──────────────────────────────── */
.presence-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(68, 204, 136, 0.08);
    border: 1px solid rgba(68, 204, 136, 0.2);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--success);
    margin-bottom: 12px;
}

.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

/* ──────────────────────────────── INBOX ──────────────────────────────── */
.inbox-list { display: flex; flex-direction: column; gap: 12px; }

.inbox-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.1s;
}

.inbox-item:hover {
    border-color: rgba(124,108,255,0.4);
    transform: translateX(4px);
    color: var(--text);
}

.inbox-item.stat-urgency {
    border-color: rgba(255, 51, 51, 0.4);
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.1);
}

.inbox-item.unread { background: rgba(124, 108, 255, 0.05); }

.inbox-item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: #0D0D14;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.inbox-item-icon img { width: 100%; height: 100%; object-fit: cover; }

.inbox-item-body { flex: 1; min-width: 0; }

.inbox-item-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-item-meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.inbox-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* ──────────────────────────────── NOTIFICATIONS PAGE ──────────────────────────────── */
.notif-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: border-color 0.15s;
}

.notif-item.unread {
    border-left: 3px solid var(--accent);
}

.notif-icon { font-size: 20px; }
.notif-body { flex: 1; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-time { font-size: 12px; color: var(--muted); }

/* ──────────────────────────────── MODAL ──────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.invoice-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.invoice-line.total {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent2);
    border-bottom: none;
    padding-top: 16px;
}

/* ──────────────────────────────── LOGIN PAGE ──────────────────────────────── */
.login-wrap {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }

/* ──────────────────────────────── ALERT ──────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error { background: rgba(255,68,68,0.1); border: 1px solid rgba(255,68,68,0.3); color: var(--danger); }
.alert-success { background: rgba(68,204,136,0.1); border: 1px solid rgba(68,204,136,0.3); color: var(--success); }
.alert-info { background: rgba(124,108,255,0.1); border: 1px solid rgba(124,108,255,0.3); color: var(--accent2); }

/* ──────────────────────────────── NEW CASE FORM ──────────────────────────────── */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--accent2);
}

.urgency-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.urgency-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}

.urgency-card:hover { border-color: var(--accent); }
.urgency-card.selected { border-color: var(--accent); background: rgba(124,108,255,0.1); }
.urgency-card input[type="radio"] { display: none; }
.urgency-card-label { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.urgency-card-desc { font-size: 12px; color: var(--muted); }
.urgency-card-price { font-size: 20px; font-weight: 700; color: var(--accent2); margin-top: 8px; }

/* ──────────────────────────────── SPECIALIST PICKER ──────────────────────────── */
.specialist-grid { display: flex; flex-direction: column; gap: 10px; }

.specialist-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}
.specialist-card:hover { border-color: var(--accent); background: var(--card-hover); }
.specialist-card.selected { border-color: var(--accent); background: rgba(124,108,255,0.08); }

.specialist-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(124,108,255,0.2);
    color: var(--accent2);
    font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.specialist-info { flex: 1; min-width: 0; }
.specialist-name { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.specialist-clinic { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.specialist-bio { font-size: 12px; color: var(--muted); line-height: 1.5; }
.specialist-stat {
    font-size: 11px; font-weight: 600; color: var(--accent2);
    background: rgba(124,108,255,0.12);
    padding: 3px 10px; border-radius: 20px;
    white-space: nowrap; flex-shrink: 0; align-self: center;
}
.specialist-check {
    position: absolute; top: 10px; right: 12px;
    font-size: 14px; color: var(--accent);
    opacity: 0; transition: opacity 0.15s;
}
.specialist-card.selected .specialist-check { opacity: 1; }
.specialist-none { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* ──────────────────────────────── FILE UPLOAD ──────────────────────────────── */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: rgba(124,108,255,0.05);
}

.file-upload-area input { display: none; }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-text { color: var(--muted); font-size: 14px; }

/* ──────────────────────────────── DETAIL UPLOAD ──────────────────────────────── */
.detail-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 28px 20px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.detail-upload-zone:hover,
.detail-upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(124,108,255,0.06);
}
.detail-upload-zone .duz-icon { font-size: 36px; margin-bottom: 8px; }
.detail-upload-zone .duz-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.detail-upload-zone .duz-sub { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.btn-choose-files {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(124,108,255,0.12);
    color: var(--accent);
    border: 1px solid rgba(124,108,255,0.3);
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
}
.btn-choose-files:hover {
    background: rgba(124,108,255,0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.btn-choose-files:active { transform: translateY(0); }
.upload-file-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}
.upload-file-row .ufr-icon { font-size: 20px; flex-shrink: 0; }
.upload-file-row .ufr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.upload-file-row .ufr-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.btn-upload-submit {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none; border-radius: 10px;
    padding: 11px 16px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.btn-upload-submit:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-upload-submit:active { transform: translateY(0); }
.btn-upload-submit:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ──────────────────────────────── COLLECTIONS ──────────────────────────────── */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.collection-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.collection-card:hover {
    border-color: rgba(124,108,255,0.4);
    transform: translateY(-2px);
}

.collection-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.collection-count { font-size: 13px; color: var(--muted); }

/* ──────────────────────────────── EMPTY STATE ──────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
}

.empty-state-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; }

/* ──────────────────────────────── SPECIALTY ICONS ──────────────────────────────── */
.specialty-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

/* ──────────────────────────────── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ──────────────────────────────── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
    main { padding: 16px; }

    .workspace {
        flex-direction: column;
        height: auto;
    }

    .sidebar-pane { max-width: 100%; }

    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .urgency-cards { grid-template-columns: 1fr; }
    .case-grid { grid-template-columns: 1fr; }

    .topnav { padding: 0 16px; gap: 12px; }
    .nav-links { display: none; }

    .filters-bar { flex-direction: column; align-items: stretch; }
    .search-input { max-width: 100%; }
}

