/* ====================================================================
   ELOG — Login + Web Portal styles
   Reuses the design tokens from styles.css (link it first).
   ==================================================================== */

/* ===================== LOGIN ===================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}

/* Left brand panel */
.auth-aside {
  position: relative;
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(11,179,166,.35), transparent 55%),
    linear-gradient(155deg, var(--navy) 0%, var(--sea) 100%);
}
.auth-aside::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(700px 500px at 70% 30%, #000, transparent 80%);
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-brand { display: inline-flex; align-items: center; gap: 11px; font-family: 'Sora', sans-serif; }
.auth-brand .brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: rgba(255,255,255,.14); color: #fff;
  display: grid; place-items: center;
}
.auth-brand-name { font-weight: 800; font-size: 1.35rem; }
.auth-brand-tag {
  display: block; font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.6); margin-top: 2px;
}

.auth-aside-body { max-width: 440px; }
.auth-aside-body h2 {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem); font-weight: 800; line-height: 1.14;
  margin-bottom: 18px;
}
.auth-aside-body p { color: rgba(255,255,255,.78); font-size: 1.05rem; margin-bottom: 28px; }
.auth-features { list-style: none; display: grid; gap: 13px; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: .98rem; color: rgba(255,255,255,.9); }
.auth-features .af-check {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px;
  background: rgba(11,179,166,.25); color: #8ff0e5;
  display: grid; place-items: center;
}

.auth-quote { border-left: 2px solid rgba(255,255,255,.25); padding-left: 18px; max-width: 440px; }
.auth-quote p { font-size: 1.02rem; font-style: italic; color: rgba(255,255,255,.92); margin-bottom: 8px; }
.auth-quote cite { font-style: normal; font-size: .86rem; color: rgba(255,255,255,.6); }

/* Right form panel */
.auth-main {
  display: flex; flex-direction: column;
  padding: 32px 40px;
}
.auth-topbar { display: flex; align-items: center; justify-content: space-between; }
.auth-back { font-size: .92rem; font-weight: 600; color: var(--muted); transition: color .15s; }
.auth-back:hover { color: var(--navy); }

.auth-form-wrap {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  max-width: 400px; width: 100%; margin: 0 auto; padding: 32px 0;
}
.auth-form-wrap h1 { font-size: 1.9rem; font-weight: 800; margin-bottom: 8px; }
.auth-form-wrap .auth-sub { color: var(--muted); margin-bottom: 28px; font-size: .98rem; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.field-input {
  position: relative; display: flex; align-items: center;
}
.field-input input {
  width: 100%; font: inherit; font-size: .98rem;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-alt); color: var(--ink); transition: border-color .15s, background .15s, box-shadow .15s;
}
.field-input input:focus {
  outline: none; border-color: var(--teal);
  background: #fff; box-shadow: 0 0 0 3px rgba(11,179,166,.14);
}
.field-input input.invalid { border-color: #e0524f; background: #fff5f5; }
.pw-toggle {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: var(--muted); padding: 4px 6px;
}
.pw-toggle:hover { color: var(--teal-deep); }
.field-error { display: none; color: #c8413e; font-size: .82rem; margin-top: 6px; }
.field-error.show { display: block; }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.remember { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--teal-deep); }
.auth-forgot { font-size: .9rem; font-weight: 600; color: var(--teal-deep); }
.auth-forgot:hover { text-decoration: underline; }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 24px 0; color: var(--muted); font-size: .82rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.sso-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: 11px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); cursor: pointer; margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.sso-btn:hover { border-color: var(--ink-soft); background: var(--bg-alt); }

.auth-signup { text-align: center; margin-top: 24px; font-size: .94rem; color: var(--muted); }
.auth-signup a { font-weight: 600; color: var(--teal-deep); }
.auth-signup a:hover { text-decoration: underline; }

.auth-demo {
  display: flex; align-items: center; gap: 9px;
  background: rgba(11,179,166,.09); border: 1px solid rgba(11,179,166,.22);
  color: var(--teal-deep); border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: .85rem; margin-bottom: 22px;
}

.auth-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.auth-secure { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--muted); }
.auth-legal { font-size: .78rem; color: var(--muted); max-width: 400px; margin: 8px auto 0; text-align: center; }

/* ===================== PORTAL ===================== */
body.portal-body { background: var(--bg-alt); }

.portal-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* Sidebar */
.portal-side {
  background: var(--navy); color: rgba(255,255,255,.78);
  display: flex; flex-direction: column;
  padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.portal-side .auth-brand { padding: 4px 8px 22px; color: #fff; }
.portal-side .auth-brand-name { color: #fff; font-size: 1.2rem; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  color: rgba(255,255,255,.72); font-size: .92rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.side-link svg { flex-shrink: 0; opacity: .85; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: var(--teal); color: #04221f; font-weight: 600; }
.side-link.active svg { opacity: 1; }
.side-sep { height: 1px; background: rgba(255,255,255,.1); margin: 12px 8px; }
.side-foot { padding: 8px; }
.side-logout {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.6); font: inherit; font-size: .9rem; padding: 10px 12px; border-radius: 9px;
  transition: background .15s, color .15s;
}
.side-logout:hover { background: rgba(224,82,79,.16); color: #ff9b99; }

/* Main */
.portal-main { display: flex; flex-direction: column; min-width: 0; }
.portal-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 28px; background: rgba(255,255,255,.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.portal-search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; color: var(--muted);
}
.portal-search input { flex: 1; border: none; background: none; font: inherit; font-size: .92rem; color: var(--ink); outline: none; }
.topbar-spacer { flex: 1; }
.topbar-icon {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink-soft);
  background: var(--bg-alt); border: 1px solid var(--line); cursor: pointer;
}
.topbar-icon .dot-badge {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  background: #e0524f; border-radius: 50%; border: 1.5px solid #fff;
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--sea)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.user-meta { line-height: 1.2; }
.user-meta strong { display: block; font-size: .9rem; }
.user-meta span { font-size: .78rem; color: var(--muted); }

.portal-content { padding: 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: .96rem; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat-card .stat-ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  margin-bottom: 14px; color: var(--sea); background: linear-gradient(150deg, rgba(11,179,166,.16), rgba(31,122,224,.12));
}
.stat-num { font-family: 'Sora', sans-serif; font-size: 1.9rem; font-weight: 700; color: var(--ink); }
.stat-label { font-size: .86rem; color: var(--muted); margin-top: 2px; }

/* Grid for tables/cards */
.portal-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 1.05rem; font-weight: 700; }
.panel-head a { font-size: .85rem; font-weight: 600; color: var(--teal-deep); }
.panel-head a:hover { text-decoration: underline; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 11px 20px; background: var(--bg-alt);
}
.data-table td { padding: 13px 20px; border-top: 1px solid var(--line); font-size: .9rem; }
.data-table td code { font-size: .82rem; color: var(--sea); font-family: ui-monospace, monospace; }
.data-table tr:hover td { background: #fafcfe; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: rgba(11,179,166,.14); color: var(--teal-deep); }
.pill-amber { background: rgba(214,158,46,.16); color: #b7791f; }
.pill-blue  { background: rgba(31,122,224,.13); color: #1558a8; }

/* Side stack */
.side-stack { display: grid; gap: 20px; }
.vessel-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.vessel-row:first-of-type { border-top: none; }
.vessel-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-alt); display: grid; place-items: center; font-size: 1.1rem; }
.vessel-meta { flex: 1; line-height: 1.3; }
.vessel-meta strong { font-size: .92rem; }
.vessel-meta span { display: block; font-size: .8rem; color: var(--muted); }

.id-list { padding: 6px 20px 16px; }
.id-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.id-row:first-child { border-top: none; }
.id-label { font-size: .86rem; color: var(--muted); }
.id-val { font-family: ui-monospace, monospace; font-size: .88rem; color: var(--ink); font-weight: 600; }
.id-note { font-size: .78rem; color: var(--muted); padding: 0 20px 16px; }

/* Mobile-app banner */
.portal-banner {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--navy), var(--sea)); color: #fff;
  border-radius: var(--radius); padding: 22px 26px; margin-top: 24px;
}
.portal-banner .pb-text { flex: 1; min-width: 240px; }
.portal-banner h3 { font-size: 1.15rem; margin-bottom: 4px; }
.portal-banner p { color: rgba(255,255,255,.8); font-size: .94rem; }
.portal-banner .btn { background: #fff; color: var(--navy); }

/* ===================== Responsive ===================== */
@media (max-width: 920px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-shell { grid-template-columns: 1fr; }
  .portal-side {
    position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px 12px;
  }
  .portal-side .auth-brand { display: none; }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-link span { display: none; }
  .side-sep, .side-foot .side-logout span { display: none; }
  .side-sep { display: none; }
}
@media (max-width: 560px) {
  .auth-main { padding: 24px; }
  .stat-grid { grid-template-columns: 1fr; }
  .portal-search { display: none; }
  .portal-content { padding: 18px; }
}

/* ===================== Portal sections (SPA) ===================== */
.portal-section { display: none; }
.portal-section.active { display: block; animation: sectionIn .25s ease; }
@keyframes sectionIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ai {
  background: linear-gradient(135deg, var(--teal), var(--sea)); color: #fff; border: none;
}
.btn-ai:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(11,179,166,.7); }
.btn-ai .spark { display: inline-grid; place-items: center; }

.panel-pad { padding: 22px; }
.empty-hint { color: var(--muted); font-size: .94rem; padding: 26px 22px; text-align: center; }

/* ===================== AI Assistant drawer ===================== */
.ai-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 18px 13px 15px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--teal), var(--sea)); color: #fff;
  font: inherit; font-weight: 700; font-size: .95rem;
  box-shadow: 0 14px 34px -10px rgba(10,40,64,.6);
  transition: transform .18s ease, box-shadow .2s ease;
}
.ai-fab:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -12px rgba(10,40,64,.7); }
.ai-fab .fab-pulse {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.2);
}

.ai-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8,24,41,.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.ai-overlay.open { opacity: 1; visibility: visible; }

.ai-drawer {
  position: fixed; top: 0; right: 0; z-index: 80;
  width: 420px; max-width: 100vw; height: 100vh;
  background: var(--bg); display: flex; flex-direction: column;
  box-shadow: -24px 0 60px -24px rgba(8,24,41,.5);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.ai-drawer.open { transform: none; }

.ai-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--sea));
}
.ai-head .ai-avatar {
  width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.16);
  display: grid; place-items: center; flex-shrink: 0;
}
.ai-head-meta { flex: 1; line-height: 1.25; }
.ai-head-meta strong { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.ai-head-badge {
  font-size: .62rem; font-weight: 700; letter-spacing: .06em; padding: 2px 7px;
  border-radius: 999px; background: rgba(11,179,166,.35); color: #c9fff7;
}
.ai-head-ctx { font-size: .8rem; color: rgba(255,255,255,.72); }
.ai-close {
  width: 34px; height: 34px; border-radius: 9px; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center;
}
.ai-close:hover { background: rgba(255,255,255,.22); }

.ai-quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ai-chip {
  font: inherit; font-size: .82rem; font-weight: 500; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-alt); color: var(--ink-soft); transition: border-color .15s, color .15s;
}
.ai-chip:hover { border-color: var(--teal); color: var(--teal-deep); }

.ai-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }

.ai-msg { max-width: 86%; font-size: .92rem; line-height: 1.55; }
.ai-msg-bot {
  align-self: flex-start; background: var(--bg-alt); border: 1px solid var(--line);
  color: var(--ink); padding: 12px 14px; border-radius: 4px 14px 14px 14px;
}
.ai-msg-user {
  align-self: flex-end; background: var(--navy); color: #fff;
  padding: 12px 14px; border-radius: 14px 4px 14px 14px;
}
.ai-msg-bot .ai-src {
  display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: .76rem; color: var(--muted);
}
.ai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Image preview + OCR progress */
.ai-image-card {
  align-self: flex-end; max-width: 86%;
  border-radius: 14px 4px 14px 14px; overflow: hidden; border: 1px solid var(--line);
}
.ai-image-card img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.ai-ocr-progress { padding: 10px 12px; background: var(--bg-alt); font-size: .82rem; color: var(--ink-soft); }
.ai-ocr-bar { height: 5px; border-radius: 999px; background: var(--line); margin-top: 7px; overflow: hidden; }
.ai-ocr-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--sea)); transition: width .2s; }

/* Suggestion / confirm card */
.ai-suggest {
  align-self: stretch; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.ai-suggest-head {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px;
  background: rgba(11,179,166,.09); color: var(--teal-deep); font-weight: 600; font-size: .86rem;
  border-bottom: 1px solid var(--line);
}
.ai-suggest-body { padding: 12px 14px; display: grid; gap: 10px; }
.ai-sfield { display: grid; gap: 5px; }
.ai-sfield label { font-size: .76rem; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.ai-conf { font-weight: 600; }
.ai-conf.high { color: var(--teal-deep); }
.ai-conf.med { color: #b7791f; }
.ai-sfield input {
  font: inherit; font-size: .9rem; padding: 9px 11px;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg-alt); color: var(--ink);
}
.ai-sfield input:focus { outline: none; border-color: var(--teal); background: #fff; }
.ai-suggest-foot { display: flex; gap: 9px; padding: 12px 14px; border-top: 1px solid var(--line); }
.ai-suggest-note { font-size: .76rem; color: var(--muted); padding: 0 14px 12px; display: flex; gap: 6px; align-items: flex-start; }

/* Composer */
.ai-composer { border-top: 1px solid var(--line); padding: 12px 14px; background: var(--bg); }
.ai-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 12px; background: var(--bg-alt);
}
.ai-input-row:focus-within { border-color: var(--teal); background: #fff; }
.ai-input-row textarea {
  flex: 1; border: none; background: none; resize: none; font: inherit; font-size: .92rem;
  color: var(--ink); max-height: 96px; padding: 7px 0; outline: none; line-height: 1.4;
}
.ai-tool {
  width: 38px; height: 38px; border-radius: 11px; border: none; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
  transition: background .15s, color .15s, border-color .15s;
}
.ai-tool:hover { border-color: var(--teal); color: var(--teal-deep); }
.ai-tool.send { background: var(--navy); color: #fff; border-color: var(--navy); }
.ai-tool.send:hover { background: var(--navy-2); color: #fff; }
.ai-tool.recording { background: #e0524f; color: #fff; border-color: #e0524f; animation: micpulse 1.3s infinite; }
@keyframes micpulse { 0% { box-shadow: 0 0 0 0 rgba(224,82,79,.5); } 70% { box-shadow: 0 0 0 10px rgba(224,82,79,0); } 100% { box-shadow: 0 0 0 0 rgba(224,82,79,0); } }
.ai-hint { font-size: .74rem; color: var(--muted); margin-top: 8px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.ai-voice-status { font-size: .8rem; color: var(--teal-deep); padding: 6px 2px 0; min-height: 18px; }

@media (max-width: 560px) {
  .ai-drawer { width: 100vw; }
  .ai-fab span.fab-label { display: none; }
}

/* ===================== Logbook entry form ===================== */
.lb-shell { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.lb-top { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.lb-top-title { flex: 1; min-width: 240px; }
.lb-top-title h1 { font-size: 1.5rem; font-weight: 800; }
.lb-top-title p { color: var(--muted); font-size: .9rem; margin-top: 4px; max-width: 620px; }
.lb-top-right { display: flex; align-items: center; gap: 12px; }

.lb-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; }
.lb-card { margin-bottom: 18px; padding: 22px; }
.lb-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.lb-card-head h2 { font-size: 1.1rem; font-weight: 700; }
.lb-step {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-family: 'Sora', sans-serif; font-weight: 700; font-size: .9rem;
  color: #fff; background: linear-gradient(135deg, var(--teal), var(--sea));
}
.lb-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lb-fields .field { margin-bottom: 0; }
.lb-req { color: #c8413e; }
.lb-hint { display: block; font-size: .76rem; color: var(--muted); margin-top: 5px; }
.lb-hint code { background: var(--bg-alt); padding: 1px 6px; border-radius: 5px; color: var(--sea); }
.lb-inline { display: flex; gap: 8px; }
.lb-inline .field-input { flex: 1; }
.lb-inline .lb-narrow { max-width: 90px; }
.lb-select {
  font: inherit; font-size: .95rem; padding: 0 12px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-alt); color: var(--ink);
}

.lb-position { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.lb-position-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; font-weight: 600; font-size: .92rem; }
.lb-mode-toggle { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lb-mode { font: inherit; font-size: .82rem; font-weight: 600; border: none; background: none; cursor: pointer; padding: 6px 13px; border-radius: 999px; color: var(--muted); }
.lb-mode.active { background: var(--navy); color: #fff; }

.lb-compliance { display: grid; gap: 14px; }
.lb-radio { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.lb-radio legend { font-size: .88rem; font-weight: 600; color: var(--ink-soft); padding-right: 10px; }
.lb-attest { align-items: flex-start; gap: 10px; }
.lb-integrity { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; color: var(--muted); background: rgba(11,179,166,.08); border-radius: 10px; padding: 10px 12px; }
.lb-integrity svg { flex-shrink: 0; margin-top: 2px; color: var(--teal-deep); }

.lb-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* Output panel */
.lb-output { position: sticky; top: 18px; display: grid; gap: 12px; }
.lb-validation { padding: 12px 16px; font-size: .86rem; line-height: 1.5; }
.lb-validation.fail { background: #fff5f5; color: #9b2c2c; border-top: 1px solid var(--line); }
.lb-validation.pass { background: rgba(11,179,166,.1); color: var(--teal-deep); font-weight: 600; border-top: 1px solid var(--line); }
.lb-validation ul { margin: 6px 0 0 18px; }
.xml-meta { display: flex; flex-direction: column; gap: 5px; padding: 12px 16px; border-top: 1px solid var(--line); }
.xml-meta code { font-family: ui-monospace, monospace; font-size: .82rem; color: var(--sea); word-break: break-all; }
.lb-xml {
  margin: 0; padding: 16px; background: #0a1829; color: #cfe8ff;
  font-family: ui-monospace, Menlo, monospace; font-size: .76rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto;
}
.lb-out-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); }
.lb-ws { padding: 12px 16px; font-size: .86rem; border-top: 1px solid var(--line); line-height: 1.6; }
.lb-ws.ok { background: rgba(11,179,166,.1); color: var(--teal-deep); }
.lb-ws.warn { background: #fff8ec; color: #92591a; }
.lb-ws code { font-family: ui-monospace, monospace; }
.lb-units-note { font-size: .78rem; color: var(--muted); line-height: 1.5; padding: 0 4px; }

/* Locked app-identification note */
.lb-locked-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.lb-locked-note svg { flex-shrink: 0; margin-top: 2px; color: var(--muted); }
.lb-locked-note code { background: var(--bg-alt); padding: 1px 6px; border-radius: 5px; color: var(--sea); }

/* Privacy notice (collapsible, App. C) */
.lb-legal { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--bg-alt); }
.lb-legal summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.lb-legal p { font-size: .78rem; color: var(--muted); line-height: 1.55; margin-top: 10px; }

/* Transmission register (§13.3) */
.lb-register .panel-head { display: flex; align-items: center; justify-content: space-between; }
.lb-reg-empty { padding: 14px 16px; font-size: .82rem; color: var(--muted); }
.lb-reg-wrap { overflow-x: auto; }
.lb-reg-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.lb-reg-table th, .lb-reg-table td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.lb-reg-table th { color: var(--muted); font-weight: 600; }
.lb-reg-table .pill { font-size: .7rem; padding: 1px 8px; }

/* Closed/locked data group */
.lb-readonly { position: relative; }
.lb-readonly .lb-card { opacity: .72; }

/* Full-width select + multi-species catch table (Salmon) */
.lb-select-full { width: 100%; height: 44px; }
.lb-species { width: 100%; border-collapse: collapse; margin: 4px 0 6px; }
.lb-species th, .lb-species td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; }
.lb-species thead th { font-size: .78rem; color: var(--muted); font-weight: 600; border-top: none; }
.lb-species tbody th { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.lb-species input { width: 100%; height: 38px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-alt); padding: 0 10px; font: inherit; }
.lb-bycatch-row { margin-top: 6px; }

/* Fishery chooser (new-trip.html) */
.nt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 8px; }
.nt-card {
  display: flex; flex-direction: column; gap: 6px; padding: 22px; text-decoration: none;
  background: var(--surface, #fff); border: 1.5px solid var(--line); border-radius: var(--radius); color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.nt-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(12,39,64,.12); border-color: var(--teal); }
.nt-emoji { font-size: 2rem; }
.nt-name { font-size: 1.15rem; font-weight: 700; }
.nt-meta { font-size: .82rem; color: var(--muted); }
.nt-pill { align-self: flex-start; margin-top: 8px; font-size: .72rem; }
.nt-card-soon { cursor: not-allowed; opacity: .6; }
.nt-card-soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.nt-note { margin-top: 22px; max-width: 760px; }

@media (max-width: 900px) {
  .lb-grid { grid-template-columns: 1fr; }
  .lb-output { position: static; }
}
@media (max-width: 560px) {
  .lb-fields { grid-template-columns: 1fr; }
}

/* ===================== Accessibility: visible focus ===================== */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}
.side-link:focus-visible { outline-offset: -2px; }
.portal-section:focus { outline: none; }   /* programmatic focus target — no ring */
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 200;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-weight: 600; transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ===================== Manual crew entry form ===================== */
.crew-form { margin-bottom: 18px; padding: 20px 22px; }
.crew-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.crew-form .field { margin-bottom: 0; }
.crew-form-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.crew-form-note { font-size: .8rem; color: var(--muted); }
@media (max-width: 640px) { .crew-form-grid { grid-template-columns: 1fr; } }

/* ===================== Toast ===================== */
.toast-host {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--navy); color: #fff; font-weight: 600; font-size: .92rem;
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; }
.toast svg { color: #8ff0e5; }
