:root {
    --bg-base: #030303;
    --bg-surface: #0a0a0a;
    --bg-surface-elevated: #121212;
    --bg-surface-hover: #1c1c1c;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --border-color: #27272a;
    --primary: #ff3344;
    /* Aggressive crisp red accent */
    --primary-hover: #d12432;
    --primary-text: #ffffff;
    --danger: #ff3344;
    --danger-hover: #d12432;
    --success: #10b981;
    --radius-sm: 0px;
    /* Sharp geometric borders */
    --radius-md: 0px;
    --radius-lg: 0px;
    --font-sans: 'Inter', -apple-system, monospace, sans-serif;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.8);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 1);
    --transition: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-base);
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 16px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.5rem;
}

a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s var(--transition);
}

a:hover {
    color: var(--text-primary);
}

p {
    font-size: 14px;
}

/* Utilities */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.items-center {
    display: flex;
    align-items: center;
}

.justify-between {
    display: flex;
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

/* Components */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s var(--transition);
}

.btn:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(255, 51, 68, 0.3);
}

.btn-danger {
    background: rgba(255, 51, 68, 0.05);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-icon {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-surface-elevated);
    color: var(--primary);
}

.carbon-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    transition: border 0.2s var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group {
    margin-bottom: 1rem;
}

/* Screens & Layout */
.screen {
    display: none;
    height: 100vh;
    width: 100vw;
}

.screen.active {
    display: flex;
}

#login-screen {
    background: var(--bg-base);
}

.login-box {
    padding: 2.5rem;
    width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.brand h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 14px;
}

.error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-top: 1rem;
    display: none;
}

/* Main App Layout */
.sidebar {
    width: 250px;
    background: var(--bg-base);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 0.1rem;
}

.nav-item:hover {
    background: var(--bg-surface-elevated);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    font-weight: 500;
    border-left: 2px solid var(--primary);
    padding-left: 0.4rem;
}

.nav-item .icon {
    opacity: 0.7;
    font-size: 15px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-info .username {
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.user-info .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

.topbar {
    height: 50px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    background: transparent;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 12px;
}

.status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator.online::before {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-indicator.offline::before {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* View Sections */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s var(--transition);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards & Dashboard */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.stat-card {
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Project Cards */
.project-card {
    padding: 1.5rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: transform 0.2s, border 0.2s;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.project-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.project-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.project-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    min-height: 40px;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    height: calc(100vh - 120px);
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-col {
    width: 300px;
    min-width: 300px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.kanban-col-header {
    padding: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    position: relative;
}

.kanban-col-header .count {
    float: right;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: normal;
}

.kanban-cards {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
}

.task-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    user-select: none;
    border-left: 2px solid var(--border-color);
}

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

.task-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #fff;
}

.task-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.priority-indicator {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.priority-high {
    color: var(--text-primary);
    background: var(--danger);
    font-weight: 600;
    text-transform: uppercase;
}

.priority-normal {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
}

.priority-low {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    text-transform: uppercase;
}

/* Chat Module */
.chat-layout {
    display: flex;
    height: calc(100vh - 120px);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.chat-sidebar {
    width: 220px;
    background: var(--bg-base);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-channels {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13.5px;
}

.channel-item:hover {
    background: var(--bg-surface-elevated);
    color: #fff;
}

.channel-item.active {
    background: var(--bg-surface-elevated);
    color: var(--primary);
    font-weight: 500;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    background: var(--bg-base);
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.2s ease;
}

.message-content {
    flex: 1;
}

.message-header {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.message-author {
    font-weight: 600;
    color: #fff;
    font-size: 13px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: pre-wrap;
}

.message.system {
    justify-content: center;
}

.message.system .message-text {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-surface-elevated);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-base);
}

.chat-input textarea {
    height: 60px;
    resize: none;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Documents */
.docs-layout {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 120px);
}

.docs-list {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.doc-item {
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.doc-item:hover {
    border-color: var(--text-muted);
}

.doc-item.active {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.doc-item h4 {
    margin: 0 0 0.25rem 0;
    font-size: 14px;
}

.doc-item p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.doc-editor {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.doc-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-title-input {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    border: none;
    background: transparent;
    padding: 0;
}

.doc-title-input:focus {
    outline: none;
    border-bottom: 1px solid var(--border-color);
}

.doc-content-input {
    flex: 1;
    width: 100%;
    height: 100%;
    resize: none;
    border: none;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    padding: 2rem;
}

/* Lists / Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--bg-surface);
    width: 480px;
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: fadeIn 0.2s;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--bg-base);
}