/* ═══════════════════════════════════════════════
   ERPS – ERP Vendor Selection Platform
   ═══════════════════════════════════════════════ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --success: #16a34a;
    --success-light: #dcfce7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-50);
}

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

h1, h2, h3, h4 { margin-top: 0; }


/* ═══ NAVBAR ════════════════════════════════════ */

.navbar-main {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gray-900);
    color: #fff;
    font-size: 13px;
    height: 48px;
}

.navbar-container {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    gap: .75rem;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1;
    min-width: 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.navbar-link {
    color: var(--gray-300);
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.navbar-link:hover, .navbar-link.active {
    color: #fff;
    background: rgba(255,255,255,.12);
}

.navbar-divider {
    color: var(--gray-600);
    margin: 0 2px;
    user-select: none;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.navbar-notification-bell {
    color: #fff !important;
    text-decoration: none !important;
    position: relative;
    font-size: 16px;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 99px;
    font-weight: 600;
}

.navbar-username { font-weight: 500; }
.navbar-role { color: var(--gray-400); font-size: 12px; }
.navbar-logout { color: var(--gray-400) !important; }

.navbar-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
    border-radius: 3px;
}

.navbar-project-switcher {
    display: flex;
    align-items: center;
}

.project-select {
    background: var(--gray-800);
    color: var(--gray-300);
    border: 1px solid var(--gray-600);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    max-width: 200px;
}
.project-select:focus {
    outline: none;
    border-color: var(--primary);
}

.navbar-project-badge {
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.project-badge {
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}


/* ═══ MAIN CONTENT ══════════════════════════════ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}


/* ═══ FLASH MESSAGES ════════════════════════════ */

.flash-container {
    max-width: 1200px;
    margin: 1rem auto 0;
    padding: 0 1.5rem;
}

.flash-message {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: .5rem;
}

.flash-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.flash-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.flash-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }


/* ═══ PAGE HEADER ═══════════════════════════════ */

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.page-header .meta, .page-header .page-subtitle {
    color: var(--gray-500); font-size: 13px; width: 100%;
}

.header-actions { margin-left: auto; display: flex; gap: .5rem; }


/* ═══ BUTTONS ═══════════════════════════════════ */

.btn, button.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
    transition: background .15s;
    line-height: 1.4;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: .9; }
.btn-full { width: 100%; text-align: center; }

.btn-sm, button.btn-sm {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    text-decoration: none !important;
}
.btn-sm:hover { background: var(--gray-100); }

.btn-promote { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.promoted { background: var(--gray-100); color: var(--success); border-color: var(--success); }

.link-secondary { color: var(--gray-500); font-size: 13px; }


/* ═══ CARDS ═════════════════════════════════════ */

.card, .section-card, .form-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card h3, .section-card h3 { margin: 0 0 .75rem; font-size: 15px; font-weight: 600; }
.card-full { grid-column: 1 / -1; }
.card-warning { border-left: 4px solid var(--warning); }
.card-info { border-left: 4px solid var(--primary); }
.card-danger { border-left: 4px solid var(--danger); }

.dashboard-grid, .grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}


/* ═══ TABLES ════════════════════════════════════ */

.table, table.table, .table-compact {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td,
.table-compact th, .table-compact td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th, .table-compact th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table-compact td { font-size: 13px; padding: 6px 8px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }


/* ═══ FORMS ═════════════════════════════════════ */

.form-card { max-width: 700px; padding: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-weight: 500; font-size: 13px;
    margin-bottom: 4px; color: var(--gray-700);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
}

.form-group textarea { resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

.form-section { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.form-section:last-of-type { border-bottom: none; }
.form-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; color: var(--gray-700); }

.form-label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; color: var(--gray-700); }

.form-input, .form-textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 14px; background: #fff;
}
.form-input:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-textarea { resize: vertical; }

.form-help-text { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

.inline-form {
    display: flex; gap: .5rem; align-items: center; margin: .75rem 0;
}
.inline-form input, .inline-form select { padding: 6px 8px; font-size: 13px; }

.inline-filters, .filter-bar form {
    display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.inline-filters select, .filter-bar select {
    padding: 6px 10px; border: 1px solid var(--gray-300);
    border-radius: var(--radius); font-size: 13px;
}

.readonly { background: var(--gray-100) !important; color: var(--gray-500); }


/* ═══ STATUS / TIER / PHASE BADGES ══════════════ */

.status-open, .status-draft, .badge-warning { color: var(--warning); font-weight: 500; }
.status-closed, .status-completed, .status-consolidated, .status-weighted,
.badge-success { color: var(--success); font-weight: 500; }
.status-deferred, .status-archived { color: var(--gray-500); }
.status-n\/a { color: var(--gray-400); }
.overdue, .text-danger { color: var(--danger); font-weight: 500; }

.badge, .tier-badge, .status-badge, .role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
}

.tier-A, .badge-tier-a { background: #fee2e2; color: #991b1b; }
.tier-B, .badge-tier-b { background: #fef3c7; color: #92400e; }
.tier-C, .badge-tier-c { background: #dbeafe; color: #1e40af; }
.tier-D, .badge-tier-d { background: var(--gray-100); color: var(--gray-600); }

.phase-invited { color: var(--gray-500); }
.phase-rfi { color: var(--primary); font-weight: 500; }
.phase-rfp { color: var(--warning); font-weight: 500; }
.phase-evaluated { color: var(--success); font-weight: 500; }

.tier-pending { color: var(--gray-400); }
.tier-pass { color: var(--success); font-weight: 600; }
.tier-fail { color: var(--danger); font-weight: 600; }

.comply-yes { color: var(--success); font-weight: 600; }
.comply-no { color: var(--danger); font-weight: 600; }
.pending { color: var(--gray-400); font-style: italic; }

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-success { background: var(--success-light); color: #166534; }


/* ═══ MATURITY BAR ══════════════════════════════ */

.maturity-bar {
    width: 100%; height: 20px; background: var(--gray-200);
    border-radius: 3px; overflow: hidden;
}
.maturity-fill {
    height: 100%; background: var(--primary); color: #fff;
    font-size: 11px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    min-width: 30px;
}


/* ═══ TABS ══════════════════════════════════════ */

.tab-bar, .tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1rem;
    gap: 0;
}

.tab, .tab-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--gray-500);
}

.tab:hover, .tab-btn:hover { color: var(--gray-700); }
.tab.active, .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content, .tab-panel { display: none; }
.tab-content.active, .tab-panel.active { display: block; }


/* ═══ TOPIC / ENTRY BLOCKS ══════════════════════ */

.topic-block {
    margin-bottom: 1.5rem; background: #fff;
    border: 1px solid var(--gray-200); border-radius: var(--radius);
    padding: 1rem;
}

.topic-header { margin: 0 0 .75rem; font-size: 14px; font-weight: 600; color: var(--gray-700); }

.entry-row, .entry-item {
    display: flex; gap: .75rem; padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.entry-type-badge, .type-badge {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.type-fact, .type-F { background: #dbeafe; color: #1e40af; }
.type-decision, .type-D { background: #dcfce7; color: #166534; }
.type-action, .type-A { background: #fef3c7; color: #92400e; }

.entry-body, .entry-content { flex: 1; }
.entry-body p, .entry-content p { margin: 0 0 4px; }
.entry-meta, .entry-details {
    display: flex; gap: 1rem; font-size: 12px; color: var(--gray-500);
    align-items: center;
}

.add-entry-bar, .add-entry-form {
    display: flex; gap: .5rem; margin-top: .75rem;
    align-items: center; flex-wrap: wrap;
}
.add-entry-bar select, .add-entry-bar input,
.add-entry-form select, .add-entry-form input {
    padding: 5px 8px; font-size: 13px;
    border: 1px solid var(--gray-300); border-radius: 4px;
}
.add-entry-bar input[type="text"], .add-entry-form input[type="text"] {
    flex: 1; min-width: 200px;
}


/* ═══ STATS ═════════════════════════════════════ */

.stat-row, .stats-row {
    display: flex; gap: 1.5rem; margin: .75rem 0;
}
.stat, .stat-card { text-align: center; }
.stat-num, .stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--gray-500); }

.count { font-size: 12px; color: var(--gray-400); font-weight: 400; }
.count-info { color: var(--gray-500); font-size: 13px; margin-top: .5rem; }


/* ═══ LOGIN ═════════════════════════════════════ */

.login-page, .login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 80vh;
}

.login-card, .login-box {
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 2rem;
    width: 360px; box-shadow: var(--shadow-md); text-align: center;
}

.login-card h1, .login-box h1 { margin: 0; font-size: 1.75rem; }
.login-title { font-size: 1.75rem; margin: 0; }
.subtitle, .login-subtitle { color: var(--gray-500); margin: 4px 0 1.5rem; font-size: 14px; }
.login-card .form-group, .login-box .form-group { text-align: left; }
.login-form .form-group { text-align: left; }

.btn-block { width: 100%; text-align: center; display: block; }

.login-footer { margin-top: 1rem; text-align: center; }

.current-logo { margin-bottom: 1rem; }
.logo-preview { max-height: 48px; width: auto; border: 1px solid var(--gray-200); border-radius: 4px; padding: 4px; }

.select-project-container {
    max-width: 700px; margin: 3rem auto; text-align: center;
}
.select-project-header { margin-bottom: 2rem; }
.select-project-header h1 { margin: 0 0 .5rem; font-size: 1.5rem; }
.select-project-header p { color: var(--gray-500); margin: 0; }

.project-cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem; text-align: left;
}

.project-card {
    display: block; padding: 1rem 1.25rem;
    border: 1px solid var(--gray-200); border-radius: var(--radius);
    text-decoration: none !important; color: var(--gray-800);
    transition: border-color .15s, box-shadow .15s;
    background: #fff; box-shadow: var(--shadow);
}
.project-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

.project-card-header { margin-bottom: .5rem; }
.project-code { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.project-card-body {}
.project-name { margin: 0 0 .5rem; font-size: 14px; color: var(--gray-600); }
.project-role { margin: 0; }

.no-projects-message { text-align: center; color: var(--gray-500); padding: 2rem; }

.page-container { max-width: 800px; }

.role-tag {
    display: inline-block; background: var(--primary-light);
    color: var(--primary-dark); padding: 2px 8px;
    border-radius: 3px; font-size: 11px; font-weight: 600; margin-left: 8px;
}


/* ═══ NOTIFICATIONS ═════════════════════════════ */

.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li, .notif-item {
    display: flex; align-items: center; gap: .75rem;
    padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px;
}
.notif-item.unread, .notif-list li.unread { font-weight: 500; border-left: 3px solid var(--primary); padding-left: 8px; }

.notif-type {
    background: var(--gray-100); padding: 2px 6px;
    border-radius: 3px; font-size: 11px; color: var(--gray-600);
}
.notif-content p { margin: 4px 0; font-size: 13px; color: var(--gray-500); }
.notif-actions { display: flex; gap: .5rem; margin-left: auto; }


/* ═══ Q&A ═══════════════════════════════════════ */

.qa-list { margin: .5rem 0; }
.qa-thread {
    padding: 10px; border: 1px solid var(--gray-200);
    border-radius: var(--radius); margin-bottom: .5rem;
    display: flex; align-items: center; gap: .75rem;
}
.qa-meta { font-size: 12px; color: var(--gray-400); margin-left: auto; }


/* ═══ DETAIL PAGES ══════════════════════════════ */

.detail-card, .detail-section {
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item label, .detail-label {
    font-size: 12px; font-weight: 500;
    color: var(--gray-500); text-transform: uppercase;
}
.detail-item span, .detail-value { display: block; margin-top: 2px; }

.detail-description {
    margin-top: 1rem; padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}


/* ═══ RFI / RFP FORMS ══════════════════════════ */

.rfi-row, .rfp-row, .svc-row, .response-row {
    padding: 12px; border: 1px solid var(--gray-200);
    border-radius: var(--radius); margin-bottom: .75rem;
}
.rfi-response, .response-options { display: flex; gap: 1.5rem; margin: 8px 0; }
.rfi-response label, .response-options label { display: flex; align-items: center; gap: 4px; cursor: pointer; }

.phase-gate, .locked-section {
    text-align: center; padding: 2rem; color: var(--gray-500);
    background: var(--gray-50); border-radius: var(--radius);
    border: 1px dashed var(--gray-300);
}


/* ═══ LISTS ═════════════════════════════════════ */

.decision-list, .participant-list { list-style: none; padding: 0; margin: 0; }
.decision-list li, .participant-list li {
    padding: 6px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px;
}
.participant-list li {
    display: flex; align-items: center; justify-content: space-between;
}


/* ═══ MISC ══════════════════════════════════════ */

.empty, .no-data { color: var(--gray-400); font-style: italic; padding: 1rem 0; }
.hint, .help-text { font-size: 12px; color: var(--gray-400); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: .5rem; }
.mb-1 { margin-bottom: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

section { margin-bottom: 1.5rem; }
section h2 { font-size: 1.1rem; margin-bottom: .75rem; }

.filter-bar { margin-bottom: 1rem; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 1rem; font-size: 13px; }
.alert-info { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }


/* ═══ RESPONSIVE ════════════════════════════════ */

@media (max-width: 900px) {
    .navbar-main { height: auto; }
    .navbar-container { flex-wrap: wrap; padding: .5rem; }
    .navbar-links { flex-wrap: wrap; }
    .dashboard-grid, .grid-2col { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .detail-grid { grid-template-columns: 1fr; }
    .navbar-right { font-size: 12px; }
}
