/* ── PCA Change Management – site.css ── */

:root {
    --color-primary: #e8533a;
    --color-primary-hover: #c73f28;
    --color-sidebar-bg: #ffffff;
    --color-sidebar-text: #374151;
    --color-app-bg: #f0f4ed;
    --color-card-bg: #ffffff;
    --color-topbar-bg: #ffffff;
    --font-family: 'Inter', system-ui, sans-serif;
    --sidebar-width: 230px;
    --sidebar-collapsed: 64px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--color-app-bg);
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

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

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    box-shadow: 1px 0 0 #e5e7eb;
    transition: width .2s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid #f3f4f6;
    min-height: 64px;
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--color-primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    white-space: nowrap;
    line-height: 1.2;
}
.sidebar-logo .logo-text small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 14px 10px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--color-sidebar-text);
    font-weight: 500;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
    white-space: nowrap;
}
.sidebar-link i { font-size: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-link:hover {
    background: #f9fafb;
    color: var(--color-primary);
}
.sidebar-link:hover i { opacity: 1; }
.sidebar-link.active {
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    font-weight: 600;
}
.sidebar-link.active i { opacity: 1; }

.sidebar-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid #f3f4f6;
}

/* ── Main area ── */
.main-wrap {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    background: var(--color-topbar-bg);
    border-bottom: 1px solid #e5e7eb;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}
.topbar-title small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
}
.topbar-user:hover { background: #f3f4f6; color: #374151; }
.topbar-user .avatar {
    width: 28px; height: 28px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* ── Page content ── */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ── Toasts ── */
.toast-area {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 300px;
    max-width: 420px;
}
.toast-item {
    background: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 4px solid #10b981;
    font-size: 13px;
    animation: slideIn .2s ease;
}
.toast-item.error { border-left-color: #ef4444; }
.toast-item i { font-size: 16px; margin-top: 1px; }
.toast-item.success i { color: #10b981; }
.toast-item.error i { color: #ef4444; }
.toast-close {
    margin-left: auto;
    cursor: pointer;
    color: #9ca3af;
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}
.toast-close:hover { color: #374151; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Cards ── */
.card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid #f3f4f6;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    background: transparent;
}

.card-body { padding: 20px; }

/* ── Stat cards ── */
.stat-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.primary   { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); }
.stat-icon.blue      { background: #eff6ff; color: #3b82f6; }
.stat-icon.green     { background: #f0fdf4; color: #16a34a; }
.stat-icon.yellow    { background: #fefce8; color: #ca8a04; }
.stat-icon.red       { background: #fef2f2; color: #dc2626; }
.stat-icon.purple    { background: #f5f3ff; color: #7c3aed; }
.stat-icon.gray      { background: #f9fafb; color: #6b7280; }
.stat-icon.dark      { background: #f3f4f6; color: #374151; }

.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; color: #111827; }
.stat-label { font-size: 12px; color: #6b7280; margin-top: 2px; font-weight: 500; }

/* ── Buttons ── */
.btn-primary {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--color-primary-hover) !important;
    border-color: var(--color-primary-hover) !important;
    color: #fff !important;
}
.btn-outline-primary {
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}
.btn-outline-primary:hover {
    background: var(--color-primary) !important;
    color: #fff !important;
}

/* ── Tables ── */
.table { font-size: 13.5px; margin-bottom: 0; }
.table th {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    padding: 10px 14px;
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
}
.table td {
    padding: 12px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.table tbody tr:hover td { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Status badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}
.status-draft       { background: #f3f4f6; color: #6b7280; }
.status-submitted   { background: #eff6ff; color: #2563eb; }
.status-underreview { background: #fef9c3; color: #854d0e; }
.status-approved    { background: #f0fdf4; color: #15803d; }
.status-rejected    { background: #fef2f2; color: #b91c1c; }
.status-implemented { background: #f5f3ff; color: #6d28d9; }
.status-closed      { background: #f3f4f6; color: #374151; }
.priority-low      { background: #f0fdf4; color: #15803d; }
.priority-medium   { background: #fef9c3; color: #854d0e; }
.priority-high     { background: #fff7ed; color: #c2410c; }
.priority-critical { background: #fef2f2; color: #b91c1c; }

/* ── Forms ── */
.form-label { font-weight: 500; font-size: 13px; color: #374151; margin-bottom: 5px; }
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 13.5px;
    padding: 8px 12px;
    color: #1f2937;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
    outline: none;
}

/* CR form sections */
.form-section {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
    overflow: hidden;
}
.form-section-header {
    background: #f9fafb;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-header i { color: var(--color-primary); }
.form-section-body { padding: 20px; }

/* CR details */
.detail-table { width: 100%; }
.detail-table tr td:first-child {
    width: 220px;
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 0;
    vertical-align: top;
}
.detail-table tr td:last-child {
    padding: 10px 0;
    color: #1f2937;
    font-size: 13.5px;
    border-bottom: 1px solid #f3f4f6;
}
.detail-table tr:last-child td { border-bottom: none; }

/* ── Approval timeline ── */
.approval-timeline { display: flex; flex-direction: column; gap: 0; }
.approval-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    padding-bottom: 20px;
}
.approval-step:last-child { padding-bottom: 0; }
.approval-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 17px; top: 36px;
    width: 2px;
    bottom: 0;
    background: #e5e7eb;
}
.step-dot {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    z-index: 1;
}
.step-dot.pending  { background: #fef9c3; color: #854d0e; border: 2px solid #fde047; }
.step-dot.approved { background: #f0fdf4; color: #15803d; border: 2px solid #86efac; }
.step-dot.rejected { background: #fef2f2; color: #b91c1c; border: 2px solid #fca5a5; }
.step-content { flex: 1; padding-top: 6px; }
.step-content .step-title { font-weight: 600; font-size: 13.5px; color: #1f2937; }
.step-content .step-meta  { font-size: 12px; color: #9ca3af; margin-top: 2px; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}
.page-header-title { font-size: 22px; font-weight: 700; color: #111827; margin: 0; line-height: 1.3; }
.page-header-sub   { font-size: 13px; color: #6b7280; margin: 2px 0 0; }

/* ── Theme editor ── */
.color-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.color-field label { font-size: 12px; font-weight: 600; color: #374151; display: block; margin-bottom: 6px; }
.color-field input[type=color] {
    width: 100%; height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px 4px;
}

/* ── Auth pages ── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-app-bg);
}
.auth-card {
    background: var(--color-card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo .logo-icon {
    width: 48px; height: 48px;
    background: var(--color-primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center; justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 10px;
}
.auth-card h2 { font-size: 22px; font-weight: 700; text-align: center; color: #111827; margin: 0 0 6px; }
.auth-card .sub  { font-size: 13px; color: #6b7280; text-align: center; margin-bottom: 28px; }

/* ── Chart container ── */
.chart-container { position: relative; height: 220px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar-logo .logo-text, .sidebar-link span, .sidebar-section-label { display: none; }
    .sidebar-badge { display: none; }
    .main-wrap { margin-left: var(--sidebar-collapsed); }
    .page-content { padding: 16px; }
}

/* ── Document Repository ── */
.folder-tree { padding: 8px 0; }
.folder-tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: background .15s;
    cursor: pointer;
}
.folder-tree-item:hover { background: color-mix(in srgb, var(--color-primary) 8%, transparent); color: var(--color-primary); }
.folder-tree-item.active { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); font-weight: 600; }

.doc-card { transition: box-shadow .2s, transform .15s; border: 1px solid var(--bs-border-color); }
.doc-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.09); transform: translateY(-2px); }

.doc-icon {
    width: 38px; height: 38px;
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: var(--color-primary);
}

.upload-zone {
    border: 2px dashed color-mix(in srgb, var(--color-primary) 35%, transparent);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: color-mix(in srgb, var(--color-primary) 3%, transparent);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 7%, transparent);
}

/* ── Dashboard section headers ── */
.dashboard-section-header {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid color-mix(in srgb, var(--color-primary) 18%, transparent);
}
