:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d9dee7;
  --line-soft: #edf0f4;
  --nav: #12324a;
  --nav-soft: #1d4a68;
  --nav-active: rgba(255, 255, 255, 0.12);
  --primary: #b42318;
  --primary-hover: #95180f;
  --blue: #1f6feb;
  --cyan: #027a97;
  --green: #16803c;
  --amber: #b98920;
  --red: #b42318;
  --shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(120deg, #12324a 0%, #1d4a68 46%, #eef3f6 46%);
}

.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 8px;
  overflow: hidden;
}

.login-brand {
  min-height: 520px;
  padding: 46px;
  color: #fff;
  background:
    linear-gradient(rgba(16, 24, 32, 0.78), rgba(16, 24, 32, 0.78)),
    url("https://images.unsplash.com/photo-1569263979104-865ab7cd8d13?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-logo {
  display: block;
  width: min(7cm, 100%);
  height: auto;
  margin: 0 0 24px;
  border-radius: 4px;
}

.brand-logo {
  display: block;
  width: 2.5cm;
  max-width: 100%;
  height: auto;
  margin: 0 0 10px;
  border-radius: 4px;
}

.login-brand p {
  max-width: 520px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

.login-form {
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.login-access {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.access-card {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.access-card strong,
.access-card span {
  display: block;
}

.access-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.login-form h2,
.view-title h1,
.modal h2 {
  margin: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 9px 13px;
  background: #e9eef5;
  color: var(--ink);
  font-weight: 700;
}

.btn.primary {
  color: #fff;
  background: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.dark {
  color: #fff;
  background: var(--nav);
}

.btn.danger {
  color: #fff;
  background: var(--red);
}

.notice {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.notice.danger {
  background: #fff1f0;
  border: 1px solid #f2b8b5;
  color: #8f1d16;
}

.doc-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

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

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

.app-shell.scope-inland {
  --nav: #12324a;
  --nav-soft: #1d4a68;
  --nav-active: rgba(180, 35, 24, 0.22);
  --primary: #b42318;
  --primary-hover: #95180f;
  --cyan: #0f5f78;
}

.app-shell.scope-yacht {
  --nav: #071a34;
  --nav-soft: #102a50;
  --nav-active: rgba(196, 154, 50, 0.22);
  --primary: #c49a32;
  --primary-hover: #a77e1f;
  --amber: #b98920;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 18px;
}

.brand {
  padding: 8px 4px 12px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.userbox span,
.small,
.meta {
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand span,
.sidebar .userbox span {
  color: rgba(255, 255, 255, 0.64);
}

.scope-switch {
  display: grid;
  gap: 8px;
}

.scope-button,
.nav-button {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
}

.scope-button.active,
.nav-button.active {
  background: var(--nav-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav {
  display: grid;
  gap: 5px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 16px;
}

.content {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.view-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.view-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.metric,
.panel,
.card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2,
.panel h2 {
  font-size: 18px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:hover td {
  background: #fafbfc;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1849a9;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.green {
  background: #eaf7ee;
  color: var(--green);
}

.pill.amber {
  background: #fff4e5;
  color: var(--amber);
}

.pill.gray {
  background: #f2f4f7;
  color: #344054;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  padding: 13px;
}

.card strong {
  display: block;
}

.card .meta {
  margin-top: 5px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-edit-panel {
  border-color: #c7d7ee;
  background: #f8fbff;
}

.quick-edit-panel .panel-head {
  align-items: flex-start;
}

.quick-edit-panel .panel-head .meta {
  margin: 5px 0 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.quick-actions .btn {
  justify-content: center;
  min-height: 42px;
  white-space: normal;
  text-align: center;
}

.workflow-panel {
  background: #fbfcfe;
}

.workflow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workflow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.dot.green {
  background: var(--green);
}

.dot.amber {
  background: var(--amber);
}

.dot.red {
  background: var(--red);
}

.workflow-track {
  display: grid;
  grid-template-columns: repeat(9, minmax(95px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workflow-step {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fff;
}

.workflow-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f6;
  color: #344054;
}

.workflow-step strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.workflow-step.done {
  border-color: #b7dfc4;
  background: #f0fbf4;
}

.workflow-step.done span {
  background: var(--green);
  color: #fff;
}

.workflow-step.active {
  border-color: #f1c27d;
  background: #fff8ec;
}

.workflow-step.active span {
  background: var(--amber);
  color: #fff;
}

.workflow-step.attention {
  border-color: #f0b4b4;
  background: #fff5f5;
}

.workflow-step.attention span {
  background: var(--red);
  color: #fff;
}

.tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tab {
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 6px;
  color: var(--ink);
  background: #e9eef5;
  font-weight: 700;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.fact {
  padding: 12px;
  background: #fafbfc;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.check-item input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.event {
  position: relative;
  padding-left: 18px;
}

.event:before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.event strong {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
}

.filter-actions {
  align-self: end;
}

.full {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 24, 32, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(860px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 12px;
    gap: 12px;
  }

  .brand {
    padding: 4px 2px;
  }

  .scope-switch,
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scope-button,
  .nav-button {
    min-height: 40px;
    font-size: 14px;
  }

  .metrics,
  .grid-two,
  .grid-three,
  .detail-layout,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 340px;
  }
}

@media (max-width: 640px) {
  .content,
  .topbar,
  .login-form,
  .login-brand {
    padding: 14px;
  }

  .metrics,
  .facts,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .view-title,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .content {
    gap: 14px;
  }

  .login-brand {
    min-height: 260px;
  }

  .login-brand h1 {
    font-size: 30px;
  }

  .actions,
  .quick-actions,
  .tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .btn,
  .tab {
    width: 100%;
  }

  .panel,
  .metric,
  .card {
    border-radius: 6px;
  }

  .panel {
    padding: 14px;
  }

  .metric strong {
    font-size: 24px;
  }

  .table-wrap {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }
}
