/* ==============================================================================
   ERP UTS STYLING SYSTEM - MODERN ENTERPRISE DASHBOARD
   ============================================================================== */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.5;
    font-size: 14px;
}

/* Layout Core */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: #0f172a;
    color: #f8fafc;
    padding: 24px 16px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.brand {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand .badge-inst {
    font-size: 10px;
    background: #2563eb;
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
}
.subbrand {
    font-size: 12px;
    color: #94a3b8;
    margin: 6px 0 24px;
    line-height: 1.4;
}
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}
.nav a:hover {
    background: #1e293b;
    color: #ffffff;
}
.nav a.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
    font-size: 11px;
    color: #64748b;
    line-height: 1.5;
}

/* Main Area */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}
.domain-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-family: Consolas, monospace;
}
.content {
    padding: 24px 28px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Typography & Headings */
h1 { font-size: 24px; font-weight: 800; margin: 0 0 6px; color: #0f172a; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; color: #1e293b; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 10px; color: #334155; }
.lead { color: #64748b; line-height: 1.6; margin: 0 0 20px; font-size: 14px; }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 14px;
}
.section { margin-top: 20px; }
.metric { font-size: 26px; font-weight: 800; color: #0f172a; margin: 8px 0; }
.metric-sub { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Tables */
.tablewrap { overflow-x: auto; width: 100%; margin: 8px 0; border: 1px solid #e2e8f0; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; text-align: left; }
th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-green { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-yellow { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-red { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-purple { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }

/* Alert Boxes */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.warning-box {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 12px;
}
.ok-box {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 12px;
}

/* Forms & Inputs */
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.formgrid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 700; color: #475569; }
input, select, textarea {
    font: inherit;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 9px 12px;
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    outline: none;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: #2563eb;
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn:hover { background: #1d4ed8; }
.btn.secondary { background: #e2e8f0; color: #1e293b; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.success { background: #10b981; color: #fff; }
.btn.success:hover { background: #059669; }
.btn.danger { background: #ef4444; color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

/* Diagram / Flowchart Styling */
.dgm { display: flex; flex-direction: column; align-items: stretch; width: 100%; max-width: 580px; margin: 8px auto 14px; }
.dgm.wide { max-width: 680px; }
.dgm-box {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    line-height: 1.4;
}
.dgm-box b { display: block; font-size: 14px; font-weight: 700; color: #0f172a; }
.dgm-box span { display: block; font-size: 12px; color: #64748b; margin-top: 4px; }
.dgm-gap { height: 10px; }
.dgm-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    color: #2563eb;
    font-size: 16px;
    font-weight: 800;
}
.dgm-erp { background: #eff6ff; border-color: #93c5fd; }
.dgm-erp b { color: #1e40af; }
.dgm-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dgm-chips .dgm-box { padding: 10px 6px; border-radius: 8px; }
.dgm-chips .dgm-box b { font-size: 12px; }

/* As-Is & To-Be Flow Steps */
.dgm-step {
    background: #ffffff;
    border: 1px solid #f97316;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
    line-height: 1.4;
}
.dgm-step .who {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #2563eb;
}
.dgm-step .what { display: block; font-size: 13px; font-weight: 600; color: #0f172a; margin-top: 2px; }
.dgm-step .note { display: block; font-size: 11px; color: #c2410c; margin-top: 4px; }
.dgm-step.good { border-color: #10b981; }
.dgm-step.good .note { color: #047857; }
.dgm-step.decision { border-style: dashed; background: #fffbeb; border-color: #f59e0b; }
.dgm-step.decision .note { color: #b45309; }

.dgm-branch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dgm-branch .dgm-step { padding: 10px; }
.dgm-branch .tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 4px;
}
.dgm-branch .yes .tag { background: #dcfce7; color: #15803d; }
.dgm-branch .no .tag { background: #fee2e2; color: #b91c1c; }

/* Stat lines & checklist */
.statline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.checklist {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
    font-size: 13px;
    color: #334155;
}
.checklist li { margin-bottom: 4px; }

/* Card Callout / Evidence Banner */
.evidence-card {
    background: #f8fafc;
    border-left: 4px solid #2563eb;
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin: 14px 0;
}
.evidence-card h4 { margin: 0 0 6px; font-size: 14px; color: #0f172a; }
.evidence-card p { margin: 0; font-size: 13px; color: #475569; line-height: 1.5; }

/* Modal / Popup for Audit Log */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal {
    background: #ffffff;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .layout { display: block; }
    .sidebar { width: 100%; padding: 16px; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .nav a { font-size: 11px; padding: 8px 10px; }
    .two, .grid, .formgrid, .grid-3, .formgrid-3 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-direction: column; align-items: flex-start; }
    .dgm-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dgm-branch { grid-template-columns: 1fr; }
}
