:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #06406c;
  --brand-2: #0284c7;
  --brand-dark: #053153;
  --green: #008f46;
  --green-dark: #006638;
  --gold: #d97706;
  --warn: #d97706;
  --danger: #ef4444;
  --ok: #10b981;
  --shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(at top right, rgba(2, 132, 199, 0.03), transparent 400px),
    radial-gradient(at bottom left, rgba(0, 143, 70, 0.03), transparent 400px),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--green));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.bank-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
  color: var(--brand);
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  letter-spacing: -0.01em;
}

h3 {
  margin-bottom: 5px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.tab,
button,
.portal-link {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(6, 64, 108, 0.1);
}

button:hover {
  background: var(--green-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 102, 56, 0.15);
}

.tab {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
  transform: none;
  box-shadow: none;
}

.tab.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}

.tab.active:hover {
  background: #fff;
}

.portal-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-left: 1.5px solid var(--line);
  background: transparent;
  color: var(--brand-dark);
  box-shadow: none;
}

.portal-link:hover {
  color: var(--brand-2);
  transform: none;
}

main,
.footer {
  width: min(1150px, calc(100% - 32px));
  margin: 0 auto;
}

main {
  padding: 24px 0 48px;
}

.session-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: var(--radius-md);
  background: #f0fdf4;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.developer-credit {
  color: var(--green-dark);
  font-weight: 800;
}

.model-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(110deg, var(--brand) 0%, #05506a 58%, var(--green) 100%);
  box-shadow: var(--shadow);
}

.model-banner h2 {
  max-width: 780px;
  font-size: 26px;
  margin-bottom: 8px;
}

.model-banner p {
  margin-bottom: 0;
  max-width: 840px;
  line-height: 1.6;
  color: #cbd5e1;
  font-size: 14px;
}

.model-banner .eyebrow {
  color: #38bdf8;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.view {
  display: none;
}

.hidden {
  display: none !important;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head p,
.panel-head p,
.help-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metrics div,
.panel,
.form-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metrics div {
  padding: 20px;
  border-top: 3px solid var(--brand);
  transition: transform 0.2s ease;
}

.metrics div:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metrics span {
  display: block;
  color: var(--brand);
  font-size: 32px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
  margin-bottom: 4px;
}

.metrics p {
  margin-bottom: 0;
  color: var(--muted);
}

.panel {
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.form-card {
  margin-bottom: 20px;
  padding: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: all 0.25s ease;
}

input:focus,
select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

button.secondary {
  border: 1.5px solid var(--line);
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: none;
}

button.secondary:hover {
  background: #f8fafc;
  border-color: var(--brand-2);
  color: var(--brand-2);
  transform: translateY(-1px);
}

.record-list {
  display: grid;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  background: #fff;
  transition: background 0.2s ease;
}

.record-card:first-child {
  border-top: 0;
}

.record-card:hover {
  background: #f8fafc;
}

.record-card.ready {
  border-left-color: var(--green);
}

.record-card.updated {
  border-left-color: var(--brand);
}

.record-card.warning {
  border-left-color: var(--warn);
}

.record-card.danger {
  border-left-color: var(--danger);
}

.record-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-dark);
  font-size: 15px;
}

.record-card p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.record-actions {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 8px;
}

.record-actions button {
  white-space: nowrap;
}

.status-note {
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
}

.batch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: 20px;
}

.batch-summary {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.batch-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.rule-list {
  margin: 0;
  padding: 18px 24px 20px 36px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-action {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.admin-action:hover {
  transform: translateY(-2px);
}

.admin-action h3 {
  color: var(--brand-dark);
  margin-bottom: 8px;
  font-size: 16px;
}

.admin-action p {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  padding: 36px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0 36px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .topbar,
  .brand-block,
  .section-head,
  .model-banner,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .model-banner,
  .batch-layout,
  .grid.three,
  .grid.four,
  .crop-grid,
  .metrics,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .bank-logo {
    width: min(210px, 100%);
  }
}
