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

:root {
  --navy: #0a2540;
  --navy-light: #1a3a5c;
  --navy-lighter: #2d4f73;
  --accent: #00d4aa;
  --accent-dark: #00b894;
  --accent-soft: #e6faf5;
  --text: #0a2540;
  --text-secondary: #425466;
  --text-tertiary: #8494a7;
  --bg: #ffffff;
  --bg-subtle: #f6f9fc;
  --bg-muted: #edf2f7;
  --border: #e3e8ee;
  --border-light: #f0f3f7;
  --success: #00d4aa;
  --warning: #f5a623;
  --error: #e25c3d;
  --shadow-sm: 0 1px 3px rgba(10,37,64,0.06);
  --shadow-md: 0 4px 16px rgba(10,37,64,0.08);
  --shadow-lg: 0 8px 32px rgba(10,37,64,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon { width: 28px; height: 28px; }

.brand-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links { display: flex; gap: 8px; }

.nav-link {
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--bg-subtle); }

.nav-link-admin {
  color: var(--bg) !important;
  background: var(--navy) !important;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-link-admin:hover { background: var(--navy-light) !important; color: var(--bg) !important; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

.page-header {
  position: relative;
  padding: 48px 24px 40px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, var(--navy-lighter) 100%);
}

.page-header-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0,212,170,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0,212,170,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.page-header-content {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.page-title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.page-subtitle {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.controls-bar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}

.controls-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: 100px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cet-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.cet-label { font-weight: 500; }

.cet-value {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-secondary:hover { background: var(--bg-muted); color: var(--text); }

.btn-exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--bg);
  background: var(--navy);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-exit:hover { background: var(--navy-light); }

.table-section {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  flex: 1;
}

.table-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.table-search-icon {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.table-search-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

.table-search-input::placeholder {
  color: var(--text-tertiary);
}

.table-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.12);
}

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

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  min-width: 1200px;
}

.logs-table thead th {
  text-align: left;
  padding: 10px 10px;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
  background: var(--bg-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.logs-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}

.logs-table tbody tr:hover { background: var(--bg-subtle); }

.logs-table tbody tr:last-child { border-bottom: none; }

.logs-table tbody td {
  padding: 8px 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.logs-table tbody td.mono {
  font-family: var(--mono);
}

.logs-table tbody td.muted {
  color: var(--text-tertiary);
}

.cell-logid {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.6875rem;
  color: var(--navy);
}

.cell-bank {
  max-width: 180px;
}

.cell-bank-name {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: block;
}

.cell-bank-bic {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text-tertiary);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.5625rem;
  font-weight: 600;
  font-family: var(--mono);
  border-radius: 100px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.mode-off-ledger {
  background: #fef3c7;
  color: #b45309;
  border-color: rgba(245,158,11,0.2);
}

.mode-non-gpi {
  background: #ede9fe;
  color: #6d28d9;
  border-color: rgba(109,40,217,0.2);
}

.cell-amount {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.cell-amount-ccy {
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  margin-left: 4px;
}

.cell-msg-type {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.6875rem;
}

.cell-msg-mt103 { color: var(--accent-dark); }
.cell-msg-other { color: var(--text-tertiary); }

.cell-side {
  font-size: 0.6875rem;
  font-weight: 500;
}

.cell-expiry {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.75rem;
}

.expiry-urgent { color: var(--error); }
.expiry-warning { color: #d97706; }
.expiry-ok { color: var(--text); }

.cell-compliance {
  min-width: 100px;
}

.compliance-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compliance-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 3px;
  overflow: hidden;
  min-width: 50px;
}

.compliance-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.compliance-high { background: var(--accent); }
.compliance-med { background: #f59e0b; }
.compliance-low { background: var(--error); }

.compliance-pct {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

.cell-timeline {
  font-size: 0.6875rem;
}

.timeline-label {
  font-weight: 600;
  color: var(--text);
}

.timeline-date {
  font-family: var(--mono);
  font-size: 0.5625rem;
  color: var(--text-tertiary);
  display: block;
}

.cell-trn {
  max-width: 140px;
}

.trn-text {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.trn-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color 0.15s, border-color 0.15s;
  vertical-align: middle;
  margin-left: 4px;
  flex-shrink: 0;
}

.trn-copy-btn:hover { color: var(--accent-dark); border-color: var(--accent); }

.trn-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cell-server {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--text-secondary);
}

.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--navy);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-buy:hover { background: var(--accent-dark); }

.btn-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg-muted);
  color: var(--text-tertiary);
}

.btn-purchased {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.5625rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: 100px;
  white-space: nowrap;
}

.row-disabled {
  opacity: 0.5;
}

.row-disabled td { color: var(--text-tertiary) !important; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-wrap: wrap;
}

.table-footer-left { flex: 1; }
.table-footer-center { display: flex; justify-content: center; }
.table-footer-right { display: flex; align-items: center; gap: 8px; }

.rows-info {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.page-btn:hover { background: var(--bg-muted); }

.page-btn.active {
  background: var(--navy);
  color: var(--bg);
  border-color: var(--navy);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.per-page-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.per-page-select {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
}

.per-page-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.15);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 37, 64, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.hidden { display: none !important; }

.modal-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.15s;
}

.modal-close:hover { background: var(--bg-muted); }

.modal-body { padding: 20px 24px; }

.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.modal-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.modal-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.modal-value.mono { font-family: var(--mono); }

.modal-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}

.modal-total-row { padding: 10px 0 4px; }

.modal-total-label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--navy);
}

.modal-total-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

.btn-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--navy);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-confirm:hover { background: var(--accent-dark); }

.btn-confirm:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  margin-top: auto;
  background: var(--navy);
  color: rgba(255,255,255,0.65);
}

.footer-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.footer-top {
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 32px;
}

.footer-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon-sm { width: 22px; height: 22px; }

.footer-brand-text {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 32px;
}

.footer-col { display: flex; flex-direction: column; gap: 8px; }

.footer-col-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.footer-link {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.5;
}

.footer-link:hover { color: var(--accent); }

.footer-link-cta { color: var(--accent); font-weight: 500; }
.footer-link-cta:hover { color: var(--accent-dark); }

.footer-hq {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}

.footer-hq-item { display: flex; align-items: center; gap: 8px; }

.footer-hq-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}

.footer-hq-value {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom-links { display: flex; gap: 24px; flex-wrap: wrap; }

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
}

/* Mobile nav dropdown */
.nav-links.mobile-open {
  display: flex;
}

@media (max-width: 900px) {
  .footer-columns { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
  .nav-links.mobile-open { display: flex; }
  .nav-inner { position: relative; }
  .mobile-menu-btn { display: block; }
  .page-header { padding: 28px 16px 24px; }
  .page-title { font-size: 1.125rem; }
  .page-subtitle { font-size: 0.75rem; }
  .controls-bar { padding: 10px 12px; }
  .controls-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .controls-left { gap: 12px; }
  .controls-right { width: 100%; justify-content: flex-end; }
  .table-section { padding: 0 8px; margin: 12px auto; }
  .table-search { padding: 10px 12px; }
  .table-search-input { font-size: 14px; padding: 10px 12px; }
  .logs-table { font-size: 0.6875rem; }
  .logs-table thead th { padding: 8px 6px; font-size: 0.5625rem; white-space: nowrap; }
  .logs-table tbody td { padding: 8px 6px; }
  .table-footer { flex-direction: column; align-items: flex-start; gap: 10px; padding: 10px 12px; }
  .table-footer-center { width: 100%; }
  .pagination { flex-wrap: wrap; }
  .table-footer-right { width: 100%; }
  .modal-overlay { padding: 16px; }
  .modal-card { max-width: 100%; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .footer-wide { padding: 28px 16px 20px; }
  .footer-columns { grid-template-columns: 1fr 1fr; gap: 20px; }
  .footer-hq { flex-direction: column; align-items: flex-start; gap: 12px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 400px) {
  .page-header { padding: 20px 12px 18px; }
  .page-title { font-size: 1rem; }
  .table-section { padding: 0 4px; }
  .footer-columns { grid-template-columns: 1fr; gap: 16px; }
}
