:root { --blue:#0b6fcc; --bg:#f4f6f8; --border:#d8dee4; --text:#1c2733; }
* { box-sizing: border-box; }

/* Custom Modern Themed Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
    border: 1px solid transparent;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
body { margin:0; font-family: system-ui, -apple-system, sans-serif; background:var(--bg); color:var(--text); }
.nav { display:flex; align-items:center; gap:24px; padding:12px 24px; background:#fff; border-bottom:1px solid var(--border); }
.nav nav { flex:1; display:flex; gap:16px; }
.nav a { text-decoration:none; color:var(--text); padding:4px 8px; border-radius:4px; }
.nav a.active { background:#e6f0fa; color:var(--blue); }
.logout { display:flex; align-items:center; gap:12px; margin:0; font-size:14px; }
.container { max-width:1100px; margin:24px auto; padding:0 16px; }
.card { background:#fff; border:1px solid var(--border); border-radius:8px; padding:20px; margin:16px 0; }
.card.narrow { max-width:380px; margin:80px auto; }
.card form { display:flex; flex-direction:column; gap:12px; }
label { display:flex; flex-direction:column; gap:4px; font-size:14px; }
label.inline { flex-direction:row; align-items:center; gap:8px; }
input[type=text], input[type=email], input[type=password], input[type=date], select { padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:14px; background:#fff; color:var(--text); }
fieldset { border:1px solid var(--border); border-radius:6px; padding:12px 16px; margin:8px 0; display:flex; flex-direction:column; gap:8px; }
legend { font-size:13px; font-weight:600; padding:0 6px; color:#4a5568; }
code { background:#eef2f6; padding:2px 6px; border-radius:4px; font-size:13px; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; color:#0b6fcc; }
.row { display:flex; gap:8px; align-items:center; margin:12px 0; flex-wrap:wrap; }
.row input[type=text] { flex:1; min-width:200px; }
.between { justify-content:space-between; }
.btn { background:var(--blue); color:#fff; border:0; padding:8px 14px; border-radius:6px; cursor:pointer; font-size:14px; font-weight:500; }
.btn:hover { opacity:0.9; }
.btn.secondary { background:#fff; color:var(--text); border:1px solid var(--border); }
.btn.secondary:hover { background:#f8fafc; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
    background: #fff; 
    border: 1px solid #e2e8f0; 
    border-radius: 12px; 
    margin: 16px 0; 
    overflow: hidden; 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
}
th, td { 
    text-align: left; 
    padding: 10px 14px; 
    border-bottom: 1px solid #f1f5f9; 
    font-size: 13px; 
    vertical-align: middle; 
}
th { 
    background: #f8fafc; 
    font-size: 12px;
    font-weight: 600; 
    color: #475569; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid #e2e8f0;
}
tbody tr {
    transition: background-color 0.15s ease;
}
tbody tr:last-child td {
    border-bottom: none;
}
tbody tr:hover { 
    background: #f8faff; 
}
.badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 4px;
    white-space: nowrap;
    padding: 3px 10px; 
    border-radius: 20px; 
    font-size: 11.5px; 
    font-weight: 600; 
    background: #f1f5f9; 
    color: #475569;
    letter-spacing: 0.2px;
    line-height: 1.2;
}
.badge.confirmed, .badge.success, .badge.approved, .badge.completed { 
    background: #dcfce7; 
    color: #15803d; 
    border: 1px solid #bbf7d0;
}
.badge.pending, .badge.initiated, .badge.created { 
    background: #fef3c7; 
    color: #92400e; 
    border: 1px solid #fde68a;
}
.badge.failed, .badge.cancelled, .badge.declined, .badge.expired { 
    background: #fee2e2; 
    color: #b91c1c; 
    border: 1px solid #fecaca;
}
.badge.received {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.error { color:#b3261e; font-size:13px; margin:0; }
.box { background:#fff; border:1px solid var(--border); padding:10px 14px; border-radius:6px; }
.error.box { border-color:#f0b4b0; background:#fff8f8; }
.muted { color:#6b7785; text-align:center; }
[x-cloak] { display: none !important; }

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 16px;
}
.modal-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    max-width: 440px;
    width: 100%;
    padding: 24px;
    border: 1px solid var(--border);
    animation: modalPop 0.15s ease-out;
}
.modal-dialog.modal-large {
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.modal-body {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 24px;
}
.modal-body p { margin: 0 0 6px 0; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn.success-btn {
    background: #16662b;
    color: #fff;
}
.btn.success-btn:hover {
    background: #135223;
}
.btn.danger {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
}
.btn.danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
.btn.danger-outline {
    background: #fff;
    color: #dc2626;
    border: 1px solid #fca5a5;
}
.btn.danger-outline:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* Modal Header & Close */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.modal-header .modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}
.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.modal-close-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Modal Form */
.modal-dialog.modal-form {
    max-width: 440px;
    padding: 24px;
}
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    text-align: left;
}
.form-label {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-align: left;
}
.form-optional {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
}
.form-group input, .form-group select {
    width: 100%;
    height: 38px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 32px;
    cursor: pointer;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(11, 111, 204, 0.15);
}
.password-input-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}
.password-input-wrap input {
    padding-right: 38px !important;
}
.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.password-toggle-btn:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}
.password-toggle-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 111, 204, 0.4);
}
.form-group input.has-error, .form-group select.has-error {
    border-color: #ef4444;
    background-color: #fffbfb;
}
.form-group input.has-error:focus, .form-group select.has-error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.form-group .error {
    color: #dc2626;
    font-size: 12px;
    margin: 2px 0 0 0;
    font-weight: 500;
}
.form-hint {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0 0;
    line-height: 1.4;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}
.box.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.filter-tabs {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-tab {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #475569;
    text-decoration: none;
    transition: all 0.15s ease;
}
.filter-tab:hover {
    background: #f8fafc;
    color: var(--text);
}
.filter-tab.active {
    background: #e6f0fa;
    border-color: #0b6fcc;
    color: #0b6fcc;
    font-weight: 600;
}
.reconcile-banner {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.selection-bar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 16px;
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Status Lifecycle Timeline */
.timeline {
    position: relative;
    padding: 8px 0 8px 32px;
    margin: 16px 0;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 18px;
    bottom: 24px;
    left: 13px;
    width: 2px;
    background: #e2e8f0;
}
.timeline-item {
    position: relative;
    margin-bottom: 16px;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-marker {
    position: absolute;
    left: -32px;
    top: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    z-index: 1;
}
.timeline-marker.completed {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.timeline-marker.in-progress {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
.timeline-marker.pending {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #94a3b8;
}
.timeline-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.15s ease;
}
.timeline-card.active-stage {
    background: #f0f9ff;
    border-color: #bae6fd;
}
.timeline-card.completed-stage {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2px;
}
.timeline-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.timeline-time {
    font-size: 12px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.timeline-desc {
    font-size: 13px;
    color: #475569;
    margin: 2px 0 0 0;
    line-height: 1.4;
}
.timeline-note-box {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    color: #334155;
}


