@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #1b2a4a;
  --navy-dark: #12203a;
  --navy-light: #253a63;
  --blue: #3a6ea5;
  --blue-dark: #2c5580;
  --blue-light: #eaf2fb;
  --bg: #f2f4f8;
  --card-bg: #ffffff;
  --section-bg: #f8fafc;
  --border: #e1e7f0;
  --border-strong: #cbd5e3;
  --text: #1f2937;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --green: #17874a;
  --green-bg: #e5f8ee;
  --orange: #b5560b;
  --orange-bg: #fdf1e3;
  --red: #dc2626;
  --gray-bg: #eef1f5;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { letter-spacing: -0.015em; }

a { color: var(--blue); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--blue-dark); text-decoration: underline; }

.topbar {
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #cfe0f7;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 20px 23px;
  text-align: center;
}

.appbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 5;
}
.appbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 16px;
}
.brand { display: flex; align-items: center; gap: 13px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 15px; font-weight: 700; }
.brand-text small { color: var(--text-muted); font-size: 12.5px; }
.appbar-user { display: flex; align-items: center; gap: 16px; font-size: 13.5px; color: var(--text-muted); }

.tabbar {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  padding: 0 24px 14px;
}
.tabbar a {
  padding: 9px 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tabbar a:hover {
  color: var(--navy);
  background: var(--section-bg);
  border-color: var(--border);
  text-decoration: none;
}
.tabbar a.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.tabbar a.active:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 70px;
}

.page h2 { font-size: 22px; font-weight: 700; color: var(--navy); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 20px;
  transition: box-shadow .2s ease;
}

.card h2, .card h3 { margin-top: 0; }
.card h3 { font-size: 15.5px; font-weight: 700; color: var(--navy); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* A bare `1fr` lets a wide table's min-content size steal space from the
   other column regardless of the fr ratio — minmax(0, 1fr) plus a fixed
   width for the side panel keeps both columns predictable no matter how
   wide the table's own content wants to be. */
.grid-2-wide-right { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-filter { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr auto; gap: 16px; }
.grid-filter.no-vendor { grid-template-columns: 2fr 1.3fr auto; }
.full { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .grid-2, .grid-2-wide-right, .grid-3, .grid-filter, .grid-filter.no-vendor { grid-template-columns: 1fr; }
}

.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.error { font-size: 12px; color: var(--red); font-weight: 500; }
#wizard-step-error { font-size: 13px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="tel"], input[type="search"], select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b7c3d6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58, 110, 165, 0.16);
}

.section-box {
  border: 1px solid var(--border);
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.section-box > h4 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--blue-dark); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-navy { background: var(--navy); }
.btn-navy:hover { background: var(--navy-dark); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--section-bg); border-color: var(--text-faint); box-shadow: none; }
.btn-danger { background: #c0342b; }
.btn-danger:hover { background: #9c2921; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.full.btn, .btn.full { width: 100%; }

.btn-row { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
.btn-row .spacer { flex: 1; }

.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.wizard-steps div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 999px;
  transition: background-color .2s ease, color .2s ease;
}
.wizard-steps div .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gray-bg);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.wizard-steps div.active { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.wizard-steps div.active .step-num { background: rgba(255,255,255,0.22); color: #fff; }
.wizard-steps div.done { color: var(--green); }
.wizard-steps div.done .step-num { background: var(--green-bg); color: var(--green); }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn .2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner {
  background: var(--blue-light);
  border: 1px solid #c6dcf2;
  border-left: 3px solid var(--blue);
  color: #1f4c73;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

.pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-orange { background: var(--orange-bg); color: var(--orange); }
.pill-blue { background: var(--blue-light); color: var(--blue-dark); }
.pill-gray { background: var(--gray-bg); color: var(--text-muted); }

.table-scroll { overflow-x: auto; }
td.truncate { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
tr { border-bottom: 1px solid var(--border-strong); }
th, td { text-align: left; padding: 13px 12px; line-height: 1.45; }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.6; padding-bottom: 12px; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: var(--section-bg); }
tbody tr:last-child { border-bottom: none; }

.actions-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.actions-row form { margin: 0; flex-shrink: 0; }
.link-strong { font-size: 12.5px; font-weight: 700; }

.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; margin: 0; }
.dl-grid dt { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.dl-grid dd { margin: 4px 0 0; font-size: 14px; }

.box-block {
  background: var(--section-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.55;
  margin-top: 6px;
}

.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-sm); }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--orange-bg); color: var(--orange); }
.flash-info { background: var(--blue-light); color: var(--blue-dark); }

.stat-tiles { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.stat-tile {
  min-width: 170px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px;
  transition: box-shadow .2s ease, transform .15s ease;
}
.stat-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-tile .label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 6px; }
.stat-tile .num { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; }

.steps-list { padding-left: 20px; line-height: 1.7; font-size: 14.5px; }
.steps-list li { margin-bottom: 14px; }
.steps-list li:last-child { margin-bottom: 0; }
.steps-list strong { color: var(--navy); }

.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { position: relative; border-left: 2px solid var(--border-strong); padding: 2px 0 16px 16px; margin-left: 4px; }
.history-list li::before {
  content: '';
  position: absolute;
  left: -5px; top: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--blue);
}
.history-list li:last-child { border-left-color: transparent; }
.history-list li .text { font-weight: 600; font-size: 13px; }
.history-list li .time { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.copyable { display: inline-flex; align-items: center; gap: 8px; }
.copyable .pill-navy { background: var(--navy); color: #fff; padding: 4px 11px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }

.auth-wrap { max-width: 430px; margin: 64px auto; }
.auth-wrap .card { padding: 32px; box-shadow: var(--shadow-lg); }
.auth-wrap h2 { font-size: 21px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox-row input { width: auto; }

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.count-hint { font-size: 11.5px; color: var(--text-faint); text-align: right; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: modalFadeIn .12s ease;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  animation: modalPopIn .15s ease;
}
.modal-box p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text); }

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPopIn { from { opacity: 0; transform: scale(.97) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
