:root {
  --navy: #0b2a4a;
  --navy-deep: #06192d;
  --sea: #1a9b8e;
  --sea-soft: #d7f1ee;
  --brass: #c4a35a;
  --foam: #f4f8fb;
  --ink: #132537;
  --muted: #5d7388;
  --line: rgba(11, 42, 74, 0.1);
  --ok: #1f8a5b;
  --warn: #c47a12;
  --danger: #c0392b;
  --shadow: 0 18px 40px rgba(6, 25, 45, 0.12);
  --radius: 18px;
  --font: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(26,155,142,.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(196,163,90,.16), transparent 45%),
    linear-gradient(180deg, #e8f1f6 0%, var(--foam) 40%, #eef4f8 100%);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%230b2a4a' stroke-width='1'/%3E%3C/svg%3E");
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 16px 110px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 28px 24px 26px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(26,155,142,.25), transparent 40%),
    linear-gradient(160deg, var(--navy-deep), var(--navy) 55%, #12385f);
  box-shadow: var(--shadow);
  animation: rise .7s ease both;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -50px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,155,142,.35), transparent 70%);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.brand-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,.2);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  object-fit: cover;
  background: #0a223b;
  animation: float 4.5s ease-in-out infinite;
}

.brand-copy h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: -.02em;
  line-height: 1.15;
}

.brand-copy p {
  margin: 6px 0 0;
  color: rgba(255,255,255,.78);
  font-size: .92rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.vessel-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  font-size: .85rem;
}

.vessel-chip strong { color: var(--brass); font-weight: 600; }

.lang-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
}
.lang-btn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-btn.active {
  background: #fff;
  color: var(--navy);
}
.lang-switch-lg {
  background: #eef3f7;
  border-color: var(--line);
}
.lang-switch-lg .lang-btn {
  color: var(--muted);
  padding: 10px 18px;
  font-size: .9rem;
}
.lang-switch-lg .lang-btn.active {
  background: var(--navy);
  color: #fff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.stat {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
}

.stat .n {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  display: block;
}
.stat .l { font-size: .72rem; opacity: .75; letter-spacing: .04em; text-transform: uppercase; }
.stat.danger .n { color: #ffb4a8; }
.stat.warn .n { color: #ffd39a; }
.stat.ok .n { color: #9ef0d0; }

.toolbar {
  display: flex;
  gap: 10px;
  margin: 18px 0 8px;
  flex-wrap: wrap;
}

.search, .select, .btn, input[type="date"], input[type="text"], input[type="number"] {
  font: inherit;
}

.search {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
.search:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(26,155,142,.15); }

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn.ghost {
  background: transparent;
  color: var(--navy);
  border: 1px dashed var(--line);
}
.btn.sea { background: var(--sea); }

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 12px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .82rem;
  cursor: pointer;
}
.chip.active {
  background: var(--navy);
  color: #fff;
  border-color: transparent;
}

.section {
  margin: 14px 0 22px;
  animation: rise .5s ease both;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px 4px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--navy);
}
.section-head span {
  color: var(--muted);
  font-size: .8rem;
}

.item {
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(11,42,74,.04);
  transition: border-color .2s ease, transform .2s ease;
}
.item:hover { transform: translateY(-1px); }
.item.expired { border-color: rgba(192,57,43,.35); background: linear-gradient(180deg, #fff7f6, #fff); }
.item.soon { border-color: rgba(196,122,18,.35); background: linear-gradient(180deg, #fffaf2, #fff); }
.item.ok { border-color: rgba(31,138,91,.22); }

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.item-id {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sea);
  font-weight: 700;
}
.item-label {
  margin: 4px 0 0;
  font-weight: 600;
  line-height: 1.35;
}
.badge {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 9px;
  border-radius: 999px;
}
.badge.ok { background: #e5f7ee; color: var(--ok); }
.badge.soon { background: #fff1db; color: var(--warn); }
.badge.expired { background: #fde8e6; color: var(--danger); }
.badge.none { background: #eef2f6; color: var(--muted); }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.field label {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: .02em;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(26,155,142,.12);
}
.days-left {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--muted);
}
.field-hint {
  margin-top: 4px;
  font-size: .7rem;
  line-height: 1.3;
  color: var(--muted);
}
.field.role-info .field-hint { color: #8a96a3; font-style: italic; }
.field.role-last .field-hint { color: var(--sea); }
.field.role-due .field-hint { color: var(--navy); }

.confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef7f4;
  border: 1px solid rgba(26,155,142,.22);
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  user-select: none;
}
.confirm-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--sea);
  cursor: pointer;
}
.item.confirmed {
  border-color: rgba(31,138,91,.4);
  background: linear-gradient(180deg, #f2fbf6, #fff);
}
.badge.confirmed {
  background: #e5f7ee;
  color: var(--ok);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: min(920px - 32px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(6,25,45,.16);
  z-index: 30;
}
.nav-btn {
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 10px 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
}
.nav-btn.active {
  background: var(--navy);
  color: #fff;
}

.panel { display: none; animation: rise .35s ease both; }
.panel.active { display: block; }

.settings-block {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.settings-block h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  color: var(--navy);
}
.settings-block p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .9rem;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-of-type { border-top: 0; }
.toggle {
  appearance: none;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #c9d4de;
  position: relative;
  cursor: pointer;
  border: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.toggle.on { background: var(--sea); }
.toggle.on::after { transform: translateX(18px); }

.section-toggles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px 6px; }
  .stat .n { font-size: 1.2rem; }
  .brand-icon { width: 56px; height: 56px; }
}
