/* NetNavi — MMBN-inspired dark teal theme */
:root {
    --bg-primary: #0a1628;
    --bg-secondary: #0f2238;
    --bg-card: #132d4a;
    --bg-input: #1a3a5c;
    --text-primary: #e0f0ff;
    --text-secondary: #8badc4;
    --text-muted: #4a7a9b;
    --accent: #00d4ff;
    --accent-dim: #0088aa;
    --accent-glow: rgba(0, 212, 255, 0.15);
    --error: #ff4444;
    --success: #44ff88;
    --warning: #ffaa00;
    --border: #1e4a6e;
    --radius: 8px;
    --font-mono: 'Courier New', Courier, monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* === APP LAYOUT === */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}

#login-screen h1 {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 28px;
    letter-spacing: 2px;
}

#login-screen input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 16px;
    width: 280px;
    outline: none;
}

#login-screen input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

#login-screen button {
    background: var(--accent-dim);
    color: var(--text-primary);
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

#login-screen button:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

#login-error {
    color: var(--error);
    font-size: 14px;
    min-height: 20px;
}

/* === MAIN VIEW === */
#main-view {
    display: none;
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* fallback for older browsers */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
@supports (height: 100dvh) {
    #main-view { height: 100dvh; }
}

#main-view.active {
    display: flex;
}

/* === HEADER === */
#header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    cursor: pointer;
    transition: padding 0.2s;
}

#header.collapsed {
    padding: 6px 16px;
    gap: 10px;
}

#header.collapsed #avatar-container {
    width: 28px;
    height: 28px;
}

#header.collapsed #avatar-canvas {
    width: 28px;
    height: 28px;
}

#header.collapsed #navi-name {
    font-size: 13px;
}

#header.collapsed #navi-status {
    font-size: 11px;
}

#header-toggle {
    color: var(--text-muted);
    font-size: 10px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

#header.collapsed #header-toggle {
    transform: rotate(180deg);
}

#header.collapsed #header-search {
    display: none;
}

#avatar-container {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    transition: width 0.2s, height 0.2s;
}

#avatar-canvas {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    border-radius: 4px;
    background: var(--bg-card);
    transition: width 0.2s, height 0.2s;
}

#header.collapsed #avatar-canvas {
    width: 28px;
    height: 28px;
}

#header-info {
    flex: 1;
}

#navi-name {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--accent);
    letter-spacing: 1px;
}

#navi-status {
    font-size: 13px;
    color: var(--text-secondary);
}

/* === TAB CONTENT === */
#tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
}

/* === CHAT === */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.operator {
    align-self: flex-end;
    background: var(--accent-dim);
    color: var(--text-primary);
    border-bottom-right-radius: 2px;
}

.message.navi {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border);
}

.message.system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.message .typing-indicator {
    display: inline-block;
}

.message .typing-indicator::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* === CHAT INPUT === */
#chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    align-items: flex-end;
}

#new-chat-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.15s;
}
#new-chat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    font-family: inherit;
}

#chat-input:focus {
    border-color: var(--accent);
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#send-btn {
    background: var(--accent-dim);
    color: var(--text-primary);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

#send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === TAB BAR === */
#tab-bar {
    display: flex;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-btn {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: color 0.2s;
    border-top: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent);
    border-top-color: var(--accent);
}

.tab-icon {
    font-size: 18px;
}

/* === SETTINGS === */
#settings-panel {
    padding: 16px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 24px;
}

.trust-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}
.trust-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}
.trust-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.settings-section h3 {
    color: var(--accent);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.setting-row label {
    color: var(--text-secondary);
    font-size: 14px;
}

.setting-row input[type="text"],
.setting-row input[type="time"],
.setting-row input[type="number"],
.setting-row select,
.setting-row textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    width: 200px;
}

.setting-row textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.setting-row input:focus,
.setting-row select:focus,
.setting-row textarea:focus {
    border-color: var(--accent);
}

.settings-save-btn {
    background: var(--accent-dim);
    color: var(--text-primary);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    margin-top: 8px;
}

.settings-save-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* === TOOL EXECUTION IN CHAT === */
.message.tool-exec {
    align-self: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    max-width: 90%;
    font-size: 13px;
}

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

.tool-icon { font-size: 14px; }
.tool-name { color: var(--accent); font-weight: bold; }
.tool-status { font-size: 11px; }
.tool-status.running { color: var(--warning); }
.tool-status.running::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid var(--warning);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 4px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes callPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 8px 32px rgba(39,174,96,0.4), 0 0 20px rgba(39,174,96,0.2); }
}
.tool-status.success { color: var(--success); }
.tool-status.error { color: var(--error); }

.tool-input {
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
    white-space: pre-wrap;
    max-height: 60px;
    overflow: hidden;
}

.tool-output {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-mono);
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

.tool-output.error { color: var(--error); }

/* === NOTIFICATIONS IN CHAT === */
.message.notification {
    align-self: center;
    background: var(--bg-card);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    padding: 10px 14px;
    max-width: 90%;
}

.message.notification.high { border-color: var(--warning); }
.message.notification.critical { border-color: var(--error); background: rgba(255,68,68,0.1); }
.message.notification.acknowledged { opacity: 0.5; }

.notif-header {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.notif-icon { font-size: 16px; }
.notif-content { color: var(--text-primary); font-size: 14px; }

.notif-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notif-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.notif-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.notif-btn.mute { color: var(--text-muted); }

/* === APPROVAL REQUESTS === */
.message.approval-request {
    align-self: center;
    background: var(--bg-card);
    border: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-width: 90%;
}

.approval-header {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.approval-icon { margin-right: 6px; }

.approval-details {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: pre-wrap;
    max-height: 80px;
    overflow: hidden;
    margin-bottom: 10px;
}

.approval-actions {
    display: flex;
    gap: 8px;
}

.approve-btn {
    background: var(--success);
    color: var(--bg-primary);
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

.deny-btn {
    background: var(--error);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.approve-btn.small, .deny-btn.small {
    padding: 3px 10px;
    font-size: 11px;
}

/* Approval resolved states */
.approval-request.resolved { opacity: 0.7; }
.approval-resolved {
    font-size: 13px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 4px;
}
.approval-resolved.approved { color: var(--success); }
.approval-resolved.denied { color: var(--error); }

/* Tab badge (notification count) */
.tab-btn { position: relative; }
.tab-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    background: var(--error);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    font-weight: bold;
}

/* === WORKFLOW PLAN === */
.message.workflow-plan {
    align-self: center;
    background: var(--bg-card);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-width: 95%;
}

.wf-header {
    color: var(--accent);
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}

.wf-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.wf-step-num {
    background: var(--bg-input);
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    flex-shrink: 0;
}

.wf-step-desc { flex: 1; min-width: 0; }

.wf-step-trust {
    color: var(--text-muted);
    font-size: 10px;
    font-family: var(--font-mono);
}

.wf-step-actions { display: flex; gap: 4px; flex-shrink: 0; }

.wf-step-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}
.wf-step-badge.approved { color: var(--success); }
.wf-step-badge.rejected { color: var(--error); }
.wf-step-badge.auto { color: var(--text-muted); font-style: italic; }
.wf-step-badge.error { color: var(--error); }

.wf-step.approved .wf-step-num { background: var(--success); color: white; }
.wf-step.rejected .wf-step-num { background: var(--error); color: white; }

.message.workflow-complete {
    align-self: center;
    background: var(--bg-card);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-width: 95%;
}

.wf-summary {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 8px 0;
}

/* Trust level badges (settings) */
.trust-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    font-family: var(--font-mono);
}
.trust-badge.supervised { background: rgba(245,183,49,0.2); color: var(--warning); }
.trust-badge.review_only { background: rgba(0,180,255,0.2); color: #00b4ff; }
.trust-badge.autonomous { background: rgba(0,200,100,0.2); color: var(--success); }

/* User Management */
.um-table { width:100%; border-collapse:collapse; margin-bottom:12px; }
.um-table th { text-align:left; padding:6px 8px; font-size:11px; color:var(--text-muted); border-bottom:1px solid var(--border); text-transform:uppercase; letter-spacing:0.5px; }
.um-table td { padding:6px 8px; font-size:13px; color:var(--text-secondary); border-bottom:1px solid rgba(30,74,110,0.3); }
.um-table tr.um-inactive td { opacity:0.5; }
.um-role-badge { display:inline-block; padding:1px 8px; border-radius:8px; font-size:11px; font-weight:bold; font-family:var(--font-mono); }
.um-role-owner { background:rgba(0,212,255,0.2); color:var(--accent); }
.um-role-user { background:rgba(100,150,200,0.15); color:var(--text-secondary); }
.um-edit-btn { background:var(--bg-card); color:var(--accent); border:1px solid var(--border); padding:2px 10px; border-radius:4px; font-size:11px; cursor:pointer; }
.um-edit-btn:hover { background:var(--accent); color:#fff; }
.um-input { background:var(--bg-input); border:1px solid var(--border); color:var(--text-primary); padding:6px 10px; border-radius:4px; font-size:13px; outline:none; }
.um-input:focus { border-color:var(--accent); }
.um-form-row { display:flex; gap:8px; align-items:center; }
.um-check-label { font-size:13px; color:var(--text-secondary); display:flex; align-items:center; gap:6px; cursor:pointer; }
.um-app-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(130px, 1fr)); gap:4px; }
.um-app-check { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:4px; cursor:pointer; padding:2px 4px; border-radius:4px; }
.um-app-check:hover { background:var(--accent-glow); }
.um-small-btn { background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); padding:2px 8px; border-radius:4px; font-size:10px; cursor:pointer; }
.um-small-btn:hover { color:var(--accent); border-color:var(--accent); }
.um-edit-modal { position:fixed; inset:0; z-index:300; display:flex; align-items:center; justify-content:center; }
.um-edit-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
.um-edit-panel { position:relative; width:90%; max-width:500px; max-height:85vh; overflow-y:auto; background:var(--bg-secondary); border:1px solid var(--border); border-radius:12px; padding:20px; z-index:301; }

/* Read-only mode — hide write actions globally */
body.read-only-mode .settings-save-btn,
body.read-only-mode .doc-connect-btn,
body.read-only-mode [data-write-action] { display:none !important; }

/* Login username field */
#login-username { width:100%; max-width:280px; margin-bottom:8px; }

.wf-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

/* === PROGRAMS TAB === */
.panel-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.program-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 10px;
}

.program-card.disabled { opacity: 0.5; }

.program-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.program-name {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 14px;
}

.permission-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.permission-badge.standard { background: rgba(68,255,136,0.15); color: var(--success); }
.permission-badge.elevated { background: rgba(255,170,0,0.15); color: var(--warning); }
.permission-badge.privileged { background: rgba(255,68,68,0.15); color: var(--error); }

.program-desc {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.program-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-input);
    border-radius: 11px;
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--accent);
}

/* === TASKS TAB === */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.task-card:hover {
    border-color: var(--accent-dim);
}

/* Task detail view */
.task-detail {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.task-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.task-detail-title {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--accent);
    font-weight: bold;
}

.task-detail-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.task-detail-section {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
}
.task-detail-section.full {
    flex-direction: column;
    gap: 4px;
}
.task-detail-section label {
    color: var(--text-muted);
    font-size: 12px;
    min-width: 80px;
    flex-shrink: 0;
}
.task-detail-section span {
    color: var(--text-primary);
    font-size: 13px;
}
.task-detail-raw {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted) !important;
}

.task-detail-prompt {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.5;
}

.task-detail-actions {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.task-enabled-badge {
    color: var(--success) !important;
    font-weight: bold;
}
.task-disabled-badge {
    color: var(--text-muted) !important;
}

.task-card .task-card:hover { /* nesting guard */ }
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.task-name {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 14px;
}

.task-schedule {
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}

.task-next-run {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.task-deadline {
    font-size: 12px;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.task-deadline.normal { color: var(--text-secondary); }
.task-deadline.important { color: var(--warning); background: rgba(255,170,0,0.1); }
.task-deadline.critical { color: var(--error); background: rgba(255,68,68,0.1); }

.task-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.task-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.task-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.task-btn.danger:hover { border-color: var(--error); color: var(--error); }

.create-task-btn {
    background: var(--accent-dim);
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    margin-bottom: 12px;
}

.create-task-btn:hover { background: var(--accent); color: var(--bg-primary); }

#create-task-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
}

.create-btn {
    background: var(--success);
    color: var(--bg-primary);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: bold;
}

.task-history-modal {
    background: var(--bg-card);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 10px;
}

.task-history-modal h3 { color: var(--accent); margin-bottom: 10px; }

.history-entry {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    font-size: 12px;
}

.history-entry.success .history-status { color: var(--success); }
.history-entry.error .history-status { color: var(--error); }

.history-time { color: var(--text-muted); }
.history-status { margin-left: 8px; }
.history-summary { color: var(--text-secondary); margin-top: 4px; }

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* === RESPONSIVE === */
@media (min-width: 768px) {
    #header {
        padding: 16px 24px;
    }

    #avatar-container {
        width: 96px;
        height: 96px;
    }

    #avatar-canvas {
        width: 96px;
        height: 96px;
    }

    #navi-name {
        font-size: 22px;
    }

    #chat-messages {
        padding: 20px 24px;
    }

    .message {
        max-width: 70%;
    }

    #chat-input-area {
        padding: 16px 24px;
    }
}

/* === APPS TAB === */
#apps-home {
    padding: 24px 16px;
    overflow-y: auto;
    flex: 1;
}

#apps-grid {
    width: 100%;
}

.app-filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.app-filter-tab {
    padding: 5px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-family: var(--font-mono);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
}

.app-filter-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.app-filter-tab:hover:not(.active) {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.app-group-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 12px 0 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.app-group-label:first-child {
    padding-top: 0;
}

.app-group-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 12px;
    margin-bottom: 8px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.app-icon-tile {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.app-icon-tile:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

.app-icon-glyph {
    font-size: 28px;
    line-height: 1;
}

.app-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--error);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-primary);
}

.app-icon-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* === APP SCREEN === */
.app-screen {
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#email-account-tabs {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
    flex-shrink: 0;
}

#email-account-tabs::-webkit-scrollbar { display: none; }

.email-account-tab {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-family: var(--font-mono);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.email-account-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.email-tab-badge {
    background: rgba(255,255,255,0.25);
    border-radius: 8px;
    font-size: 11px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
}

.email-account-tab:not(.active) .email-tab-badge {
    background: var(--accent);
    color: #fff;
}

#email-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}

.app-back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.app-back-btn:hover {
    background: var(--accent-glow);
}

#email-toolbar-title {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.email-refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s;
}

.email-refresh-btn:hover { color: var(--accent); }
.email-refresh-btn:disabled { opacity: 0.5; cursor: wait; }

/* Email Thread View */
#email-thread-section { padding: 0 20px 20px; }
.email-thread-header { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: bold; margin-top: 20px; padding: 10px 0 6px; border-top: 1px solid var(--border); }
.email-thread-msg { padding: 10px 12px; margin: 4px 0; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.email-thread-msg.received { background: var(--bg-card); border-left: 3px solid var(--text-muted); }
.email-thread-msg.sent { background: rgba(0, 210, 211, 0.08); border-left: 3px solid var(--accent); }
.email-thread-msg.current { opacity: 0.5; cursor: default; }
.thread-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.thread-dir { font-size: 12px; font-weight: bold; color: var(--text-primary); }
.email-thread-msg.sent .thread-dir { color: var(--accent); }
.thread-date { font-size: 11px; color: var(--text-muted); }
.thread-body { font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.thread-body.collapsed { max-height: 40px; overflow: hidden; text-overflow: ellipsis; }

#email-compose-sheet {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
#email-compose-sheet .form-panel {
    max-height: 80vh;
    z-index: 301;
    border-radius: 16px 16px 0 0;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* === EMAIL LAYOUT === */
#email-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#email-list-pane {
    width: 320px;
    min-width: 240px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

#email-search-bar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#email-search {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
}

#email-search:focus { border-color: var(--accent); }

#email-list {
    flex: 1;
    overflow-y: auto;
}

.email-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

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

.email-star {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.35;
    padding: 2px 0 0 0;
    line-height: 1;
    transition: color 0.15s, opacity 0.15s;
}

.email-star:hover {
    opacity: 0.7;
}

.email-star.starred {
    color: #f5b731;
    opacity: 1;
}

.email-spam-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.2;
    padding: 2px 0 0 0;
    line-height: 1;
    transition: opacity 0.15s;
}
.email-spam-btn:hover { opacity: 0.6; }
.email-spam-btn.is-spam { opacity: 1; }

.email-unimp-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.2;
    padding: 2px 0 0 0;
    line-height: 1;
    transition: opacity 0.15s;
}
.email-unimp-btn:hover { opacity: 0.6; }
.email-unimp-btn.is-unimp { opacity: 0.8; }

.email-rule-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.3;
    padding: 2px 0 0 0;
    line-height: 1;
    transition: opacity 0.15s;
}
.email-rule-btn:hover { opacity: 0.8; color: var(--accent); }

.email-row:hover { background: var(--bg-card); }
.email-row.selected { background: var(--bg-input); border-left: 3px solid var(--accent); }

.email-row-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}

.email-sender {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.email-row.unread .email-sender { color: var(--accent); }

.email-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.email-subject {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.email-row.unread .email-subject {
    color: var(--text-primary);
    font-weight: 500;
}

.email-load-more {
    display: block;
    width: 100%;
    padding: 14px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}

.email-load-more:hover {
    background: var(--bg-card);
}

.email-row-account {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
    font-family: var(--font-mono);
}

.email-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === EMAIL DETAIL === */
#email-detail-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

#email-detail-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

#email-detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.email-detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.email-detail-subject {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
}

.email-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    color: var(--text-secondary);
}

.email-detail-body {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.email-loading, .email-empty, .email-error {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.email-error { color: var(--error); }

/* Mobile: stack email list/detail */
@media (max-width: 600px) {
    .app-group-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px 8px;
    }
    .app-icon-tile { width: 56px; height: 56px; border-radius: 14px; }
    .app-icon-glyph { font-size: 24px; }

    #email-list-pane {
        width: 100%;
        border-right: none;
    }
    #email-detail-pane {
        display: none;
    }
    #email-list-pane.detail-open {
        display: none;
    }
    #email-detail-pane.detail-open {
        display: flex;
    }
}

/* === CONTACTS APP === */

#contacts-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}

#contacts-toolbar-title {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

#contacts-add-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

#contacts-domain-tabs {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.contacts-tab {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-family: var(--font-mono);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
}

.contacts-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#contacts-filters {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#contacts-role-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 13px;
    font-family: var(--font-mono);
}

#contacts-search {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 13px;
}

#contacts-list {
    flex: 1;
    overflow-y: auto;
}

/* Contacts spreadsheet */
.ct-table-header { display:flex; align-items:center; padding:4px 8px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:11px; color:var(--text-muted); font-family:var(--font-mono); position:sticky; top:0; z-index:1; }
.ct-table-row { display:flex; align-items:center; padding:2px 8px; border-bottom:1px solid var(--border); }
.ct-table-row:hover { background:var(--bg-card); }
.ct-col-check { width:28px; flex-shrink:0; text-align:center; }
.ct-col-check input[type="checkbox"] { accent-color:var(--accent); cursor:pointer; }
.ct-col-imp { width:30px; flex-shrink:0; text-align:center; }

.ct-table-row.ct-selected { background:rgba(0,200,150,0.08); }

.ct-bulk-bar { display:flex; align-items:center; gap:8px; padding:8px 12px; background:var(--accent); border-radius:var(--radius); margin-bottom:8px; flex-wrap:wrap; }
.ct-bulk-count { font-size:13px; font-weight:bold; color:#fff; font-family:var(--font-mono); }
.ct-bulk-select { background:rgba(255,255,255,0.2); color:#fff; border:1px solid rgba(255,255,255,0.3); border-radius:4px; padding:3px 8px; font-size:12px; cursor:pointer; }
.ct-bulk-btn { background:rgba(255,255,255,0.15); color:#fff; border:1px solid rgba(255,255,255,0.3); border-radius:4px; padding:3px 10px; font-size:11px; cursor:pointer; font-weight:bold; }
.ct-bulk-btn:hover { background:rgba(255,255,255,0.3); }
.ct-bulk-btn.danger { background:rgba(255,60,60,0.3); border-color:rgba(255,60,60,0.5); }
.ct-bulk-btn.danger:hover { background:rgba(255,60,60,0.5); }
.ct-col-name { width:130px; flex-shrink:0; }
.ct-col-cat { width:90px; flex-shrink:0; }

.ct-star-btn { background:none; border:none; font-size:16px; cursor:pointer; color:var(--text-muted); opacity:0.3; padding:0; line-height:1; transition:opacity 0.15s,color 0.15s; }
.ct-star-btn:hover { opacity:0.7; }
.ct-star-btn.starred { color:#f5b731; opacity:1; }
.ct-col-type { width:100px; flex-shrink:0; }
.ct-col-phone { width:120px; flex-shrink:0; }
.ct-col-email { width:160px; flex-shrink:0; }
.ct-col-addr { width:150px; flex-shrink:0; }
.ct-col-entity { width:120px; flex-shrink:0; }
.ct-col-tenant { width:130px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ct-col-desc { flex:1; min-width:0; }
/* Phone spreadsheet */
.ph-sheet { display:flex; flex-direction:column; min-width:max-content; }
.ph-head, .ph-filters, .ph-row { display:flex; align-items:center; border-bottom:1px solid var(--border); }
.ph-head { background:var(--bg-secondary); position:sticky; top:0; z-index:2; }
.ph-filters { background:var(--bg-primary); position:sticky; top:28px; z-index:1; border-bottom:2px solid var(--border); }
.ph-h { padding:4px 6px; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; cursor:pointer; user-select:none; white-space:nowrap; }
.ph-h:hover { color:var(--text-primary); }
.ph-f { padding:2px 4px; }
.ph-filter-input { width:100%; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:3px; padding:2px 4px; font-size:11px; box-sizing:border-box; }
.ph-filter-input:focus { border-color:var(--accent); outline:none; }
.ph-row { transition:background 0.1s; }
.ph-row:hover { background:rgba(255,255,255,0.03); }
.ph-cell { padding:2px 4px; font-size:12px; overflow:hidden; }
.ph-inp { width:100%; background:transparent; color:var(--text-primary); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:12px; box-sizing:border-box; font-family:var(--font-mono); }
.ph-inp:hover { border-color:var(--border); }
.ph-inp:focus { border-color:var(--accent); background:var(--bg-input); outline:none; }
.ph-sel { width:100%; background:transparent; color:var(--text-primary); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:11px; cursor:pointer; }
.ph-sel:hover { border-color:var(--border); }
.ph-sel:focus { border-color:var(--accent); background:var(--bg-input); outline:none; }
.ph-desc-inp { text-overflow:ellipsis; color:var(--text-muted); }
.ph-desc-inp:hover { color:var(--accent); text-decoration:underline; }
.ph-del-btn { background:transparent; border:none; color:var(--text-muted); cursor:pointer; font-size:11px; padding:2px 4px; opacity:0.3; }
.ph-del-btn:hover { opacity:1; color:#e74c3c; }
.ph-c-star { width:28px; flex-shrink:0; text-align:center; }
.ph-c-date { width:110px; flex-shrink:0; }
.ph-c-entity { width:120px; flex-shrink:0; }
.ph-c-number { width:130px; flex-shrink:0; }
.ph-c-tenant { width:150px; flex-shrink:0; }
.ph-c-name { width:160px; flex-shrink:0; }
.ph-c-desc { flex:1; min-width:200px; }
.ph-c-actions { width:28px; flex-shrink:0; }
.ph-status-bar { padding:4px 10px; font-size:11px; color:var(--text-muted); background:var(--bg-secondary); border-top:1px solid var(--border); position:sticky; bottom:0; }
.ph-detail-textarea { width:100%; min-height:200px; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:10px; font-size:13px; font-family:var(--font-mono); resize:vertical; box-sizing:border-box; }
.ph-detail-textarea:focus { border-color:var(--accent); outline:none; }

/* Notification Bell */
#notif-bell { position:relative; cursor:pointer; padding:4px 8px; flex-shrink:0; }
.notif-bell-icon { font-size:18px; }
.notif-badge { position:absolute; top:-2px; right:0; background:#e74c3c; color:white; font-size:10px; font-weight:700; min-width:16px; height:16px; border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 4px; font-family:var(--font-mono); }
.notif-dropdown { position:absolute; top:100%; right:0; width:360px; max-height:480px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,0.4); z-index:1000; overflow:hidden; margin-top:6px; }
.nf-header { display:flex; justify-content:space-between; align-items:center; padding:10px 12px; border-bottom:1px solid var(--border); }
.nf-title { font-size:13px; font-weight:700; color:var(--text-primary); }
.nf-header-actions { display:flex; gap:6px; }
.nf-action-btn { background:transparent; border:none; color:var(--accent); font-size:11px; cursor:pointer; padding:2px 6px; }
.nf-action-btn:hover { text-decoration:underline; }
.nf-list { max-height:400px; overflow-y:auto; }
.nf-item { display:flex; gap:8px; padding:8px 12px; border-bottom:1px solid rgba(255,255,255,0.03); cursor:pointer; align-items:flex-start; }
.nf-item:hover { background:rgba(255,255,255,0.03); }
.nf-item.nf-unread { background:rgba(100,200,255,0.05); border-left:3px solid var(--accent); }
.nf-item-icon { font-size:12px; flex-shrink:0; padding-top:2px; }
.nf-item-body { flex:1; min-width:0; }
.nf-item-content { font-size:12px; color:var(--text-primary); line-height:1.4; }
.nf-item-meta { display:flex; gap:8px; margin-top:2px; }
.nf-item-topic { font-size:10px; color:var(--accent); text-transform:uppercase; }
.nf-item-time { font-size:10px; color:var(--text-muted); }
.nf-dismiss { background:transparent; border:none; color:var(--text-muted); font-size:10px; cursor:pointer; opacity:0.3; flex-shrink:0; padding:2px; }
.nf-dismiss:hover { opacity:1; color:#e74c3c; }
.nf-empty, .nf-loading { padding:24px; text-align:center; color:var(--text-muted); font-size:12px; }
@media (max-width:768px) { .notif-dropdown { width:calc(100vw - 20px); right:-40px; } }

/* Global Search */
#header-search { flex:1; max-width:400px; position:relative; margin:0 16px; }
#global-search-input { width:100%; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:18px; padding:6px 14px; font-size:13px; font-family:var(--font-mono); box-sizing:border-box; }
#global-search-input:focus { border-color:var(--accent); outline:none; }
#global-search-input::placeholder { color:var(--text-muted); font-size:12px; }
#global-search-results { position:absolute; top:100%; left:0; right:0; margin-top:4px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:10px; max-height:400px; overflow-y:auto; z-index:1000; box-shadow:0 8px 24px rgba(0,0,0,0.4); }
.gs-group-label { padding:6px 12px 2px; font-size:10px; color:var(--accent); text-transform:uppercase; letter-spacing:1px; font-weight:600; }
.gs-item { padding:6px 12px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,0.03); }
.gs-item:hover, .gs-item.gs-selected { background:rgba(100,200,255,0.08); }
.gs-item:last-child { border-bottom:none; }
.gs-item-title { font-size:13px; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gs-item-sub { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.gs-empty { padding:16px; text-align:center; color:var(--text-muted); font-size:12px; }
@media (max-width:768px) {
    #header-search { max-width:none; margin:0 8px; }
    #global-search-input { font-size:12px; padding:5px 10px; }
}

/* Contact Detail Page */
.cd-page { display:flex; flex-direction:column; height:100%; }
.cd-header { display:flex; gap:14px; padding:16px; background:var(--bg-secondary); border-bottom:1px solid var(--border); align-items:flex-start; flex-wrap:wrap; }
.cd-avatar { width:56px; height:56px; border-radius:50%; background:var(--accent); color:var(--bg-primary); display:flex; align-items:center; justify-content:center; font-size:22px; font-weight:700; flex-shrink:0; }
.cd-info { flex:1; min-width:200px; }
.cd-name { font-size:20px; font-weight:700; color:var(--text-primary); }
.cd-meta { display:flex; gap:6px; align-items:center; margin-top:4px; flex-wrap:wrap; }
.cd-tag { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:2px 8px; font-size:11px; color:var(--accent); }
.cd-meta-text { font-size:12px; color:var(--text-muted); }
.cd-contact-row { display:flex; gap:12px; margin-top:6px; flex-wrap:wrap; }
.cd-contact-item { font-size:12px; color:var(--text-muted); }
.cd-contact-item:hover { color:var(--accent); }
.cd-actions { display:flex; gap:6px; flex-shrink:0; }
.cd-action-btn { background:var(--bg-card); border:1px solid var(--border); border-radius:6px; padding:6px 12px; color:var(--text-primary); font-size:12px; cursor:pointer; }
.cd-action-btn:hover { border-color:var(--accent); }
.cd-danger { color:#e74c3c; }
.cd-danger:hover { border-color:#e74c3c; }
.cd-stat-row { display:flex; gap:2px; padding:8px 16px; background:var(--bg-primary); border-bottom:1px solid var(--border); }
.cd-stat { flex:1; text-align:center; padding:6px 4px; cursor:pointer; border-radius:6px; }
.cd-stat:hover { background:rgba(255,255,255,0.03); }
.cd-stat-n { display:block; font-size:18px; font-weight:700; color:var(--accent); font-family:var(--font-mono); }
.cd-stat-l { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; }
.cd-tabs { display:flex; gap:2px; padding:4px 16px; background:var(--bg-secondary); border-bottom:1px solid var(--border); overflow-x:auto; }
.cd-tab { background:transparent; border:none; color:var(--text-muted); padding:6px 12px; font-size:12px; cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap; }
.cd-tab:hover { color:var(--text-primary); }
.cd-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.cd-body { flex:1; overflow-y:auto; padding:8px 16px; }
.cd-empty { text-align:center; padding:30px; color:var(--text-muted); font-size:13px; }
.cd-notes { white-space:pre-wrap; font-size:13px; color:var(--text-primary); padding:12px; background:var(--bg-card); border-radius:8px; }
.cd-tl-row { display:flex; gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,0.04); }
.cd-tl-row:last-child { border-bottom:none; }
.cd-tl-icon { font-size:16px; flex-shrink:0; width:24px; text-align:center; padding-top:2px; }
.cd-tl-body { flex:1; min-width:0; }
.cd-tl-top { display:flex; gap:6px; align-items:baseline; }
.cd-tl-type { font-size:11px; color:var(--accent); text-transform:uppercase; font-weight:600; }
.cd-tl-dir { font-size:10px; }
.cd-tl-date { font-size:10px; color:var(--text-muted); margin-left:auto; }
.cd-tl-text { font-size:12px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cd-list-row { display:flex; gap:10px; padding:8px 4px; border-bottom:1px solid rgba(255,255,255,0.04); align-items:flex-start; }
.cd-list-row:last-child { border-bottom:none; }
.cd-list-main { flex:1; min-width:0; }
.cd-list-top { display:flex; gap:8px; align-items:baseline; font-size:12px; color:var(--text-primary); }
.cd-list-date { font-size:10px; color:var(--text-muted); margin-left:auto; flex-shrink:0; }
.cd-list-dur { font-size:10px; color:var(--accent); font-family:var(--font-mono); }
.cd-list-subj { font-size:13px; color:var(--text-primary); font-weight:600; margin-top:2px; }
.cd-list-text { font-size:11px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cd-list-amt { font-size:13px; font-weight:600; font-family:var(--font-mono); flex-shrink:0; }
.cd-list-amt.debit { color:#e74c3c; }
.cd-list-amt.credit { color:#27ae60; }
.cd-sheet { display:flex; flex-direction:column; }
.cd-sheet-head { display:flex; background:var(--bg-secondary); border-bottom:2px solid var(--border); position:sticky; top:0; z-index:1; }
.cd-sheet-body { }
.cd-sh { padding:5px 6px; font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; }
.cd-sheet-row { display:flex; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; }
.cd-sheet-row:hover { background:rgba(255,255,255,0.03); }
.cd-sc { padding:5px 6px; font-size:12px; color:var(--text-primary); }
.cd-sc.debit { color:#e74c3c; }
.cd-sc.credit { color:#27ae60; }
.cd-expand, .comms-expand { background:var(--bg-card); border-left:3px solid var(--accent); border-bottom:1px solid var(--border); animation:cdExpandIn 0.15s ease-out; }
.comms-sticky-bar { position:sticky; top:0; z-index:5; background:var(--bg-secondary); border-bottom:2px solid var(--accent); box-shadow:0 2px 8px rgba(0,0,0,0.4); padding:6px 12px; display:none; align-items:center; justify-content:space-between; gap:8px; }
.comms-sticky-info { display:flex; align-items:center; gap:8px; flex:1; min-width:0; font-size:12px; color:var(--text-primary); overflow:hidden; }
.comms-sticky-type { background:var(--accent); color:var(--bg-primary); padding:2px 8px; border-radius:10px; font-size:10px; font-weight:700; text-transform:uppercase; flex-shrink:0; }
.comms-sticky-subj { color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comms-sticky-date { color:var(--text-muted); font-size:10px; flex-shrink:0; }
.comms-sticky-close { background:#e74c3c; color:white; border:none; border-radius:6px; padding:4px 12px; font-size:11px; font-weight:600; cursor:pointer; flex-shrink:0; }
.comms-sticky-close:hover { background:#c0392b; }
@keyframes cdExpandIn { from { opacity:0; } to { opacity:1; } }
.cd-expand-content { padding:10px 14px; overflow-wrap:break-word; word-break:break-word; min-width:0; }
.cd-expand-subj { font-size:13px; font-weight:600; color:var(--text-primary); margin-bottom:4px; }
.cd-expand-meta { font-size:11px; color:var(--text-muted); margin-bottom:6px; }
.cd-expand-body { font-size:12px; color:var(--text-primary); white-space:pre-wrap; word-break:break-word; line-height:1.5; background:var(--bg-primary); border:1px solid var(--border); border-radius:6px; padding:8px 10px; }
.cd-expand-loading { padding:12px; color:var(--text-muted); font-size:12px; }
.cd-expand-err { padding:12px; color:#e74c3c; font-size:12px; }

/* My Tasks */
.mt-section-tabs { display:flex; background:var(--bg-secondary); border-bottom:2px solid var(--border); }
.mt-section-tab { flex:1; text-align:center; padding:10px; font-size:13px; font-weight:600; color:var(--text-muted); cursor:pointer; border-bottom:3px solid transparent; background:transparent; border-top:none; border-left:none; border-right:none; }
.mt-section-tab:hover { color:var(--text-primary); }
.mt-section-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.mt-toolbar { display:flex; gap:8px; padding:8px 12px; background:var(--bg-secondary); border-bottom:1px solid var(--border); align-items:center; flex-wrap:wrap; }
.mt-view-toggle { display:flex; gap:2px; }
.mt-view-btn { background:var(--bg-input); color:var(--text-muted); border:1px solid var(--border); padding:4px 12px; font-size:11px; cursor:pointer; border-radius:4px; }
.mt-view-btn.active { background:var(--accent); color:white; border-color:var(--accent); }
.mt-filters { display:flex; gap:4px; }
.mt-filter-sel { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:4px; padding:3px 6px; font-size:11px; }
.mt-copy-btn { background:#27ae60; color:white; border:none; border-radius:6px; padding:5px 12px; font-size:11px; font-weight:600; cursor:pointer; }
.mt-copy-btn:hover { opacity:0.9; }
.mt-sync-btn { background:none; color:var(--text-secondary); border:1px solid var(--border); border-radius:6px; padding:5px 12px; font-size:11px; cursor:pointer; transition:color 0.2s; }
.mt-sync-btn:hover { color:var(--accent); border-color:var(--accent); }
.mt-add-btn { background:var(--accent); color:white; border:none; border-radius:6px; padding:5px 12px; font-size:11px; font-weight:600; cursor:pointer; }

/* My Tasks — List */
.mt-sheet { display:flex; flex-direction:column; overflow-x:auto; }
.mt-sheet-head { display:flex; background:var(--bg-secondary); border-bottom:2px solid var(--border); position:sticky; top:0; z-index:1; min-width:max-content; }
.mt-sh { padding:5px 6px; font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; flex-shrink:0; overflow:hidden; position:relative; }
.mt-resize-handle { position:absolute; right:0; top:0; bottom:0; width:4px; cursor:col-resize; background:transparent; }
.mt-resize-handle:hover { background:var(--accent); }
.mt-sheet-row { display:flex; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; align-items:center; min-width:max-content; }
.mt-sheet-row:hover { background:rgba(255,255,255,0.03); }
.mt-sc { padding:4px 6px; font-size:12px; color:var(--text-primary); flex-shrink:0; overflow:hidden; }
.mt-pri-badge { display:inline-block; color:white; font-size:9px; font-weight:700; padding:2px 6px; border-radius:8px; }
.mt-status-badge { font-size:10px; padding:2px 6px; border-radius:8px; }
.mt-status-todo { background:var(--bg-input); color:var(--text-muted); }
.mt-status-in_progress { background:rgba(52,152,219,0.2); color:#3498db; }
.mt-status-done { background:rgba(39,174,96,0.2); color:#27ae60; }
.mt-status-wont_do { background:rgba(149,165,166,0.2); color:#95a5a6; }
.mt-expand { background:var(--bg-card); border-left:3px solid var(--accent); border-bottom:1px solid var(--border); animation:cdExpandIn 0.15s ease-out; min-width:0; max-width:100vw; width:100%; overflow-wrap:break-word; word-break:break-word; }
.mt-expand .cd-expand-body { white-space:pre-wrap; word-break:break-word; overflow-wrap:break-word; max-height:none; overflow-y:auto; }

/* My Tasks — Kanban */
.mt-kanban { display:flex; gap:12px; padding:12px; min-height:400px; overflow-x:auto; }
.mt-kanban-col { flex:1; min-width:250px; background:var(--bg-secondary); border-radius:10px; display:flex; flex-direction:column; }
.mt-kanban-header { padding:10px 12px; font-size:13px; font-weight:700; color:var(--text-primary); border-bottom:1px solid var(--border); }
.mt-kanban-count { font-size:11px; color:var(--text-muted); font-weight:400; margin-left:4px; }
.mt-kanban-cards { padding:8px; flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.mt-kanban-card { background:var(--bg-card); border:1px solid var(--border); border-radius:8px; padding:10px; cursor:pointer; }
.mt-kanban-card:hover { border-color:var(--accent); }
.mt-kanban-card.mt-dragging { opacity:0.4; border:2px dashed var(--accent); }
.mt-kanban-col.mt-drag-over { background:rgba(100,200,255,0.08); border:2px dashed var(--accent); border-radius:10px; }
.mt-kanban-col[data-column="approved"] .mt-kanban-header { color:var(--accent); }
.mt-kanban-col[data-column="approved"] { border:1px solid rgba(0,210,211,0.25); }
.mt-kanban-card-top { display:flex; gap:6px; align-items:center; margin-bottom:4px; }
.mt-kanban-card-cat { font-size:10px; color:var(--text-muted); }
.mt-kanban-card-title { font-size:12px; font-weight:600; color:var(--text-primary); }
.mt-kanban-card-desc { font-size:11px; color:var(--text-muted); margin-top:4px; }
.mt-kanban-card-actions { margin-top:6px; }
.mt-move-btn { background:var(--bg-input); border:1px solid var(--border); color:var(--text-primary); border-radius:4px; padding:2px 8px; font-size:10px; cursor:pointer; }
.mt-move-btn:hover { border-color:var(--accent); }

/* My Tasks — Action Fields */
.mt-action-field { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.mt-response-textarea { width:100%; min-height:80px; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:6px; padding:8px; font-size:13px; resize:vertical; box-sizing:border-box; font-family:var(--font-mono); }
.mt-response-textarea:focus { border-color:var(--accent); outline:none; }
.mt-response-input { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:6px; padding:6px 10px; font-size:13px; width:100%; box-sizing:border-box; margin-bottom:6px; }
.mt-response-input:focus { border-color:var(--accent); outline:none; }
.mt-submit-btn { background:var(--accent); color:white; border:none; border-radius:6px; padding:6px 16px; font-size:12px; font-weight:600; cursor:pointer; margin-top:6px; }
.mt-approve-btn { background:#27ae60; color:white; border:none; border-radius:6px; padding:8px 20px; font-size:12px; font-weight:600; cursor:pointer; }
.mt-reject-btn { background:#e74c3c; color:white; border:none; border-radius:6px; padding:8px 20px; font-size:12px; font-weight:600; cursor:pointer; }
.mt-file-input { margin-bottom:6px; }
@media (max-width:768px) { .mt-kanban { flex-direction:column; } .mt-kanban-col { min-width:100%; } .mt-toolbar { gap:4px; } }

/* My Tasks v2 — Top-level tabs (Inbox/Today/Board/Upcoming/Delegated/Areas/Someday) */
.mt-tabs { display:flex; gap:0; background:var(--bg-secondary); border-bottom:2px solid var(--border); overflow-x:auto; flex-wrap:nowrap; }
.mt-tab { display:flex; align-items:center; gap:6px; padding:10px 14px; font-size:12px; font-weight:600; color:var(--text-muted); cursor:pointer; border:none; background:transparent; border-bottom:3px solid transparent; white-space:nowrap; flex-shrink:0; }
.mt-tab:hover { color:var(--text-primary); background:rgba(255,255,255,0.03); }
.mt-tab.active { color:var(--accent); border-bottom-color:var(--accent); background:rgba(255,255,255,0.04); }
.mt-tab-count { display:inline-block; background:var(--bg-input); color:var(--text-muted); font-size:10px; font-weight:700; padding:1px 6px; border-radius:8px; min-width:14px; text-align:center; }
.mt-tab.active .mt-tab-count { background:var(--accent); color:#fff; }
.mt-area-dot { display:inline-block; width:8px; height:8px; border-radius:50%; }

/* Area filter chips (Board tab) */
.mt-area-chips { display:flex; gap:4px; flex-wrap:wrap; }
.mt-area-chip { display:inline-flex; align-items:center; gap:5px; background:var(--bg-input); border:1px solid var(--border); color:var(--text-primary); border-radius:14px; padding:3px 10px; font-size:11px; font-weight:600; cursor:pointer; }
.mt-area-chip:hover { border-color:var(--accent); }
.mt-area-chip.active { border-color:transparent; }

/* Area pill (used in cards/rows to show task area) */
.mt-area-pill { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:10px; font-size:10px; font-weight:600; }

/* 6-column Board */
.mt-kanban-5 .mt-kanban-col { min-width:200px; }
.mt-kanban-5 .mt-kanban-col[data-column="inbox"] .mt-kanban-header { color:#9b59b6; }
.mt-kanban-5 .mt-kanban-col[data-column="today"] .mt-kanban-header { color:#f5b731; }
.mt-kanban-5 .mt-kanban-col[data-column="today"] { background:rgba(245,183,49,0.04); box-shadow:inset 0 0 0 1px rgba(245,183,49,0.18); }
.mt-kanban-5 .mt-kanban-col[data-column="todo"] .mt-kanban-header { color:var(--text-primary); }
.mt-kanban-5 .mt-kanban-col[data-column="in_progress"] .mt-kanban-header { color:#3498db; }
.mt-kanban-5 .mt-kanban-col[data-column="waiting_on"] .mt-kanban-header { color:#e67e22; }
.mt-kanban-5 .mt-kanban-col[data-column="done"] .mt-kanban-header { color:#27ae60; }
.mt-card-today-btn { background:transparent; border:1px solid var(--border); color:var(--text-muted); border-radius:10px; padding:1px 7px; font-size:9px; font-weight:700; cursor:pointer; letter-spacing:0.3px; }
.mt-card-today-btn:hover { color:#f5b731; border-color:#f5b731; }
.mt-card-today-btn-active { background:rgba(245,183,49,0.15); border-color:#f5b731; color:#f5b731; }
.mt-tab.mt-drag-over { background:rgba(245,183,49,0.15); border-bottom-color:#f5b731 !important; }

/* Card Edit button */
.mt-card-edit-btn { background:transparent; border:1px solid var(--border); color:var(--text-muted); border-radius:10px; padding:1px 6px; font-size:11px; cursor:pointer; line-height:1; margin-left:4px; }
.mt-card-edit-btn:hover { color:var(--accent); border-color:var(--accent); }

/* Board wrap with side-scroll buttons */
.mt-board-wrap { position:relative; }
.mt-scroll-btn { position:absolute; top:50%; transform:translateY(-50%); z-index:5; background:var(--bg-card); border:1px solid var(--border); color:var(--text-primary); width:30px; height:60px; cursor:pointer; font-size:22px; font-weight:700; border-radius:6px; opacity:0.5; transition:opacity 0.15s; padding:0; line-height:60px; }
.mt-scroll-btn:hover { opacity:1; }
.mt-scroll-left { left:6px; }
.mt-scroll-right { right:6px; }

/* Column header drag/grip + delete */
.mt-kanban-header { cursor:grab; padding:10px 12px 8px; display:flex; align-items:center; gap:6px; }
.mt-kanban-header:active { cursor:grabbing; }
.mt-col-grip { color:var(--text-muted); font-size:14px; line-height:1; user-select:none; }
.mt-col-label { flex:1; }
.mt-col-del { background:transparent; border:none; color:var(--text-muted); font-size:11px; cursor:pointer; padding:2px 6px; border-radius:4px; }
.mt-col-del:hover { color:#e74c3c; background:rgba(231,76,60,0.1); }
.mt-kanban-col.mt-col-drag-over { background:rgba(0,210,211,0.08); box-shadow:inset 0 0 0 2px var(--accent); }

/* Column resize handle on right edge */
.mt-kanban-col { position:relative; }
.mt-col-resize { position:absolute; top:0; right:0; bottom:0; width:6px; cursor:col-resize; z-index:2; }
.mt-col-resize:hover { background:var(--accent); opacity:0.4; }

/* Add Column / Reset cluster at the end of the kanban */
.mt-kanban-add-col { display:flex; flex-direction:column; gap:6px; padding:10px 8px; flex-shrink:0; min-width:140px; }
.mt-add-col-btn { background:transparent; border:1px dashed var(--border); color:var(--text-muted); border-radius:8px; padding:8px 10px; font-size:12px; font-weight:600; cursor:pointer; }
.mt-add-col-btn:hover { color:var(--accent); border-color:var(--accent); }
.mt-reset-col-btn { background:transparent; border:none; color:var(--text-muted); font-size:11px; cursor:pointer; padding:4px; }
.mt-reset-col-btn:hover { color:var(--text-primary); }

/* Add Column form sheet */
#mt-col-sheet { position:absolute; inset:0; display:flex; align-items:flex-end; z-index:200; }
#mt-col-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
#mt-col-panel { position:relative; width:100%; max-width:480px; margin:0 auto; max-height:90vh; background:var(--bg-secondary); border-top:1px solid var(--border); border-radius:16px 16px 0 0; padding:20px; overflow-y:auto; z-index:201; box-shadow:0 -4px 24px rgba(0,0,0,0.4); }
#mt-col-panel input { width:100%; box-sizing:border-box; }
.mt-wip-warn { background:rgba(231,126,34,0.25) !important; color:#e67e22 !important; }
.mt-kanban-col.mt-wip-over { box-shadow:inset 0 0 0 1px rgba(231,126,34,0.4); }
.mt-kanban-header { display:flex; justify-content:space-between; align-items:center; }
.mt-kanban-card-deleg { font-size:10px; color:#e67e22; margin-top:3px; }
.mt-kanban-card-due { font-size:10px; color:var(--text-muted); margin-top:3px; }
.mt-kanban-card-due.mt-due-soon { color:#e74c3c; font-weight:600; }
.mt-kanban-card-time { font-size:10px; color:var(--text-muted); margin-top:3px; }
.mt-deleg-tag { font-size:10px; color:#e67e22; font-weight:500; margin-left:6px; }

/* Today view — three columns */
.mt-today { display:grid; grid-template-columns:2fr 1fr 1fr; gap:12px; padding:12px; min-height:400px; }
.mt-today-col { background:var(--bg-secondary); border-radius:10px; display:flex; flex-direction:column; padding:0; overflow:hidden; }
.mt-today-header { padding:10px 12px; font-size:13px; font-weight:700; color:var(--text-primary); border-bottom:1px solid var(--border); background:var(--bg-card); display:flex; align-items:center; gap:6px; }
.mt-today-empty { padding:16px 12px; color:var(--text-muted); font-size:12px; text-align:center; }
.mt-today-item { display:flex; align-items:flex-start; gap:8px; padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; }
.mt-today-item:hover { background:rgba(255,255,255,0.03); }
.mt-today-time { font-size:11px; font-weight:700; color:var(--text-muted); min-width:50px; padding-top:2px; }
.mt-today-body { display:flex; align-items:center; gap:6px; flex-wrap:wrap; flex:1; }
.mt-today-title { font-size:12px; font-weight:600; color:var(--text-primary); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }

/* Delegated view */
.mt-deleg-list { display:flex; flex-direction:column; }
.mt-deleg-row { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; }
.mt-deleg-row:hover { background:rgba(255,255,255,0.03); }
.mt-deleg-to { font-size:11px; color:#e67e22; font-weight:600; min-width:120px; }
.mt-deleg-title { font-size:12px; font-weight:600; color:var(--text-primary); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
.mt-deleg-stale { font-size:11px; color:var(--text-muted); }
.mt-nudge-btn { background:#e67e22; color:#fff; border:none; border-radius:4px; padding:3px 10px; font-size:11px; font-weight:600; cursor:pointer; }
.mt-nudge-btn:hover { opacity:0.9; }

/* Inline edit grid (in expand panel) */
.mt-edit-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:8px; margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.mt-edit-grid label { display:flex; flex-direction:column; gap:3px; font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; }
.mt-edit-grid label .ph-sel, .mt-edit-grid label input, .mt-edit-grid label select { font-size:12px; padding:4px 6px; text-transform:none; letter-spacing:normal; font-weight:400; color:var(--text-primary); }

.mt-add-btn-small { background:transparent; border:1px dashed var(--border); color:var(--text-muted); border-radius:4px; padding:3px 8px; font-size:11px; cursor:pointer; }
.mt-add-btn-small:hover { color:var(--accent); border-color:var(--accent); }

@media (max-width:900px) {
    .mt-today { grid-template-columns:1fr; }
}

/* Add Task form sheet */
#mt-add-sheet, #mt-proj-sheet { position:absolute; inset:0; display:flex; align-items:flex-end; z-index:200; }
#mt-add-backdrop, #mt-proj-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
#mt-add-panel, #mt-proj-panel { position:relative; width:100%; max-width:640px; margin:0 auto; max-height:90vh; background:var(--bg-secondary); border-top:1px solid var(--border); border-radius:16px 16px 0 0; padding:20px; overflow-y:auto; z-index:201; box-shadow:0 -4px 24px rgba(0,0,0,0.4); }
#mt-proj-panel input[type="date"], #mt-proj-panel input[type="text"], #mt-proj-panel select, #mt-proj-panel textarea { width:100%; box-sizing:border-box; }
.mt-f-row { display:flex; gap:10px; flex-wrap:wrap; }
.mt-f-row .ae-field { min-width:120px; }
#mt-add-panel input[type="date"], #mt-add-panel input[type="datetime-local"], #mt-add-panel input[type="number"], #mt-add-panel input[type="text"], #mt-add-panel select, #mt-add-panel textarea { width:100%; box-sizing:border-box; }

/* Form Panels (Health, Insurance) */
#health-form-sheet, #insurance-form-sheet { position:absolute; inset:0; display:flex; align-items:flex-end; z-index:200; }
#health-form-backdrop, #insurance-form-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
.form-panel { position:relative; width:100%; max-width:600px; margin:0 auto; max-height:85vh; background:var(--bg-secondary); border-top:1px solid var(--border); border-radius:16px 16px 0 0; display:flex; flex-direction:column; box-shadow:0 -4px 24px rgba(0,0,0,0.4); }
.form-scroll { overflow-y:auto; padding:12px 16px 20px; flex:1; }

/* Notes Spreadsheet */
.notes-sheet { display:flex; flex-direction:column; }
.notes-sheet-head { display:flex; background:var(--bg-secondary); border-bottom:2px solid var(--border); position:sticky; top:0; z-index:1; }
.notes-sh { padding:5px 8px; font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; flex-shrink:0; }
.notes-sheet-row { display:flex; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; align-items:center; }
.notes-sheet-row:hover { background:rgba(255,255,255,0.03); }
.notes-sc { padding:5px 8px; font-size:12px; color:var(--text-primary); flex-shrink:0; }
.notes-expand { background:var(--bg-card); border-left:3px solid var(--accent); border-bottom:1px solid var(--border); animation:cdExpandIn 0.15s ease-out; }

/* Dashboard */
.dash-greeting { font-size:20px; font-weight:600; color:var(--text-primary); margin-bottom:16px; font-family:var(--font-mono); }
.dash-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:10px; margin-bottom:20px; }
.dash-stat { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:14px 12px; text-align:center; cursor:pointer; transition:border-color 0.15s, transform 0.1s; }
.dash-stat:hover { border-color:var(--accent); transform:translateY(-1px); }
.dash-stat-num { font-size:28px; font-weight:700; color:var(--accent); font-family:var(--font-mono); line-height:1; }
.dash-stat-label { font-size:11px; color:var(--text-muted); margin-top:4px; text-transform:uppercase; letter-spacing:0.5px; }
.dash-columns { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:16px; }
@media (max-width:700px) { .dash-columns { grid-template-columns:1fr; } }
.dash-col { min-width:0; }
.dash-section-title { font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:8px; font-weight:600; }
.dash-card { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:10px; max-height:300px; overflow-y:auto; }
.dash-comm-row { display:flex; gap:8px; padding:6px 4px; border-bottom:1px solid rgba(255,255,255,0.04); align-items:flex-start; }
.dash-comm-row:last-child { border-bottom:none; }
.dash-comm-icon { font-size:14px; flex-shrink:0; width:20px; text-align:center; padding-top:2px; }
.dash-comm-body { flex:1; min-width:0; }
.dash-comm-top { display:flex; align-items:baseline; gap:6px; }
.dash-comm-name { font-size:12px; font-weight:600; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-comm-dir { font-size:10px; }
.dash-comm-time { font-size:10px; color:var(--text-muted); margin-left:auto; flex-shrink:0; }
.dash-comm-preview { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.dash-upcoming-group { margin-bottom:10px; }
.dash-upcoming-group:last-child { margin-bottom:0; }
.dash-upcoming-label { font-size:11px; font-weight:600; color:var(--accent); margin-bottom:4px; }
.dash-upcoming-row { display:flex; gap:8px; padding:4px 0; font-size:12px; align-items:baseline; }
.dash-upcoming-text { flex:1; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-upcoming-amt { color:var(--accent); font-weight:600; font-family:var(--font-mono); flex-shrink:0; }
.dash-upcoming-date { color:var(--text-muted); font-size:11px; flex-shrink:0; }
.dash-empty-section { text-align:center; padding:20px; color:var(--text-muted); font-size:12px; }
.dash-quick-actions { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.dash-action { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:10px 16px; color:var(--text-primary); font-size:12px; font-weight:600; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:4px; min-width:70px; transition:border-color 0.15s; }
.dash-action:hover { border-color:var(--accent); }
.dash-action-icon { font-size:18px; }
.dash-empty { text-align:center; padding:40px; color:var(--text-muted); }

/* Text Messages — iMessage style */
.tx-layout { display:flex; height:100%; overflow:hidden; }
.tx-convo-list { width:280px; min-width:280px; border-right:1px solid var(--border); overflow-y:auto; background:var(--bg-primary); }
.tx-convo-search { padding:8px; }
.tx-search-input { width:100%; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:16px; padding:6px 12px; font-size:12px; box-sizing:border-box; }
.tx-search-input:focus { border-color:var(--accent); outline:none; }
.tx-convo-item { display:flex; align-items:center; gap:10px; padding:10px 12px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,0.04); transition:background 0.1s; }
.tx-convo-item:hover { background:rgba(255,255,255,0.04); }
.tx-convo-item.active { background:var(--accent); background:rgba(100,200,255,0.12); }
.tx-avatar { width:36px; height:36px; border-radius:50%; background:var(--accent); color:var(--bg-primary); display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:bold; flex-shrink:0; }
.tx-avatar-lg { width:32px; height:32px; font-size:13px; }
.tx-convo-body { flex:1; min-width:0; }
.tx-convo-top { display:flex; justify-content:space-between; align-items:baseline; gap:6px; }
.tx-convo-name { font-size:13px; font-weight:600; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tx-convo-date { font-size:10px; color:var(--text-muted); white-space:nowrap; flex-shrink:0; }
.tx-convo-preview { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.tx-thread { flex:1; display:flex; flex-direction:column; overflow:hidden; background:var(--bg-primary); }
.tx-thread-header { display:flex; align-items:center; gap:10px; padding:10px 16px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; }
.tx-thread-info { min-width:0; }
.tx-thread-name { font-size:14px; font-weight:600; color:var(--text-primary); }
.tx-thread-phone { font-size:11px; color:var(--text-muted); }
.tx-msg-count { font-size:11px; color:var(--text-muted); flex-shrink:0; }
.tx-messages { flex:1; overflow-y:auto; padding:12px 16px; display:flex; flex-direction:column; gap:4px; }
.tx-date-sep { text-align:center; font-size:10px; color:var(--text-muted); padding:8px 0 4px; }
.tx-bwrap { display:flex; }
.tx-bwrap.out { justify-content:flex-end; }
.tx-bwrap.in { justify-content:flex-start; }
.tx-bubble { max-width:70%; border-radius:16px; padding:8px 12px; position:relative; }
.tx-b-out { background:#1982FC; color:white; border-bottom-right-radius:4px; }
.tx-b-in { background:var(--bg-secondary); color:var(--text-primary); border:1px solid var(--border); border-bottom-left-radius:4px; }
.tx-b-text { font-size:13px; line-height:1.4; white-space:pre-wrap; word-break:break-word; }
.tx-b-time { font-size:9px; opacity:0.6; text-align:right; margin-top:2px; }
.tx-compose { display:flex; gap:8px; padding:8px 12px; background:var(--bg-secondary); border-top:1px solid var(--border); flex-shrink:0; }
.tx-compose-input { flex:1; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:18px; padding:8px 14px; font-size:13px; }
.tx-compose-input:focus { border-color:var(--accent); outline:none; }
.tx-send-btn { background:var(--accent); color:white; border:none; border-radius:18px; padding:8px 16px; font-size:12px; font-weight:bold; cursor:pointer; }
.tx-send-btn:hover { opacity:0.9; }
.tx-empty { text-align:center; padding:40px 20px; color:var(--text-muted); font-size:13px; }
.tx-folder-bar { display:flex; gap:2px; padding:6px 8px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-wrap:wrap; align-items:center; }
.tx-folder-tab { background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:12px; padding:3px 10px; font-size:11px; cursor:pointer; }
.tx-folder-tab:hover { background:rgba(255,255,255,0.05); }
.tx-folder-tab.active { background:var(--accent); color:white; border-color:var(--accent); }
.tx-folder-add { background:transparent; color:var(--text-muted); border:1px dashed var(--border); border-radius:12px; padding:3px 8px; font-size:11px; cursor:pointer; }
.tx-folder-add:hover { color:var(--text-primary); border-color:var(--text-muted); }
.tx-hdr-btn { background:transparent; border:1px solid var(--border); color:var(--text-muted); border-radius:6px; padding:4px 8px; font-size:12px; cursor:pointer; }
.tx-hdr-btn:hover { background:var(--bg-input); color:var(--text-primary); }
.tx-hdr-del:hover { color:#e74c3c; border-color:#e74c3c; }
.tx-msg-del { background:transparent; border:none; color:var(--text-muted); font-size:10px; cursor:pointer; opacity:0; padding:2px 4px; align-self:center; }
.tx-bwrap:hover .tx-msg-del { opacity:0.5; }
.tx-msg-del:hover { opacity:1 !important; color:#e74c3c; }
.tx-bwrap { align-items:flex-end; }

/* ── Slack App ───────────────────────────────────────────────────────── */
.sl-layout { display:flex; height:100%; overflow:hidden; }
.sl-channel-list { width:260px; min-width:260px; border-right:1px solid var(--border); overflow-y:auto; background:var(--bg-primary); }
.sl-ch-search { padding:8px; }
.sl-search-input { width:100%; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:16px; padding:6px 12px; font-size:12px; box-sizing:border-box; }
.sl-search-input:focus { border-color:var(--accent); outline:none; }
.sl-ch-section { font-size:10px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; padding:12px 12px 4px; }
.sl-ch-item { display:flex; align-items:center; gap:8px; padding:7px 12px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,0.03); transition:background 0.1s; font-size:13px; }
.sl-ch-item:hover { background:rgba(255,255,255,0.04); }
.sl-ch-item.active { background:rgba(100,200,255,0.12); }
.sl-ch-item.sl-dragging { opacity:0.4; }
.sl-ch-item.sl-drag-over { border-top:2px solid var(--accent); background:rgba(0,200,150,0.08); }
.sl-ch-drag { cursor:grab; color:var(--text-muted); font-size:10px; opacity:0.3; flex-shrink:0; }
.sl-ch-item:hover .sl-ch-drag { opacity:0.8; }
.sl-group-header.sl-drag-over { background:rgba(0,200,150,0.15); border-radius:4px; }
.sl-ch-icon { font-size:14px; width:20px; text-align:center; flex-shrink:0; color:var(--text-muted); }
.sl-ch-name { flex:1; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sl-ch-members { font-size:10px; color:var(--text-muted); flex-shrink:0; }
.sl-thread { flex:1; display:flex; flex-direction:column; overflow:hidden; background:var(--bg-primary); }
.sl-thread-header { display:flex; align-items:center; gap:10px; padding:10px 16px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; }
.sl-thread-info { min-width:0; }
.sl-thread-name { font-size:14px; font-weight:600; color:var(--text-primary); }
.sl-thread-preview { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:300px; }
.sl-msg-count { font-size:11px; color:var(--text-muted); flex-shrink:0; }
.sl-messages { flex:1; overflow-y:auto; padding:12px 16px; display:flex; flex-direction:column; gap:2px; }
.sl-date-sep { text-align:center; font-size:10px; color:var(--text-muted); padding:8px 0 4px; }
.sl-bwrap { display:flex; align-items:flex-start; gap:8px; padding:4px 0; }
.sl-bwrap.sl-me .sl-avatar { background:#4a154b; }
.sl-avatar { width:32px; height:32px; border-radius:6px; background:var(--accent); color:white; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:bold; flex-shrink:0; }
.sl-msg-body { flex:1; min-width:0; }
.sl-msg-header { display:flex; align-items:baseline; gap:8px; margin-bottom:2px; }
.sl-msg-name { font-size:12px; font-weight:700; color:var(--text-primary); }
.sl-msg-time { font-size:10px; color:var(--text-muted); }
.sl-msg-text { font-size:13px; line-height:1.45; color:var(--text-primary); white-space:pre-wrap; word-break:break-word; }
.sl-mention { background:rgba(100,200,255,0.15); color:var(--accent); padding:0 3px; border-radius:3px; font-weight:600; }
.sl-link { color:var(--accent); text-decoration:underline; }
.sl-code { background:var(--bg-secondary); padding:1px 4px; border-radius:3px; font-family:var(--font-mono); font-size:12px; border:1px solid var(--border); }
.sl-thread-btn { background:transparent; border:none; color:var(--accent); font-size:11px; cursor:pointer; padding:2px 0; margin-top:2px; }
.sl-thread-btn:hover { text-decoration:underline; }
.sl-thread-start { color:var(--text-muted); }
.sl-thread-start:hover { color:var(--accent); }
.sl-compose { display:flex; gap:8px; padding:8px 12px; background:var(--bg-secondary); border-top:1px solid var(--border); flex-shrink:0; }
.sl-compose-input { flex:1; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:18px; padding:8px 14px; font-size:13px; }
.sl-compose-input:focus { border-color:var(--accent); outline:none; }
.sl-send-btn { background:#4a154b; color:white; border:none; border-radius:18px; padding:8px 16px; font-size:12px; font-weight:bold; cursor:pointer; }
.sl-send-btn:hover { background:#611f69; }
.sl-back-thread { background:transparent; border:none; color:var(--text-primary); font-size:18px; cursor:pointer; padding:2px 6px; }
.sl-back-thread:hover { color:var(--accent); }
.sl-empty { text-align:center; padding:40px 20px; color:var(--text-muted); font-size:13px; }
/* Slack groups & archive */
.sl-group-bar { display:flex; gap:2px; padding:6px 8px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-wrap:wrap; align-items:center; }
.sl-group-tab { background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:12px; padding:3px 10px; font-size:11px; cursor:pointer; }
.sl-group-tab:hover { background:rgba(255,255,255,0.05); }
.sl-group-tab.active { background:var(--accent); color:white; border-color:var(--accent); }
.sl-group-add { background:transparent; color:var(--text-muted); border:1px dashed var(--border); border-radius:12px; padding:3px 8px; font-size:11px; cursor:pointer; }
.sl-group-add:hover { color:var(--text-primary); border-color:var(--text-muted); }
.sl-group-header { display:flex; align-items:center; gap:6px; padding:8px 12px; cursor:pointer; background:var(--bg-secondary); border-bottom:1px solid rgba(255,255,255,0.04); user-select:none; }
.sl-group-header:hover { background:rgba(255,255,255,0.06); }
.sl-group-del { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:10px; opacity:0; padding:2px 4px; margin-left:auto; transition:opacity 0.15s; }
.sl-group-header:hover .sl-group-del { opacity:0.5; }
.sl-group-del:hover { opacity:1 !important; color:var(--error); }
.sl-add-section { padding:10px 12px; color:var(--text-muted); font-size:12px; cursor:pointer; border-top:1px solid rgba(255,255,255,0.04); transition:color 0.15s; }
.sl-add-section:hover { color:var(--accent); }
.sl-group-arrow { font-size:9px; color:var(--text-muted); width:12px; text-align:center; }
.sl-group-name { font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; flex:1; }
.sl-group-count { font-size:10px; color:var(--text-muted); background:rgba(255,255,255,0.06); padding:1px 6px; border-radius:8px; }
.sl-ch-archived { opacity:0.5; }
.sl-ctx-menu { position:fixed; z-index:9999; background:var(--bg-secondary); border:1px solid var(--border); border-radius:8px; padding:4px 0; min-width:160px; box-shadow:0 4px 16px rgba(0,0,0,0.4); }
.sl-ctx-label { font-size:10px; font-weight:700; color:var(--text-muted); text-transform:uppercase; padding:6px 12px 2px; letter-spacing:0.5px; }
.sl-ctx-item { padding:6px 12px; font-size:12px; color:var(--text-primary); cursor:pointer; }
.sl-ctx-item:hover { background:rgba(100,200,255,0.12); }
.sl-ctx-archive { color:#e74c3c; }
.sl-ctx-archive:hover { background:rgba(231,76,60,0.15); }
.sl-ctx-divider { height:1px; background:var(--border); margin:4px 0; }

.ct-inline { width:100%; background:transparent; color:var(--text-primary); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:12px; box-sizing:border-box; }
.ct-inline:hover { border-color:var(--border); }
.ct-inline:focus { border-color:var(--accent); background:var(--bg-input); outline:none; }
.ct-inline-sel { width:100%; background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:11px; cursor:pointer; }
.ct-inline-sel:hover { border-color:var(--border); background:var(--bg-input); }
.ct-inline-sel:focus { border-color:var(--accent); background:var(--bg-input); color:var(--text-primary); outline:none; }

/* Column resize handle (shared across all spreadsheets) */
.col-resize-handle { position:absolute; right:-4px; top:0; bottom:0; width:12px; cursor:col-resize; background:transparent; z-index:10; }
.col-resize-handle:hover::after { content:''; position:absolute; left:5px; top:2px; bottom:2px; width:2px; background:var(--accent); }
.col-resize-handle:active::after { content:''; position:absolute; left:5px; top:2px; bottom:2px; width:2px; background:var(--accent); }

/* Sortable header cells */
.ct-table-header > div, .txn-table-header > div, .comms-table-header > div, .kb-header-row > div, .doc-list-header > div { cursor:pointer; user-select:none; position:relative; }
.ct-table-header > div:hover, .txn-table-header > div:hover, .doc-list-header > div:hover { color:var(--accent); }

.contacts-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

.contact-row {
    display: flex;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.contact-row:hover {
    background: var(--bg-card);
}

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

.contact-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.contact-role-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.contact-role-badge.contractor {
    background: rgba(0, 200, 150, 0.15);
    color: var(--accent);
    font-weight: bold;
}

.contact-specialty {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

.contact-sub {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Contact detail */
#contacts-detail {
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.contact-detail-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-detail-section {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.contact-detail-section.full {
    flex-direction: column;
    gap: 4px;
}

.contact-detail-section label {
    color: var(--text-muted);
    font-size: 12px;
    min-width: 80px;
    flex-shrink: 0;
}

.contact-detail-section span {
    color: var(--text-primary);
    font-size: 13px;
}

.contact-specialty-value {
    color: var(--accent) !important;
    font-weight: 500;
}

.contact-notes {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.contact-linked-item {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.contact-detail-actions {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* Contact form sheet */
#contact-form-sheet {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    z-index: 200;
}

#contact-form-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

#contact-form-panel {
    position: relative;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 201;
}

.cf-checkbox-group {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.cf-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.cf-checkbox-group input[type="checkbox"] {
    accent-color: var(--accent);
}

/* === PROPERTIES APP === */

#props-toolbar {
    display: flex; align-items: center; padding: 10px 14px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    flex-shrink: 0; gap: 12px;
}
#props-toolbar-title { flex: 1; font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); letter-spacing: 0.5px; }
#props-add-btn { background: var(--accent); color: white; border: none; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: bold; cursor: pointer; }

#props-type-tabs { display: flex; gap: 6px; padding: 6px 12px; background: var(--bg-primary); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.props-tab { flex-shrink: 0; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-family: var(--font-mono); cursor: pointer; background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); transition: background 0.15s, color 0.15s; }
.props-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#props-search-bar { padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
#props-search { width: 100%; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; box-sizing: border-box; }

#props-list { flex: 1; overflow-y: auto; }
#props-detail { flex-direction: column; flex: 1; overflow-y: auto; }

.prop-row { display: flex; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.prop-row:hover { background: var(--bg-card); }
.prop-row-main { flex: 1; min-width: 0; }
.prop-row-header { display: flex; align-items: center; gap: 8px; }
.prop-address { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.prop-type-badge { font-size: 11px; padding: 1px 8px; border-radius: 8px; font-family: var(--font-mono); flex-shrink: 0; }
.prop-type-badge.rental { background: rgba(0,150,255,0.15); color: #4da6ff; }
.prop-type-badge.development { background: rgba(255,150,0,0.15); color: #ffa64d; }
.prop-type-badge.raw_land { background: rgba(139,90,43,0.15); color: #b5854a; }
.prop-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 12px; }
.prop-mortgage { color: var(--text-muted); }

/* Property detail */
.prop-detail-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.prop-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.prop-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; color: var(--accent); font-weight: bold; }
.prop-section-btn { background: none; border: 1px solid var(--accent); color: var(--accent); padding: 3px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.prop-section-btn:hover { background: var(--accent); color: white; }
.prop-empty-section { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.prop-linked-item { font-size: 12px; color: var(--text-secondary); padding: 4px 0; border-bottom: 1px solid var(--border); }

.prop-linked-contact { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--border); font-size:13px; }
.prop-lc-name { font-weight:500; color:var(--text-primary); }
.prop-lc-role { font-size:11px; padding:1px 6px; border-radius:6px; background:var(--bg-input); color:var(--accent); font-family:var(--font-mono); }
.prop-lc-info { font-size:11px; color:var(--text-muted); margin-left:auto; }
.prop-lc-remove { background:none; border:none; color:var(--text-muted); cursor:pointer; opacity:0.4; font-size:12px; padding:0 4px; }
.prop-lc-remove:hover { opacity:1; color:var(--error); }

.prop-lease-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.prop-lease-info { display: flex; justify-content: space-between; align-items: center; }
.prop-lease-tenant { font-weight: 500; color: var(--text-primary); font-size: 13px; }
.prop-lease-rent { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.prop-lease-meta { display: flex; gap: 10px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--text-muted); }

/* Property/Lease form sheets */
#prop-form-sheet, #lease-form-sheet { position: absolute; inset: 0; display: flex; align-items: flex-end; z-index: 200; }
#prop-form-backdrop, #lease-form-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
#prop-form-panel, #lease-form-panel { position: relative; width: 100%; background: var(--bg-secondary); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 20px; max-height: 85vh; overflow-y: auto; z-index: 201; }

/* === LEASES APP (RENT ROLL) === */

#leases-toolbar { display: flex; align-items: center; padding: 10px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 12px; }
#leases-toolbar-title { flex: 1; font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); letter-spacing: 0.5px; }

.lease-summary-bar { display: flex; padding: 12px 14px; gap: 0; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.lease-summary-item { flex: 1; text-align: center; }
.lease-summary-value { display: block; font-size: 18px; font-weight: bold; color: var(--text-primary); font-family: var(--font-mono); }
.lease-summary-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.lease-summary-item.warning .lease-summary-value { color: var(--warning); }

#leases-status-tabs { display: flex; gap: 6px; padding: 6px 12px; background: var(--bg-primary); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.leases-tab { flex-shrink: 0; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-family: var(--font-mono); cursor: pointer; background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); transition: background 0.15s, color 0.15s; }
.leases-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#leases-list { flex: 1; overflow-y: auto; }

.lease-row { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.lease-row.expiring-soon { border-left: 3px solid var(--warning); }
.lease-row-main { }
.lease-row-header { display: flex; justify-content: space-between; align-items: center; }
.lease-tenant-name { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.lease-rent { color: var(--accent); font-family: var(--font-mono); font-size: 14px; font-weight: bold; }
.lease-row-address { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lease-row-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.lease-status-badge { font-size: 11px; padding: 1px 8px; border-radius: 8px; font-family: var(--font-mono); }
.lease-status-badge.active { background: rgba(0,200,150,0.15); color: var(--success); }
.lease-status-badge.expired { background: rgba(255,68,68,0.15); color: var(--error); }
.lease-status-badge.pending_renewal { background: rgba(245,183,49,0.15); color: var(--warning); }

.lease-end-date { font-size: 12px; color: var(--text-muted); }
.lease-end-date.warning { color: var(--warning); font-weight: 500; }

/* === BILLS APP === */

#bills-toolbar { display: flex; align-items: center; padding: 10px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 12px; }
#bills-toolbar-title { flex: 1; font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); letter-spacing: 0.5px; }
#bills-add-btn { background: var(--accent); color: white; border: none; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: bold; cursor: pointer; }

#bills-cat-tabs { display: flex; gap: 6px; padding: 6px 12px; background: var(--bg-primary); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.bills-cat-tab { flex-shrink: 0; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-family: var(--font-mono); cursor: pointer; background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); transition: background 0.15s, color 0.15s; }
.bills-cat-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#bills-filters { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
#bills-status-select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; font-family: var(--font-mono); }
#bills-search { flex: 1; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; }

#bills-list { flex: 1; overflow-y: auto; }
#bills-detail { flex-direction: column; flex: 1; overflow-y: auto; }

.bill-row { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.bill-row:hover { background: var(--bg-card); }
.bill-row-header { display: flex; justify-content: space-between; align-items: center; }
.bill-name { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.bill-amount { color: var(--accent); font-family: var(--font-mono); font-size: 14px; font-weight: bold; }
.bill-row-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.bill-status-badge { font-size: 11px; padding: 1px 8px; border-radius: 8px; font-family: var(--font-mono); }
.bill-status-badge.upcoming { background: rgba(0,180,255,0.15); color: #4da6ff; }
.bill-status-badge.due { background: rgba(245,183,49,0.15); color: var(--warning); }
.bill-status-badge.overdue { background: rgba(255,68,68,0.15); color: var(--error); }
.bill-status-badge.paid { background: rgba(0,200,150,0.15); color: var(--success); }
.bill-autopay { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(0,200,150,0.1); color: var(--success); font-family: var(--font-mono); }
.bill-due-date { font-size: 12px; color: var(--text-muted); }
.bill-category { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.bill-property { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

#bill-form-sheet { position: absolute; inset: 0; display: flex; align-items: flex-end; z-index: 200; }
#bill-form-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
#bill-form-panel { position: relative; width: 100%; background: var(--bg-secondary); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 20px; max-height: 85vh; overflow-y: auto; z-index: 201; }

/* === DELEGATIONS APP === */

#deleg-toolbar { display: flex; align-items: center; padding: 10px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 12px; }
#deleg-toolbar-title { flex: 1; font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); letter-spacing: 0.5px; }
#deleg-add-btn { background: var(--accent); color: white; border: none; padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: bold; cursor: pointer; }

#deleg-domain-tabs { display: flex; gap: 6px; padding: 6px 12px; background: var(--bg-primary); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.deleg-domain-tab { flex-shrink: 0; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-family: var(--font-mono); cursor: pointer; background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); transition: background 0.15s, color 0.15s; }
.deleg-domain-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

#deleg-filters { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
#deleg-status-select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; font-family: var(--font-mono); }
#deleg-search { flex: 1; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; }

#deleg-list { flex: 1; overflow-y: auto; }
#deleg-detail { flex-direction: column; flex: 1; overflow-y: auto; }

.deleg-row { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.deleg-row:hover { background: var(--bg-card); }
.deleg-row.overdue { border-left: 3px solid var(--error); }
.deleg-row-header { display: flex; align-items: center; gap: 8px; }
.deleg-desc { font-weight: 500; color: var(--text-primary); font-size: 13px; flex: 1; }
.deleg-row-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

.deleg-status-badge { font-size: 11px; padding: 1px 8px; border-radius: 8px; font-family: var(--font-mono); }
.deleg-status-badge.assigned { background: rgba(0,180,255,0.15); color: #4da6ff; }
.deleg-status-badge.in_progress { background: rgba(245,183,49,0.15); color: var(--warning); }
.deleg-status-badge.waiting { background: rgba(160,160,160,0.15); color: var(--text-muted); }
.deleg-status-badge.overdue { background: rgba(255,68,68,0.15); color: var(--error); }
.deleg-status-badge.complete { background: rgba(0,200,150,0.15); color: var(--success); }

.deleg-priority-badge { font-size: 11px; padding: 1px 8px; border-radius: 8px; font-family: var(--font-mono); }
.deleg-priority-badge.urgent { background: rgba(255,68,68,0.2); color: var(--error); font-weight: bold; }
.deleg-priority-badge.high { background: rgba(245,183,49,0.2); color: var(--warning); }
.deleg-priority-badge.normal { background: var(--bg-input); color: var(--text-muted); }
.deleg-priority-badge.low { background: var(--bg-input); color: var(--text-muted); }

.deleg-assignee { font-size: 12px; color: var(--text-secondary); }
.deleg-due { font-size: 12px; color: var(--text-muted); }
.deleg-due.overdue { color: var(--error); font-weight: 500; }
.deleg-domain-label { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.deleg-followup-item { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.deleg-fu-date { color: var(--text-muted); font-family: var(--font-mono); }
.deleg-fu-method { color: var(--accent); margin-left: 6px; }
.deleg-fu-response { color: var(--text-secondary); margin-top: 2px; }

#deleg-form-sheet { position: absolute; inset: 0; display: flex; align-items: flex-end; z-index: 200; }
#deleg-form-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
#deleg-form-panel { position: relative; width: 100%; background: var(--bg-secondary); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 20px; max-height: 85vh; overflow-y: auto; z-index: 201; }

/* === HIRING APP === */
#hiring-toolbar, #mktg-toolbar, #proj-toolbar, #notes-toolbar { display:flex; align-items:center; padding:10px 14px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; gap:12px; }
#hiring-toolbar-title, #mktg-toolbar-title, #proj-toolbar-title, #notes-toolbar-title { flex:1; font-family:var(--font-mono); font-size:15px; color:var(--text-primary); letter-spacing:0.5px; }
#hiring-add-btn, #mktg-add-btn, #proj-add-btn, #notes-add-btn { background:var(--accent); color:white; border:none; padding:5px 14px; border-radius:6px; font-size:13px; font-weight:bold; cursor:pointer; }

#hiring-stage-tabs, #mktg-status-tabs, #proj-status-tabs, #notes-domain-tabs { display:flex; gap:6px; padding:6px 12px; background:var(--bg-primary); border-bottom:1px solid var(--border); flex-shrink:0; overflow-x:auto; scrollbar-width:none; }
#hiring-stage-tabs::-webkit-scrollbar, #mktg-status-tabs::-webkit-scrollbar, #proj-status-tabs::-webkit-scrollbar { display:none; }
.hiring-stage-tab, .mktg-tab, .proj-tab, .notes-tab { flex-shrink:0; padding:4px 12px; border-radius:12px; font-size:13px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.hiring-stage-tab.active, .mktg-tab.active, .proj-tab.active, .notes-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

#hiring-search-bar, #mktg-search-bar, #proj-search-bar, #notes-search-bar { padding:8px 12px; border-bottom:1px solid var(--border); flex-shrink:0; }
#hiring-list, #mktg-list, #proj-list, #notes-list { flex:1; overflow-y:auto; }
#hiring-detail, #mktg-detail, #proj-detail, #notes-detail { flex-direction:column; flex:1; overflow-y:auto; }

/* Hiring rows */
.hiring-row { padding:12px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.hiring-row:hover { background:var(--bg-card); }
.hiring-row-header { display:flex; justify-content:space-between; align-items:center; }
.hiring-candidate { font-weight:500; color:var(--text-primary); font-size:14px; }
.hiring-role { font-size:12px; color:var(--accent); font-family:var(--font-mono); margin-top:2px; }
.hiring-row-meta { display:flex; gap:8px; margin-top:3px; font-size:12px; color:var(--text-muted); }
.hiring-source { font-family:var(--font-mono); }

.hiring-stage-badge { font-size:11px; padding:1px 8px; border-radius:8px; font-family:var(--font-mono); }
.hiring-stage-badge.applied { background:rgba(0,180,255,0.15); color:#4da6ff; }
.hiring-stage-badge.screened { background:rgba(0,200,150,0.15); color:var(--success); }
.hiring-stage-badge.phone_interview { background:rgba(245,183,49,0.15); color:var(--warning); }
.hiring-stage-badge.in_person { background:rgba(180,100,255,0.15); color:#b464ff; }
.hiring-stage-badge.offer_sent { background:rgba(0,200,150,0.2); color:var(--success); font-weight:bold; }
.hiring-stage-badge.accepted { background:rgba(0,200,150,0.3); color:var(--success); font-weight:bold; }
.hiring-stage-badge.rejected { background:rgba(255,68,68,0.15); color:var(--error); }

/* Marketing rows */
.mktg-row { padding:12px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.mktg-row:hover { background:var(--bg-card); }
.mktg-row-header { display:flex; justify-content:space-between; align-items:center; }
.mktg-name { font-weight:500; color:var(--text-primary); font-size:14px; }
.mktg-row-meta { display:flex; gap:10px; margin-top:3px; font-size:12px; color:var(--text-muted); }
.mktg-type { font-family:var(--font-mono); }
.mktg-status-badge { font-size:11px; padding:1px 8px; border-radius:8px; font-family:var(--font-mono); }
.mktg-status-badge.planning { background:rgba(0,180,255,0.15); color:#4da6ff; }
.mktg-status-badge.active { background:rgba(0,200,150,0.15); color:var(--success); }
.mktg-status-badge.paused { background:rgba(245,183,49,0.15); color:var(--warning); }
.mktg-status-badge.complete { background:rgba(160,160,160,0.15); color:var(--text-muted); }

/* Project rows */
.proj-row { padding:12px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.proj-row:hover { background:var(--bg-card); }
.proj-row-header { display:flex; justify-content:space-between; align-items:center; }
.proj-name { font-weight:500; color:var(--text-primary); font-size:14px; }
.proj-address { font-size:12px; color:var(--text-muted); margin-top:2px; }
.proj-row-meta { display:flex; gap:10px; margin-top:3px; font-size:12px; color:var(--text-muted); }
.proj-status-badge { font-size:11px; padding:1px 8px; border-radius:8px; font-family:var(--font-mono); }
.proj-status-badge.planning { background:rgba(0,180,255,0.15); color:#4da6ff; }
.proj-status-badge.permitting { background:rgba(245,183,49,0.15); color:var(--warning); }
.proj-status-badge.construction { background:rgba(255,150,0,0.15); color:#ffa64d; }
.proj-status-badge.complete { background:rgba(0,200,150,0.15); color:var(--success); }

.proj-milestone { display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px solid var(--border); font-size:12px; color:var(--text-secondary); }
.proj-ms-status { font-family:var(--font-mono); }
.proj-permit { display:flex; gap:10px; padding:4px 0; border-bottom:1px solid var(--border); font-size:12px; color:var(--text-secondary); }

/* Project detail tabs */
.proj-detail-tabs { display:flex; gap:4px; padding:8px 12px; overflow-x:auto; border-bottom:1px solid var(--border); }
.proj-detail-tab { flex-shrink:0; padding:4px 12px; border-radius:12px; font-size:13px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.proj-detail-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.proj-detail-content { flex:1; overflow-y:auto; padding:12px; }

/* Project overview stats */
.proj-overview-stats { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.proj-stat { text-align:center; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:8px 14px; min-width:70px; }
.proj-stat-val { display:block; font-size:18px; font-weight:600; color:var(--text-primary); }
.proj-stat-label { display:block; font-size:11px; color:var(--text-muted); font-family:var(--font-mono); }

/* Project progress bar */
.proj-progress-bar { height:6px; background:var(--bg-input); border-radius:3px; margin-top:4px; overflow:hidden; }
.proj-progress-fill { height:100%; border-radius:3px; transition:width 0.3s; }

/* Project section toolbar */
.proj-section-toolbar { display:flex; gap:8px; align-items:center; padding:8px 0; flex-wrap:wrap; }
.proj-doc-upload-group { display:flex; gap:6px; align-items:center; }
.proj-doc-upload-group select { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:4px 8px; font-size:12px; }
.proj-doc-filter-tabs { display:flex; gap:4px; overflow-x:auto; margin-bottom:8px; }

/* Project permit rows (expandable) */
.proj-permit-row { border-bottom:1px solid var(--border); }
.proj-permit-row-main { display:flex; gap:10px; align-items:center; padding:8px 4px; cursor:pointer; font-size:13px; color:var(--text-secondary); }
.proj-permit-row-main:hover { background:var(--bg-card); }
.proj-permit-type { font-weight:500; color:var(--text-primary); min-width:80px; }
.proj-permit-num { font-family:var(--font-mono); color:var(--text-muted); font-size:12px; }
.proj-permit-expanded { padding:8px 12px 12px; background:var(--bg-card); border-radius:0 0 var(--radius) var(--radius); }
.proj-permit-actions { display:flex; gap:6px; margin-top:8px; }

/* Project fields (label/value) in expanded areas */
.proj-field { display:flex; gap:8px; padding:3px 0; font-size:12px; color:var(--text-secondary); }
.proj-field label { font-weight:500; color:var(--text-muted); min-width:70px; flex-shrink:0; }
.proj-field.full { flex-direction:column; }

/* Project file references */
.proj-file-link { display:inline-block; color:var(--accent); font-size:12px; margin-right:8px; text-decoration:none; }
.proj-file-link:hover { text-decoration:underline; }
.proj-file-count { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); }

/* Document rows */
.proj-doc-row { display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid var(--border); font-size:13px; }
.proj-doc-size { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); }
.proj-doc-date { font-size:11px; color:var(--text-muted); }
.proj-category-badge { font-size:10px; padding:1px 6px; border-radius:6px; background:rgba(0,180,255,0.1); color:var(--accent); font-family:var(--font-mono); }

/* Milestone rows */
.proj-milestone-row { display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid var(--border); font-size:13px; color:var(--text-secondary); }
.proj-ms-name { flex:1; font-weight:500; color:var(--text-primary); }
.proj-ms-date { font-size:12px; color:var(--text-muted); font-family:var(--font-mono); }
.proj-ms-done { font-size:11px; color:var(--success); }
.proj-status-badge.clickable { cursor:pointer; }
.proj-status-badge.clickable:hover { filter:brightness(1.2); }

/* Inspection rows */
.proj-inspection-row { display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid var(--border); font-size:13px; color:var(--text-secondary); }
.proj-ins-date { font-family:var(--font-mono); font-size:12px; min-width:80px; }
.proj-ins-permit { min-width:100px; }
.proj-ins-type { text-transform:capitalize; }
.proj-ins-inspector { color:var(--text-muted); }

/* Contact rows in project */
.proj-contact-row { display:flex; align-items:center; gap:10px; padding:6px 4px; border-bottom:1px solid var(--border); font-size:13px; }
.proj-contact-name { font-weight:500; color:var(--text-primary); }
.proj-contact-chip { font-size:10px; padding:1px 8px; border-radius:8px; background:rgba(0,180,255,0.1); color:var(--accent); font-family:var(--font-mono); text-transform:capitalize; }
.proj-contact-spec { font-size:12px; color:var(--text-muted); }
.proj-contact-phone { font-size:12px; color:var(--text-muted); font-family:var(--font-mono); }
.proj-subsection-label { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; padding:8px 4px 4px; }

/* Industry contacts */
.proj-industry-filters { display:flex; gap:6px; padding:8px 0; flex-wrap:wrap; }
.proj-industry-filters input, .proj-industry-filters select { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:4px 8px; font-size:12px; }
.proj-industry-row { border-bottom:1px solid var(--border); }
.proj-industry-main { display:flex; gap:10px; align-items:center; padding:8px 4px; cursor:pointer; font-size:13px; }
.proj-industry-main:hover { background:var(--bg-card); }
.proj-industry-name { font-weight:500; color:var(--text-primary); }
.proj-industry-jurisdiction { font-size:12px; color:var(--text-muted); }
.proj-industry-expanded { padding:8px 12px 12px; background:var(--bg-card); }

/* Inline forms in project detail */
.proj-inline-form { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:10px 12px; margin-bottom:8px; }
.proj-form-row { display:flex; gap:6px; align-items:center; margin-bottom:6px; flex-wrap:wrap; }
.proj-form-row input, .proj-form-row select, .proj-form-row textarea { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:4px 8px; font-size:12px; flex:1; min-width:0; }
.proj-form-row textarea { resize:vertical; }
.proj-form-row label { display:flex; flex-direction:column; gap:2px; font-size:11px; color:var(--text-muted); flex:1; }
.proj-form-row label input { width:100%; }

/* Draft document */
.proj-draft-desc { font-size:12px; color:var(--text-muted); font-style:italic; padding:2px 0 6px; }

/* Dynamic form rows in create/edit panel */
.proj-form-dyn-row { display:flex; gap:4px; align-items:center; margin-bottom:4px; }
.proj-form-dyn-row input, .proj-form-dyn-row select { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:3px 6px; font-size:12px; flex:1; min-width:0; }

/* Note rows */
.note-row { padding:12px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.note-row:hover { background:var(--bg-card); }
.note-row-header { display:flex; justify-content:space-between; align-items:center; }
.note-title { font-weight:500; color:var(--text-primary); font-size:14px; }
.note-date { font-size:11px; color:var(--text-muted); }
.note-preview { font-size:12px; color:var(--text-muted); margin-top:3px; }
.note-tags { display:flex; gap:4px; flex-wrap:wrap; margin-top:4px; }
.note-tag { font-size:10px; padding:1px 6px; border-radius:6px; background:var(--bg-input); color:var(--accent); font-family:var(--font-mono); }
.note-content { background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); padding:10px 12px; font-size:13px; color:var(--text-secondary); white-space:pre-wrap; line-height:1.5; }

/* === TAX PREP APP === */
#tax-toolbar { display:flex; align-items:center; padding:10px 14px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; gap:12px; }
#tax-toolbar-title { flex:1; font-family:var(--font-mono); font-size:15px; color:var(--text-primary); }
#tax-add-btn { background:var(--accent); color:white; border:none; padding:5px 14px; border-radius:6px; font-size:13px; font-weight:bold; cursor:pointer; }

#tax-cat-tabs { display:flex; gap:6px; padding:6px 12px; background:var(--bg-primary); border-bottom:1px solid var(--border); flex-shrink:0; }
.tax-cat-tab { flex-shrink:0; padding:4px 12px; border-radius:12px; font-size:13px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.tax-cat-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

#tax-list { flex:1; overflow-y:auto; }
#tax-detail { flex-direction:column; flex:1; overflow-y:auto; }

.tax-row { padding:10px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.tax-row:hover { background:var(--bg-card); }
.tax-row-header { display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--text-primary); }
.tax-amount { font-family:var(--font-mono); font-weight:bold; color:var(--accent); }
.tax-amount.deduction { color:var(--success); }
.tax-row-meta { display:flex; gap:8px; margin-top:3px; font-size:11px; color:var(--text-muted); }
.tax-category-badge { padding:1px 6px; border-radius:6px; font-family:var(--font-mono); }
.tax-category-badge.income { background:rgba(0,180,255,0.15); color:#4da6ff; }
.tax-category-badge.deduction { background:rgba(0,200,150,0.15); color:var(--success); }
.tax-category-badge.credit { background:rgba(180,100,255,0.15); color:#b464ff; }
.tax-status { font-family:var(--font-mono); }

#tax-form-sheet { position:absolute; inset:0; display:flex; align-items:flex-end; z-index:200; }
#tax-form-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
#tax-form-panel { position:relative; width:100%; background:var(--bg-secondary); border-top:1px solid var(--border); border-radius:16px 16px 0 0; padding:20px; max-height:85vh; overflow-y:auto; z-index:201; }

/* === FINANCES DASHBOARD === */
.fin-section { margin-bottom:20px; }
.fin-section-title { font-family:var(--font-mono); font-size:14px; color:var(--accent); font-weight:bold; margin-bottom:10px; letter-spacing:0.5px; }

/* Domain tabs */
.fin-domain-tabs { display:flex; gap:0; background:var(--bg-card); border-bottom:1px solid var(--border); flex-shrink:0; }
.fin-domain-tab { flex:1; text-align:center; padding:10px 12px; font-size:13px; font-family:var(--font-mono); font-weight:bold; cursor:pointer; color:var(--text-muted); border-bottom:3px solid transparent; transition:all 0.15s; }
.fin-domain-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.fin-domain-tab:hover:not(.active) { color:var(--text-primary); }

/* Property sub-tabs */
.fin-prop-tabs { display:flex; gap:4px; padding:6px 10px; background:var(--bg-primary); border-bottom:1px solid var(--border); overflow-x:auto; flex-shrink:0; }
.fin-prop-tab { flex-shrink:0; padding:3px 10px; border-radius:10px; font-size:11px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); white-space:nowrap; }
.fin-prop-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* Year sub-tabs */
.fin-year-tabs { display:flex; gap:4px; padding:6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); overflow-x:auto; flex-shrink:0; }
.fin-year-tab { flex-shrink:0; padding:4px 12px; border-radius:12px; font-size:12px; font-family:var(--font-mono); font-weight:600; cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); white-space:nowrap; transition:all 0.15s; }
.fin-year-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.fin-year-tab:hover:not(.active) { color:var(--text-primary); border-color:var(--text-muted); }

/* Sub-tabs */
.fin-sub-tabs { display:flex; gap:0; background:var(--bg-card); border-bottom:1px solid var(--border); flex-shrink:0; }
.fin-sub-tab { padding:8px 16px; font-size:12px; font-family:var(--font-mono); font-weight:600; cursor:pointer; color:var(--text-muted); border-bottom:2px solid transparent; transition:all 0.15s; }
.fin-sub-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.fin-sub-tab:hover:not(.active) { color:var(--text-primary); }

/* Transactions table in finances */
.fin-txn-scroll { max-height:500px; overflow-y:auto; }
.fin-txn-table tr { border-bottom:1px solid var(--border); }
.fin-txn-row td { padding:4px 8px; font-size:12px; vertical-align:middle; }
.fin-txn-row:hover { background:var(--bg-secondary); }
.fin-txn-sel { background:transparent; border:1px solid transparent; color:var(--text-primary); font-size:11px; font-family:var(--font-mono); padding:2px 4px; border-radius:4px; width:100%; cursor:pointer; }
.fin-txn-sel:hover, .fin-txn-sel:focus { border-color:var(--border); background:var(--bg-secondary); }
.fin-txn-input { background:transparent; border:1px solid transparent; color:var(--text-primary); font-size:11px; font-family:var(--font-mono); padding:2px 4px; border-radius:4px; width:100%; }
.fin-txn-input:hover, .fin-txn-input:focus { border-color:var(--border); background:var(--bg-secondary); outline:none; }

/* Financial reports */
.fin-summary-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:10px; padding:12px; }
.fin-card { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:14px; text-align:center; }
.fin-card-label { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
.fin-card-num { font-size:22px; font-weight:700; font-family:var(--font-mono); }
.fin-card-num.positive { color:#27ae60; }
.fin-card-num.negative { color:#e74c3c; }
.fin-charts-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:0 12px 12px; }
@media (max-width:768px) { .fin-charts-row { grid-template-columns:1fr; } .fin-summary-cards { grid-template-columns:repeat(2, 1fr); } }
.fin-chart-box { background:var(--bg-card); border:1px solid var(--border); border-radius:10px; padding:12px; max-height:280px; overflow:hidden; }
.fin-chart-title { font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:8px; font-weight:600; }
.fin-reports { padding:12px; display:flex; flex-direction:column; gap:20px; }
.fin-report { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.fin-report-title { font-family:var(--font-mono); font-size:14px; font-weight:bold; color:var(--accent); padding:10px 14px; background:var(--bg-secondary); border-bottom:1px solid var(--border); letter-spacing:0.5px; }

.fin-table { width:100%; border-collapse:collapse; font-size:13px; }
.fin-table td { padding:5px 14px; }
.fin-table-header td { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); border-bottom:1px solid var(--border); background:var(--bg-secondary); }
.fin-table-section td { font-size:12px; font-weight:bold; color:var(--text-primary); padding-top:10px; border-bottom:1px solid var(--border); }
.fin-indent { padding-left:28px !important; color:var(--text-secondary); }
.fin-num { text-align:right; font-family:var(--font-mono); color:var(--text-primary); }
.fin-num.positive { color:var(--success); }
.fin-num.negative { color:var(--error); }
.fin-table-total td { font-weight:bold; color:var(--text-primary); border-top:1px solid var(--border); }
.fin-table-grand td { font-weight:bold; font-size:14px; color:var(--text-primary); border-top:2px solid var(--accent); background:rgba(0,200,150,0.05); padding:8px 14px; }

/* Investments */
.inv-table td { padding:6px 10px; font-size:12px; }
.inv-holding-row:hover { background:var(--bg-card); }
.inv-holding-row td:first-child { font-size:13px; }

/* === COMMUNICATIONS APP (Spreadsheet) === */
.comms-domain-tab { flex-shrink:0; padding:3px 10px; border-radius:10px; font-size:12px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.comms-domain-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.comms-filter-select { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:3px 6px; font-size:11px; font-family:var(--font-mono); }

.comms-table-wrap { overflow-x:auto; }
.comms-table-header { display:flex; align-items:center; padding:4px 6px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:10px; color:var(--text-muted); font-family:var(--font-mono); position:sticky; top:0; z-index:1; min-width:900px; }
.comms-table-header > div { cursor:pointer; }
.comms-table-header > div:hover { color:var(--accent); }

.comms-table-row { display:flex; align-items:center; padding:3px 6px; border-bottom:1px solid var(--border); font-size:12px; min-width:900px; cursor:default; }
.comms-table-row:hover { background:var(--bg-card); }

.comms-col-imp { width:30px; flex-shrink:0; text-align:center; }
.comms-col-type { width:65px; flex-shrink:0; }
.comms-col-dir { width:25px; flex-shrink:0; text-align:center; }
.comms-col-from { width:140px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comms-col-to { width:110px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comms-col-acct { width:80px; flex-shrink:0; font-size:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-muted); }
.comms-col-date { width:70px; flex-shrink:0; font-size:11px; line-height:1.2; }
.comms-col-subj { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-primary); padding:0 4px; }
.comms-col-domain { width:75px; flex-shrink:0; }
.comms-col-tags { width:100px; flex-shrink:0; }
.comms-col-by { width:35px; flex-shrink:0; text-align:center; }
.comms-col-custom { width:90px; flex-shrink:0; }

.comms-type-pill { font-size:9px; padding:1px 5px; border-radius:4px; background:var(--bg-input); color:var(--text-muted); font-family:var(--font-mono); text-transform:capitalize; }
.comms-dir { font-size:10px; }
.comms-dir.incoming { color:var(--success); }
.comms-dir.outgoing { color:var(--accent); }

.comms-inline-sel { width:100%; background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:3px; padding:1px 2px; font-size:10px; cursor:pointer; }
.comms-inline-sel:hover { border-color:var(--border); background:var(--bg-input); }
.comms-inline-sel:focus { border-color:var(--accent); background:var(--bg-input); color:var(--text-primary); outline:none; }
.comms-inline-input { width:100%; background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:3px; padding:1px 4px; font-size:10px; box-sizing:border-box; }
.comms-inline-input:hover { border-color:var(--border); }
.comms-inline-input:focus { border-color:var(--accent); background:var(--bg-input); color:var(--text-primary); outline:none; }

.comms-by-badge { font-size:9px; padding:1px 4px; border-radius:3px; font-family:var(--font-mono); font-weight:bold; }
.comms-by-badge.hyper { background:rgba(0,200,150,0.15); color:var(--accent); }
.comms-by-badge.op { background:rgba(100,150,255,0.15); color:#6496ff; }

.comms-add-col-bar { padding:6px 10px; border-top:1px solid var(--border); }

/* === TAX PREP FORM VIEWER === */
.tax-forms-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:8px; }
.tax-form-card { display:flex; align-items:center; gap:10px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:12px; cursor:pointer; transition:border-color 0.15s; }
.tax-form-card:hover { border-color:var(--accent); }
.tax-form-icon { font-size:28px; }
.tax-form-name { font-weight:500; color:var(--text-primary); font-size:14px; text-transform:uppercase; }
.tax-form-meta { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); }

.tax-field-toolbar { display:flex; gap:8px; align-items:center; margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.tax-autofill-btn { background:var(--success); color:#fff; border:none; padding:5px 14px; border-radius:6px; font-size:12px; font-weight:bold; cursor:pointer; }
.tax-generate-btn { background:var(--accent); color:#fff; border:none; padding:5px 14px; border-radius:6px; font-size:12px; font-weight:bold; cursor:pointer; }

.tax-section { margin-bottom:16px; }
.tax-section-title { font-family:var(--font-mono); font-size:13px; color:var(--accent); font-weight:bold; padding:6px 0; border-bottom:1px solid var(--border); margin-bottom:6px; }

.tax-field-row { display:flex; align-items:center; gap:8px; padding:3px 0; }
.tax-field-label { flex:1; font-size:12px; color:var(--text-secondary); display:flex; align-items:center; gap:6px; }
.tax-line-num { font-family:var(--font-mono); font-size:10px; color:var(--text-muted); background:var(--bg-input); padding:1px 4px; border-radius:3px; flex-shrink:0; }
.tax-auto-badge { font-size:9px; padding:0 4px; border-radius:3px; background:rgba(0,200,150,0.15); color:var(--success); font-family:var(--font-mono); }
.tax-field-input { width:140px; flex-shrink:0; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:3px 6px; font-size:12px; font-family:var(--font-mono); text-align:right; }
.tax-field-input.auto-filled { border-color:var(--success); background:rgba(0,200,150,0.05); }
.tax-field-input:focus { border-color:var(--accent); outline:none; }

/* === CALENDAR APP === */

/* Toolbar */
.cal-toolbar { display:flex; align-items:center; gap:4px; padding:6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; }
.cal-toolbar .app-back-btn { padding:2px 6px; font-size:13px; }
.cal-nav-btn { background:none; border:none; color:var(--accent); font-size:14px; cursor:pointer; padding:2px 4px; }
.cal-title { flex:1; text-align:center; font-family:var(--font-mono); font-size:13px; color:var(--text-primary); white-space:nowrap; }
.cal-today-btn { background:var(--bg-card); color:var(--text-primary); border:1px solid var(--border); padding:2px 8px; border-radius:6px; font-size:11px; cursor:pointer; font-family:var(--font-mono); }
.cal-view-tabs { display:flex; gap:2px; }
.cal-view-tab { padding:2px 8px; border-radius:6px; font-size:11px; font-family:var(--font-mono); cursor:pointer; color:var(--text-muted); background:transparent; border:1px solid transparent; }
.cal-view-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.cal-add-btn { background:var(--accent); color:white; border:none; width:24px; height:24px; border-radius:50%; font-size:16px; cursor:pointer; font-weight:bold; line-height:1; }

/* Month grid */
.cal-month-grid { display:flex; flex-direction:column; height:100%; }
.cal-month-header-row { display:grid; grid-template-columns:repeat(7, 1fr); background:var(--bg-secondary); border-bottom:1px solid var(--border); }
.cal-month-header-cell { text-align:center; padding:4px 0; font-size:11px; font-family:var(--font-mono); color:var(--text-muted); }
.cal-month-row { display:grid; grid-template-columns:repeat(7, 1fr); flex:1; min-height:0; }
.cal-month-cell { border-right:1px solid var(--border); border-bottom:1px solid var(--border); padding:2px 3px; overflow:hidden; cursor:pointer; min-height:60px; }
.cal-month-cell:nth-child(7n) { border-right:none; }
.cal-month-cell:hover { background:var(--bg-card); }
.cal-month-cell.today { background:rgba(0,200,150,0.08); }
.cal-month-cell.today .cal-month-day-num { color:var(--accent); font-weight:bold; }
.cal-month-cell.other-month { opacity:0.35; }
.cal-month-day-num { font-size:12px; color:var(--text-primary); margin-bottom:1px; font-family:var(--font-mono); }
.cal-month-event { font-size:9px; padding:1px 3px; margin-bottom:1px; border-radius:2px; background:var(--bg-card); color:var(--text-primary); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; cursor:pointer; }
.cal-month-event:hover { background:var(--accent); color:#fff; }
.cal-week-event { cursor:pointer; }
.cal-week-event:hover { opacity:0.8; }
.cal-list-event:hover { background:var(--bg-card); }
.cal-month-more { font-size:9px; color:var(--text-muted); padding:0 3px; }

/* Week grid */
.cal-week-grid { display:flex; flex-direction:column; height:100%; }
.cal-week-header { display:grid; grid-template-columns:50px repeat(7, 1fr); background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; }
.cal-week-day-header { text-align:center; padding:4px 0; cursor:pointer; }
.cal-week-day-header.today .cal-week-day-num { background:var(--accent); color:#fff; border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; }
.cal-week-day-name { font-size:10px; color:var(--text-muted); font-family:var(--font-mono); }
.cal-week-day-num { font-size:13px; color:var(--text-primary); font-weight:bold; }
.cal-week-time-col { width:50px; flex-shrink:0; font-size:10px; color:var(--text-muted); font-family:var(--font-mono); text-align:right; padding-right:6px; display:flex; align-items:flex-start; justify-content:flex-end; }

.cal-week-allday-row { display:grid; grid-template-columns:50px repeat(7, 1fr); border-bottom:1px solid var(--border); min-height:20px; }
.cal-week-allday-cell { border-left:1px solid var(--border); padding:1px 2px; }

.cal-week-body { flex:1; overflow-y:auto; }
.cal-week-row { display:grid; grid-template-columns:50px repeat(7, 1fr); min-height:40px; border-bottom:1px solid var(--border); }
.cal-week-cell { border-left:1px solid var(--border); padding:1px 2px; }
.cal-week-event { font-size:9px; padding:1px 3px; margin-bottom:1px; border-radius:2px; background:var(--accent); color:#fff; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.cal-week-event.allday { background:rgba(0,200,150,0.2); color:var(--accent); }

/* Day view */
.cal-day-view { }
.cal-day-allday { padding:6px 12px; background:var(--bg-secondary); border-bottom:1px solid var(--border); }
.cal-day-allday-event { font-size:12px; padding:3px 8px; background:var(--accent); color:#fff; border-radius:4px; margin-bottom:3px; }
.cal-day-hour-row { display:flex; border-bottom:1px solid var(--border); min-height:48px; }
.cal-day-hour-label { width:55px; flex-shrink:0; font-size:11px; color:var(--text-muted); font-family:var(--font-mono); text-align:right; padding:4px 8px 0 0; }
.cal-day-hour-content { flex:1; padding:2px 8px; border-left:1px solid var(--border); }
.cal-day-event { background:var(--accent); color:#fff; border-radius:4px; padding:4px 8px; margin-bottom:3px; }
.cal-day-event-time { font-size:11px; opacity:0.8; }
.cal-day-event-title { font-size:13px; font-weight:500; }
.cal-day-event-loc { font-size:11px; opacity:0.7; }

/* List view */
.cal-list-day { border-bottom:1px solid var(--border); }
.cal-list-day-header { padding:6px 14px; font-family:var(--font-mono); font-size:12px; color:var(--accent); background:var(--bg-secondary); font-weight:bold; position:sticky; top:0; }
.cal-list-event { padding:6px 14px; display:flex; gap:10px; align-items:baseline; }
.cal-list-event-time { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); min-width:55px; }
.cal-list-event-title { font-size:13px; color:var(--text-primary); font-weight:500; }
.cal-list-event-loc { font-size:11px; color:var(--text-muted); }

/* === TRANSACTIONS APP === */
.txn-header { display:flex; align-items:center; gap:4px; padding:6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; }
.txn-header .app-back-btn { padding:2px 6px; font-size:13px; }
.txn-header #bank-connections-bar { margin-left:auto; padding:0; border:none; background:none; }

.txn-type-tab { padding:4px 12px; border-radius:10px; font-size:12px; font-family:var(--font-mono); font-weight:bold; cursor:pointer; background:transparent; color:var(--text-muted); border:1px solid transparent; transition:all 0.15s; }
.txn-type-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.txn-filters-row { display:flex; align-items:center; gap:4px; padding:4px 10px; border-bottom:1px solid var(--border); flex-shrink:0; }
#bank-domain-tabs { display:flex; gap:4px; flex-wrap:wrap; }
.bank-tab { flex-shrink:0; padding:2px 8px; border-radius:8px; font-size:11px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.bank-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.txn-search-input { flex:1; min-width:80px; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:3px 8px; font-size:12px; box-sizing:border-box; }

#app-bank_feed .lease-summary-bar { padding:6px 14px; }
#app-bank_feed .lease-summary-value { font-size:14px; }
#app-bank_feed .lease-summary-label { font-size:10px; }

.txn-connect-prompt { display:flex; align-items:center; gap:4px; font-size:11px; color:var(--text-muted); }
.txn-connect-btn { background:var(--accent); color:white; border:none; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:bold; cursor:pointer; white-space:nowrap; }
.txn-connect-btn.small { padding:2px 8px; font-size:10px; }
.txn-connect-btn.secondary { background:var(--bg-card); color:var(--text-primary); border:1px solid var(--border); }
.txn-connections-wrapper { }
.txn-connections-toggle { display:flex; align-items:center; gap:6px; cursor:pointer; font-size:11px; color:var(--text-muted); font-family:var(--font-mono); padding:2px 0; user-select:none; }
.txn-connections-toggle:hover { color:var(--text-primary); }
.txn-connections-list { overflow:hidden; transition:max-height 0.25s ease; max-height:300px; }
.txn-connections-wrapper.collapsed .txn-connections-list { max-height:0; }
.txn-connections-row { display:flex; align-items:center; gap:4px; flex-wrap:wrap; padding:4px 0; }
.txn-connections-actions { display:flex; align-items:center; gap:4px; margin-left:auto; }
.txn-connected-acct { font-size:10px; font-family:var(--font-mono); background:var(--bg-card); border:1px solid var(--border); border-radius:4px; padding:2px 6px; display:flex; align-items:center; gap:3px; color:var(--text-primary); white-space:nowrap; }
.txn-acct-remove { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:11px; padding:2px 4px; opacity:0.6; }
.txn-acct-remove:hover { opacity:1; color:var(--error); }

/* Transaction table */
.txn-table-header { display:flex; align-items:center; padding:6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:11px; color:var(--text-muted); font-family:var(--font-mono); position:sticky; top:0; z-index:1; }
.txn-table-header.txn-filter-row { top:28px; padding:4px 10px; background:var(--bg-primary); }
.txn-table-header.txn-filter-row > div { cursor:default; padding-right:6px; }
.txn-table-header.txn-filter-row > div:hover { color:var(--text-muted); }
.txn-col-filter { width:100%; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:3px; padding:2px 4px; font-size:10px; font-family:var(--font-mono); }
.txn-col-filter:focus { border-color:var(--accent); outline:none; }
select.txn-col-filter { cursor:pointer; }
.txn-col-filter-clear { background:none; border:1px solid var(--border); color:var(--text-muted); width:22px; height:22px; border-radius:3px; cursor:pointer; font-size:11px; }
.txn-col-filter-clear:hover { color:var(--error); border-color:var(--error); }
.txn-table-row { display:flex; align-items:center; padding:6px 10px; border-bottom:1px solid var(--border); font-size:13px; }
.txn-table-row:hover { background:var(--bg-card); }

.txn-col-date { width:80px; flex-shrink:0; font-size:12px; color:var(--text-secondary); }
.txn-col-acct { width:120px; flex-shrink:0; font-size:11px; color:var(--text-muted); font-family:var(--font-mono); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.txn-col-desc { flex:1; min-width:0; padding-right:8px; }
.txn-desc-main { font-weight:500; color:var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.txn-col-amt { width:110px; flex-shrink:0; text-align:right; font-family:var(--font-mono); font-weight:bold; font-size:13px; padding-right:10px; }
.txn-col-amt.debit { color:var(--text-primary); }
.txn-col-amt.credit { color:var(--success); }
.txn-col-domain { width:90px; flex-shrink:0; }
.txn-col-cat { width:200px; flex-shrink:0; }
.txn-col-subcat { width:140px; flex-shrink:0; }
.txn-col-prop { width:130px; flex-shrink:0; }
.txn-col-rev { width:80px; flex-shrink:0; text-align:center; display:flex; align-items:center; justify-content:center; gap:2px; }

.txn-inline-sel { width:100%; background:transparent; color:var(--text-muted); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:11px; cursor:pointer; }
.txn-inline-sel:hover { border-color:var(--border); background:var(--bg-input); }
.txn-inline-sel:focus { border-color:var(--accent); background:var(--bg-input); color:var(--text-primary); outline:none; }

.txn-review-btn { background:none; border:1px solid var(--border); color:var(--text-muted); width:26px; height:26px; border-radius:50%; cursor:pointer; font-size:13px; transition:all 0.15s; }
.txn-review-btn:hover { border-color:var(--accent); }
.txn-review-btn.reviewed { background:var(--success); border-color:var(--success); color:white; }
.txn-delete-btn { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:11px; padding:2px 4px; opacity:0.4; transition:all 0.15s; }
.txn-delete-btn:hover { opacity:1; color:var(--error); }
.txn-rule-btn { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:11px; padding:2px 4px; opacity:0.4; transition:all 0.15s; }
.txn-rule-btn:hover { opacity:1; color:var(--accent); }

/* Auto-categorize button */
.txn-auto-cat-btn { background:var(--accent-dim); color:#fff; border:none; padding:4px 12px; border-radius:6px; font-size:11px; font-weight:bold; cursor:pointer; white-space:nowrap; flex-shrink:0; transition:all 0.2s; }
.txn-auto-cat-btn:hover { background:var(--accent); }
.txn-auto-cat-btn:disabled { opacity:0.5; cursor:wait; }

/* Anomaly highlighting */
.txn-table-row.txn-anomaly { background:rgba(255,68,68,0.08); border-left:3px solid var(--error); }
.txn-anomaly-badge { color:var(--warning); font-size:13px; margin-right:4px; cursor:help; }

/* Transaction Rules Panel */
.txn-rules-panel { padding:10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); max-height:60vh; overflow-y:auto; }
.txn-rules-title { font-size:12px; font-weight:bold; color:var(--text-primary); margin-bottom:8px; display:flex; align-items:center; justify-content:space-between; }
.txn-rules-list-header { display:flex; justify-content:space-between; align-items:center; padding:6px 4px; cursor:pointer; font-size:11px; font-weight:600; color:var(--text-muted); border-bottom:1px solid var(--border); margin-bottom:4px; }
.txn-rules-list-header:hover { color:var(--accent); }
.txn-rules-close { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:14px; padding:2px 6px; opacity:0.6; }
.txn-rules-close:hover { opacity:1; color:var(--error); }
.txn-rules-empty { font-size:11px; color:var(--text-muted); margin-bottom:8px; }
.txn-rules-list { margin-bottom:10px; }
.txn-rules-row-multi { display:flex; align-items:center; gap:8px; padding:5px 4px; border-bottom:1px solid var(--border); font-size:11px; }
.txn-rule-conditions { flex:1; display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.txn-rule-cond { background:var(--bg-card); border:1px solid var(--border); border-radius:4px; padding:2px 6px; font-family:var(--font-mono); font-size:10px; color:var(--text-primary); white-space:nowrap; }
.txn-rule-and { font-size:9px; color:var(--accent); font-weight:bold; }
.txn-rule-actions-display { font-size:11px; color:var(--text-secondary); white-space:nowrap; }
.txn-rules-builder { border-top:1px solid var(--border); padding-top:8px; }
.txn-rules-builder-label { font-size:11px; font-weight:bold; color:var(--text-muted); margin-bottom:6px; }
.txn-rules-cond-list { display:flex; align-items:center; gap:4px; flex-wrap:wrap; margin-bottom:6px; }
.txn-rule-cond-row { display:flex; align-items:center; gap:2px; }
.txn-rules-cond-add { display:flex; align-items:center; gap:4px; margin-bottom:6px; }
.txn-rules-cond-add .txn-inline-sel { font-size:11px; width:140px; flex-shrink:0; }
.txn-rules-cond-add .txn-search-input { font-size:11px; padding:3px 6px; flex:1; min-width:200px; }
.txn-rules-actions-row { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.txn-rules-actions-row .txn-inline-sel { font-size:11px; }

/* === DOCUMENTS APP (File Explorer) === */

.doc-breadcrumbs { display:flex; align-items:center; gap:4px; padding:6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:12px; flex-shrink:0; flex-wrap:wrap; }
.doc-bread-item { color:var(--accent); cursor:pointer; font-family:var(--font-mono); }
.doc-bread-item:hover { text-decoration:underline; }
.doc-bread-sep { color:var(--text-muted); font-size:8px; }

.doc-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(120px, 1fr)); gap:8px; padding:12px; }
.doc-item.folder { display:flex; flex-direction:column; align-items:center; padding:12px 8px; border-radius:var(--radius); cursor:pointer; transition:background 0.15s; text-align:center; }
.doc-item.folder:hover, .doc-item.folder.highlight { background:var(--bg-card); }
.doc-item-icon { font-size:36px; margin-bottom:4px; }
.doc-item-name { font-size:12px; color:var(--text-primary); word-break:break-word; }
.doc-folder-del { position:absolute; top:4px; right:4px; background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:12px; opacity:0; transition:opacity 0.15s; padding:2px 5px; border-radius:4px; }
.doc-item.folder { position:relative; }
.doc-item.folder:hover .doc-folder-del { opacity:0.6; }
.doc-folder-del:hover { opacity:1 !important; color:var(--error); background:var(--bg-secondary); }
.doc-item-domain { font-size:9px; color:var(--accent); font-family:var(--font-mono); margin-top:2px; }

.doc-split { display:flex; flex:1; overflow:hidden; }
.doc-file-list { flex:1; overflow-y:auto; min-width:0; }
.doc-preview { width:40%; min-width:250px; border-left:1px solid var(--border); display:flex; flex-direction:column; overflow-y:auto; }

/* File Explorer table layout */
.doc-list-header { display:flex; align-items:center; gap:0; padding:4px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:11px; color:var(--text-muted); font-family:var(--font-mono); position:sticky; top:0; z-index:1; }
.doc-list-header .doc-list-icon { width:24px; flex-shrink:0; }
.doc-list-header .doc-list-name { flex:1; }
.doc-list-header .doc-list-col { width:120px; flex-shrink:0; text-align:left; }

.doc-list-row { display:flex; align-items:center; gap:0; padding:3px 10px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.1s; }
.doc-list-row:hover { background:var(--bg-card); }
.doc-list-row.highlight { background:rgba(0,200,150,0.06); }
.doc-list-row.selected { background:rgba(0,200,150,0.1); }
.doc-list-icon { width:24px; flex-shrink:0; font-size:15px; text-align:center; }
.doc-list-name { flex:1; font-size:13px; color:var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-right:8px; }
.doc-list-col { width:120px; flex-shrink:0; font-size:11px; color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.doc-preview-header { display:flex; align-items:center; gap:8px; padding:8px 10px; border-bottom:1px solid var(--border); background:var(--bg-secondary); flex-shrink:0; }
.doc-preview-name { flex:1; font-size:13px; font-weight:500; color:var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.doc-preview-open { background:var(--accent); color:white; border:none; padding:3px 10px; border-radius:4px; font-size:11px; cursor:pointer; font-weight:bold; }
.doc-preview-content { padding:10px; font-size:12px; color:var(--text-secondary); white-space:pre-wrap; word-break:break-word; line-height:1.5; flex:1; overflow-y:auto; }

.doc-drop-zone { border-top:1px solid var(--border); background:var(--bg-secondary); flex-shrink:0; transition:background 0.2s, border-color 0.2s; }
.doc-drop-zone.dragover { background:rgba(0,200,150,0.08); border-top-color:var(--accent); }
.doc-drop-label { text-align:center; padding:8px 0 2px; font-size:11px; color:var(--text-muted); letter-spacing:0.5px; }
.doc-drop-zone.dragover .doc-drop-label { color:var(--accent); font-weight:bold; }
.doc-connect-bar { display:flex; gap:6px; padding:6px 10px; flex-shrink:0; align-items:center; flex-wrap:wrap; }
.doc-connect-input { flex:1; background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:4px 8px; font-size:12px; }
.doc-connect-select { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); border-radius:var(--radius); padding:4px 6px; font-size:11px; }
.doc-connect-btn { background:var(--accent); color:white; border:none; padding:4px 12px; border-radius:6px; font-size:11px; font-weight:bold; cursor:pointer; white-space:nowrap; }

/* Upload progress bar */
.doc-upload-progress { position:relative; height:22px; background:var(--bg-input); border-radius:6px; overflow:hidden; margin:0 10px 8px; }
.doc-upload-progress-bar { position:absolute; top:0; left:0; height:100%; width:0; background:var(--accent); border-radius:6px; transition:width 0.2s ease, background 0.3s ease; }
.doc-upload-progress-bar.extracting { width:100% !important; background:linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-dim)); background-size:200% 100%; animation:progress-pulse 1.5s ease-in-out infinite; }
.doc-upload-progress-bar.done { width:100% !important; background:var(--success); }
.doc-upload-progress-bar.error { background:var(--error); }
.doc-upload-progress-text { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:11px; font-family:var(--font-mono); font-weight:bold; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,0.5); z-index:1; }
@keyframes progress-pulse { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Keep these for generated docs display elsewhere */
.doc-gen-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.doc-gen-name { flex: 1; color: var(--text-primary); font-family: var(--font-mono); }
.doc-gen-date { color: var(--text-muted); font-size: 12px; }
.doc-gen-download { color: var(--accent); text-decoration: none; font-weight: bold; font-size: 12px; }

/* Shared form sheets for new apps */
#hiring-form-sheet, #mktg-form-sheet, #proj-form-sheet, #note-form-sheet { position:absolute; inset:0; display:flex; align-items:flex-end; z-index:200; }
#hiring-form-backdrop, #mktg-form-backdrop, #proj-form-backdrop, #note-form-backdrop { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
#hiring-form-panel, #mktg-form-panel, #proj-form-panel, #note-form-panel { position:relative; width:100%; background:var(--bg-secondary); border-top:1px solid var(--border); border-radius:16px 16px 0 0; padding:20px; max-height:85vh; overflow-y:auto; z-index:201; }

/* === KNOWLEDGE BASE APP === */
.kb-inner-tab { flex:1; text-align:center; padding:10px 16px; font-size:14px; font-family:var(--font-mono); font-weight:bold; cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:none; border-bottom:3px solid transparent; transition:all 0.15s; letter-spacing:0.5px; }
.kb-inner-tab.active { color:var(--accent); border-bottom-color:var(--accent); background:var(--bg-primary); }
.kb-inner-tab:hover:not(.active) { color:var(--text-primary); background:var(--bg-secondary); }
.kb-domain-tab { flex-shrink:0; padding:4px 12px; border-radius:12px; font-size:13px; font-family:var(--font-mono); cursor:pointer; background:var(--bg-card); color:var(--text-muted); border:1px solid var(--border); transition:background 0.15s,color 0.15s; }
.kb-domain-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* Spreadsheet-style knowledge list */
.kb-header-row { display:flex; align-items:center; gap:4px; padding:4px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border); font-size:11px; color:var(--text-muted); font-family:var(--font-mono); position:sticky; top:0; z-index:1; }
.kb-header-title { flex:1; min-width:0; }
.kb-header-col { width:110px; flex-shrink:0; text-align:center; }

.kb-row { display:flex; align-items:center; gap:4px; padding:3px 10px; border-bottom:1px solid var(--border); font-size:12px; }
.kb-row:hover { background:var(--bg-card); }
.kb-row-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-primary); cursor:pointer; }
.kb-row-title:hover { color:var(--accent); text-decoration:underline; }

.kb-inline-select { width:110px; flex-shrink:0; background:var(--bg-input); color:var(--text-primary); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:11px; font-family:var(--font-mono); cursor:pointer; }
.kb-inline-select:hover { border-color:var(--border); }
.kb-inline-select:focus { border-color:var(--accent); outline:none; }

.kb-page-info { padding:6px 10px; font-size:11px; color:var(--text-muted); font-family:var(--font-mono); background:var(--bg-secondary); border-bottom:1px solid var(--border); }
.kb-page-nav { display:flex; gap:6px; padding:8px 10px; justify-content:center; }

.kb-add-cat-btn { background:none; border:none; color:var(--accent); font-size:13px; cursor:pointer; padding:0 4px; font-weight:bold; }

/* Memory browser */
.mem-overview { padding:12px; }
.mem-section-title { font-family:var(--font-mono); font-size:14px; color:var(--accent); font-weight:bold; margin-bottom:10px; }
.mem-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:8px; }
.mem-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:12px; cursor:pointer; transition:border-color 0.15s; }
.mem-card:hover { border-color:var(--accent); }
.mem-card-count { font-size:24px; font-weight:bold; color:var(--accent); font-family:var(--font-mono); }
.mem-card-label { font-size:13px; font-weight:500; color:var(--text-primary); margin:4px 0; }
.mem-card-desc { font-size:11px; color:var(--text-muted); }

.mem-obs-types { display:flex; flex-wrap:wrap; gap:6px; }
.mem-obs-type { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:4px 10px; font-size:12px; display:flex; gap:6px; align-items:center; }
.mem-obs-type-name { color:var(--text-primary); font-family:var(--font-mono); }
.mem-obs-type-count { color:var(--accent); font-weight:bold; }

.mem-section-header { display:flex; align-items:center; gap:10px; padding:8px 12px; background:var(--bg-secondary); border-bottom:1px solid var(--border); flex-shrink:0; }
.mem-section-header span { font-family:var(--font-mono); font-size:14px; color:var(--text-primary); }

.mem-list { }
.mem-item { padding:8px 12px; border-bottom:1px solid var(--border); }
.mem-item-header { display:flex; align-items:center; gap:6px; margin-bottom:3px; }
.mem-item-type { font-size:10px; padding:1px 6px; border-radius:6px; background:var(--bg-input); color:var(--accent); font-family:var(--font-mono); font-weight:bold; }
.mem-type-fact { color:#4da6ff; }
.mem-type-preference { color:#ffa64d; }
.mem-type-instruction { color:#00c896; }
.mem-item-cat { font-size:11px; color:var(--text-muted); font-family:var(--font-mono); }
.mem-item-conf { font-size:10px; color:var(--text-muted); margin-left:auto; }
.mem-item-del { background:none; border:none; color:var(--text-muted); cursor:pointer; opacity:0.4; font-size:12px; padding:0 4px; }
.mem-item-del:hover { opacity:1; color:var(--error); }
.mem-item-content { font-size:13px; color:var(--text-primary); line-height:1.4; }
.mem-item-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
.mem-item-facts { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }

.mem-personality-section { margin-bottom:14px; }
.mem-personality-label { font-family:var(--font-mono); font-size:13px; color:var(--accent); font-weight:bold; margin-bottom:4px; }
.mem-personality-item { font-size:12px; color:var(--text-secondary); padding:1px 0; }

.mem-conv-item { cursor:pointer; }
.mem-conv-item:hover { background:var(--bg-card); }

.mem-conv-messages { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:8px; }
.mem-msg { max-width:85%; padding:8px 12px; border-radius:12px; font-size:13px; line-height:1.5; }
.mem-msg-operator { align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
.mem-msg-navi { align-self:flex-start; background:var(--bg-card); color:var(--text-primary); border:1px solid var(--border); border-bottom-left-radius:4px; }
.mem-msg-role { font-size:10px; font-weight:bold; margin-bottom:2px; opacity:0.7; font-family:var(--font-mono); }
.mem-msg-operator .mem-msg-role { color:rgba(255,255,255,0.7); }
.mem-msg-content { white-space:pre-wrap; word-break:break-word; }
.mem-msg-time { font-size:10px; opacity:0.5; margin-top:3px; text-align:right; }

.kbpd { width:110px; flex-shrink:0; position:relative; }
.kbpd-sel { background:var(--bg-input); border:1px solid transparent; border-radius:3px; padding:2px 4px; font-size:11px; font-family:var(--font-mono); cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-primary); }
.kbpd-sel:hover { border-color:var(--border); }
.kbpd-menu { display:none; position:absolute; top:100%; left:0; min-width:200px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius); box-shadow:0 4px 12px rgba(0,0,0,0.4); z-index:100; max-height:220px; overflow-y:auto; }
.kbpd-menu.open { display:block; }
.kbpd-item { display:flex; align-items:center; padding:5px 8px; font-size:12px; cursor:pointer; color:var(--text-primary); gap:4px; }
.kbpd-item:hover { background:var(--bg-card); }
.kbpd-item span:first-child { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kbpd-trash { flex-shrink:0; opacity:0.3; cursor:pointer; font-size:14px; }
.kbpd-trash:hover { opacity:1; }

.kb-domain-badge { font-size:10px; padding:1px 6px; border-radius:6px; background:var(--bg-input); color:var(--accent); font-family:var(--font-mono); }

.kb-role-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:12px; margin-bottom:10px; }
.kb-role-header { display:flex; align-items:center; gap:8px; }
.kb-role-name { font-weight:bold; color:var(--text-primary); font-size:14px; }
.kb-role-desc { font-size:12px; color:var(--text-muted); margin:6px 0; }
.kb-role-domains { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:8px; }
.kb-role-actions { display:flex; gap:6px; }

.kb-add-role, .kb-add-folder { display:flex; gap:8px; margin-top:12px; align-items:center; }

.kb-folder-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); }
.kb-folder-path { font-family:var(--font-mono); font-size:12px; color:var(--text-primary); word-break:break-all; flex:1; margin-right:8px; }

#kb-tab-roles { gap:0; }
#kb-tab-folders { gap:0; }

/* === ADD APP ICON === */
.app-icon-add {
    background: var(--bg-card) !important;
    border: 2px dashed var(--border);
    font-size: 32px !important;
    color: var(--text-muted);
}

.app-icon-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* === ADD APP SHEET / RENAME APP SHEET === */
#rename-app-sheet {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    z-index: 200;
}

#rename-app-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

#rename-app-panel {
    position: relative;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    z-index: 201;
}

#add-app-sheet {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    z-index: 200;
}

#add-app-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

#add-app-panel {
    position: relative;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 201;
}

.add-app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.add-app-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.add-app-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 8px;
}

.add-app-option:hover:not(.disabled) {
    background: var(--bg-card);
}

.add-app-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.add-app-option-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.add-app-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.add-app-option-info strong {
    font-size: 14px;
    color: var(--text-primary);
}

.add-app-option-info span {
    font-size: 12px;
    color: var(--text-muted);
}

/* Add email form */
.add-app-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 14px;
    padding: 0;
}

.ae-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.ae-field label {
    font-size: 12px;
    color: var(--text-muted);
}

.ae-field input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    width: 100%;
}

.ae-field input:focus {
    border-color: var(--accent);
}

.ae-submit {
    width: 100%;
    background: var(--accent-dim);
    color: var(--text-primary);
    border: none;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 15px;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
}

.ae-submit:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — screens < 768px
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Header ──────────────────────────────────────────────────── */
    #header { padding:6px 8px; gap:6px; flex-wrap:wrap; }
    #avatar-container, #avatar-canvas { width:32px; height:32px; }
    #header.collapsed #avatar-container, #header.collapsed #avatar-canvas { width:24px; height:24px; }
    #navi-name { font-size:12px; }
    #navi-status { font-size:10px; }
    #header-info { min-width:0; }
    #header-search { max-width:none; margin:0; flex-basis:100%; order:10; }
    #global-search-input { font-size:12px; padding:5px 10px; }
    #notif-bell { padding:2px 4px; }
    .notif-bell-icon { font-size:14px; }
    #header-toggle { font-size:8px; }

    /* ── Tab Bar ──────────────────────────────────────────────────── */
    #tab-bar { padding:2px 0; padding-bottom:env(safe-area-inset-bottom, 0px); overflow-x:auto; -webkit-overflow-scrolling:touch; flex-wrap:nowrap; }
    .tab-btn { padding:4px 0; font-size:8px; min-width:0; flex:1 0 auto; }
    .tab-icon { font-size:14px; }
    .tab-btn span:last-child { white-space:nowrap; }

    /* ── Dashboard ────────────────────────────────────────────────── */
    .dash-greeting { font-size:16px; margin-bottom:10px; }
    .dash-stats { grid-template-columns:repeat(3, 1fr); gap:6px; margin-bottom:12px; }
    .dash-stat { padding:10px 6px; }
    .dash-stat-num { font-size:20px; }
    .dash-stat-label { font-size:9px; }
    .dash-columns { grid-template-columns:1fr; gap:10px; }
    .dash-card { max-height:220px; }
    .dash-quick-actions { gap:6px; }
    .dash-action { padding:8px 10px; min-width:58px; font-size:11px; }
    .dash-action-icon { font-size:16px; }

    /* ── Chat ──────────────────────────────────────────────────────── */
    #chat-messages { padding:8px; }
    .chat-message { max-width:90%; padding:8px 10px; font-size:13px; }
    #chat-input-area { padding:6px 8px; gap:6px; }
    #chat-input { font-size:14px; padding:8px 10px; }

    /* ── Contact Detail ───────────────────────────────────────────── */
    .cd-header { flex-direction:column; padding:12px; gap:10px; }
    .cd-avatar { width:44px; height:44px; font-size:18px; }
    .cd-name { font-size:16px; }
    .cd-actions { width:100%; justify-content:flex-start; }
    .cd-stat-row { padding:6px 8px; gap:1px; }
    .cd-stat-n { font-size:14px; }
    .cd-stat-l { font-size:8px; }
    .cd-tabs { padding:4px 8px; gap:0; }
    .cd-tab { padding:5px 8px; font-size:11px; }
    .cd-body { padding:6px 10px; }

    /* ── Contact List ─────────────────────────────────────────────── */
    .ct-table-header, .ct-table-row { font-size:11px; }
    .ct-col-name { width:100px; }
    .ct-col-phone { width:90px; }
    .ct-col-type { width:70px; }
    .ct-col-email { display:none; }
    .ct-col-addr { display:none; }
    .ct-col-desc { display:none; }

    /* ── Phone App (spreadsheet) ──────────────────────────────────── */
    .ph-sheet { overflow-x:auto; }
    .ph-head, .ph-filters, .ph-row { min-width:800px; }
    .ph-c-desc { min-width:150px; }

    /* ── Texts App ────────────────────────────────────────────────── */
    .tx-layout { flex-direction:column; }
    .tx-convo-list { width:100%; min-width:100%; max-height:40vh; border-right:none; border-bottom:1px solid var(--border); }
    .tx-thread { min-height:50vh; }
    .tx-bubble { max-width:85%; }

    /* ── Email App ────────────────────────────────────────────────── */
    #email-list-pane { width:100%; min-width:100%; }

    /* ── Comms App ────────────────────────────────────────────────── */
    .comms-table-header, .comms-table-row { font-size:11px; }
    .comms-col-domain { width:60px; }
    .comms-col-type { width:50px; }

    /* ── Apps Grid ────────────────────────────────────────────────── */
    .app-group-grid { grid-template-columns:repeat(4, 1fr); gap:12px 6px; }
    .app-icon-tile { width:50px; height:50px; }
    .app-icon-glyph { font-size:22px; }
    .app-label { font-size:10px; }

    /* ── Bank Feed ────────────────────────────────────────────────── */
    .txn-table-header, .txn-table-row { font-size:11px; }
    .txn-col-desc { min-width:100px; }
    .txn-col-cat { width:80px; }

    /* ── Generic app toolbar ──────────────────────────────────────── */
    .app-screen > div:first-child { flex-wrap:wrap; }
    .app-screen > div:first-child input[type="text"] { width:80px; }

    /* ── Properties ───────────────────────────────────────────────── */
    .prop-grid { grid-template-columns:1fr; }

    /* ── Settings ─────────────────────────────────────────────────── */
    .settings-grid { grid-template-columns:1fr; }

    /* ── Incoming call overlay ────────────────────────────────────── */
    #call-overlay { right:10px; left:10px; min-width:auto; }
}

/* ── Learning Center ─────────────────────────────────────────────────── */
.lc-curriculum-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:12px; }
.lc-curriculum-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; cursor:pointer; transition:border-color 0.15s; }
.lc-curriculum-card:hover { border-color:var(--accent); }
.lc-progress-bar { height:6px; background:var(--bg-input); border-radius:3px; overflow:hidden; margin-top:6px; }
.lc-progress-fill { height:100%; background:var(--accent); border-radius:3px; transition:width 0.3s; }
.lc-difficulty-badge { font-size:10px; padding:2px 8px; border-radius:10px; font-weight:bold; display:inline-block; }
.lc-difficulty-beginner { background:#1a5a3a; color:#44ff88; }
.lc-difficulty-intermediate { background:#5a4a1a; color:#ffaa00; }
.lc-difficulty-advanced { background:#5a1a1a; color:#ff4444; }
.lc-lesson-row:hover { background:var(--bg-secondary); }
.lc-resource-card { display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--border); border-radius:var(--radius); margin-bottom:6px; cursor:pointer; background:var(--bg-card); }
.lc-resource-card:hover { border-color:var(--accent); }
.lc-course-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; margin-bottom:10px; }
.lc-course-card:hover { border-color:var(--accent); }
.lc-study-btn { background:linear-gradient(135deg, #00d4ff, #0088cc); color:white; border:none; padding:8px 18px; border-radius:6px; font-weight:bold; cursor:pointer; font-size:13px; transition:transform 0.1s, box-shadow 0.1s; }
.lc-study-btn:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,212,255,0.3); }
.lc-code-block { background:var(--bg-primary); border:1px solid var(--border); border-radius:var(--radius); padding:12px; overflow-x:auto; font-family:var(--font-mono); font-size:13px; margin:8px 0; white-space:pre; }
.lc-inline-code { background:var(--bg-input); padding:1px 5px; border-radius:3px; font-family:var(--font-mono); font-size:12px; }
.lc-exercise-item { transition:background 0.1s; }
.lc-exercise-item:hover, .lc-exercise-item.active { background:var(--bg-secondary); }
.lc-question-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:14px; margin-bottom:10px; }
.lc-option { padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius); margin:4px 0; cursor:pointer; transition:all 0.15s; color:var(--text-primary); font-size:13px; }
.lc-option:hover { border-color:var(--accent); background:rgba(0,212,255,0.05); }
.lc-option.selected { border-color:var(--accent); background:rgba(0,212,255,0.1); }
.lc-option.correct { border-color:#44ff88; background:rgba(68,255,136,0.1); }
.lc-option.incorrect { border-color:#ff4444; background:rgba(255,68,68,0.1); }
.lc-note-item { transition:background 0.1s; }
.lc-note-item:hover, .lc-note-item.active { background:var(--bg-secondary); }
.lc-outline-node { display:flex; align-items:center; gap:2px; min-height:30px; }
.lc-outline-handle { cursor:grab; color:var(--text-muted); padding:2px 4px; user-select:none; font-size:12px; opacity:0.4; }
.lc-outline-node:hover .lc-outline-handle { opacity:1; }
.lc-outline-input { flex:1; background:transparent; border:none; color:var(--text-primary); font-size:14px; padding:4px 0; outline:none; font-family:inherit; }
.lc-outline-input:focus { border-bottom:1px solid var(--accent); }
.lc-outline-bullet { color:var(--accent); font-family:var(--font-mono); min-width:24px; text-align:right; padding:2px 6px 2px 0; user-select:none; font-size:12px; }
.lc-flashcard { width:320px; max-width:90vw; height:200px; perspective:1000px; margin:16px auto; cursor:pointer; }
.lc-flashcard-inner { width:100%; height:100%; transition:transform 0.5s; transform-style:preserve-3d; position:relative; }
.lc-flashcard.flipped .lc-flashcard-inner { transform:rotateY(180deg); }
.lc-flashcard-front, .lc-flashcard-back { position:absolute; inset:0; backface-visibility:hidden; display:flex; align-items:center; justify-content:center; padding:20px; border-radius:var(--radius); font-size:15px; text-align:center; color:var(--text-primary); }
.lc-flashcard-front { background:var(--bg-card); border:1px solid var(--border); }
.lc-flashcard-back { background:var(--bg-secondary); border:1px solid var(--accent); transform:rotateY(180deg); }
.lc-heatmap-cell { width:10px; height:10px; border-radius:2px; background:var(--bg-input); }
.lc-heatmap-cell.l1 { background:#0a4a2d; }
.lc-heatmap-cell.l2 { background:#0d6e3a; }
.lc-heatmap-cell.l3 { background:#1a8a4a; }
.lc-heatmap-cell.l4 { background:#44ff88; }
.CodeMirror { height:100% !important; font-family:var(--font-mono) !important; }
@media (max-width:600px) {
    .lc-curriculum-grid { grid-template-columns:1fr; }
    .lc-flashcard { width:90vw; height:180px; }
}

/* ── Drafting App ────────────────────────────────────────────────────── */
.draft-filter-tab {
    padding:3px 10px; border-radius:4px; font-size:12px; cursor:pointer;
    color:var(--text-muted); background:transparent; border:1px solid transparent;
    transition:all 0.15s;
}
.draft-filter-tab:hover { color:var(--text-primary); background:var(--bg-input); }
.draft-filter-tab.active { color:var(--accent); border-color:var(--accent); background:rgba(0,255,170,0.05); }

.draft-item {
    display:flex; align-items:center; gap:10px; padding:10px 12px;
    border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.1s;
}
.draft-item:hover { background:var(--bg-secondary); }
.draft-item-icon { font-size:22px; flex-shrink:0; }
.draft-item-title { color:var(--text-primary); font-size:13px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.draft-item-meta { display:flex; gap:8px; align-items:center; font-size:11px; margin-top:2px; }

.draft-new-grid {
    display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:12px;
}
.draft-new-card {
    background:var(--bg-card); border:1px solid var(--border); border-radius:8px;
    padding:16px; cursor:pointer; transition:all 0.15s; text-align:center;
}
.draft-new-card:hover { border-color:var(--accent); background:var(--bg-secondary); transform:translateY(-1px); }
.draft-new-icon { font-size:28px; margin-bottom:6px; }
.draft-new-label { color:var(--text-primary); font-size:14px; font-weight:600; margin-bottom:4px; }
.draft-new-desc { color:var(--text-muted); font-size:12px; }

.draft-btn-sm {
    background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border);
    padding:4px 10px; border-radius:6px; font-size:11px; cursor:pointer; white-space:nowrap;
}
.draft-btn-sm:hover { background:var(--bg-secondary); }
.draft-btn-accent { background:var(--accent) !important; color:white !important; border-color:var(--accent) !important; font-weight:bold; }

.form-field-row { margin-bottom:8px; }
.form-field-clear {
    background:none; border:none; color:var(--text-muted); cursor:pointer;
    font-size:14px; padding:2px 4px; border-radius:3px;
}
.form-field-clear:hover { color:var(--accent); background:var(--bg-input); }

.fill-entry-row {
    background:var(--bg-card); border:1px solid var(--border); border-radius:6px;
    padding:8px; margin-bottom:6px;
}
.fill-entry-row:hover { border-color:var(--accent); }

/* OnlyOffice editor needs light background for toolbar visibility */
#draft-onlyoffice-container { background:#fff; }
#draft-onlyoffice-container iframe { border:none; width:100%; height:100%; }

/* ── ClearOffice ─────────────────────────────────────────────────────── */
.co-btn {
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; font-size: 11px; cursor: pointer;
    white-space: nowrap; font-family: inherit; text-decoration: none;
    display: inline-block;
}
.co-btn:hover { background: var(--bg-secondary); border-color: var(--accent); }
.co-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.co-btn-primary:hover { opacity: 0.9; }
.co-btn-muted { opacity: 0.7; }
.co-stat {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px; min-width: 140px;
    display: flex; flex-direction: column; gap: 2px;
}
.co-stat b { font-size: 18px; color: var(--text-primary); }
.co-stat span { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.co-chip {
    display: inline-block; background: var(--bg-input); color: var(--text-primary);
    padding: 4px 10px; border-radius: 12px; font-size: 11px;
    border: 1px solid var(--border); text-decoration: none;
    max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.co-chip:hover { border-color: var(--accent); }
.co-chip-x {
    background: transparent; color: var(--text-secondary); border: none;
    cursor: pointer; font-size: 11px; padding: 2px 6px;
}
.co-chip-x:hover { color: #c0392b; }
