/* ==========================================================================
   Jazz Services Platform — Design System
   Dark dashboard theme inheriting jazz.services palette
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
    --color-ruby: #9b111e;
    --color-ruby-hover: #b71c2a;
    --color-ruby-dim: rgba(155, 17, 30, 0.15);

    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --bg-surface: #161616;
    --bg-input: #1a1a1a;
    --bg-overlay: rgba(10, 10, 10, 0.9);

    --text: #f5f5f5;
    --text-muted: #cccccc;
    --text-faint: #888888;
    --text-subtle: #555555;

    --border: rgba(245, 245, 245, 0.06);
    --border-light: rgba(245, 245, 245, 0.08);
    --border-hover: rgba(155, 17, 30, 0.3);

    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-dim: rgba(234, 179, 8, 0.15);
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-dim: rgba(59, 130, 246, 0.15);

    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    --sidebar-width: 240px;
    --topbar-height: 56px;
    --transition: 0.2s ease;
    --radius: 6px;
    --radius-sm: 4px;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-elevated: #ffffff;
    --bg-surface: #ebebeb;
    --bg-input: #ffffff;
    --bg-overlay: rgba(245, 245, 245, 0.9);

    --text: #1a1a1a;
    --text-muted: #444444;
    --text-faint: #777777;
    --text-subtle: #aaaaaa;

    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);
    --border-hover: rgba(155, 17, 30, 0.3);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
}

img { max-width: 100%; height: auto; display: block; }

a {
    color: var(--color-ruby);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--text); }

ul, ol { list-style: none; }

::selection {
    background-color: var(--color-ruby);
    color: #f5f5f5;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

h6 {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-ruby);
}

p { margin-bottom: var(--space-sm); color: var(--text-muted); }
strong { color: var(--text); }

.text-ruby { color: var(--color-ruby); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---------- App Layout ---------- */
.app-body {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.sidebar-collapsed .app-main {
    margin-left: 60px;
}

.page-content {
    padding: var(--space-lg);
    max-width: 1400px;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: 60px;
}

.sidebar__logo {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
}

.sidebar__logo a {
    text-decoration: none;
    color: var(--text);
}

.sidebar__logo-text {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-collapsed .sidebar__logo-text {
    display: none;
}

.sidebar__nav {
    flex: 1;
    padding: var(--space-sm) 0;
    overflow-y: auto;
}

.sidebar__nav ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem var(--space-md);
    color: var(--text-faint);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar__link:hover {
    color: var(--text);
    background-color: var(--bg-surface);
}

.sidebar__link--active {
    color: var(--text);
    background-color: var(--bg-surface);
    border-left-color: var(--color-ruby);
}

.sidebar__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-collapsed .sidebar__link span {
    display: none;
}

.sidebar__footer {
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--border);
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
    background-color: var(--bg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topbar__menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 0.25rem;
}

.topbar__menu-toggle svg {
    width: 20px;
    height: 20px;
}

.topbar__title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topbar__search {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
}

.topbar__search svg {
    width: 16px;
    height: 16px;
    color: var(--text-subtle);
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.topbar__search input {
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    width: 200px;
}

.topbar__search input::placeholder {
    color: var(--text-subtle);
}

.topbar__theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-faint);
    cursor: pointer;
    transition: all var(--transition);
}

.topbar__theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background-color: var(--bg-surface);
}

.topbar__theme-toggle svg {
    width: 16px;
    height: 16px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Show sun icon in dark mode, moon icon in light mode */
.theme-icon--light { display: none; }
.theme-icon--dark { display: block; }
[data-theme="light"] .theme-icon--light { display: block; }
[data-theme="light"] .theme-icon--dark { display: none; }

/* ---------- Flash Messages ---------- */
.flash {
    padding: 0.75rem var(--space-md);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash--success {
    background-color: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.flash--danger {
    background-color: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash--warning {
    background-color: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.flash--info {
    background-color: var(--info-dim);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.flash__close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
}

.flash__close:hover { opacity: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn--primary {
    background-color: var(--color-ruby);
    color: #f5f5f5;
}
.btn--primary:hover {
    background-color: var(--color-ruby-hover);
    color: #f5f5f5;
}

.btn--secondary {
    background-color: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn--secondary:hover {
    background-color: var(--bg-input);
    color: var(--text);
    border-color: var(--border-hover);
}

.btn--ghost {
    background: none;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
}
.btn--ghost:hover {
    color: var(--text);
    background-color: var(--bg-surface);
}

.btn--danger {
    background-color: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn--danger:hover {
    background-color: var(--danger);
    color: #fff;
}

.btn--sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn--full { width: 100%; justify-content: center; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--text);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-ruby);
    box-shadow: 0 0 0 3px var(--color-ruby-dim);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-subtle);
}

.form-input--mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.form-inline {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

/* ---------- Cards ---------- */
.card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    transition: border-color var(--transition);
}

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

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card__title {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

/* ---------- Stats Cards ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 20px rgba(155, 17, 30, 0.05);
}

.stat-card__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: var(--space-xs);
}

.stat-card__value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.1;
}

.stat-card__change {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-top: var(--space-xs);
}

.stat-card__change--up { color: var(--success); }
.stat-card__change--down { color: var(--danger); }

/* ---------- Tables ---------- */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th {
    text-align: left;
    padding: 0.75rem var(--space-sm);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.table td {
    padding: 0.65rem var(--space-sm);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: var(--bg-surface);
}

.table td a {
    color: var(--text);
    font-weight: 500;
}
.table td a:hover {
    color: var(--color-ruby);
}

.table__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.table__empty {
    text-align: center;
    padding: var(--space-xl) var(--space-sm);
    color: var(--text-subtle);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.badge--muted {
    background-color: var(--bg-surface);
    color: var(--text-faint);
}

.badge--success {
    background-color: var(--success-dim);
    color: var(--success);
}

.badge--danger {
    background-color: var(--danger-dim);
    color: var(--danger);
}

.badge--warning {
    background-color: var(--warning-dim);
    color: var(--warning);
}

.badge--info {
    background-color: var(--info-dim);
    color: var(--info);
}

.badge--ruby {
    background-color: var(--color-ruby-dim);
    color: var(--color-ruby);
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    gap: 0.25rem;
    margin-top: var(--space-md);
}

.pagination__item {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-faint);
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.pagination__item:hover {
    color: var(--text);
    border-color: var(--border-hover);
}

.pagination__item--active {
    color: #f5f5f5;
    background-color: var(--color-ruby);
    border-color: var(--color-ruby);
}

/* ---------- Filters Bar ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filters .form-input,
.filters .form-select {
    width: auto;
    min-width: 150px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
}

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.page-header__left h2 {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-faint);
    margin-top: 0.25rem;
}

/* ---------- Detail Page ---------- */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.detail-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.detail-meta__item {
    min-width: 120px;
}

.detail-meta__item h6 {
    margin-bottom: 0.2rem;
}

.detail-meta__item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    padding-left: var(--space-lg);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--border);
}

.timeline__item {
    position: relative;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
}

.timeline__item::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-lg) + 3px);
    top: 4px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 2px solid var(--color-ruby);
}

.timeline__date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-subtle);
    margin-bottom: 0.25rem;
}

.timeline__content {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.timeline__content strong {
    color: var(--text);
}

/* ---------- Pipeline / Kanban Board ---------- */
.pipeline {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
}

.pipeline__column {
    min-width: 280px;
    flex: 1;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.pipeline__header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pipeline__header h4 {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pipeline__count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-faint);
}

.pipeline__cards {
    padding: var(--space-sm);
    flex: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.pipeline__card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    cursor: grab;
    transition: border-color var(--transition), transform var(--transition);
}

.pipeline__card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.pipeline__card h5 {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pipeline__card p {
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-bottom: 0.25rem;
}

.pipeline__card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xs);
}

/* ---------- Calendar ---------- */
.calendar {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.calendar__header h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
}

.calendar__nav {
    display: flex;
    gap: 0.5rem;
}

.calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar__day-label {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.calendar__day {
    min-height: 100px;
    padding: 0.5rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    transition: background-color var(--transition);
}

.calendar__day:nth-child(7n) {
    border-right: none;
}

.calendar__day:hover {
    background-color: var(--bg-surface);
}

.calendar__day-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-bottom: 0.25rem;
}

.calendar__day--today .calendar__day-number {
    color: var(--color-ruby);
    font-weight: 700;
}

.calendar__day--other {
    opacity: 0.3;
}

.calendar__event {
    display: block;
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    border-radius: 2px;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.calendar__event--gig { background-color: var(--color-ruby-dim); border-left: 2px solid var(--color-ruby); }
.calendar__event--follow_up { background-color: var(--info-dim); border-left: 2px solid var(--info); }
.calendar__event--task { background-color: var(--warning-dim); border-left: 2px solid var(--warning); }
.calendar__event--meeting { background-color: var(--success-dim); border-left: 2px solid var(--success); }
.calendar__event--deadline { background-color: var(--danger-dim); border-left: 2px solid var(--danger); }

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-subtle);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-subtle);
    margin-bottom: var(--space-sm);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-faint);
    margin-bottom: var(--space-xs);
}

.empty-state p {
    color: var(--text-subtle);
    margin-bottom: var(--space-md);
}

/* ---------- Activity Feed ---------- */
.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-feed__item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.activity-feed__item:last-child {
    border-bottom: none;
}

.activity-feed__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-ruby);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-feed__text {
    color: var(--text-muted);
}

.activity-feed__text strong {
    color: var(--text);
}

.activity-feed__time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-subtle);
    margin-top: 0.15rem;
}

/* ---------- Grid Layouts ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.grid-sidebar { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-lg); align-items: start; }

/* ---------- Divider ---------- */
.divider {
    width: 60px;
    height: 3px;
    background-color: var(--color-ruby);
    border: none;
    margin: var(--space-md) 0;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-md);
}

.tabs__item {
    padding: 0.6rem var(--space-md);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-faint);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.tabs__item:hover {
    color: var(--text);
}

.tabs__item--active {
    color: var(--text);
    border-bottom-color: var(--color-ruby);
}

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal__header h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
}

.modal__body {
    padding: var(--space-md);
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: var(--space-md);
    border-top: 1px solid var(--border);
}

/* ---------- HTMX Loading States ---------- */
.htmx-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* ---------- Template Editor ---------- */
.template-editor {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm);
    min-height: 200px;
    resize: vertical;
    width: 100%;
    color: var(--text);
    line-height: 1.8;
}

.template-editor:focus {
    border-color: var(--color-ruby);
    box-shadow: 0 0 0 3px var(--color-ruby-dim);
    outline: none;
}

.template-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: var(--space-xs);
}

.template-var {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ruby);
    cursor: pointer;
}

.template-var:hover {
    background-color: var(--color-ruby-dim);
}

/* ---------- Login Page ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--space-md);
}

.login-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.login-logo {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-faint);
    margin-bottom: 0;
}

.login-form {
    margin-top: var(--space-md);
}

.login-footer {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-subtle);
    margin-top: var(--space-lg);
    margin-bottom: 0;
}

/* ---------- Discovery ---------- */
.discovery-form {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.discovery-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.discovery-venue {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.discovery-venue__info h4 {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.discovery-venue__actions {
    display: flex;
    gap: 0.5rem;
}

/* ---------- Analytics Charts ---------- */
.chart-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
}

.chart-card__header {
    margin-bottom: var(--space-md);
}

.chart-card__header h3 {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.chart-bar__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 100px;
    text-align: right;
}

.chart-bar__track {
    flex: 1;
    height: 24px;
    background-color: var(--bg-surface);
    border-radius: 2px;
    overflow: hidden;
}

.chart-bar__fill {
    height: 100%;
    background-color: var(--color-ruby);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-bar__value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    min-width: 40px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .grid-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .topbar__menu-toggle {
        display: block;
    }

    .topbar__search input {
        width: 120px;
    }

    .page-content {
        padding: var(--space-md);
    }

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

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .pipeline {
        flex-direction: column;
    }

    .pipeline__column {
        min-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters .form-input,
    .filters .form-select {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-header {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .detail-meta {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .calendar__day {
        min-height: 60px;
        padding: 0.25rem;
    }

    .btn-group {
        flex-direction: column;
    }
}

/* ---------- Print ---------- */
@media print {
    .sidebar,
    .topbar,
    .flash {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
    }

    body {
        background: #fff;
        color: #000;
    }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
