/* ==========================================================================
   Ashranda Contracts — design system
   Brand: gold #C09040 · deep bronze #705020 · navy #0050A0
          warm cream #FAF7F0 · ink #1C1917
   Type:  Fraunces (display serif) · Inter (UI sans)
   Motion: ease-out cubic-bezier(0.23,1,0.32,1), 150–250ms, press scale(0.97)
   ========================================================================== */

:root {
  --gold: #C09040;
  --gold-strong: #B0813A;
  --gold-deep: #8F6A2B;
  --gold-soft: rgba(192, 144, 64, 0.13);
  --gold-ring: rgba(192, 144, 64, 0.55);
  --bronze: #705020;
  --navy: #0050A0;
  --navy-soft: rgba(0, 80, 160, 0.10);
  --cream: #FAF7F0;
  --ink: #1C1917;
  --ink-soft: #57504A;
  --muted: #8A8177;
  --line: #ECE5D8;
  --line-strong: #DDD2BE;
  --card: #FFFFFF;
  --danger: #B3402F;
  --danger-soft: #FBEDEA;
  --ok: #2E7D4F;
  --ok-soft: #E8F4EC;
  --sidebar-bg: #1D1610;
  --sidebar-bg-2: #14100B;
  --sidebar-text: rgba(250, 247, 240, 0.66);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05), 0 1px 3px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 2px 4px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 4px 8px rgba(28, 25, 23, 0.06), 0 18px 50px rgba(28, 25, 23, 0.14);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--bronze); text-decoration: none; }
a:hover { color: var(--gold-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-soft); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- Shell layout ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(178deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.sidebar-brand img {
  height: 44px; width: auto;
  background: #FFFDF8;
  border-radius: 10px;
  padding: 5px 9px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.sidebar-brand .brand-word { font-family: var(--serif); font-size: 19px; color: var(--cream); letter-spacing: 0.06em; }
.sidebar-brand .brand-sub { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin-top: 1px; }
.gold-curve {
  height: 26px; margin: 0 0 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 26' preserveAspectRatio='none'%3E%3Cpath d='M0,20 C60,2 160,26 240,8' fill='none' stroke='%23C09040' stroke-width='1.4' opacity='0.85'/%3E%3Cpath d='M0,24 C70,8 150,28 240,14' fill='none' stroke='%23C09040' stroke-width='0.8' opacity='0.4'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.nav-group { padding: 14px 12px 4px; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(250,247,240,0.38); padding: 0 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 14px; font-weight: 500;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out);
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.75; }
.nav-item:hover { background: rgba(250, 247, 240, 0.06); color: var(--cream); }
.nav-item.active { background: var(--gold-soft); color: #E9C98F; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--gold);
}
.sidebar-foot { margin-top: auto; padding: 18px 20px; font-size: 11px; color: rgba(250,247,240,0.30); }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  background: rgba(250, 247, 240, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-family: var(--serif); font-size: 21px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.topbar-title .count { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-soft); }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #FFF9EE; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.03em;
}
.menu-btn, .topbar .menu-btn { display: none; }

.content { padding: 28px; max-width: 1160px; width: 100%; margin: 0 auto; }
.content-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 30px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin: 6px 0 0; max-width: 60ch; }
.content-head::after {
  content: ""; display: block; flex-basis: 100%; height: 0;
}
.head-curve { margin: 18px 0 4px; height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 30' preserveAspectRatio='none'%3E%3Cpath d='M0,22 C70,4 150,30 240,10' fill='none' stroke='%23C09040' stroke-width='1.2' opacity='0.6'/%3E%3Cpath d='M0,27 C80,12 160,32 240,18' fill='none' stroke='%23C09040' stroke-width='0.7' opacity='0.3'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card + .card { margin-top: 20px; }
.card-title { font-size: 17px; margin-bottom: 4px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ---- Buttons ---- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  border-radius: 10px; border: 1px solid transparent;
  padding: 10px 18px; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out),
              box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out),
              opacity 160ms var(--ease-out);
  text-decoration: none; line-height: 1.2; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-gold {
  background: linear-gradient(180deg, #C9973F 0%, #B4842F 100%);
  color: #FFF9EE;
  box-shadow: 0 1px 2px rgba(112, 80, 32, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-gold:hover { background: linear-gradient(180deg, #D2A14A 0%, #BD8C36 100%); }
.btn-outline {
  background: var(--card); border-color: var(--line-strong); color: var(--ink);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--gold-soft); color: var(--gold-deep); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-lg { font-size: 16px; padding: 15px 30px; border-radius: 12px; }
.btn-sm { font-size: 12.5px; padding: 6px 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---- Forms ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%;
  font-family: var(--sans); font-size: 14.5px; color: var(--ink);
  background: #FFFEFB;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.input::placeholder { color: #B3AA9E; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Search bar — CRM style with gold focus ring */
.searchbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-input {
  flex: 1 1 260px;
  font-size: 15px; padding: 12px 16px;
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: #FFFEFB; font-family: var(--sans);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.search-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.select-inline {
  font-size: 13.5px; padding: 10px 12px;
  border: 1.5px solid var(--line-strong); border-radius: 10px; background: #FFFEFB;
  font-family: var(--sans); color: var(--ink);
}
.select-inline:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---- Alerts ---- */
.alert { border-radius: 12px; padding: 13px 16px; font-size: 14px; margin-bottom: 18px; border: 1px solid; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #EFCFC8; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #CBE5D3; }
.alert-warn { background: #FBF3E4; color: var(--bronze); border-color: #EBD9B4; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ---- Tables (CRM style) ---- */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.crm { width: 100%; border-collapse: collapse; font-size: 14px; }
table.crm th {
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  padding: 13px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.crm td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.crm tbody tr { transition: background-color 140ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  table.crm tbody tr:hover { background: #FCFAF4; }
}
table.crm tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .btn + .btn { margin-left: 6px; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state .big { font-family: var(--serif); font-size: 19px; color: var(--ink-soft); margin-bottom: 6px; }

/* ---- Badges & chips ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  border-radius: 999px; padding: 3px 10px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-gold { background: var(--gold-soft); color: var(--gold-deep); border-color: rgba(192,144,64,0.35); }
.badge-navy { background: var(--navy-soft); color: var(--navy); border-color: rgba(0,80,160,0.22); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: #CBE5D3; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #EFCFC8; }
.badge-neutral { background: #F4EFE5; color: var(--ink-soft); border-color: var(--line-strong); }
.ref-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; color: var(--bronze); font-weight: 600; }

/* ---- Boat cards (generate) ---- */
.boat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.boat-card {
  position: relative;
  background: #FFFEFB;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 20px 14px 16px;
  text-align: center; cursor: pointer;
  transition: transform 200ms var(--ease-out), border-color 200ms var(--ease-out),
              box-shadow 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .boat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold-ring); }
}
.boat-card input { position: absolute; opacity: 0; pointer-events: none; }
.boat-mono {
  width: 52px; height: 52px; margin: 0 auto 10px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-ring);
  background: radial-gradient(circle at 32% 28%, #FFF7E8, #F3E5C9);
  color: var(--bronze);
  font-family: var(--serif); font-size: 21px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.boat-name { font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.boat-check {
  position: absolute; top: 9px; right: 9px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: #FFF9EE;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.6);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.boat-check svg { width: 12px; height: 12px; }
.boat-card.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, #FFFDF7 0%, #FDF6E9 100%);
  box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow-sm);
}
.boat-card.selected .boat-check { opacity: 1; transform: scale(1); }
.boat-card.selected .boat-mono { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.boat-card:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---- Generation progress & chips ---- */
.progress-panel { margin-top: 18px; display: none; }
.progress-panel.open { display: block; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.boat-chip {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--line-strong); border-radius: 999px;
  padding: 8px 15px; font-size: 13.5px; font-weight: 500;
  background: var(--card); color: var(--ink-soft);
  transition: border-color 220ms var(--ease-out), background-color 220ms var(--ease-out),
              color 220ms var(--ease-out), opacity 220ms var(--ease-out);
}
.boat-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: 0 0 8px; }
.boat-chip.rendering { border-color: var(--gold-ring); color: var(--bronze); background: #FFFBF2; }
.boat-chip.rendering .dot { background: var(--gold); animation: pulse 1.1s ease-in-out infinite; }
.boat-chip.done { border-color: #BBD9C5; background: var(--ok-soft); color: var(--ok); }
.boat-chip.done .dot { background: var(--ok); animation: none; }
.boat-chip.failed { border-color: #EFCFC8; background: var(--danger-soft); color: var(--danger); }
.boat-chip.failed .dot { background: var(--danger); animation: none; }
.boat-chip .status-copy { font-size: 12px; color: var(--muted); font-weight: 400; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.gen-error-note { font-size: 12.5px; color: var(--danger); margin-top: 4px; display: none; }
.gen-error-note.show { display: block; }

/* ---- Success / celebration overlay ---- */
.success-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 250ms var(--ease-out);
}
.success-scrim.open { display: flex; }
.success-scrim.visible { opacity: 1; }
.success-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  max-width: 620px; width: 100%;
  padding: 40px 36px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  transition: transform 320ms var(--ease-out);
  max-height: 92vh; overflow-y: auto;
}
.success-scrim.visible .success-card { transform: scale(1) translateY(0); }
.success-card .curve-top {
  position: absolute; top: 0; left: 0; right: 0; height: 46px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 46' preserveAspectRatio='none'%3E%3Cpath d='M0,38 C160,4 420,50 600,12' fill='none' stroke='%23C09040' stroke-width='1.6' opacity='0.7'/%3E%3Cpath d='M0,44 C180,14 400,54 600,22' fill='none' stroke='%23C09040' stroke-width='0.9' opacity='0.35'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.success-check {
  width: 86px; height: 86px; margin: 6px auto 16px;
  border-radius: 50%;
  background: linear-gradient(160deg, #E9C98F, var(--gold) 55%, var(--gold-strong));
  box-shadow: 0 0 0 10px var(--gold-soft), 0 10px 30px rgba(192, 144, 64, 0.35);
  display: flex; align-items: center; justify-content: center;
  animation: checkPop 480ms var(--ease-out) both;
}
.success-check svg { width: 40px; height: 40px; }
.success-check path {
  stroke: #FFF9EE; stroke-width: 5.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 48; stroke-dashoffset: 48;
  animation: drawCheck 420ms 200ms var(--ease-out) forwards;
}
@keyframes checkPop { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.success-title { font-size: 30px; }
.success-sub { color: var(--ink-soft); font-size: 14.5px; margin: 8px 0 22px; }
.success-boats { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.success-boat {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; background: #FFFEFB;
  opacity: 0; transform: perspective(700px) rotateX(-9deg) translateY(10px);
  animation: cardIn 380ms var(--ease-out) forwards;
}
.success-boat > div:first-child { flex: 1 1 auto; min-width: 150px; }
.success-boat .b-name { font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.success-boat .b-ref { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
@keyframes cardIn { to { opacity: 1; transform: perspective(700px) rotateX(0) translateY(0); } }
.success-boat .b-name { font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.success-boat .b-ref { font-size: 12px; color: var(--muted); margin-top: 1px; }
.success-boat .b-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.success-boat.failed { border-color: #EFCFC8; background: var(--danger-soft); }
.success-foot { margin-top: 24px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- Login ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 900' preserveAspectRatio='xMidYMid slice'%3E%3Cpath d='M-50,720 C300,560 700,860 1250,640' fill='none' stroke='%23C09040' stroke-width='1.6' opacity='0.30'/%3E%3Cpath d='M-50,760 C320,610 720,900 1250,690' fill='none' stroke='%23C09040' stroke-width='1' opacity='0.18'/%3E%3Cpath d='M-50,180 C260,40 760,260 1250,90' fill='none' stroke='%23C09040' stroke-width='1.4' opacity='0.22'/%3E%3Cpath d='M-50,220 C300,90 780,300 1250,140' fill='none' stroke='%23C09040' stroke-width='0.8' opacity='0.12'/%3E%3C/svg%3E") no-repeat center / cover,
    var(--cream);
}
.auth-card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  padding: 40px 36px 32px;
  opacity: 0; transform: translateY(10px) scale(0.985);
  animation: authIn 420ms var(--ease-out) forwards;
}
@keyframes authIn { to { opacity: 1; transform: translateY(0) scale(1); } }
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.auth-logo img { height: 64px; width: auto; margin-bottom: 10px; }
.auth-logo .curve { width: 150px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 14' preserveAspectRatio='none'%3E%3Cpath d='M0,10 C40,1 105,14 150,4' fill='none' stroke='%23C09040' stroke-width='1.5' opacity='0.8'/%3E%3Cpath d='M0,13 C45,5 100,15 150,8' fill='none' stroke='%23C09040' stroke-width='0.8' opacity='0.4'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.auth-title { font-size: 23px; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 22px; }

.remember-row { display: flex; align-items: center; gap: 9px; margin: 4px 0 20px; font-size: 13.5px; color: var(--ink-soft); }
.remember-row input { width: 16px; height: 16px; accent-color: var(--gold); }

/* ---- Misc layout helpers ---- */
.two-col { display: grid; grid-template-columns: 1.05fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.filters-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.file-links a { font-weight: 600; margin-right: 10px; white-space: nowrap; }

/* User management */
.user-table-wrap { overflow-x: auto; }
.inline-form { display: inline; }
.pw-form { display: flex; gap: 8px; align-items: center; }
.pw-form .input { max-width: 180px; }

/* ---- Staggered entrance for page content ---- */
.stagger > * { opacity: 0; transform: translateY(8px); animation: rise 360ms var(--ease-out) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 55ms; }
.stagger > *:nth-child(3) { animation-delay: 110ms; }
.stagger > *:nth-child(4) { animation-delay: 165ms; }
.stagger > *:nth-child(5) { animation-delay: 220ms; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ---- Responsive ---- */
@media (max-width: 1020px) {
  .boat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; height: 100vh;
    transform: translateX(-102%);
    transition: transform 260ms var(--ease-in-out);
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(28,25,23,0.4); z-index: 35; opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease-out); }
  .sidebar-scrim.show { opacity: 1; pointer-events: auto; }
  .menu-btn, .topbar .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 30px; }
  .topbar { padding: 12px 16px; }
  .page-title { font-size: 24px; }
  .topbar-title { font-size: 17px; white-space: nowrap; }
  .topbar-right .btn { white-space: nowrap; }
  .user-chip .username-text { display: none; }
  .boat-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-title .count { display: none; }
  .success-card { padding: 30px 20px 22px; }
  .success-boat { flex-wrap: wrap; }
  .success-boat .b-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 420px) {
  .boat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .boat-card { padding: 14px 8px 12px; }
  .boat-mono { width: 42px; height: 42px; font-size: 17px; }
}

/* ---- Reduced motion: fewer, gentler animations ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .stagger > *, .auth-card, .success-boat { opacity: 1; transform: none; }
  .boat-card:hover { transform: none; }
}

/* Clickable table rows (Companies page) */
tr.link-row { cursor: pointer; }
tr.link-row:hover { background: #FCF7EC; }
tr.link-row .cell-strong { color: var(--gold-deep, #705020); }
@media (prefers-reduced-motion: reduce) {
  tr.link-row { cursor: pointer; }
}

/* Sidebar footer credit line */
.sidebar-foot .foot-credit {
  margin-top: 3px;
  color: rgba(250, 247, 240, 0.42);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

/* Users page inline forms (email / password reset cells) */
.email-form, .pw-form { display: flex; gap: 8px; align-items: center; min-width: 220px; }
.email-form .input, .pw-form .input { flex: 1 1 auto; min-width: 0; }

/* Signed-version buttons (distinct teal so they read as a different version) */
.btn-signed {
  border: 1.5px solid #1F7A6D;
  color: #1F7A6D;
  background: #F0FAF8;
}

/* Archived state (grey, deliberately quiet) */
.badge-archived { background: #EFEBE4; color: var(--muted); border-color: var(--line-strong); }
table.crm tbody tr.archived-row { opacity: 0.72; }

/* Templates page */
.template-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.upload-row { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 10px; margin-top: 14px; align-items: center; }
.upload-row .input[type="file"] { padding: 9px 10px; }
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; }
.step-num {
  flex: none; width: 26px; height: 26px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-soft); color: var(--gold-deep);
  font-weight: 700; font-size: 13px;
}
.version-details summary {
  cursor: pointer; user-select: none; list-style: none;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 7px 12px; background: #FFFEFB;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.version-details summary:hover { background: #FBF7EE; border-color: var(--gold); }
.version-details summary::-webkit-details-marker { display: none; }
.version-details summary .chev { transition: transform 200ms var(--ease-out); }
.version-details[open] summary .chev { transform: rotate(180deg); }
.version-details .table-wrap { margin-top: 12px; }
.token-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.token-hint span { font-size: 12px; color: var(--muted); }

/* Boat colour coding (library + company detail) */
.badge-boat-lr { background: rgba(192,144,64,0.13); color: var(--gold-deep); border-color: rgba(192,144,64,0.35); }
.badge-boat-nn { background: var(--navy-soft); color: var(--navy); border-color: rgba(0,80,160,0.22); }
.badge-boat-nu { background: #E6F3F1; color: #1F7A6D; border-color: #BFDCD7; }
.badge-boat-sa { background: #F1EAF6; color: #6E4B8E; border-color: #DCCBE8; }
.badge-boat-dw { background: #F9E9E4; color: #A34A33; border-color: #EBCBC0; }

/* Table footer (showing X of Y) */
.table-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 11px 14px; font-size: 12.5px; color: var(--muted);
  border-top: 1px solid var(--line);
}

/* Row action menu (⋯) */
.row-menu { position: relative; display: inline-block; margin-left: 6px; }
.row-menu summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #FFFEFB;
  color: var(--ink-soft); font-weight: 700; letter-spacing: 1px;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover { background: #FBF7EE; border-color: var(--gold); }
.row-menu .menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 168px; padding: 6px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 11px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
}
.row-menu .menu-panel::before {
  content: ""; position: absolute; top: -6px; right: 10px;
  width: 10px; height: 10px; transform: rotate(45deg);
  background: var(--card); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong);
}
.row-menu .menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink);
  text-decoration: none; white-space: nowrap;
  transition: background-color 120ms var(--ease-out);
}
.row-menu .menu-item:hover { background: #FBF7EE; color: var(--gold-deep); }
.row-menu .menu-item.menu-danger { color: var(--danger); }
.row-menu .menu-item.menu-danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-menu .menu-item form { display: contents; }
.row-menu .menu-item button {
  all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.row-menu .menu-item button:hover { color: inherit; }

/* Toasts (bottom-right, with optional Undo action) */
.toast-region {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  background: #241E17; color: #F5EFE6;
  border: 1px solid rgba(192,144,64,0.35);
  border-radius: 12px; padding: 12px 14px 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; max-width: 380px;
  opacity: 0; transform: translateY(12px);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast .toast-msg { line-height: 1.4; }
.toast .toast-action {
  flex: none; background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 700;
  color: #E9C98F; padding: 4px 6px; border-radius: 7px;
  transition: background-color 140ms var(--ease-out);
}
.toast .toast-action:hover { background: rgba(192,144,64,0.18); }
.toast .toast-close {
  flex: none; background: none; border: none; cursor: pointer;
  color: rgba(245,239,230,0.55); font-size: 15px; line-height: 1;
  padding: 4px 6px; border-radius: 7px;
}
.toast .toast-close:hover { color: #F5EFE6; }

/* Company detail contact form */
.contact-form .field-row { margin-bottom: 12px; }

.mt8 { margin-top: 8px; }

@media (max-width: 860px) {
  .upload-row { grid-template-columns: 1fr; }
  .steps-row { grid-template-columns: 1fr; }
  .toast-region { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .toast { max-width: none; }
}
.btn-signed:hover { background: #E2F4F0; }
