:root {
    --primary: #14213D;
    --secondary: #14A47F;
    --accent: #E0A62B;
    --error: #E0584F;
    --background: #F7F8FA;
    --surface: #FFFFFF;
    --surface-muted: #F0F1F4;
    --border: #E5E7EB;
    --text-primary: #14213D;
    --text-secondary: #6B7280;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --health-green: #14A47F;
    --health-amber: #E0A62B;
    --health-red: #E0584F;
}

[data-theme="dark"] {
    --primary: #7C93FF;
    --secondary: #34D399;
    --accent: #F2B94A;
    --error: #F07068;
    --background: #111318;
    --surface: #191C22;
    --surface-muted: #20242C;
    --border: #2A2E37;
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --health-green: #34D399;
    --health-amber: #F2B94A;
    --health-red: #F07068;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background-color: var(--background); color: var(--text-primary); transition: all 0.3s; font-size: 16px; line-height: 1.5; }
#app { display: flex; flex-direction: column; height: 100vh; width: 100%; }

.search-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: none; align-items: flex-start; justify-content: center; z-index: 2000; padding-top: 60px; }
.search-overlay.active { display: flex; }
.search-modal { background: var(--surface); border-radius: var(--radius); width: 90%; max-width: 600px; max-height: 70vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.search-input { width: 100%; padding: 16px; border: none; background: var(--surface); font-size: 16px; color: var(--text-primary); border-bottom: 1px solid var(--border); font-family: inherit; }
.search-input:focus { outline: none; }
.search-results { max-height: calc(70vh - 60px); overflow-y: auto; }
.search-result-item { padding: 12px 16px; cursor: pointer; border-left: 3px solid transparent; transition: all 0.2s; }
.search-result-item:hover { background: var(--surface-muted); border-left-color: var(--primary); }

.bottom-nav { display: flex; justify-content: space-around; align-items: center; height: 68px; background: var(--surface); border-top: 1px solid var(--border); position: sticky; bottom: 0; z-index: 100; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 0; background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 11px; font-weight: 500; transition: color 0.2s; }
.nav-item.active { color: var(--primary); }
.nav-item .icon { font-size: 24px; }

.content { flex: 1; overflow-y: auto; padding-bottom: 0; }
.screen { display: none; padding-bottom: 80px; }
.screen.active { display: block; }

.screen-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: var(--background); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; gap: 12px; }
.screen-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; flex: 1; }

.btn-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-icon:hover { background: var(--surface-muted); }

.btn-fab { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: white; border: none; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-fab:hover { opacity: 0.9; }

.btn-back { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-primary); padding: 8px; }

.workspace-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 16px; }
.workspace-tab { padding: 12px 16px; border: none; background: none; color: var(--text-secondary); cursor: pointer; font-weight: 500; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; transition: all 0.2s; }
.workspace-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.workspace-section { display: none; }
.workspace-section.active { display: block; }

.container { max-width: 100%; padding: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-header h2 { font-size: 16px; font-weight: 600; }

.stat-value { font-size: 28px; font-weight: 700; }
.progress-bar { width: 100%; height: 8px; background: var(--surface-muted); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.progress-fill { height: 100%; background: var(--secondary); transition: width 0.3s; }

.stats-row { display: flex; justify-content: space-around; gap: 12px; }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat-number { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-secondary); }

.progress-chip { background: var(--surface-muted); padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; }

.brands-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.brand-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all 0.2s; }
.brand-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.brand-card-title h3 { font-size: 16px; font-weight: 600; margin-bottom: 2px; word-break: break-word; }
.brand-card-title p { font-size: 11px; color: var(--text-secondary); line-height: 1.3; }

.health-indicator { width: 12px; height: 12px; border-radius: 50%; }
.health-green { background: var(--health-green); }
.health-amber { background: var(--health-amber); }
.health-red { background: var(--health-red); }

.brands-list { display: flex; flex-direction: column; gap: 12px; }
.brand-list-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all 0.2s; }
.brand-list-item:hover { border-color: var(--primary); }

.category-section { margin-bottom: 24px; }
.category-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.category-header h3 { font-size: 16px; font-weight: 600; }
.category-progress { font-size: 12px; color: var(--text-secondary); }

.item-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s; display: flex; gap: 12px; align-items: flex-start; }
.item-tile:hover { border-color: var(--primary); background: var(--surface-muted); }
.item-tile input[type="checkbox"] { cursor: pointer; width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--secondary); }
.item-tile-content { flex: 1; min-width: 0; }
.item-tile-title { font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.item-tile.done .item-tile-title { text-decoration: line-through; opacity: 0.6; }
.item-tile-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; }
.item-tile-badges { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }

.badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--surface-muted); color: var(--text-primary); white-space: nowrap; }
.badge-low { background: rgba(20, 164, 127, 0.12); color: var(--health-green); }
.badge-medium { background: rgba(224, 166, 43, 0.12); color: var(--health-amber); }
.badge-high { background: rgba(224, 88, 79, 0.12); color: var(--health-red); }
.badge-task { background: rgba(20, 164, 127, 0.12); color: var(--secondary); }
.badge-milestone { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.badge-idea { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.badge-checkpoint { background: rgba(34, 197, 94, 0.12); color: #22c55e; }

.quick-action-bar { padding: 12px 0; margin-bottom: 16px; }
.btn-sm { padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-xs); cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s; }
.btn-sm:hover { background: var(--surface-muted); }

.add-item-btn { width: 100%; padding: 12px; border: 1px dashed var(--border); background: none; color: var(--text-primary); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; transition: all 0.2s; }
.add-item-btn:hover { background: var(--surface-muted); border-color: var(--primary); }

.timeline { position: relative; padding-left: 24px; }
.timeline-item { position: relative; padding: 12px 0 12px 24px; margin-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -12px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); border: 2px solid var(--surface); }
.timeline-item::after { content: ''; position: absolute; left: -8px; top: 16px; width: 2px; height: calc(100% + 8px); background: var(--border); }
.timeline-item:last-child::after { display: none; }
.timeline-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.timeline-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.timeline-title { font-weight: 600; margin-bottom: 4px; }
.timeline-type { font-size: 11px; display: inline-block; padding: 2px 6px; background: var(--surface-muted); border-radius: 4px; margin-top: 8px; }

.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: all 0.2s; }
.note-card:hover { border-color: var(--primary); }
.note-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.note-title { font-weight: 600; flex: 1; }
.note-preview { font-size: 13px; color: var(--text-secondary); line-height: 1.4; max-height: 3em; overflow: hidden; text-overflow: ellipsis; }
.note-meta { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

.documents-list { display: flex; flex-direction: column; gap: 12px; }
.document-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: all 0.2s; }
.document-card:hover { border-color: var(--primary); }
.document-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.document-title { font-weight: 600; flex: 1; word-break: break-word; }
.document-url { font-size: 12px; color: #0EA5E9; text-decoration: none; word-break: break-all; margin-bottom: 8px; }
.document-notes { font-size: 13px; color: var(--text-secondary); }

.contacts-list { display: flex; flex-direction: column; gap: 12px; }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: all 0.2s; }
.contact-card:hover { border-color: var(--primary); }
.contact-name { font-weight: 600; }
.contact-info { font-size: 12px; color: var(--text-secondary); }
.contact-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.contact-tag { font-size: 10px; padding: 2px 6px; background: var(--surface-muted); border-radius: 4px; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal.active { display: flex; }
.modal-content { background: var(--surface); border-radius: var(--radius); padding: 24px; max-width: 100%; width: 100%; max-height: 85vh; overflow-y: auto; }
.modal-content h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.modal-content label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; margin-top: 12px; }

.input-field { width: 100%; padding: 12px 16px; border: none; background: var(--surface-muted); border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary); margin-bottom: 12px; font-family: inherit; transition: all 0.2s; }
.input-field:focus { outline: none; background: var(--surface); border: 2px solid var(--primary); margin-bottom: 11px; }

.form-row { display: flex; gap: 12px; }
.form-row .input-field { flex: 1; }
textarea.input-field { resize: none; font-family: inherit; }

.color-picker { margin-bottom: 16px; }
.color-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.color-option { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: all 0.2s; }
.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--surface); }

.icon-picker { margin-bottom: 16px; }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-option { width: 100%; aspect-ratio: 1; border: 2px solid var(--border); background: var(--surface-muted); border-radius: var(--radius-xs); cursor: pointer; font-size: 28px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.icon-option:hover { border-color: var(--primary); }
.icon-option.selected { background: var(--primary); border-color: var(--primary); }

.tag-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--surface-muted); border-radius: var(--radius-xs); cursor: pointer; font-size: 13px; transition: all 0.2s; }
.tag-pill:hover { background: var(--primary); color: white; }
.tag-pill input[type="checkbox"] { cursor: pointer; accent-color: var(--secondary); }

.brand-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-tag { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--surface-muted); border-radius: var(--radius-xs); font-size: 12px; cursor: pointer; }
.brand-tag.selected { background: var(--primary); color: white; }

.btn-primary, .btn-outline, .btn-danger { padding: 12px 24px; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--surface-muted); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { opacity: 0.9; }

.modal-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end; }

.theme-toggle { display: flex; gap: 12px; }
.theme-btn { flex: 1; padding: 12px; border: 1px solid var(--border); background: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; transition: all 0.2s; }
.theme-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.settings-section { margin-bottom: 32px; }
.settings-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.settings-section p { margin-bottom: 8px; font-size: 14px; }
.settings-section button { width: 100%; margin-bottom: 8px; }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 24px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

@media (max-width: 600px) {
    .brands-grid { grid-template-columns: 1fr; }
    .modal-content { border-radius: var(--radius-sm); }
    .color-grid { grid-template-columns: repeat(4, 1fr); }
    .icon-grid { grid-template-columns: repeat(5, 1fr); }
    .form-row { flex-direction: column; }
}

@media (max-width: 400px) {
    .color-grid { grid-template-columns: repeat(3, 1fr); }
    .icon-grid { grid-template-columns: repeat(4, 1fr); }
}
