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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: #1a2332;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: #b0bec5;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-logout {
    color: #ef5350;
}

.nav-logout:hover {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

.footer {
    text-align: center;
    padding: 1rem;
    color: #999;
    font-size: 0.85rem;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    color: #1a2332;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #2196f3;
    color: #fff;
}

.btn-primary:hover {
    background: #1976d2;
}

.btn-block {
    display: block;
    width: 100%;
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.dashboard h1 {
    color: #1a2332;
    margin-bottom: 1.5rem;
}

.dashboard h2 {
    color: #1a2332;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    border-left: 4px solid #2196f3;
}

.stat-card.stat-success {
    border-left-color: #4caf50;
}

.stat-card.stat-failed {
    border-left-color: #ef5350;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1a2332;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

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

.data-table th {
    background: #f8f9fa;
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

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

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-failed {
    background: #ffebee;
    color: #c62828;
}

code {
    background: #f5f5f5;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #d32f2f;
}

.error-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #999;
}

details summary {
    cursor: pointer;
    color: #2196f3;
    font-size: 0.85rem;
    font-weight: 600;
}

.detail-content {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.8rem;
}

.detail-content pre {
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.78rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.logs-page h1 {
    color: #1a2332;
    margin-bottom: 1rem;
}

.logs-page h2 {
    color: #1a2332;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.tab-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #1a2332;
}

.tab-btn.active {
    color: #2196f3;
    border-bottom-color: #2196f3;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.endpoint-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xml-block {
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.78rem;
    font-family: "Courier New", Courier, monospace;
}

/* ── Manual Transfer ── */
.stat-card.stat-manual {
    border-left-color: #7c4dff;
}

.form-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-top: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem 1.5rem;
}

.required {
    color: #ef5350;
}

.field-error {
    color: #c62828;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

.btn-secondary {
    background: #f0f0f0;
    color: #444;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.transfer-result {
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.result-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.result-failed {
    background: #ffebee;
    border: 1px solid #ef9a9a;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.result-icon {
    font-size: 1.3rem;
    font-weight: 700;
}

.result-success .result-icon { color: #2e7d32; }
.result-failed .result-icon  { color: #c62828; }

.result-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2332;
}

.result-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.6rem;
}

.result-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Transfer History ── */
.filter-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.btn-link {
    color: #2196f3;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ── Transfer Details ── */
.detail-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 2rem;
}

.section-title {
    color: #1a2332;
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.payload-block {
    white-space: pre-wrap;
    word-break: break-all;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.8rem;
    font-family: "Courier New", Courier, monospace;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 0.4rem;
}
