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

:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-light: #f0f1f3;
    --text: #1a1d26;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-text: #3730a3;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --sidebar-width: 220px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

/* === Layout === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--text);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 200;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-switcher { position: relative; }
.brand-current {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.brand-current:hover { opacity: 0.85; }
.brand-current svg { opacity: 0.5; }
.brand-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: -10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}
.brand-dropdown.open { display: block; }
.brand-option {
    display: block;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background 0.1s;
}
.brand-option:hover { background: #f3f4f6; }
.brand-option.active {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: #1a237e;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content {
    padding: 24px 32px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    background: var(--surface);
    color: var(--text);
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--bg); border-color: #d1d5db; }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 6px; font-size: 11px; border-radius: 4px; }

/* === Forms === */
input[type="text"],
select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s;
    outline: none;
}

input[type="text"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

input[type="text"]::placeholder { color: var(--text-muted); }

/* === Meeting Cards === */
details.meeting-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
}

details.meeting-card > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
details.meeting-card > summary::-webkit-details-marker { display: none; }

details.meeting-card > summary .meeting-toggle {
    display: inline-block;
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.15s;
    width: 16px;
    text-align: center;
}

details.meeting-card[open] > summary .meeting-toggle {
    transform: rotate(90deg);
}

details.meeting-card[open] > summary {
    border-bottom: 1px solid var(--border-light);
}

.meeting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg);
}

.meeting-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meeting-header h2 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.meeting-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.meeting-title-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    text-underline-offset: 2px;
}
.meeting-title-link:hover {
    color: var(--primary);
    text-decoration-color: var(--primary);
}

.meeting-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-count {
    font-weight: 500;
    color: var(--text-secondary);
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--primary-light);
    color: var(--primary-text);
}

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

.badge-request {
    background: #e0e7ff;
    color: #3730a3;
}

/* Cluster-specific badges */
.badge-ops { background: #e8f5e9; color: #2e7d32; }
.badge-cs { background: #fff3e0; color: #e65100; }
.badge-fss { background: #f3e5f5; color: #7b1fa2; }
.badge-hmh { background: #e3f2fd; color: #1565c0; }
.badge-ps { background: #fce4ec; color: #c62828; }
.badge-other { background: #f5f5f5; color: #616161; }

/* === Tables === */
.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th {
    text-align: left;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.items-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    font-size: 13px;
}

.items-table tbody tr {
    transition: background 0.1s;
}

.items-table tbody tr:hover {
    background: var(--bg);
}

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

/* === Description === */
.description-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* === Department Tag === */
.dept-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* === Date Headers === */
.date-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 32px 0 14px;
    padding: 10px 0;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-header:first-of-type { margin-top: 4px; }

/* === Search Bar === */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* === Filters === */
.tracking-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.tracking-filters select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    min-width: 160px;
    outline: none;
    transition: border-color 0.15s;
    cursor: pointer;
}

/* === No Items / Empty === */
.no-items {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px 20px;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p { font-size: 14px; }

/* === Section Header (for non-meeting tables) === */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
}

.section-card-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* === Bid Type === */
.bid-type {
    font-size: 11px;
    color: var(--text-muted);
}

/* === Flags === */
.flag-tag {
    padding: 3px 0;
    font-size: 12.5px;
    line-height: 1.4;
}

.flag-tag strong {
    color: var(--primary-text);
    font-weight: 600;
}

.flag-source {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.flag-ai {
    background: #fef3c7;
    color: #92400e;
}

.flag-manual {
    background: #d1fae5;
    color: #065f46;
}

.flag-action-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Row highlight for flagged items */
.items-table tbody tr.matched {
    background: #f0fdf4;
}

.items-table tbody tr.ai-match {
    background: #fffbeb;
}

/* === Notes/Request textarea === */
.item-notes {
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.item-notes:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

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

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

.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* === Week Navigation === */
.date-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.date-nav-form { display: contents; }

.date-nav-arrow {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1;
}

.date-nav-arrow:hover {
    background: var(--bg);
    color: var(--text);
    border-color: #d1d5db;
}

.date-nav-label {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
