.sync-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.sync-block b,
.sync-block small {
  display: block;
}
.sync-block small {
  color: var(--muted);
  margin-top: 5px;
}
.support-block {
  align-items: flex-start;
}
.support-content {
  min-width: 0;
}
.support-content p {
  color: var(--muted);
  margin: 5px 0 0;
}
.support-content p + p {
  margin-top: 3px;
}
.sync-block button,
.sync-block .download {
  padding: 11px 15px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  font-weight: 700;
}
.sync-block .download {
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}
.sync-block .download:hover {
  border-color: var(--blue);
  background: #f2fbfa;
}
.legacy-download { display: none; }
.platform-downloads {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.platform-downloads .download {
  display: grid;
  place-items: center;
  min-width: 92px;
  gap: 2px;
  padding: 8px 13px;
  text-align: center;
  line-height: 1.1;
}
.platform-downloads .download small {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.backup-actions {
  display: flex;
  gap: 8px;
}
.restore-json {
  display: block !important;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.restore-json input {
  display: none;
}
@media (max-width: 600px) {
  .seabirds-downloads {
    align-items: flex-start;
    gap: 14px;
  }
  .seabirds-downloads > span,
  .platform-downloads {
    width: 100%;
  }
  .platform-downloads .download { flex: 1; }
  .backup-block {
    align-items: flex-start;
    gap: 14px;
  }
  .backup-actions {
    width: 100%;
  }
  .backup-actions button,
  .restore-json {
    flex: 1;
    text-align: center;
  }
}
.status-card {
  align-items: center;
}
.status-card > div {
  flex: 1;
  min-width: 0;
}
.status-card > #downloadDeviceDives {
  margin-left: auto;
  white-space: nowrap;
  flex: none;
}
.error-dialog {
  max-width: 520px;
}
.error-dialog form {
  padding: 34px;
}
.error-dialog h2 {
  padding-right: 30px;
  margin-bottom: 12px;
}
.error-dialog-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.error-dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.error-dialog-actions .primary {
  min-width: 100px;
  padding: 11px 20px;
  border: 0;
}
@media (max-width: 600px) {
  .status-card {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    align-items: start;
    padding: 17px;
    gap: 10px;
  }
  .status-card > i {
    grid-column: 1;
  }
  .status-card > div {
    grid-column: 2;
  }
  .status-card > .sync-time,
  .status-card > #downloadDeviceDives {
    grid-column: 1/-1;
    width: 100%;
    margin: 4px 0 0;
  }
  .status-card > .sync-time {
    justify-content: flex-start;
    padding: 9px 2px;
  }
  .status-card > #downloadDeviceDives {
    min-height: 48px;
  }
  .download-dives-dialog {
    width: calc(100% - 18px);
    max-height: calc(100dvh - 18px);
  }
  .download-dives-dialog form {
    padding: 26px 14px 16px;
  }
  .download-dives-dialog h2 {
    font-size: 26px;
    padding-right: 30px;
    margin-bottom: 18px;
  }
  .download-summary {
    font-size: 12px;
    line-height: 1.45;
  }
  .device-dive-choices {
    max-height: 48dvh;
  }
  .device-dive-choice {
    grid-template-columns: 22px minmax(0, 1fr);
    padding: 10px 9px;
    gap: 7px;
  }
  .device-dive-choice em {
    grid-column: 2;
    justify-self: start;
  }
  .download-select-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .download-select-actions button {
    padding: 8px 4px;
    font-size: 10px;
  }
  .download-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .download-dialog-actions button {
    min-height: 44px;
    padding: 9px 7px;
  }
  .error-dialog {
    width: calc(100% - 28px);
  }
  .error-dialog form {
    padding: 30px 22px 22px;
  }
  .error-dialog h2 {
    font-size: 27px;
  }
  .error-dialog-actions .primary {
    width: 100%;
    min-height: 46px;
  }
}
.profile-dialog {
  max-width: 980px;
  max-height: 94vh;
  overflow: auto;
}
.profile-wrap {
  position: relative;
  width: 100%;
}
.profile-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 900/420;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f7f5;
}
.profile-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
.profile-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: rgb(8 39 50 / 75%);
  color: white;
  border: 1px solid rgb(119 214 204 / 75%);
  border-radius: 7px;
  padding: 10px 12px;
  font:
    12px/1.45 ui-monospace,
    monospace;
  z-index: 2;
  white-space: nowrap;
  min-width: 165px;
  box-shadow: 0 8px 24px #00182055;
  backdrop-filter: blur(3px);
}
.status-card > #downloadDeviceDives {
  margin-left: auto;
  white-space: nowrap;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.profile-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 11px;
}
.profile-stats b {
  display: block;
  color: var(--ink);
  font: 700 15px var(--sans);
  margin-bottom: 2px;
}
@media (max-width: 700px) {
  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Compact logbook cards: one dive-number cell and one two-line summary. */
.dive-row {
  grid-template-columns: 70px minmax(0, 1fr) 30px;
  align-items: center;
}
.dive-summary {
  min-width: 0;
  padding: 0 22px;
}
.dive-summary .dive-title-line b {
  display: block;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dive-summary .dive-card-details {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.dive-card-date {
  color: var(--muted);
}
.dive-card-divider {
  color: var(--line);
  font-weight: 700;
}
.dive-summary .dive-card-details em {
  color: var(--blue);
  font-style: normal;
}
@media (max-width: 600px) {
  .dive-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .dive-summary {
    padding: 0 0 0 10px;
  }
  .dive-summary .dive-card-details {
    flex-wrap: wrap;
    gap: 4px 9px;
    margin-top: 4px;
    font-size: 10px;
    white-space: normal;
  }
  .dive-card-date {
    flex-basis: 100%;
    white-space: nowrap;
  }
  .dive-card-divider {
    display: none;
  }
  .dive-row-arrow {
    display: none;
  }
}
.temperature-profile {
  display: none;
}
.telemetry-notice {
  margin: 10px 0;
  padding: 11px 13px;
  border: 1px solid #e3aa45;
  border-radius: 8px;
  background: #fff8e8;
  color: #75500e;
  font-size: 12px;
}
.telemetry-notice b {
  display: block;
  margin-bottom: 2px;
}
.brand-mark {
  overflow: hidden;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dive-tabs {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 8px 0 14px;
  overflow: visible;
}
.dive-tabs button {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 54px;
  border: 0;
  border-radius: 9px 9px 0 0;
  background: transparent;
  padding: 9px;
  color: var(--muted);
  cursor: pointer;
}
.dive-tabs button img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.dive-tabs button.active {
  background: #e7f3f1;
  color: var(--ink);
  box-shadow: inset 0 -2px var(--blue);
}
.dive-tabs button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.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;
}
.dive-panel {
  display: none;
  min-height: 420px;
}
.dive-panel.active {
  display: block;
}
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.edit-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.edit-grid input,
.edit-grid textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
.edit-grid .wide {
  grid-column: 1/-1;
}
.panel-help {
  color: var(--muted);
  margin-bottom: 14px;
}
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.gear-category {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
}
.gear-category h3 {
  font-size: 14px;
  margin: 0 0 9px;
}
.gear-category label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
}
.information-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.info-section-title {
  grid-column: 1/-1;
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--ink);
}
.info-section-title:first-child {
  margin-top: 0;
}
.info-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--muted);
  font-size: 11px;
}
.info-cell b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 3px;
}
.dive-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
@media (hover: hover) {
  .dive-tabs button::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 7px);
    transform: translateX(-50%) translateY(-3px);
    z-index: 20;
    padding: 6px 9px;
    border-radius: 6px;
    background: #082732;
    color: white;
    font: 12px var(--sans);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: 0.15s;
  }
  .dive-tabs button:hover::after,
  .dive-tabs button:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}
@media (max-width: 760px) {
  .equipment-grid,
  .information-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .edit-grid {
    grid-template-columns: 1fr;
  }
  .edit-grid .wide {
    grid-column: auto;
  }
  .dive-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 3px;
    overflow: hidden;
  }
  .dive-tabs button {
    height: 50px;
  }
  .dive-tabs button img {
    width: 28px;
    height: 28px;
  }
}

/* Eight welcome statistics retain the original compact banner footprint. */
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.stats article {
  min-width: 0;
  padding: 8px 26px;
}
.stats article:nth-child(4n) {
  border-right: 0;
}
.stats article:nth-child(-n + 4) {
  border-bottom: 1px solid var(--line);
}
.stats strong {
  font-size: 25px;
}
.stats .stat-computers strong {
  overflow: hidden;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
}
@media (max-width: 850px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
  .stats article:nth-child(2n) {
    border-right: 0;
  }
  .stats article:nth-child(-n + 6) {
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 600px) {
  .stats article {
    padding: 9px 12px;
  }
  .stats strong {
    font-size: 21px;
  }
  .stats .stat-computers strong {
    font-size: 12px;
  }
}

/* Shared primary and destructive actions. Icon-only edit/remove controls keep
   their intentional compact card-specific treatment. */
button.save-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 15px !important;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
button.delete-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 6px !important;
  border: 1px solid #efc4bc;
  border-radius: 8px;
  background: #fff5f3;
  color: #b8432d;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}
button.delete-action:hover {
  border-color: #e59c90;
  background: #fff0ec;
}

/* The welcome summary is compactly disclosed on phones. */
.mobile-stats-collapse {
  display: contents;
}
.mobile-stats-collapse > summary {
  display: none;
}
@media (min-width: 601px) {
  /* Keep the summary expanded on larger screens without exposing a control. */
  .mobile-stats-collapse:not([open]) > .stats {
    display: grid !important;
  }
}
@media (max-width: 600px) {
  .mobile-stats-collapse {
    display: block;
    margin: 0 0 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fdffff;
  }
  .mobile-stats-collapse > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 13px;
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    list-style: none;
  }
  .mobile-stats-collapse > summary::-webkit-details-marker {
    display: none;
  }
  .mobile-stats-collapse > summary::after {
    content: "+";
    color: var(--blue);
    font-size: 18px;
    font-weight: 400;
  }
  .mobile-stats-collapse[open] > summary {
    border-bottom: 1px solid var(--line);
  }
  .mobile-stats-collapse[open] > summary::after {
    content: "−";
  }
  .mobile-stats-collapse > .stats {
    margin: 0;
    border: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: none;
  }
  .mobile-stats-collapse:not([open]) > .stats {
    display: none;
  }
}
.sync-time {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.sync-time input {
  accent-color: var(--blue);
}
.equipment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.equipment-heading .panel-help {
  margin: 0;
}
.equipment-heading > button {
  flex: none;
  border: 1px solid var(--coral);
  border-radius: 8px;
  background: var(--coral);
  color: white;
  padding: 9px 13px;
  cursor: pointer;
}
.gear-category {
  padding: 0;
  overflow: hidden;
}
.gear-category header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: #f4f7f5;
}
.gear-category header h3 {
  margin: 0;
}
.gear-category header span {
  display: flex;
  gap: 4px;
}
.gear-category header button,
.gear-item button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.gear-category header .add-gear-to-category {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-size: 20px;
}
.gear-card-items {
  padding: 6px 10px 10px;
}
.gear-card-items:empty {
  display: none;
}
.gear-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  border-bottom: 1px solid #edf1f1;
  font-size: 12px;
}
.gear-item:last-child {
  border-bottom: 0;
}
.gear-item .remove-dive-gear,
.gear-category header .remove-gear-category {
  color: #b8432d;
}
.gear-item .rename-gear,
.gear-category header .rename-gear-category {
  color: var(--blue);
}
@media (max-width: 600px) {
  .sync-time {
    white-space: normal;
  }
  .equipment-heading {
    gap: 8px;
  }
  .equipment-heading .panel-help {
    font-size: 12px;
  }
  .equipment-heading > button {
    padding: 8px 10px;
    white-space: nowrap;
  }
}
.master-gear {
  display: grid;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.master-gear > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.master-gear > header b,
.master-gear > header small {
  display: block;
}
.master-gear > header small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.master-gear button {
  cursor: pointer;
}
.master-gear > header button {
  flex: none;
  padding: 9px 12px;
  border: 1px solid var(--coral);
  border-radius: 8px;
  background: var(--coral);
  color: white;
}
.master-gear-library {
  display: grid;
  gap: 9px;
}
.master-gear-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.master-gear-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  background: #f4f7f5;
  border-bottom: 1px solid var(--line);
}
.master-gear-card h3 {
  margin: 0;
  font-size: 13px;
}
.master-gear-card header span {
  display: flex;
  gap: 4px;
}
.master-gear-card button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--blue);
}
.master-gear-card .remove-master-card,
.master-gear-card .remove-master-item {
  color: #b8432d;
}
.master-gear-card > div {
  padding: 4px 10px;
}
.master-gear-card p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 27px 27px;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 5px 0;
  border-bottom: 1px solid #edf1f1;
  font-size: 12px;
}
.master-gear-card p:last-child {
  border-bottom: 0;
}
.master-gear-card > div > small {
  display: block;
  padding: 8px 0;
  color: var(--muted);
}
#saveMasterGear {
  justify-self: end;
  padding: 10px 14px;
  border: 0;
}
@media (max-width: 600px) {
  .master-gear > header {
    align-items: flex-start;
  }
  .master-gear > header small {
    max-width: 240px;
  }
}
.profile-dialog form {
  position: relative;
  padding-top: 42px;
}
.profile-dialog .dive-actions {
  justify-content: space-between;
}
.profile-dialog #deleteDive {
  position: static;
}
.device-connect {
  display: flex;
  align-items: center;
  gap: 8px;
}
.device-connect select {
  min-width: 190px;
  padding: 10px 34px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
@media (max-width: 650px) {
  .device-connect {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}
.cross-v,
.cross-h {
  display: none;
  position: absolute;
  pointer-events: none;
  background: #167b8a88;
}
.cross-v {
  top: 0;
  bottom: 0;
  width: 1px;
}
.cross-h {
  left: 0;
  right: 0;
  height: 1px;
}
.graph-hint {
  display: block;
  text-align: right;
  color: var(--muted);
  margin-top: 6px;
}
.graph-layer-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 9px 0 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 12px;
}
.graph-layer-controls legend {
  padding: 0;
  color: var(--ink);
  font-weight: 700;
}
.graph-layer-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.graph-layer-controls input {
  accent-color: var(--accent);
}
@media (max-width: 600px) {
  .graph-layer-controls { gap: 10px; font-size: 11px; }
}
.shearwater-logo {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1.65/1;
  align-self: center;
  border-radius: 28px;
  background: #071b25;
  display: grid;
  place-items: center;
  padding: 40px;
  box-shadow:
    inset 0 0 0 8px #17343d,
    inset 0 0 0 9px #31515a;
}
.shearwater-logo img {
  display: block;
  width: 100%;
  height: auto;
}
.legal-notice {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  font-weight: 400;
}
.tooltip-tank {
  width: 12px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 5px;
  color: #e8f7f8;
}
.tooltip-rate {
  display: inline-block;
  font-weight: 900;
  font-size: 15px;
  line-height: 11px;
}
.tooltip-rate.descent {
  color: #38bdf8;
}
.tooltip-rate.ascent {
  color: #4ade80;
}
.tooltip-depth {
  color: #159fc2;
}
.tooltip-temperature {
  color: #596cff;
}
.tooltip-ndl {
  color: #f0564d;
}
.tooltip-gf99 {
  color: #df8d2e;
}
.date-tile.full-date b {
  font:
    600 13px/1.2 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
@media (min-width: 851px) {
  .dive-row {
    grid-template-columns:
      110px minmax(160px, 1fr) repeat(3, minmax(80px, 130px))
      30px;
  }
}
@media (max-width: 850px) {
  .date-tile.full-date b {
    font-size: 10px;
  }
}
.date-tile.full-date small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--muted);
  white-space: nowrap;
}
.dive-number-cell {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 36px;
  border-right: 1px solid var(--line);
  padding-right: 12px;
}
.dive-number-cell small {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.dive-number-cell b {
  font:
    700 20px Georgia,
    serif;
}
@media (min-width: 851px) {
  .dive-row {
    grid-template-columns:
      70px 110px minmax(160px, 1fr) repeat(3, minmax(80px, 130px))
      30px;
  }
}
@media (max-width: 850px) {
  .dive-row {
    grid-template-columns: 48px 70px minmax(0, 1fr);
  }
  .dive-number-cell {
    padding-right: 7px;
  }
  .dive-number-cell b {
    font-size: 17px;
  }
}
.edit-grid select {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
.notes-edit-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
.notes-dive-number {
  grid-column: span 4;
}
.notes-dive-title {
  grid-column: span 8;
}
.notes-dive-date,
.notes-start-time,
.notes-end-time,
.notes-location,
.notes-dive-spot,
.notes-buddy,
.notes-dive-type {
  grid-column: span 3;
}
.notes-dive-mode,
.notes-dive-style,
.notes-gas-used,
.notes-salinity {
  grid-column: span 3;
}
.notes-tags {
  grid-column: 1/-1;
}
@media (max-width: 760px) {
  .notes-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .notes-edit-grid > label,
  .notes-edit-grid > .wide {
    grid-column: 1/-1;
  }
  .notes-edit-grid > .notes-start-time,
  .notes-edit-grid > .notes-end-time,
  .notes-edit-grid > .notes-dive-mode,
  .notes-edit-grid > .notes-dive-style,
  .notes-edit-grid > .notes-gas-used,
  .notes-edit-grid > .notes-salinity {
    grid-column: span 1;
  }
}
.dive-title-line {
  display: grid;
  grid-template-columns: minmax(80px, auto) minmax(0, 1fr) minmax(80px, auto);
  align-items: center;
  gap: 10px;
  width: 100%;
}
.dive-title-line b {
  text-align: center;
}
.dive-title-line em,
.dive-title-line i {
  font-style: normal;
  font-size: 10px;
  color: var(--blue);
  white-space: nowrap;
}
.other-apps {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.other-apps > b {
  font-size: 13px;
}
.app-icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
.app-icon-row a {
  display: flex;
  color: var(--muted);
  opacity: 0.82;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}
.app-icon-row a:hover {
  transform: scale(1.15);
  opacity: 1;
}
.app-icon-row img,
.app-icon-row svg {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 9px;
}
.app-icon-row img {
  border: 1px solid var(--line);
}
.app-icon-row .thingiverse-icon {
  color: #2b5cff;
}
.donate-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid #168bd2;
  border-radius: 22px;
  color: #0874bd;
  text-decoration: none;
  font:
    600 11px ui-monospace,
    monospace;
  letter-spacing: 0.4px;
  transition: 0.2s;
}
.donate-link b {
  font:
    800 12px Inter,
    sans-serif;
  background: #0874bd;
  color: white;
  border-radius: 5px;
  padding: 2px 5px;
}
.donate-link:hover {
  background: #eef8ff;
  transform: translateY(-1px);
}
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stats strong {
  white-space: nowrap;
}
@media (max-width: 850px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.equipment-heading {
  justify-content: flex-end;
  gap: 10px;
}
.equipment-heading .panel-help {
  margin-right: auto;
}
.equipment-heading select {
  min-width: 190px;
  max-width: 280px;
  padding: 8px 32px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
@media (max-width: 600px) {
  .equipment-heading {
    flex-wrap: wrap;
  }
  .equipment-heading select {
    order: 3;
    width: 100%;
    max-width: none;
  }
  .equipment-heading .panel-help {
    flex: 1;
  }
}
@media (max-width: 600px) {
  .equipment-grid {
    grid-template-columns: 1fr;
  }
}
#profileTitle {
  line-height: 1.12;
}
#profileTitle .dive-entry-title,
#profileTitle .dive-entry-meta {
  display: block;
}
#profileTitle .dive-entry-meta {
  margin-top: 7px;
  color: var(--muted);
  font: 600 15px/1.2 var(--sans);
  letter-spacing: 0.1px;
}
@media (max-width: 600px) {
  #profileTitle .dive-entry-meta {
    margin-top: 5px;
    font-size: 14px;
  }
}
.overview-welcome + .stats {
  margin-top: 18px;
}
.story-tagline {
  margin: 0;
}
.story-tagline i {
  color: var(--blue);
  font-family: Georgia, serif;
  font-size: 1.08em;
}
.status-card + .device-card {
  margin-top: 16px;
}
@media (max-width: 600px) {
  #devices .page-head h1 {
    font-size: 34px;
    letter-spacing: -1px;
    white-space: nowrap;
  }
}
#updateBanner {
  position: fixed;
  left: 50%;
  top: max(12px, env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 1000;
  width: min(620px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #62bdb4;
  border-radius: 10px;
  background: #e8f8f5;
  color: var(--ink);
  box-shadow: 0 12px 35px #00182033;
  font-size: 13px;
}
#updateBanner span {
  flex: 1;
}
#updateBanner button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 8px 11px;
  cursor: pointer;
}
#updateBanner .download-update {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
  font-weight: 700;
}
#updateBanner .dismiss-update {
  width: 34px;
  padding: 8px 0;
  color: #b8432d;
}
.download-dives-dialog {
  max-width: 720px;
}
.download-summary {
  margin: -12px 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.download-select-actions {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
}
.download-select-actions button,
.download-dialog-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px 12px;
  cursor: pointer;
}
.device-dive-choices {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.device-dive-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.device-dive-choice:last-child {
  border-bottom: 0;
}
.device-dive-choice:hover {
  background: #f4f7f5;
}
.device-dive-choice input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}
.device-dive-choice b,
.device-dive-choice small {
  display: block;
}
.device-dive-choice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.device-dive-choice em {
  font-style: normal;
  font-size: 10px;
  padding: 4px 7px;
  border-radius: 10px;
  background: #e1f4ee;
  color: #24745f;
}
.device-dive-choice.existing em {
  background: #edf0f1;
  color: #68777c;
}
.device-dive-choice.excluded em {
  background: #fff0ec;
  color: #a84835;
}
.download-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 15px;
}
.download-dialog-actions .primary {
  border-color: var(--coral);
  background: var(--coral);
  color: white;
}
.download-dialog-actions .primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .download-dives-dialog form {
    padding: 28px 18px;
  }
  .device-dive-choice {
    padding: 10px;
  }
  .download-select-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .download-select-actions button {
    padding: 8px 5px;
    font-size: 11px;
  }
}
.toolbar {
  grid-template-columns: minmax(180px, 1fr) 180px 125px 145px;
  margin-bottom: 10px;
}
.device-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 2px 18px;
  color: var(--muted);
  font-size: 12px;
}
.device-filters > span {
  font-weight: 800;
  color: var(--ink);
}
.device-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.device-filters input {
  accent-color: var(--blue);
}
.classification-filter-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0 14px;
  margin-top: -10px;
}
.classification-filter-row .classification-filters {
  margin: 0 0 18px;
}
.classification-divider {
  color: var(--muted);
  font-weight: 700;
  line-height: 18px;
}
@media (max-width: 600px) {
  .device-filters {
    gap: 7px 12px;
  }
  .device-filters > span {
    flex-basis: auto;
  }
  .classification-filter-row {
    gap: 0 10px;
  }
  .classification-filter-row .classification-filters {
    gap: 7px 10px;
  }
  .classification-divider {
    line-height: 18px;
  }
}
.dive-row {
  grid-template-columns: 70px 110px minmax(0, 1fr) 30px;
}
.dive-row .site {
  min-width: 0;
  padding: 0 22px;
}
.dive-row .dive-title-line {
  display: block;
}
.dive-row .dive-title-line b {
  display: block;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dive-card-details {
  display: flex;
  align-items: center;
  gap: 8px 22px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.dive-card-details em {
  font-style: normal;
  color: var(--blue);
}
.dive-row-arrow {
  justify-self: end;
}
@media (max-width: 600px) {
  .classification-filter-row {
    display: block;
    margin-top: -8px;
  }
  .classification-filter-row .classification-filters {
    display: flex;
    margin: 0 2px 8px;
  }
  .classification-divider {
    display: none;
  }
  .dive-row {
    grid-template-columns: 48px 70px minmax(0, 1fr);
    align-items: center;
  }
  .dive-row .date-tile {
    grid-column: 2;
  }
  .dive-row .site {
    grid-column: 3;
    padding: 0 0 0 10px;
  }
  .dive-row .site > small {
    display: none;
  }
  .dive-card-details {
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
  }
  .dive-card-details em {
    display: none;
  }
  .dive-row-arrow {
    display: none;
  }
}
/* Settings equipment-library subpage */
#settingsMain[hidden],
.settings-subpage[hidden] {
  display: none;
}
.settings-subpage,
.settings-subpage-head,
.settings-subpage .settings-card {
  max-width: 900px;
}
.settings-subpage .master-gear {
  padding: 24px 30px;
  border: 1px solid var(--line);
}
.subpage-back {
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .settings-subpage .master-gear {
    padding: 20px 16px;
  }
  .settings-subpage-head .subpage-back {
    width: 100%;
    margin-top: 15px;
  }
  .sync-block {
    gap: 14px;
  }
  .sync-block > span {
    min-width: 0;
  }
}
@media (max-width: 600px) {
  .backup-block {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }
  .backup-block > span,
  .backup-block .backup-actions {
    width: 100%;
  }
  .backup-block .backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .backup-block .backup-actions button,
  .backup-block .restore-json {
    width: 100%;
    min-width: 0;
    display: grid !important;
    place-items: center;
  }
}
.sync-block button,
.sync-block .download,
.restore-json {
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.2;
}
.settings-collapse {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.settings-collapse summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  padding: 2px 0;
  list-style: none;
}
.settings-collapse summary::-webkit-details-marker {
  display: none;
}
.settings-collapse summary:after {
  content: "+";
  float: right;
  color: var(--blue);
  font-size: 18px;
  line-height: 1;
}
.settings-collapse[open] summary:after {
  content: "\2212";
}
.settings-options {
  display: grid;
  gap: 18px;
  padding-top: 20px;
}
.dive-groups-settings {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.dive-groups-settings summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  padding: 2px 0;
  list-style: none;
}
.dive-groups-settings summary::-webkit-details-marker { display: none; }
.dive-groups-settings summary:after {
  content: "+";
  float: right;
  color: var(--blue);
  font-size: 18px;
  line-height: 1;
}
.dive-groups-settings[open] summary:after { content: "\2212"; }
.dive-groups-settings p {
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.dive-groups-library {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
}
.dive-group-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.dive-group-card span { display: grid; gap: 2px; }
.dive-group-card small { color: var(--muted); }
.dive-group-card-actions { display: flex !important; align-items: center; gap: 5px; }
.dive-group-card-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.edit-dive-group { color: var(--blue); }
.remove-dive-group { color: #b8432d; }
.dive-groups-editor-card,
.dive-groups-list-card { margin-top: 18px; }
.dive-groups-list-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dive-groups-list-card header > span {
  display: grid;
  gap: 5px;
}
.dive-groups-list-card header small {
  color: var(--muted);
  line-height: 1.45;
}
.dive-groups-list-card #newDiveGroup {
  flex: none;
  padding: 9px 12px;
  border: 1px solid var(--coral);
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  box-shadow: 0 8px 18px #d45b4528;
  white-space: nowrap;
}
.dive-groups-list-card #newDiveGroup:hover {
  background: #cf513e;
}
.group-editor-dialog {
  width: min(620px, calc(100% - 28px));
}
.group-editor-dialog form {
  padding: 30px;
}
.group-dialog-intro {
  margin: -8px 0 20px;
  color: var(--muted);
  line-height: 1.45;
}
.dive-group-form { margin-top: 18px; }
.dive-group-rule-fields {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dive-group-rule-fields[hidden] { display: none; }
.dive-group-rule-fields label { display: grid; gap: 7px; }
.group-editor-help { margin: 0; color: var(--muted); font-size: 12px; }
.dive-group-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.dive-group-editor-actions .primary { margin-left: auto; }
@media (max-width: 600px) {
  .group-editor-dialog form { padding: 26px 20px; }
  .dive-groups-list-card header {
    align-items: flex-start;
  }
}
.dive-groups-field {
  display: block;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.dive-groups-field legend { padding: 0 4px; font-size: 12px; color: var(--muted); }
.dive-group-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 16px;
}
.dive-groups-field .dive-group-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  cursor: pointer;
}
.dive-groups-field .dive-group-choice input { flex: 0 0 auto; margin: 0; }
.dive-groups-field .dive-group-choice span { display: grid; gap: 1px; min-width: 0; }
.dive-groups-field .dive-group-choice b { font-weight: 650; overflow-wrap: anywhere; }
.dive-groups-field .dive-group-choice.is-automatic { cursor: default; }
.dive-groups-field small { color: var(--muted); }
.dive-group-empty { display: block; }
@media (max-width: 600px) {
  .dive-group-choice-list { grid-template-columns: 1fr; }
}
.settings-options label {
  width: 100%;
}
@media (max-width: 600px) {
  .gear-library-block {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }
  .gear-library-block > span {
    width: 100%;
  }
  .gear-library-block > button {
    justify-self: start;
  }
  .sync-block button,
  .sync-block .download,
  .restore-json {
    padding: 9px 12px;
    font-size: 12px;
  }
  .backup-block .backup-actions {
    max-width: 290px;
  }
  .dive-group-rule-fields {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
  .dive-group-editor-actions button {
    min-width: 0;
  }
}
.date-filter-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0 14px;
  margin-top: -10px;
}
.date-filter-row .classification-filters {
  margin: 0 0 18px;
}
.dive-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.dive-pagination button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
  color: var(--blue);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
.dive-pagination button:hover:not(:disabled) {
  border-color: #79bec2;
  background: #ecf9f7;
}
.dive-pagination button:disabled {
  opacity: 0.45;
  cursor: default;
}
.logbook-page-size label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.logbook-page-size select {
  min-width: 86px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
  color: var(--ink);
}
@media (max-width: 600px) {
  .date-filter-row {
    display: block;
    margin-top: -8px;
  }
  .date-filter-row .classification-filters {
    display: flex;
    margin: 0 2px 8px;
  }
  .date-filter-row .classification-divider {
    display: none;
  }
  .dive-pagination {
    gap: 10px;
    margin-top: 18px;
  }
  .dive-pagination span {
    font-size: 11px;
  }
  .logbook-page-size {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }
  .logbook-page-size > span,
  .logbook-page-size label {
    width: 100%;
  }
  .logbook-page-size label {
    grid-template-columns: 1fr 110px;
  }
}
.choice-dialog {
  max-width: 520px;
}
.add-dive-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.add-dive-options button {
  min-height: 125px;
  padding: 22px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: 0.2s;
}
.add-dive-options button:hover,
.add-dive-options button:focus-visible {
  border-color: var(--blue);
  background: #f2fbfa;
  box-shadow: 0 10px 25px #052d3914;
}
.add-dive-options b,
.add-dive-options small {
  display: block;
}
.add-dive-options b {
  font:
    22px Georgia,
    serif;
}
.add-dive-options small {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.45;
}
@media (max-width: 500px) {
  .add-dive-options {
    grid-template-columns: 1fr;
  }
  .add-dive-options button {
    min-height: 96px;
  }
}
@media (max-width: 600px) {
  .settings-subpage-head {
    margin-bottom: 18px;
  }
  .settings-subpage-head h1 {
    font-size: 30px;
    line-height: 1.06;
    letter-spacing: -1px;
    margin-bottom: 10px;
  }
  .settings-subpage-head p {
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
  }
  .settings-subpage-head .eyebrow {
    font-size: 9px;
    margin-bottom: 8px;
  }
}
.choice-dialog .close {
  font-size: 0;
}
.choice-dialog .close:before {
  content: "\00d7";
  font-size: 28px;
}
@media (max-width: 850px) {
  #dives .page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }
  #dives .page-head > div:first-child {
    min-width: 0;
  }
  #dives .page-head .actions {
    flex: none;
    margin: 0;
  }
  #dives #addDive {
    white-space: nowrap;
  }
  #dives .page-head h1 {
    font-size: clamp(34px, 11vw, 46px);
    margin-bottom: 8px;
  }
  #dives .story-tagline {
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
  }
}
.dive-tabs {
  display: flex;
  grid-template-columns: none;
}
.dive-tabs > [data-dive-tab] {
  flex: 0 1 64px;
}
.dive-tabs .dive-export-trigger {
  flex: 0 0 58px;
  margin-left: auto;
  border: 0;
  border-radius: 9px 9px 0 0;
}
.dive-tabs .dive-export-trigger img {
  width: 29px;
  height: 29px;
}
.dive-export-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dive-export-options button {
  min-height: 130px;
  padding: 20px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.dive-export-options button:hover,
.dive-export-options button:focus-visible {
  border-color: var(--blue);
  background: #f2fbfa;
}
.dive-export-options b,
.dive-export-options small {
  display: block;
}
.dive-export-options b {
  font:
    20px Georgia,
    serif;
}
.dive-export-options small {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.4;
}
.dive-export-dialog {
  max-width: 720px;
}
@media (max-width: 600px) {
  .dive-tabs > [data-dive-tab] {
    flex: 1 1 0;
  }
  .dive-tabs .dive-export-trigger {
    flex: 0 0 50px;
  }
  .dive-export-options {
    grid-template-columns: 1fr;
  }
  .dive-export-options button {
    min-height: 82px;
    padding: 16px;
  }
}

/* Ocean visual system and responsive density pass.  The app retains the same
   controls and structure; these rules only refine presentation. */
:root {
  --ink: #062d3d;
  --muted: #59727b;
  --line: #cfe2e4;
  --paper: #f1f8f8;
  --white: #fff;
  --aqua: #66d4cc;
  --blue: #087f96;
  --deep: #04323f;
  --coral: #e8735d;
  --shadow: 0 16px 42px #0a536014;
}
body {
  background:
    radial-gradient(circle at 83% 7%, #d9f3ef 0, transparent 25rem),
    linear-gradient(140deg, #f7fbfa 0%, var(--paper) 58%, #e7f4f3 100%);
}
.sidebar {
  background: linear-gradient(180deg, #04333f 0%, #062c3a 54%, #032832 100%);
  box-shadow: inset -1px 0 #75d4cc28;
}
.brand-mark {
  border-color: #78c9ca;
  background: #0d4654;
  box-shadow: 0 0 0 4px #86ddd116;
}
.nav {
  color: #b7d0d1;
}
.nav.active,
.nav:hover {
  background: linear-gradient(90deg, #176776, #13515f);
  box-shadow: inset 3px 0 var(--aqua);
}
.nav em {
  background: #1d6571;
}
.offline {
  border-color: #39717a;
}
.topbar {
  background: #f8fcfbdf;
  border-bottom-color: #d4e6e7;
}
.topbar,
.sidebar {
  backdrop-filter: blur(14px);
}
.page-head {
  margin-bottom: 22px;
}
.page-head h1 {
  letter-spacing: -1.5px;
}
.page-head p {
  max-width: 640px;
}
.eyebrow {
  color: #087b91;
}
.story-tagline {
  color: #456b74;
}
.story-tagline i {
  color: #0c8ba1;
}
.stats,
.device-card,
.settings-card,
.status-card,
.dive-row,
.choice-dialog,
.profile-dialog {
  border-color: #cde0e2;
  box-shadow: 0 14px 36px #0a53600f;
}
.stats {
  background: linear-gradient(135deg, #fff, #f8fdfc);
  box-shadow: 0 16px 40px #0b566015;
}
.stats article {
  border-color: #d8e8e9;
}
.stats strong {
  color: #063544;
}
.stats small {
  color: #789197;
}
.dive-row {
  background: #fcffff;
}
.dive-row:hover {
  border-color: #91cfd0;
  box-shadow: 0 12px 28px #0c758615;
  transform: translateY(-1px);
}
.empty {
  background: #f9fdfc;
  border-color: #a8cccf;
}
.toolbar > input,
.toolbar select,
.settings-card select,
.device-connect select,
.edit-grid input,
.edit-grid textarea,
.form-grid input,
.form-grid textarea {
  border-color: #c8dcdf;
  background: #fdffff;
}
.toolbar > input:focus,
.toolbar select:focus,
.settings-card select:focus,
.device-connect select:focus,
.edit-grid input:focus,
.edit-grid textarea:focus,
.form-grid input:focus,
.form-grid textarea:focus {
  outline: 3px solid #64d4cf35;
  border-color: #2f9fa5;
}
.primary,
.actions .primary,
.equipment-heading > button,
.master-gear > header button {
  background: linear-gradient(135deg, #e97860, #df654f);
  box-shadow: 0 8px 18px #d45b4528;
}
.primary:hover,
.actions .primary:hover,
.equipment-heading > button:hover,
.master-gear > header button:hover {
  background: linear-gradient(135deg, #e56851, #cf513e);
}
.save-dive {
  background: linear-gradient(135deg, #238a68, #167654) !important;
  box-shadow: 0 8px 18px #16765428 !important;
}
.save-dive:hover {
  background: linear-gradient(135deg, #1d7b5d, #106546) !important;
}
.actions button,
.import,
.sync-block button,
.sync-block .download,
.restore-json,
.subpage-back,
.download-select-actions button,
.download-dialog-actions button {
  border-color: #c8dcdf;
  background: #fbfefd;
  color: #075e73;
}
.actions button:hover,
.import:hover,
.sync-block button:hover,
.sync-block .download:hover,
.restore-json:hover,
.subpage-back:hover,
.download-select-actions button:hover,
.download-dialog-actions button:hover {
  border-color: #79bec2;
  background: #ecf9f7;
}
.badge {
  background: #d8f5ef;
  color: #187267;
}
.shearwater-logo {
  background: linear-gradient(145deg, #063540, #042a35);
  box-shadow:
    inset 0 0 0 8px #0d4a58,
    inset 0 0 0 9px #3b8390,
    0 12px 25px #07394422;
}
.device-card {
  background: linear-gradient(135deg, #ffffff, #f6fcfb);
}
.device-card li::marker {
  color: #24a7ae;
}
.status-card {
  background: #fcffff;
}
.status-card.connected {
  border-color: #8fd7c9;
}
.settings-card {
  background: linear-gradient(145deg, #fff, #faffff);
}
.dive-tabs button.active {
  background: #e2f5f1;
  box-shadow: inset 0 -3px #07899c;
}
.gear-category header,
.master-gear-card > header {
  background: #eff8f7;
}
.info-cell,
.profile-stats span {
  background: #fbfefd;
  border-color: #cfe2e4;
}
.dive-export-options button,
.add-dive-options button {
  background: #fbfefd;
  border-color: #cde0e2;
}
.dive-export-options button:hover,
.add-dive-options button:hover {
  background: #eaf8f6;
  border-color: #71bfc3;
}

@media (max-width: 850px) {
  .topbar {
    height: 64px;
  }
  .view {
    padding: 27px 18px 54px;
  }
  .page-head {
    margin-bottom: 18px;
  }
  .page-head h1 {
    font-size: clamp(32px, 9.6vw, 40px);
    line-height: 1.05;
    margin-bottom: 10px;
  }
  .page-head p {
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 8px;
  }
  .section-head {
    margin-bottom: 16px;
  }
  .section-head h2 {
    font-size: 27px;
  }
  .stats {
    margin: 18px 0 40px;
  }
  .stats article {
    padding: 16px 17px;
  }
  .stats strong {
    font-size: 28px;
  }
  .empty {
    padding: 42px 16px;
  }
  .empty b {
    font-size: 22px;
  }
  .device-card {
    gap: 22px;
    padding: 20px;
    border-radius: 14px;
  }
  .shearwater-logo {
    max-width: 100%;
    padding: 27px;
    border-radius: 22px;
  }
  .device-card h2 {
    font-size: 28px;
    margin: 11px 0 7px;
  }
  .device-card ul {
    margin: 10px 0 0;
    padding-left: 22px;
  }
  .device-card li {
    line-height: 1.45;
  }
  .status-card {
    margin-top: 12px;
  }
  .device-connect {
    gap: 9px;
  }
  .device-connect select,
  .device-connect .connect {
    min-height: 44px;
  }
  .settings-card {
    padding: 20px;
    gap: 18px;
  }
  .choice-dialog {
    width: calc(100% - 24px);
  }
  dialog form {
    padding: 26px 20px;
  }
  .choice-dialog h2 {
    font-size: 29px;
    margin-bottom: 18px;
  }
  .add-dive-options {
    gap: 10px;
  }
  .add-dive-options button {
    min-height: 88px;
    padding: 16px;
  }
  .add-dive-options b {
    font-size: 20px;
  }
  .profile-dialog {
    width: calc(100% - 14px);
    max-height: 96dvh;
  }
  .profile-dialog form {
    padding: 37px 18px 20px;
  }
  .dive-tabs {
    margin-bottom: 10px;
  }
  .dive-panel {
    min-height: 0;
  }
  .dive-actions {
    margin-top: 12px;
    padding-top: 12px;
  }
}
@media (max-width: 600px) {
  .view {
    padding: 24px 16px 46px;
  }
  .topbar {
    padding: 0 16px;
  }
  .menu {
    margin-right: 12px;
  }
  .crumb {
    font-size: 11px;
  }
  .overview-welcome + .stats {
    margin-top: 14px;
  }
  .stats {
    border-radius: 13px;
    margin-bottom: 34px;
  }
  .stats article {
    padding: 14px 15px;
  }
  .stats span {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .stats strong {
    font-size: 26px;
  }
  .stats small {
    font-size: 9px;
  }
  .section-head h2 {
    font-size: 26px;
  }
  .text-btn {
    font-size: 12px;
  }
  .toolbar {
    gap: 8px;
    margin-bottom: 12px;
  }
  .toolbar > input,
  .toolbar select {
    min-height: 44px;
    padding: 11px;
  }
  .device-filters {
    font-size: 11px;
    margin-bottom: 12px;
  }
  .classification-filter-row .classification-filters {
    margin-bottom: 7px;
  }
  .status-card {
    border-radius: 13px;
  }
  .device-card {
    padding: 17px;
  }
  .shearwater-logo {
    padding: 21px;
    border-radius: 19px;
  }
  .device-card h2 {
    font-size: 27px;
  }
  .settings-card {
    padding: 18px;
    border-radius: 13px;
  }
  .sync-block {
    padding-bottom: 16px;
  }
  .sync-block button,
  .sync-block .download,
  .restore-json,
  .backup-block .backup-actions button {
    min-height: 40px;
  }
  .settings-collapse {
    padding-bottom: 14px;
  }
  .settings-options {
    gap: 13px;
    padding-top: 15px;
  }
  .settings-options label {
    font-size: 12px;
  }
  .choice-dialog {
    width: calc(100% - 20px);
    border-radius: 14px;
  }
  .choice-dialog form {
    padding: 25px 18px 18px;
  }
  .choice-dialog h2 {
    font-size: 28px;
  }
  .dive-export-options {
    gap: 9px;
  }
  .dive-export-options button {
    min-height: 74px;
    padding: 14px;
  }
  .dive-export-options b {
    font-size: 18px;
  }
  .dive-tabs button {
    height: 46px;
  }
  .dive-tabs button img {
    width: 25px;
    height: 25px;
  }
  .dive-tabs .dive-export-trigger {
    flex-basis: 46px;
  }
  .profile-stats {
    gap: 6px;
    margin: 8px 0 10px;
  }
  .profile-stats span {
    padding: 7px 8px;
    font-size: 10px;
  }
  .profile-stats b {
    font-size: 14px;
  }
  .equipment-heading {
    margin-bottom: 9px;
  }
  .equipment-heading > button {
    min-height: 38px;
  }
  .gear-category header {
    padding: 9px 10px;
  }
  .gear-item {
    padding: 5px 0;
  }
  .dive-actions .primary {
    min-height: 38px;
    padding: 8px 12px;
  }
}
@media (max-width: 700px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .toolbar > input {
    grid-column: 1/-1;
  }
}
.toolbar {
  grid-template-columns: minmax(0, 1fr);
}
.filter-dropdown {
  position: relative;
  min-width: 0;
}
.filter-dropdown summary {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #c8dcdf;
  border-radius: 9px;
  background: #fdffff;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}
.filter-dropdown summary::-webkit-details-marker {
  display: none;
}
.filter-dropdown summary:after {
  content: "⌄";
  color: var(--muted);
  font-size: 15px;
}
.filter-dropdown summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.filter-dropdown[open] summary {
  border-color: #2f9fa5;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.dropdown-filter-options {
  position: absolute;
  z-index: 12;
  top: 43px;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-height: 260px;
  overflow: auto;
  padding: 9px 12px;
  border: 1px solid #2f9fa5;
  border-radius: 0 0 9px 9px;
  background: #fdffff;
  box-shadow: 0 14px 28px #0b566024;
}
.dropdown-filter-options > span {
  display: none;
}
.dropdown-filter-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  white-space: nowrap;
}
.dropdown-filter-options input[type="checkbox"] {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}
.sort-filters {
  margin-bottom: 10px;
}
@media (max-width: 700px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .toolbar > input {
    grid-column: 1/-1;
  }
  .filter-dropdown summary {
    height: 42px;
  }
  .sort-filters {
    margin-bottom: 9px;
  }
}

/* Optional logbook filters stay available without permanently taking page space. */
.logbook-filter-collapse {
  margin: 0 2px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fdffff;
}
.logbook-filter-collapse summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 13px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}
.logbook-filter-collapse summary::-webkit-details-marker {
  display: none;
}
.logbook-filter-collapse summary::after {
  content: "+";
  color: var(--blue);
  font-size: 18px;
  font-weight: 400;
}
.logbook-filter-collapse[open] summary {
  border-bottom: 1px solid var(--line);
}
.logbook-filter-collapse[open] summary::after {
  content: "−";
}
.logbook-filter-options {
  padding: 12px 13px 2px;
}
.filter-dropdown-row {
  display: grid;
  grid-template-columns: 150px 160px 160px 160px;
  gap: 10px;
  margin: 0 0 13px;
}
.logbook-filter-options .device-filters {
  margin: 0 0 12px;
}
.logbook-filter-options .classification-filter-row {
  margin-top: 0;
}
/* Override the earlier card-grid rules after all legacy selectors. */
.dive-row {
  grid-template-columns: 70px minmax(0, 1fr) 30px;
}
.dive-summary {
  min-width: 0;
  padding: 0 22px;
}
.dive-summary .dive-card-details {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  margin-top: 5px;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .logbook-filter-collapse {
    margin-bottom: 12px;
  }
  .logbook-filter-options {
    padding: 11px 12px 1px;
  }
  .filter-dropdown-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 11px;
  }
  .dive-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .dive-summary {
    padding: 0 0 0 10px;
  }
  .dive-summary .dive-card-details {
    flex-wrap: wrap;
    gap: 4px 9px;
    margin-top: 4px;
    font-size: 10px;
    white-space: normal;
  }
  .dive-card-date {
    flex-basis: 100%;
    white-space: nowrap;
  }
  .dive-card-divider,
  .dive-row-arrow {
    display: none;
  }
}

/* Dive-entry header and Notes field order. */
.profile-dialog form {
  padding-top: 28px;
}
.dive-entry-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.dive-entry-header #profileTitle {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.dive-entry-header #deleteDive {
  position: static;
  flex: 0 0 auto;
  margin-top: 2px;
}
#profileTitle .dive-entry-primary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
#profileTitle .dive-entry-number {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 0.6em;
}
#profileTitle .dive-entry-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-dive-number {
  grid-column: span 2;
  max-width: 150px;
}
.notes-dive-title {
  grid-column: span 10;
}
.notes-dive-date,
.notes-start-time,
.notes-end-time,
.notes-dive-type {
  grid-column: span 3;
}
.notes-location,
.notes-dive-spot,
.notes-buddy {
  grid-column: span 4;
}
.notes-dive-mode,
.notes-dive-style,
.notes-gas-used,
.notes-salinity {
  grid-column: span 3;
}
@media (max-width: 760px) {
  .dive-entry-header {
    gap: 10px;
    margin-bottom: 14px;
  }
  #profileTitle .dive-entry-primary {
    gap: 7px;
  }
  #profileTitle .dive-entry-number {
    font-size: 0.56em;
  }
  .notes-edit-grid > .notes-dive-number,
  .notes-edit-grid > .notes-dive-title,
  .notes-edit-grid > .notes-start-time,
  .notes-edit-grid > .notes-end-time,
  .notes-edit-grid > .notes-dive-mode,
  .notes-edit-grid > .notes-dive-style,
  .notes-edit-grid > .notes-gas-used,
  .notes-edit-grid > .notes-salinity {
    grid-column: span 1;
  }
  .notes-edit-grid > .notes-dive-date,
  .notes-edit-grid > .notes-dive-type,
  .notes-edit-grid > .notes-location,
  .notes-edit-grid > .notes-dive-spot,
  .notes-edit-grid > .notes-buddy,
  .notes-edit-grid > .notes-tags,
  .notes-edit-grid > .wide {
    grid-column: 1/-1;
  }
}

/* Final overrides for the two-row welcome statistics. */
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.stats article {
  min-width: 0;
  padding: 8px 26px;
}
.stats article:nth-child(4n) {
  border-right: 0;
}
.stats article:nth-child(-n + 4) {
  border-bottom: 1px solid var(--line);
}
.stats strong {
  font-size: 25px;
}
.stats .stat-computers strong {
  overflow: hidden;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
}
@media (max-width: 850px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
  .stats article:nth-child(2n) {
    border-right: 0;
  }
  .stats article:nth-child(-n + 6) {
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 600px) {
  .stats article {
    padding: 9px 12px;
  }
  .stats strong {
    font-size: 21px;
  }
  .stats .stat-computers strong {
    font-size: 12px;
  }
}
