:root {
    color-scheme: light;
    --portal-bg: #f8fafc;
    --portal-surface: #ffffff;
    --portal-surface-alt: #f1f5f9;
    --portal-border: #dbe3ef;
    --portal-text: #0f172a;
    --portal-text-muted: #64748b;
    --portal-primary: #2563eb;
    --portal-primary-dark: #1d4ed8;
    --portal-danger: #dc2626;
    --portal-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--portal-bg);
    color: var(--portal-text);
}

body {
    min-height: 100vh;
}

a {
    color: var(--portal-primary);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.portal-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.portal-main {
    min-width: 0;
    padding: 1.5rem;
}

.portal-overlay {
    display: none;
}

.portal-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #e2e8f0;
    min-height: 100vh;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
}

.portal-brand-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.2);
    color: #bfdbfe;
    font-weight: 700;
}

.portal-brand-title {
    font-size: 1rem;
    font-weight: 700;
}

.portal-brand-subtitle {
    color: #94a3b8;
    font-size: 0.85rem;
}

.portal-nav {
    display: grid;
    gap: 0.4rem;
}

.portal-nav-section {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 1rem 0 0.4rem;
    padding: 0 0.75rem;
    text-transform: uppercase;
}

.portal-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0.85rem 0.9rem;
    border-radius: 0.95rem;
    text-align: left;
}

.portal-nav-item:hover,
.portal-nav-item.active {
    background: rgba(37, 99, 235, 0.18);
    color: #ffffff;
}

.portal-nav-icon {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1.25rem;
    box-shadow: var(--portal-shadow);
}

.portal-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.portal-header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.portal-header-label {
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portal-header-menu {
    display: none;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface-alt);
    color: var(--portal-text);
    border-radius: 0.85rem;
    padding: 0.75rem 0.9rem;
}

.portal-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.portal-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--portal-primary-dark);
    font-size: 0.86rem;
    font-weight: 600;
}

.portal-content-stack,
.detail-stack {
    display: grid;
    gap: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card,
.portal-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1.25rem;
    box-shadow: var(--portal-shadow);
}

.stat-card {
    padding: 1.1rem;
}

.stat-card-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.stat-card-title {
    color: var(--portal-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-card-icon {
    display: inline-grid;
    place-items: center;
    min-width: 2.5rem;
    height: 2.5rem;
    background: #eff6ff;
    color: var(--portal-primary-dark);
    border-radius: 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
}

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

.portal-card {
    padding: 1.25rem;
}

.portal-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.portal-card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.portal-card-header p {
    color: var(--portal-text-muted);
    margin-top: 0.3rem;
}

.portal-alert {
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.portal-alert.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.portal-alert.success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.portal-empty {
    display: grid;
    gap: 0.35rem;
    padding: 2rem;
    background: var(--portal-surface);
    border: 1px dashed var(--portal-border);
    border-radius: 1.25rem;
    color: var(--portal-text-muted);
}

.portal-empty.compact {
    padding: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

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

.portal-table th,
.portal-table td {
    padding: 1rem 0.85rem;
    border-top: 1px solid #edf2f7;
    text-align: left;
}

.portal-table th {
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.align-right {
    text-align: right !important;
}

.status-chip,
.attachment-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--portal-primary-dark);
    font-size: 0.78rem;
    font-weight: 600;
}

.link-button,
.secondary-button,
.primary-button,
.ghost-danger-button {
    border: 0;
    border-radius: 0.9rem;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.link-button {
    background: transparent;
    color: var(--portal-primary-dark);
    padding: 0;
}

.secondary-button {
    background: var(--portal-surface-alt);
    color: var(--portal-text);
    border: 1px solid var(--portal-border);
}

.primary-button {
    background: var(--portal-primary);
    color: #fff;
}

.primary-button:hover {
    background: var(--portal-primary-dark);
}

.ghost-danger-button {
    background: #fef2f2;
    color: var(--portal-danger);
}

.form-grid,
.fault-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.fault-stack {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.fault-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem;
    background: #fbfdff;
}

.fault-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.fault-description {
    margin-top: 1rem;
}

.portal-form-card label,
.fault-card label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--portal-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.portal-input,
.portal-select,
.portal-textarea,
.portal-input-file {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
    background: #fff;
    color: var(--portal-text);
}

.portal-textarea {
    resize: vertical;
}

.fault-upload {
    display: grid;
    gap: 0.6rem;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.form-actions-start {
    justify-content: flex-start;
}

.detail-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detail-topbar h2 {
    font-size: 1.35rem;
}

.detail-topbar p {
    color: var(--portal-text-muted);
    margin-top: 0.2rem;
}

.workflow-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

    .workflow-strip::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 2px;
        background: #e0e0e0;
        transform: translateY(-50%);
        z-index: 0;
    }

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    background: #fff;
    gap: 0.5rem;
}

.workflow-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    color: #757575;
    transition: all 0.3s ease;
}

    .workflow-badge.complete {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
    }

    .workflow-badge.current {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
        box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
    }

.workflow-step span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    text-align: center;
    max-width: 100px;
    word-wrap: break-word;
}

.tick {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Terminal rejection styling */
.workflow-strip.workflow-terminal {
    background: #fff3e0;
    border-left: 4px solid #f44336;
    padding: 1rem;
    justify-content: center;
}

.workflow-terminal-label {
    color: #f44336;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .workflow-strip {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }

        .workflow-strip::before {
            display: none;
        }

    .workflow-step {
        flex: 1 1 auto;
        min-width: 60px;
    }

    .workflow-badge {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .workflow-step span:last-child {
        font-size: 0.7rem;
    }
}

/* Optional: Add hover effect for non-completed steps */
.workflow-badge:not(.complete):not(.current):hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
    transform: scale(1.05);
    cursor: default;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(18rem, 0.9fr);
    gap: 1.5rem;
}

.detail-main,
.detail-side,
.timeline {
    display: grid;
    gap: 1rem;
}

.detail-attachment {
    margin-bottom: 1rem;
}

.timeline-item {
    display: grid;
    gap: 0.25rem;
    padding: 1rem;
    border-radius: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.timeline-item span,
.timeline-item p,
.meta-list dt {
    color: var(--portal-text-muted);
}

.meta-list {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.meta-list div {
    display: grid;
    gap: 0.25rem;
}

.meta-list dt {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.meta-list dd {
    margin: 0;
    font-weight: 600;
}

.mobile-only {
    display: none;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fef3c7;
    border-top: 1px solid #f59e0b;
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #991b1b;
    color: #fff;
    border-radius: 1rem;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .portal-page {
        grid-template-columns: 1fr;
    }

    .portal-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(18rem, 85vw);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 30;
    }

    .portal-sidebar.is-open {
        transform: translateX(0);
    }

    .portal-overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 20;
    }

    .portal-main {
        padding: 1rem;
    }

    .portal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-header-menu {
        display: inline-flex;
    }

    .form-grid,
    .fault-grid,
    .workflow-strip {
        grid-template-columns: 1fr;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: grid;
        gap: 0.75rem;
    }

    .request-mobile-card {
        display: grid;
        gap: 0.5rem;
        width: 100%;
        text-align: left;
        padding: 1rem;
        background: var(--portal-surface);
        border: 1px solid var(--portal-border);
        border-radius: 1rem;
    }

    .request-mobile-top {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        align-items: center;
    }

    .request-mobile-meta {
        color: var(--portal-text-muted);
        font-size: 0.92rem;
    }

    .approval-modal {
        width: 95vw;
        max-height: 95vh;
    }
}

/* ── Approval Action Button ── */

.btn-approval-action {
    margin-left: auto;
    padding: 0.6rem 1.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #7c3aed;
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
    transition: background 0.2s;
}

.btn-approval-action:hover {
    background: #6d28d9;
}

/* ── Approval Modal Overlay ── */

.approval-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    padding: 1rem;
}

.approval-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 56rem;
    max-height: 90vh;
    background: var(--portal-surface);
    border-radius: 1rem;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

/* ── Header ── */

.approval-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--portal-primary);
    color: #fff;
}

.approval-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.approval-close-btn {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.approval-close-btn:hover {
    color: #fff;
}

/* ── Body ── */

.approval-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--portal-surface-alt);
}

/* ── Alert ── */

.approval-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.approval-alert.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.approval-alert.success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ── Issue Block ── */

.approval-issue-block {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.approval-issue-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.approval-issue-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--portal-text);
    margin: 0;
}

.approval-issue-info p {
    font-size: 0.875rem;
    color: var(--portal-text-muted);
    margin: 0.25rem 0 0;
}

.approval-select {
    flex-shrink: 0;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--portal-border);
    border-radius: 0.6rem;
    background: var(--portal-surface-alt);
    outline: none;
    transition: border-color 0.2s;
}

.approval-select:focus {
    border-color: var(--portal-primary);
    background: var(--portal-surface);
}

/* ── Remarks ── */

.approval-remarks {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

.approval-remarks label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--portal-text-muted);
    margin-bottom: 0.35rem;
}

.required-star {
    color: var(--portal-danger);
    font-weight: 700;
}

.approval-remarks textarea {
    width: 100%;
    min-height: 4.5rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.6rem;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.approval-remarks textarea:focus {
    border-color: var(--portal-primary);
}

/* ── Footer ── */

.approval-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--portal-border);
    background: var(--portal-surface);
}

.approval-footer .btn-cancel {
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--portal-text-muted);
    background: transparent;
    border: 0;
    border-radius: 0.6rem;
    cursor: pointer;
}

.approval-footer .btn-cancel:hover {
    background: var(--portal-surface-alt);
}

.approval-footer .btn-submit {
    padding: 0.6rem 1.6rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--portal-primary-dark);
    border: 0;
    border-radius: 0.6rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: background 0.2s;
}

.approval-footer .btn-submit:hover {
    background: #1e40af;
}

.approval-footer .btn-submit:disabled,
.approval-footer .btn-cancel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .approval-issue-top {
        flex-direction: column;
    }

    .approval-select {
        width: 100%;
    }

    .btn-approval-action {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* ══════════════════════════════════════════
   Case Detail View (HTML reference match)
   ══════════════════════════════════════════ */

.case-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.case-header-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.case-header-info p {
    font-size: 0.875rem;
    color: var(--portal-text-muted);
    margin: 0.25rem 0 0;
}

.case-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-outline {
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--portal-text);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 0.6rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-outline:hover {
    background: var(--portal-surface-alt);
}

/* Case 3-col layout (75% main / 25% sidebar) */

.case-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.case-main {
    flex: 3;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.case-sidebar {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Issue Card (fault block) ── */

.issue-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-left: 4px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.issue-card.approved {
    border-left-color: #22c55e;
}

.issue-card.rejected {
    border-left-color: #ef4444;
}

.issue-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.issue-card-info h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.issue-card-info p {
    font-size: 0.875rem;
    color: var(--portal-text-muted);
    margin: 0.3rem 0 0;
    line-height: 1.5;
}

/* ── Status Badge ── */

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 9999px;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface-alt);
    color: var(--portal-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.approved {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.status-badge.rejected {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ── Issue Comments ── */

.issue-comments {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--portal-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.issue-comment-item {
    background: var(--portal-surface-alt);
    border: 1px solid var(--portal-border);
    border-radius: 0.6rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    color: var(--portal-text);
}

.issue-comment-item strong {
    color: var(--portal-primary);
    margin-right: 0.4rem;
}

/* ── Attachment Link ── */

.attachment-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--portal-primary);
    margin-right: 0.75rem;
    margin-top: 0.5rem;
}

/* ── Sidebar Card ── */

.sidebar-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.sidebar-card-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--portal-text-muted);
    margin: 0 0 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--portal-border);
}

.sidebar-meta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.meta-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--portal-text-muted);
    margin-bottom: 0.15rem;
}

.meta-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--portal-text);
}

.sidebar-empty {
    font-size: 0.85rem;
    color: var(--portal-text-muted);
    margin: 0;
}

/* ── Audit History Timeline ── */

.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.audit-item {
    display: flex;
    gap: 0.85rem;
    position: relative;
}

.audit-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: -14px;
    width: 2px;
    background: var(--portal-border);
}

.audit-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--portal-primary);
    border: 2px solid var(--portal-surface);
    flex-shrink: 0;
    margin-top: 3px;
    z-index: 1;
}

.audit-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.audit-event {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--portal-text);
    line-height: 1.3;
}

.audit-meta {
    font-size: 0.7rem;
    color: var(--portal-text-muted);
}

/* ── Verify & Assess button ── */

.btn-verify-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.15rem;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-verify-action:hover {
    background: #047857;
}

/* ── Assessment / Inventory Modal ── */

.assessment-modal-wide {
    max-width: 860px;
    width: 94vw;
}

.assessment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--portal-border);
}

.assessment-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--portal-text);
}

.assessment-issue-block {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--portal-border);
}

.assessment-issue-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.assessment-issue-header h4 {
    margin: 0 0 0.65rem 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--portal-text);
}

.assessment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.assessment-table th,
.assessment-table td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--portal-border);
}

.assessment-table th {
    font-weight: 600;
    color: var(--portal-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f9fafb;
}

.assessment-table .col-num { width: 36px; text-align: center; }
.assessment-table .col-qty { width: 72px; }
.assessment-table .col-action { width: 150px; }
.assessment-table .col-del { width: 36px; text-align: center; }

.assessment-input {
    width: 100%;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
    border: 1px solid var(--portal-border);
    border-radius: 5px;
    color: var(--portal-text);
    background: #fff;
    transition: border-color 0.15s;
}

.assessment-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.assessment-qty {
    text-align: center;
}

.stock-buy-toggle {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.stock-buy-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--portal-text);
    cursor: pointer;
}

.btn-delete-row {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
}

.btn-delete-row:hover {
    background: #fef2f2;
}

.btn-add-line {
    margin-top: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: none;
    border: 1px dashed var(--portal-border);
    border-radius: 5px;
    font-size: 0.78rem;
    color: var(--portal-primary);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-add-line:hover {
    background: #eff6ff;
    border-color: var(--portal-primary);
}

.required-star {
    color: #ef4444;
    font-weight: 600;
}

/* ── Assessment: Fault badge + title ── */

.assess-issue-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.assess-fault-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--portal-primary);
    border-radius: 4px;
    white-space: nowrap;
}

.assess-fault-note {
    margin: 0.35rem 0 0.6rem;
    font-size: 0.82rem;
    color: var(--portal-text-muted);
}

.assess-empty-parts {
    padding: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
    background: #f9fafb;
    border: 1px dashed var(--portal-border);
    border-radius: 8px;
}

/* ── Assessment: Checkbox ── */

.assess-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.assess-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.assess-checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.assess-checkbox input:checked + .assess-checkmark {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
}

.assess-checkbox input:checked + .assess-checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.assessment-table .col-check {
    width: 40px;
    text-align: center;
}

/* ── Assessment: Selected row ── */

.assess-row-selected {
    background: #eff6ff;
}

.assess-part-desc {
    font-size: 0.84rem;
    color: var(--portal-text);
}

/* ── Assessment: Action pills ── */

.assess-action-pills {
    display: flex;
    gap: 0;
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    overflow: hidden;
}

.assess-pill {
    flex: 1;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    background: #fff;
    color: var(--portal-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.assess-pill:first-child {
    border-right: 1px solid var(--portal-border);
}

.assess-pill.active {
    background: var(--portal-primary);
    color: #fff;
}

.assess-pill:hover:not(.active):not(:disabled) {
    background: #f1f5f9;
}

/* ── Assessment: Summary ── */

.assess-summary {
    margin-top: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.78rem;
    color: var(--portal-text-muted);
    font-weight: 500;
}

/* ── Assessment Items (inline in approval modals) ── */

.assess-items-block {
    margin-top: 0.75rem;
    border-top: 1px solid var(--portal-border);
    padding-top: 0.6rem;
}

.assess-items-empty {
    font-size: 0.82rem;
    color: var(--portal-text-muted);
    margin: 0;
}

.assess-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.assess-items-table th,
.assess-items-table td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--portal-border);
}

.assess-items-table th {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--portal-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f9fafb;
}

.assess-items-table .col-assess-action {
    width: 160px;
}

.assess-items-qty-input {
    width: 60px;
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    text-align: center;
}

/* ── Mobile responsive for case detail ── */

@media (max-width: 768px) {
    .case-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .case-header-actions {
        width: 100%;
    }

    .case-header-actions .btn-approval-action,
    .case-header-actions .btn-verify-action,
    .case-header-actions .btn-outline {
        flex: 1;
        text-align: center;
    }

    .case-layout {
        flex-direction: column;
    }

    .case-sidebar {
        position: static;
    }

    .assessment-modal-wide {
        max-width: 100%;
        width: 98vw;
    }
}

/* ── Master Data Panel ── */
.master-panel {
    padding: 1rem;
}

.master-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.master-header h3 {
    margin: 0;
}

.master-header p {
    margin: 0.25rem 0 0;
    color: var(--portal-text-muted);
}

.master-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.master-column {
    border: 1px solid var(--portal-border);
    border-radius: 0.8rem;
    padding: 0.9rem;
    background: var(--portal-surface-alt);
}

.master-column h4 {
    margin: 0 0 0.75rem;
}

.master-form-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.master-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 420px;
    overflow-y: auto;
}

.master-item {
    border: 1px solid var(--portal-border);
    border-radius: 0.6rem;
    padding: 0.45rem 0.6rem;
    background: var(--portal-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.master-item.active {
    border-color: var(--portal-primary);
    box-shadow: inset 0 0 0 1px var(--portal-primary);
}

.master-item-main {
    border: 0;
    background: transparent;
    text-align: left;
    color: var(--portal-text);
    width: 100%;
    cursor: pointer;
}

.master-item-actions {
    display: flex;
    gap: 0.45rem;
}

.btn-link {
    border: 0;
    background: transparent;
    color: var(--portal-primary);
    cursor: pointer;
}

.btn-link.danger {
    color: #dc2626;
}

/* ── Master Table ── */

.master-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.master-table th,
.master-table td {
    padding: 0.55rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--portal-border);
}

.master-table th {
    font-weight: 600;
    color: var(--portal-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f9fafb;
}

.master-table .col-actions {
    width: 120px;
    text-align: right;
}

.master-table td.col-actions {
    text-align: right;
}

.master-table .row-editing {
    background: #eff6ff;
}

.master-empty {
    text-align: center;
    color: var(--portal-text-muted);
    padding: 1.5rem !important;
}

/* ── Technical Master Selector ── */

.tech-master-selector {
    margin-bottom: 1rem;
}

.tech-master-selector label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--portal-text-muted);
    margin-bottom: 0.3rem;
}

.tech-master-form {
    margin-bottom: 0.5rem;
}

.tech-master-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.tech-type-select {
    width: 160px;
    flex-shrink: 0;
}

.tech-qty-input {
    width: 80px;
    flex-shrink: 0;
    text-align: center;
}

/* ── Type Badge ── */

.tech-type-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tech-type-badge.procurement {
    background: #dbeafe;
    color: #1d4ed8;
}

.tech-type-badge.service {
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 900px) {
    .master-grid {
        grid-template-columns: 1fr;
    }

    .tech-master-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tech-type-select,
    .tech-qty-input {
        width: 100%;
    }
}
