/* ============================================================
   ELISOL ERP — DESIGN SYSTEM
   Dark glassmorphism theme. Hand-written (no Tailwind runtime)
   for fast, dependency-free loads.
   ============================================================ */

:root {
    /* Elisol brand palette — the official favicon/logo color (orange)
       is the real brand accent, used throughout the UI; the indigo
       scale from the old tailwind.config.js is kept only as a named
       reference, not the primary theme color. */
    --brand: #FF5638;
    --brand-600: #E8451F;
    --brand-700: #C93A18;
    --brand-soft: rgba(255, 86, 56, 0.15);

    --bg: #0f172a;
    --bg-2: #0b1220;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-solid: #1e293b;
    --panel-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text: #eef0f8;
    --text-dim: #9aa1b8;
    --text-faint: #656d87;

    --accent: var(--brand);
    --accent-2: #22d3ee;
    --accent-soft: var(--brand-soft);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.15);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.15);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);

    --sidebar-w: 248px;
    --topbar-h: 66px;
    --transition: 160ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(255, 86, 56, 0.12), transparent),
        radial-gradient(1000px 500px at 100% 0%, rgba(34, 211, 238, 0.08), transparent),
        var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', ui-sans-serif, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
#root { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------------- Layout shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform var(--transition);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--panel-hover);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    padding: 6px;
}
.logo-mark svg { width: 100%; height: 100%; }
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text strong { font-size: 15px; display: block; }
.sidebar-brand .brand-text span { font-size: 11px; color: var(--text-dim); }

.nav-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section-label {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    color: var(--text-faint); text-transform: uppercase;
    padding: 14px 10px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-dim); font-size: 13.5px; font-weight: 500;
    cursor: pointer; transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--panel-hover); color: var(--text); }
.nav-item.active {
    background: var(--accent-soft); color: #ffd0c2;
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item .badge-pill { margin-left: auto; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }

.main-area { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 14, 23, 0.75);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .page-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }

.page { padding: 22px; max-width: 1400px; }

/* ---------------- DB status badge ---------------- */
.db-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 600;
    padding: 6px 10px; border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
}
.db-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.db-badge.online .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.db-badge.online { color: #8ff5cf; }
.db-badge.offline .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.db-badge.offline { color: #ffb4c0; }

/* ---------------- Cards / Panels ---------------- */
.card, .glass-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
}
.card { padding: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14.5px; font-weight: 700; }
.card-subtitle { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat-tile {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; gap: 8px;
    transition: transform var(--transition), border-color var(--transition);
}
.stat-tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-tile .stat-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
}
.stat-tile .stat-icon svg { width: 20px; height: 20px; }
.stat-tile .stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat-tile .stat-label { font-size: 12px; color: var(--text-dim); }
.stat-tile .stat-trend { font-size: 11.5px; font-weight: 600; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all var(--transition);
    white-space: nowrap; user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--brand-600)); color: #fff; box-shadow: 0 4px 14px rgba(255,86,56,0.35); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn-secondary { background: var(--panel-hover); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-hover); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: #ffb4c0; border-color: rgba(251,113,133,0.3); }
.btn-danger:hover:not(:disabled) { background: rgba(251,113,133,0.25); }
.btn-success { background: var(--success-soft); color: #8ff5cf; border-color: rgba(52,211,153,0.3); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 12px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }
.form-hint { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
    text-align: left; padding: 12px 14px; font-size: 11px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint);
    background: var(--bg-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--panel-hover); }
.data-table .cell-muted { color: var(--text-dim); }

/* ---------------- Badges / Pills ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
    letter-spacing: .01em; white-space: nowrap;
}
.badge-pill { padding: 2px 8px; font-size: 10.5px; border-radius: 999px; }
.badge-success { background: var(--success-soft); color: #8ff5cf; }
.badge-warning { background: var(--warning-soft); color: #ffdd9c; }
.badge-danger { background: var(--danger-soft); color: #ffb4c0; }
.badge-info { background: var(--accent-soft); color: #ffd0c2; }
.badge-neutral { background: var(--panel-hover); color: var(--text-dim); }

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #0b0e17; flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar-status-dot { position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-2); }

.progress-bar { height: 7px; border-radius: 999px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--border); }
.progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 300ms ease; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-item {
    padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-dim);
    cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--text); border-color: var(--accent); }

/* ---------------- Kanban ---------------- */
.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-column { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.kanban-column.drag-over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.kanban-col-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-dim); }
.kanban-card {
    background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px; margin-bottom: 10px; cursor: grab; transition: transform var(--transition), border-color var(--transition);
}
.kanban-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card .task-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.kanban-card .task-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* ---------------- Modal ---------------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(5, 6, 12, 0.65); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
    animation: fadeIn 150ms ease;
}
.modal {
    background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    animation: slideUp 200ms cubic-bezier(.16,1,.3,1);
}
.modal.modal-lg { max-width: 860px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel-solid); z-index: 1; }
.modal-title { font-size: 15.5px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------- Toasts / Notifications ---------------- */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
    background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow-sm); animation: slideIn 200ms ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast strong { font-size: 13px; display: block; margin-bottom: 2px; }
.toast p { margin: 0; font-size: 12px; color: var(--text-dim); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.broadcast-banner {
    position: relative; z-index: 200;
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    animation: slideDownBanner 220ms ease;
}
@keyframes slideDownBanner { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.broadcast-banner.broadcast-info { background: linear-gradient(90deg, var(--brand), var(--brand-600)); }
.broadcast-banner.broadcast-warning { background: linear-gradient(90deg, #d97706, #b45309); }
.broadcast-banner.broadcast-urgent { background: linear-gradient(90deg, #dc2626, #991b1b); }
.broadcast-banner .broadcast-msg { flex: 1; font-size: 13.5px; line-height: 1.4; }
.broadcast-banner .broadcast-more { font-size: 11.5px; opacity: 0.85; white-space: nowrap; }
.broadcast-banner .broadcast-close {
    background: rgba(255,255,255,0.18); border: none; color: #fff; border-radius: 8px;
    width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.broadcast-banner .broadcast-close:hover { background: rgba(255,255,255,0.3); }

.notif-drawer {
    position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 360px;
    background: var(--panel-solid); border-left: 1px solid var(--border-strong); z-index: 90;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3); overflow-y: auto; animation: slideInPanel 180ms ease;
}
@keyframes slideInPanel { from { transform: translateX(100%); } to { transform: none; } }
.notif-item { padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--panel-hover); }
.notif-item.unread { background: rgba(255,86,56,0.08); }
.notif-item .notif-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.notif-item .notif-msg { font-size: 12px; color: var(--text-dim); }
.notif-item .notif-time { font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* ---------------- Login page ---------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; }
.login-logo .logo-mark { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; }
.login-logo h1 { font-size: 18px; margin: 0; }
.login-logo p { font-size: 12.5px; color: var(--text-dim); margin: 0; }
.login-demo-hint { margin-top: 18px; padding: 12px; border-radius: var(--radius-sm); background: var(--panel-hover); font-size: 11.5px; color: var(--text-dim); line-height: 1.6; }

/* ---------------- Monitoring / live view ---------------- */
.live-frame-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.live-frame-wrap img { width: 100%; height: 100%; object-fit: contain; }
.live-frame-wrap .live-indicator { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.55); padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.live-indicator .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.activity-meter { display: flex; align-items: center; gap: 8px; }
.activity-meter .meter-track { flex: 1; height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.activity-meter .meter-fill { height: 100%; border-radius: 999px; }

.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.screenshot-thumb { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); cursor: pointer; background: var(--bg-2); aspect-ratio: 16/10; transition: border-color var(--transition); }
.screenshot-thumb:hover { border-color: var(--border-strong); }
.screenshot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.screenshot-thumb .thumb-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-size: 10px; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,0.75), transparent); }
.thumb-activity-row { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.thumb-activity-pill {
    display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 999px;
    font-size: 10px; font-weight: 700; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}

/* ---------------- Team chat ---------------- */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: calc(100vh - 190px); min-height: 420px; }
.chat-people { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.chat-people-header { padding: 14px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-faint); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel-solid); }
.chat-person { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.chat-person:hover { background: var(--panel-hover); }
.chat-person.active { background: var(--accent-soft); }
.chat-person-info { flex: 1; min-width: 0; }
.chat-person-name { font-size: 13px; font-weight: 600; }
.chat-person-preview { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.chat-status-label { font-size: 10px; font-weight: 600; }
.chat-thread { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-thread-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; flex-shrink: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }
.chat-bubble-row.theirs { justify-content: flex-start; }
.chat-bubble { max-width: 72%; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--panel-hover); }
.chat-bubble-row.mine .chat-bubble { background: linear-gradient(135deg, var(--accent), var(--brand-600)); color: #fff; }
.chat-bubble-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.chat-bubble-meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; opacity: .8; margin-top: 4px; justify-content: flex-end; }
.chat-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-input-row .form-input { flex: 1; }
.chat-back-btn { display: none; }
@media (max-width: 768px) {
    .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 220px); }
    .chat-layout[data-active="true"] .chat-people { display: none; }
    .chat-layout[data-active="false"] .chat-thread { display: none; }
    .chat-back-btn { display: inline-flex !important; }
}

/* ---------------- Task collaboration: comments & attachments ---------------- */
.collab-section { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; }
.collab-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.collab-tab { padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); background: var(--panel-hover); cursor: pointer; border: 1px solid transparent; }
.collab-tab.active { color: #fff; background: var(--accent); }

.comment-thread { display: flex; flex-direction: column; gap: 14px; }
.comment-item { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-bubble { background: var(--panel-hover); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.comment-bubble .comment-author { font-size: 12.5px; font-weight: 700; }
.comment-bubble .comment-text { font-size: 13px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.comment-meta { display: flex; align-items: center; gap: 14px; margin-top: 6px; padding-left: 2px; }
.comment-meta-action { font-size: 11.5px; color: var(--text-faint); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.comment-meta-action:hover { color: var(--text-dim); }
.comment-meta-action.liked { color: var(--danger); }
.comment-replies { margin-top: 10px; margin-left: 20px; display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--border); padding-left: 14px; }
.comment-edit-textarea { width: 100%; min-height: 60px; }

.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel-hover); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.attachment-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-meta { font-size: 11px; color: var(--text-faint); }
.file-input-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.file-input-label input[type="file"] { display: none; }

/* ---------------- Misc ---------------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { margin: 4px 0 0; font-size: 13px; }

.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-page { display: flex; align-items: center; justify-content: center; min-height: 300px; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px;
    background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 6px; z-index: 60; animation: fadeIn 120ms ease;
}
.dropdown-item { padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 10px; color: var(--text-dim); }
.dropdown-item:hover { background: var(--panel-hover); color: var(--text); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .kanban-board { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .page { padding: 14px; }
    .notif-drawer { width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; }

    /* Data tables become stacked cards on narrow screens instead of
       squeezing/horizontal-scrolling — each <td> needs a data-label
       attribute matching its column header. */
    .table-wrap { overflow-x: visible; border: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table thead { display: none; }
    .data-table tr {
        margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius);
        overflow: hidden; background: var(--panel);
    }
    .data-table tbody td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: right;
    }
    .data-table tbody tr:last-child td:last-child,
    .data-table tbody td:last-child { border-bottom: none; }
    .data-table tbody td::before {
        content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--text-faint);
        text-transform: uppercase; letter-spacing: .03em; text-align: left; flex-shrink: 0;
    }
    .data-table tbody td:empty::before { content: none; }
}
