:root {
  --scabro-blue: #06466c;
  --scabro-blue-2: #0057b8;
  --scabro-orange: #f6831f;
  --ink: #0f1218;
  --muted: #5f6b76;
  --line: #dfe5ea;
  --surface: #ffffff;
  --surface-soft: #f4f6f9;
  --surface-blue: #edf5fa;
  --success: #1d7a46;
  --warning: #9a6500;
  --danger: #b42318;
  --info: #12658a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(6, 70, 108, 0.09);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}
a { color: var(--scabro-blue-2); }
a:hover { color: var(--scabro-blue); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }

.top-bar {
  min-height: 42px;
  padding: 6px clamp(18px, 4vw, 42px);
  background: var(--scabro-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top-bar a { color: #fff; text-decoration: none; font-weight: 700; }
.top-bar .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.top-bar .top-meta { font-size: .9rem; color: rgba(255,255,255,.9); }
.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 13px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  transition: .15s ease;
}
.top-link:hover, .top-link:focus { background: rgba(255,255,255,.18); color: #fff; }
.top-link.solid { background: #fff; color: var(--scabro-blue); border-color: #fff; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a { padding: 3px 7px; border-radius: 6px; font-size: .82rem; }
.lang-switch a.active { background: rgba(255,255,255,.2); }
.env-badge { padding: 3px 9px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .05em; }
.orange-line { height: 4px; background: var(--scabro-orange); }

.logo-section {
  background: #fff;
  padding: 14px clamp(18px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.logo-section img { width: min(357px, 80vw); height: auto; display: block; }
.portal-caption { color: var(--muted); font-size: .94rem; font-weight: 700; text-align: right; }

.primary-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(18px, 4vw, 42px);
  overflow-x: auto;
  white-space: nowrap;
}
.primary-nav .nav-inner { display: flex; align-items: center; gap: 3px; min-width: max-content; }
.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 13px;
  text-decoration: none;
  color: #33414c;
  font-weight: 700;
  border-bottom: 3px solid transparent;
}
.primary-nav a:hover { color: var(--scabro-blue); background: #f8fafc; }
.primary-nav a.active { color: var(--scabro-blue); border-bottom-color: var(--scabro-orange); }

.container { width: min(1280px, calc(100% - 36px)); margin: 0 auto; }
.container.narrow { width: min(720px, calc(100% - 36px)); }
main { min-height: 60vh; padding: 32px 0 56px; }

.hero {
  padding: clamp(46px, 7vw, 88px) 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(246,131,31,.12), transparent 31%),
    linear-gradient(135deg, #eef5f9 0%, #f8fafc 55%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 40px; align-items: center; }
.hero h1 { margin: 0 0 14px; font-size: clamp(2.15rem, 5vw, 4.1rem); line-height: 1.03; color: var(--scabro-blue); }
.hero .lead { margin: 0; font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--muted); max-width: 720px; }
.hero-kicker { margin: 0 0 12px; color: var(--scabro-orange); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .84rem; }
.hero-panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; color: var(--scabro-blue); font-size: clamp(1.75rem, 3vw, 2.5rem); }
.page-head p { margin: 0; color: var(--muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(6,70,108,.05);
  overflow: hidden;
}
.card-body { padding: 22px; }
.card-header { padding: 16px 22px; border-bottom: 1px solid var(--line); background: #fbfcfd; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-header h2, .card-header h3, .card-body h2, .card-body h3 { margin-top: 0; }
.card h2 { font-size: 1.25rem; color: var(--scabro-blue); }
.card h3 { font-size: 1.05rem; color: var(--scabro-blue); }
.card p:last-child { margin-bottom: 0; }
.action-card { height: 100%; display: flex; flex-direction: column; }
.action-card .card-body { flex: 1; }
.action-card .card-footer { padding: 0 22px 22px; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.metric .value { font-size: 2rem; line-height: 1; font-weight: 900; color: var(--scabro-blue); }
.metric .label { margin-top: 7px; color: var(--muted); font-size: .92rem; }
.metric.attention { border-left: 5px solid var(--scabro-orange); }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { margin-bottom: 17px; }
label { display: block; margin-bottom: 6px; color: #27343e; font-size: .93rem; font-weight: 800; }
.required::after { content: ' *'; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bcc8d1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--scabro-blue-2); box-shadow: 0 0 0 3px rgba(0,87,184,.12); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #f1f4f6; color: #6e7880; }
.help { margin-top: 5px; color: var(--muted); font-size: .84rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-row input { margin-top: 4px; }
.checkbox-row label { margin: 0; font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--scabro-blue); color: #fff; }
.btn-primary:hover { background: #043a59; color: #fff; }
.btn-orange { background: var(--scabro-orange); color: #fff; }
.btn-orange:hover { background: #d86d0d; color: #fff; }
.btn-outline { background: #fff; color: var(--scabro-blue); border-color: var(--scabro-blue); }
.btn-outline:hover { background: var(--surface-blue); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1d14; color: #fff; }
.btn-muted { background: #e9eef2; color: #26343f; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: .86rem; }
.btn-block { width: 100%; }

.alert { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 9px; }
.alert-success { background: #edf8f1; color: #165d36; border-color: #b7dec6; }
.alert-warning { background: #fff8e6; color: #795000; border-color: #efd393; }
.alert-danger { background: #fff0ef; color: #8b1d16; border-color: #efb7b2; }
.alert-info { background: #edf7fb; color: #125a78; border-color: #b8dce9; }
.alert p { margin: 0; }
.alert p + p { margin-top: 8px; }
.error-list { margin: 0; padding-left: 20px; }

.status-pill { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 900; white-space: nowrap; }
.status-success { background: #e7f6ed; color: var(--success); }
.status-warning { background: #fff3d6; color: var(--warning); }
.status-danger { background: #feeceb; color: var(--danger); }
.status-info { background: #e8f5fa; color: var(--info); }
.status-neutral { background: #edf0f2; color: #52606b; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f6f8fa; color: #40505c; font-size: .8rem; text-transform: uppercase; letter-spacing: .035em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); }

.definition-list { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(0, .65fr); gap: 9px 18px; margin: 0; }
.definition-list dt { font-weight: 800; color: #40505c; }
.definition-list dd { margin: 0; overflow-wrap: anywhere; }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding-left: 34px; margin-bottom: 20px; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--scabro-orange); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline .time { color: var(--muted); font-size: .8rem; }
.timeline .title { font-weight: 900; color: var(--scabro-blue); }
.timeline .message { margin-top: 3px; white-space: pre-wrap; }

.filter-bar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.filter-bar .form-group { margin: 0; min-width: 180px; flex: 1; }

.auth-shell { width: min(620px, calc(100% - 36px)); margin: 0 auto; }
.auth-shell .card { box-shadow: var(--shadow); }
.status-hero { text-align: center; padding: 18px 0 5px; }
.status-icon { width: 70px; height: 70px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-blue); color: var(--scabro-blue); font-size: 2rem; font-weight: 900; }

.qr-box { display: grid; place-items: center; min-height: 240px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-box canvas, .qr-box img { width: 210px !important; height: 210px !important; image-rendering: pixelated; }
.secret-box, .code-list { font-family: Consolas, Monaco, monospace; background: #f4f6f8; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 20px; align-items: start; }
.sticky { position: sticky; top: 16px; }

.footer { padding: 28px clamp(18px, 4vw, 42px); background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.footer-inner { width: min(1280px, 100%); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }

@media (max-width: 980px) {
  .hero-grid, .split-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .top-bar { align-items: flex-start; }
  .top-meta { display: none; }
  .logo-section { align-items: flex-start; flex-direction: column; }
  .portal-caption { text-align: left; }
  .grid.two, .grid.three, .grid.four, .form-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .definition-list { grid-template-columns: 1fr; gap: 2px; }
  .definition-list dd { margin-bottom: 10px; }
  .code-list { grid-template-columns: 1fr; }
  .container, .container.narrow, .auth-shell { width: min(100% - 24px, 1280px); }
}
@media print {
  .top-bar, .primary-nav, .page-actions, .footer, .btn, form { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}

/* Reusable server-side tabs and compact log views */
.tab-nav { display: flex; gap: 4px; margin: 0 0 18px; padding: 5px; background: #e9eef2; border-radius: 10px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab-nav a { padding: 9px 14px; border-radius: 7px; color: #33414c; text-decoration: none; font-weight: 800; white-space: nowrap; }
.tab-nav a:hover { background: rgba(255,255,255,.65); color: var(--scabro-blue); }
.tab-nav a.active { background: #fff; color: var(--scabro-blue); box-shadow: 0 2px 7px rgba(6,70,108,.08); }
.log-detail { max-width: 620px; max-height: 240px; overflow: auto; margin: 8px 0 0; padding: 10px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; }
details summary { cursor: pointer; color: var(--scabro-blue); font-weight: 800; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; }
code { font-family: Consolas, Monaco, monospace; background: #f0f3f5; border-radius: 4px; padding: .1em .35em; }

.footer-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legal-copy h2 { margin-top: 28px; }
.legal-copy h2:first-child { margin-top: 0; }

/* RMA 1.1 access management */
fieldset { border: 1px solid #d6dde6; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
fieldset legend { font-weight: 700; padding: 0 6px; }
select[multiple] { min-height: 150px; }
details { border-bottom: 1px solid #d6dde6; padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }
.card pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
.primary-nav .nav-inner { flex-wrap: wrap; }
