/* ── QMS Custom Styles ──────────────────────────────────────── */

:root {
    --sidebar-width: 240px;
    --topbar-height: 52px;
    --sidebar-bg: #1a2942;
    --sidebar-hover: #243554;
    --sidebar-active: #0d6efd;
    --accent: #0d6efd;
}

/* ── Layout ─────────────────────────────────────────────────── */
body {
    background: #f0f2f5;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.92rem;
}

.qms-topbar {
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

#wrapper {
    margin-top: var(--topbar-height);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    min-height: calc(100vh - var(--topbar-height));
    background: var(--sidebar-bg);
    transition: width 0.25s ease;
    overflow-x: hidden;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
}

#sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-header {
    padding: 1rem 1rem 0.4rem;
    font-size: 0.7rem;
    color: #6c88a8;
    letter-spacing: 0.08em;
}

.nav-section {
    padding: 0.7rem 1rem 0.2rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #6c88a8;
    font-weight: 600;
}

#sidebar .nav-link {
    color: #b0c4de;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    font-size: 0.88rem;
    white-space: nowrap;
}

#sidebar .nav-link i {
    font-size: 1rem;
    min-width: 1.1rem;
}

#sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

#sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.8rem 1rem;
    margin-top: auto;
    color: #4a6a8a;
    font-size: 0.75rem;
    border-top: 1px solid #243554;
}

/* ── Top user avatar ─────────────────────────────────────────── */
.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}

/* ── Content area ────────────────────────────────────────────── */
#content {
    min-height: calc(100vh - var(--topbar-height));
    background: #f0f2f5;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
    padding: 0.85rem 1.25rem;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
    border-radius: 12px;
    border: none;
    overflow: hidden;
    transition: transform 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a2942;
    margin: 0;
}

.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

/* ── Table ───────────────────────────────────────────────────── */
.table-wrapper {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    background: #fff;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: #f0f2f5;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 0.3rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
}

.form-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent);
}

.form-section-title {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.87rem;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* ── Login page ──────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2942 0%, #2c4a72 50%, #0d6efd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 420px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--accent);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin: 0 auto 1rem;
}

/* ── Workflow timeline ───────────────────────────────────────── */
.workflow-steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0;
}

.workflow-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.workflow-step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}

.workflow-step:last-child::after { display: none; }

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.4rem;
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 0.85rem;
}

.step-label {
    font-size: 0.72rem;
    color: #6c757d;
    font-weight: 600;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

/* ── Approval cards ──────────────────────────────────────────── */
.approval-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
}

.approval-role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6c757d;
    font-weight: 600;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #2c4a72; border-radius: 4px; }

/* ── Utilities ───────────────────────────────────────────────── */
.text-qms { color: #1a2942; }
.bg-qms   { background: #1a2942; }
.letter-spacing { letter-spacing: 0.08em; }
.cursor-pointer { cursor: pointer; }
