/* 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: 100vh;
}

#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);
}

#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;
}

.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); }

.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 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;
}

#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;
    flex-direction: column;
    overflow: hidden;
}

.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 {
    flex: 1;
    overflow-y: auto;
    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; }
.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-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; }
.mt-sheet-head { display:flex; background:var(--bg-secondary); border-bottom:2px solid var(--border); position:sticky; top:0; z-index:1; }
.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; }
.mt-sheet-row { display:flex; border-bottom:1px solid rgba(255,255,255,0.04); cursor:pointer; align-items:center; }
.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; }
.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; }

/* 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-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; } }

/* 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; }

.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); }

/* 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); }

/* 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; }

/* === 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; }
.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-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-row { display:flex; align-items:center; gap:4px; flex-wrap:nowrap; }
.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:10px; padding:0; opacity:0.5; }
.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-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:100px; flex-shrink:0; text-align:right; font-family:var(--font-mono); font-weight:bold; font-size:13px; }
.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:180px; flex-shrink:0; }
.txn-col-prop { width:130px; flex-shrink:0; }
.txn-col-rev { width:40px; flex-shrink:0; text-align:center; }

.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; }

/* === 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-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-connect-bar { display:flex; gap:6px; padding:8px 10px; border-top:1px solid var(--border); background:var(--bg-secondary); flex-shrink:0; align-items:center; }
.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; }

/* 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 10px; }
    #avatar-container, #avatar-canvas { width:40px; height:40px; }
    #navi-name { font-size:14px; }

    /* ── Tab Bar ──────────────────────────────────────────────────── */
    #tab-bar { padding:4px 0; }
    .tab-btn { padding:6px 0; font-size:10px; }
    .tab-icon { font-size:16px; }

    /* ── 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; }
}
