/* ═══════════════════════════════════════════════════
   NETRIGO WORKSPACE — Layout & Panel Styles
   Auth, Shell, Sidebar, Topbar, Dashboard, Kanban,
   Calendar, Bugs, Docs, Meetings, Notifications, Profile
   ═══════════════════════════════════════════════════ */

/* ── Auth Screens ── */
.auth-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-screen::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    left: -100px; top: -100px;
    background: radial-gradient(circle, var(--crimson-glow), transparent 70%);
    filter: blur(80px);
    animation: authFloat 10s ease-in-out infinite alternate;
    pointer-events: none;
}
.auth-screen::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    right: -120px; bottom: -120px;
    background: radial-gradient(circle, rgba(139,26,26,0.2), transparent 70%);
    filter: blur(60px);
    animation: authFloat 12s ease-in-out infinite alternate-reverse;
    pointer-events: none;
}

.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-40);
    width: min(900px, 92vw);
    position: relative;
    z-index: 1;
}

.auth-brand { align-self: center; }
.auth-brand h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--crimson-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--sp-8);
}
.auth-brand p { color: var(--text-secondary); font-size: 15px; }
.brand-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800; color: #fff;
    margin-bottom: var(--sp-20);
    box-shadow: var(--shadow-glow);
}

.auth-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-32);
    box-shadow: var(--shadow-lg);
}
.auth-form h2 {
    margin-bottom: var(--sp-24);
    font-size: 22px;
}
.auth-form input { max-width: none; }

@keyframes authFloat {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(30px,20px) scale(1.05); }
}

/* ── App Shell ── */
.app-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    height: 100vh;
    background: var(--bg-deep);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
    padding: var(--sp-20) var(--sp-20);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}
.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-12) var(--sp-10);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-10);
    padding: 10px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    position: relative;
}
.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}
.nav-item.active {
    color: var(--crimson-light);
    background: var(--crimson-subtle);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--crimson);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-item svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--crimson);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--sp-16) var(--sp-16);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-10);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-8);
    min-width: 0;
}
.sidebar-user-name {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main Content ── */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-16) var(--sp-24);
    border-bottom: 1px solid var(--border);
    background: var(--bg-void);
    flex-shrink: 0;
    z-index: var(--z-topbar);
}
.topbar-title {
    font-size: 22px;
    font-weight: 700;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-10);
}
.topbar-btn {
    position: relative;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.topbar-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.topbar-btn svg { width: 18px; height: 18px; }
.notif-dot {
    position: absolute;
    top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--crimson);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-card);
}

/* ── Panel Container ── */
.panel-viewport {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-24);
}

.panel { display: flex; flex-direction: column; gap: var(--sp-20); }

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-12);
    flex-shrink: 0;
}

/* ── Dashboard ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-16);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-20);
    transition: border-color var(--transition-fast);
}
.stat-card:hover { border-color: var(--border-hover); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-8);
}
.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-card:nth-child(1) .stat-value { color: var(--crimson-light); }
.stat-card:nth-child(2) .stat-value { color: var(--status-high); }
.stat-card:nth-child(3) .stat-value { color: var(--status-medium); }
.stat-card:nth-child(4) .stat-value { color: var(--status-waiting); }

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-16);
}

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-20);
    display: flex;
    flex-direction: column;
}
.dash-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--sp-16);
    font-weight: 600;
}

.scroll-inner {
    overflow-y: auto;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    gap: var(--sp-8);
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-12);
    padding: var(--sp-10) var(--sp-12);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}
.list-item:hover { border-color: var(--border-hover); }

.list-item-main { min-width: 0; flex: 1; }
.list-item-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    flex-wrap: wrap;
}
.list-item-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    flex-shrink: 0;
}

/* ── Kanban ── */
.kanban-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
    flex-shrink: 0;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-16);
    flex: 1;
    min-height: 0;
}

.kanban-col {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    max-height: calc(100vh - 200px);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.kanban-col.drag-over {
    border-color: var(--crimson);
    background: rgba(192,57,43,0.05);
}

.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-16);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.kanban-col-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.kanban-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-10);
    display: flex;
    flex-direction: column;
    gap: var(--sp-8);
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-12);
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}
.kanban-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}
.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
    opacity: 0.9;
    z-index: var(--z-drag);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), var(--shadow-glow);
    transform: rotate(2deg) scale(1.03);
    border-color: var(--crimson);
}

.kanban-card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: var(--sp-8);
    line-height: 1.4;
}
.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-8);
}
.kanban-card-meta {
    font-size: 11px;
    color: var(--text-muted);
}
.kanban-card-assignee {
    display: flex;
    align-items: center;
}

/* ── Task Detail Modal ── */
.task-detail-header {
    display: flex;
    align-items: center;
    gap: var(--sp-16);
    margin-bottom: var(--sp-20);
}

.task-detail-section {
    margin-bottom: var(--sp-16);
}
.task-detail-section label {
    margin-bottom: var(--sp-6);
}

/* ── Calendar ── */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-16);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
}
.calendar-nav h3 {
    min-width: 180px;
    text-align: center;
    font-size: 16px;
}
.calendar-views {
    display: flex;
    gap: var(--sp-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-2);
}
.calendar-views .btn { border-radius: var(--radius-sm); }

/* Monthly Grid */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.cal-header-cell {
    padding: var(--sp-10);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-deep);
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.cal-day {
    min-height: 100px;
    padding: var(--sp-6);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    flex-direction: column;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--bg-elevated); }
.cal-day.other-month { opacity: 0.35; }
.cal-day.today {
    background: var(--crimson-subtle);
    border-color: var(--crimson);
}

.cal-day-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--sp-4);
    text-align: right;
}
.cal-day.today .cal-day-num { color: var(--crimson-light); }

.cal-event-chip {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-weight: 500;
}
.cal-event-chip.type-meeting  { background: rgba(52,152,219,0.2); color: #3498db; }
.cal-event-chip.type-deadline { background: rgba(231,76,60,0.2); color: #e74c3c; }
.cal-event-chip.type-milestone{ background: rgba(155,89,182,0.2); color: #9b59b6; }
.cal-event-chip.type-reminder { background: rgba(243,156,18,0.2); color: #f39c12; }

/* Weekly Grid */
.cal-week-grid {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.cal-week-header {
    padding: var(--sp-10) var(--sp-4);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-deep);
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.cal-week-header:last-child { border-right: none; }
.cal-week-header.today-col { color: var(--crimson-light); }

.cal-time-label {
    padding: var(--sp-4) var(--sp-8);
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-deep);
    min-height: 48px;
}
.cal-week-cell {
    min-height: 48px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    padding: 2px;
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast);
}
.cal-week-cell:nth-child(8n) { border-right: none; }
.cal-week-cell:hover { background: var(--bg-elevated); }
.cal-week-cell.today-col { background: var(--crimson-subtle); }

/* ── Bugs Panel ── */
.bug-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-12);
    padding: var(--sp-16);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}
.bug-item:hover { border-color: var(--border-hover); }

.bug-info { min-width: 0; flex: 1; }
.bug-title { font-size: 14px; font-weight: 600; margin-bottom: var(--sp-6); }
.bug-meta {
    display: flex; align-items: center;
    gap: var(--sp-8); flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted);
}

/* ── Docs Panel ── */
.doc-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-12);
    padding: var(--sp-16);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}
.doc-item:hover { border-color: var(--border-hover); }

.doc-info { min-width: 0; flex: 1; }
.doc-title { font-size: 14px; font-weight: 600; margin-bottom: var(--sp-4); }
.doc-snippet {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--sp-6);
}
.doc-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-6); }

/* ── Meetings Panel ── */
.meeting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-12);
    padding: var(--sp-16);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}
.meeting-item:hover { border-color: var(--border-hover); }
.meeting-info { min-width: 0; flex: 1; }
.meeting-topic { font-size: 14px; font-weight: 600; margin-bottom: var(--sp-4); }
.meeting-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.meeting-actions { display: flex; align-items: center; gap: var(--sp-8); flex-shrink: 0; }

/* ── Notifications ── */
.notif-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-12);
    padding: var(--sp-12) var(--sp-16);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}
.notif-item:hover { border-color: var(--border-hover); }
.notif-item.unread { border-left: 3px solid var(--crimson); }
.notif-info { min-width: 0; flex: 1; }
.notif-message { font-size: 13px; font-weight: 500; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-actions { display: flex; gap: var(--sp-6); flex-shrink: 0; }

/* ── Profile ── */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-20);
}
.profile-form-card, .profile-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-24);
}
.profile-form-card h3, .profile-preview-card h3 {
    font-size: 16px;
    margin-bottom: var(--sp-20);
}

.profile-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-12);
    text-align: center;
}
.profile-display-name { font-size: 20px; font-weight: 700; }
.profile-display-email { color: var(--text-secondary); font-size: 14px; }
.profile-display-meta { color: var(--text-muted); font-size: 12px; }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .kanban-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .auth-container { grid-template-columns: 1fr; gap: var(--sp-24); }

    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: -260px; top: 0;
        width: 240px; height: 100vh;
        transition: left var(--transition-md);
        z-index: var(--z-modal);
    }
    .sidebar.open { left: 0; }

    .stats-row { grid-template-columns: 1fr 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr; }
    .panel-viewport { padding: var(--sp-16); }
}
