/* Ubora Management System - Theme */
:root {
    --primary: #1a56db;
    --primary-dark: #1042a8;
    --primary-light: #e1eaff;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --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;
    --sidebar-bg: #111827;
    --sidebar-active: #1e3a5f;
    --sidebar-text: #d1d5db;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

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

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

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.sidebar-brand small {
    color: var(--gray-400);
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    transition: all .15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-nav .nav-section {
    padding: 18px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 12px;
}

.sidebar-footer .user-info { color: #fff; font-weight: 500; }
.sidebar-footer .user-role {
    color: var(--gray-400);
    font-size: 11px;
    text-transform: capitalize;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 14px 28px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

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

.content-area { padding: 24px 28px; }

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body { padding: 20px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }

.stat-card .stat-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 4px;
}

.stat-card .stat-subtitle {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Tables */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--gray-50);
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--gray-200);
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
    color: var(--gray-700);
}

table tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-review, .badge-investigation, .badge-in-progress, .badge-planned, .badge-identified, .badge-assigned {
    background: #dbeafe; color: #1d4ed8;
}
.badge-approved, .badge-completed, .badge-closed, .badge-accepted {
    background: #d1fae5; color: #065f46;
}
.badge-obsolete, .badge-cancelled, .badge-expired {
    background: #fef3c7; color: #92400e;
}
.badge-open { background: #fee2e2; color: #991b1b; }
.badge-verification, .badge-assessed, .badge-mitigating {
    background: #ede9fe; color: #5b21b6;
}

.badge-low { background: #d1fae5; color: #065f46; }
.badge-medium { background: #dbeafe; color: #1d4ed8; }
.badge-high { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fee2e2; color: #991b1b; }

.badge-minor { background: #dbeafe; color: #1d4ed8; }
.badge-major { background: #fef3c7; color: #92400e; }
.badge-observation { background: var(--gray-100); color: var(--gray-600); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; opacity: .9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

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

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    color: var(--gray-800);
    background: #fff;
    transition: border-color .15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

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

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-item { margin-bottom: 12px; }
.detail-item .detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.detail-item .detail-value {
    font-size: 14px;
    color: var(--gray-800);
    margin-top: 2px;
}

/* Action items */
.action-list { list-style: none; }
.action-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.action-item:hover { background: var(--gray-50); }
.action-item .action-title { font-weight: 500; color: var(--gray-800); }
.action-item .action-meta { font-size: 12px; color: var(--gray-500); }

/* Risk matrix colors */
.risk-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.risk-low { background: var(--success); }
.risk-medium { background: var(--warning); }
.risk-high { background: #ea580c; }
.risk-critical { background: var(--danger); }

/* Transition buttons */
.transition-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Timeline / Audit trail */
.timeline { padding: 0; list-style: none; }
.timeline-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-action { font-weight: 500; color: var(--gray-800); }
.timeline-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Overdue highlight */
.overdue { color: var(--danger) !important; font-weight: 600; }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a56db 0%, #111827 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 28px;
}

/* Grid helper */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-top: 16px;
    border-top: 1px solid var(--gray-200);
}
.pagination-info {
    font-size: 13px;
    color: var(--gray-400);
}
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pagination-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}
.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    cursor: default;
}
.pagination-btn.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 13px;
    color: var(--gray-400);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
