:root {
  --teal: #005b70;
  --blue: #13578b;
  --aqua: #5dd6e4;
  --ink: #0a2230;
  --muted: #638091;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(0, 91, 112, 0.14);
  --shadow: 0 24px 70px rgba(2, 36, 54, 0.22);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(93, 214, 228, 0.30), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(19, 87, 139, 0.24), transparent 32%),
    linear-gradient(155deg, #eaf9fb 0%, #f7fbfc 42%, #dfeff3 100%);
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: min(760px, calc(100vh - 36px));
  display: grid;
  align-items: stretch;
}

.hero-card,
.login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 34px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  backdrop-filter: blur(18px);
}

.hero-card::after,
.login-card::after {
  content: "";
  position: absolute;
  inset: auto 20px 18px 20px;
  height: 120px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(0, 91, 112, 0.08), rgba(19, 87, 139, 0.04));
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.65;
}

.glow-a { width: 170px; height: 170px; background: rgba(93, 214, 228, 0.40); top: -70px; right: -62px; }
.glow-b { width: 120px; height: 120px; background: rgba(19, 87, 139, 0.18); bottom: 110px; left: -50px; }

.top-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(0, 91, 112, 0.08);
  padding: 9px 12px;
  border-radius: 999px;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #24c48e;
  box-shadow: 0 0 0 5px rgba(36, 196, 142, 0.16);
}

.year { color: var(--blue); font-weight: 800; font-size: 13px; }

.logo-wrap {
  position: relative;
  z-index: 1;
  width: 190px;
  height: 150px;
  margin: 54px auto 34px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  background: white;
  box-shadow: 0 18px 45px rgba(0, 91, 112, 0.16);
}

.logo-wrap img,
.mini-logo img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.copy { position: relative; z-index: 1; text-align: center; }
.eyebrow { margin: 0 0 10px; color: var(--blue); text-transform: uppercase; font-size: 12px; font-weight: 900; letter-spacing: .13em; }
h1, h2 { margin: 0; line-height: 1.02; letter-spacing: -0.055em; color: #083040; }
h1 { font-size: clamp(34px, 10vw, 48px); }
h2 { font-size: 32px; }
.subtitle, .login-heading p { color: var(--muted); line-height: 1.6; font-size: 15px; }
.subtitle { margin: 16px auto 0; max-width: 320px; }

.primary-btn {
  position: relative;
  z-index: 1;
  border: 0;
  min-height: 58px;
  border-radius: 19px;
  margin-top: 32px;
  padding: 0 20px;
  color: white;
  font-size: 16px;
  font-weight: 850;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 18px 36px rgba(0, 91, 112, 0.30);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  width: 100%;
}

.primary-btn:active { transform: translateY(2px) scale(.99); box-shadow: 0 10px 24px rgba(0, 91, 112, 0.26); }
.primary-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.quick-benefits {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-benefits div {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  border-radius: 18px;
  padding: 12px 8px;
  text-align: center;
}

.quick-benefits strong { display: block; color: var(--teal); font-size: 13px; }
.quick-benefits span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 5px; line-height: 1.25; }

.hidden { display: none; }
.login-card { animation: rise .26s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.back-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  border: 1px solid rgba(0, 91, 112, 0.22);
  background: white;
  color: #004a5d;
  font-size: 22px;
  font-weight: 900;
}

.mini-logo {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 98px;
  margin: 24px auto 20px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: white;
  box-shadow: 0 12px 32px rgba(0, 91, 112, 0.12);
}

.login-heading { position: relative; z-index: 1; text-align: center; }
.login-heading p:last-child { margin: 12px 0 0; }

.login-table {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  display: grid;
  gap: 13px;
}

label span {
  display: block;
  margin: 0 0 8px 4px;
  color: #27566a;
  font-size: 13px;
  font-weight: 800;
}

input, select {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(0, 91, 112, 0.18);
  border-radius: 17px;
  background: rgba(255,255,255,.88);
  padding: 0 15px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

input:focus, select:focus {
  border-color: rgba(0, 91, 112, 0.55);
  box-shadow: 0 0 0 4px rgba(93, 214, 228, 0.20);
}

.login-submit { margin-top: 8px; }
.demo-note { position: relative; z-index: 1; color: #335f72; font-size: 12.5px; line-height: 1.45; text-align: center; margin: 18px 0 0; background: rgba(255,255,255,.68); border: 1px solid rgba(0,91,112,.10); border-radius: 14px; padding: 10px 12px; }

@media (max-height: 700px) {
  body { padding: 10px; }
  .phone-shell { min-height: calc(100vh - 20px); }
  .hero-card, .login-card { border-radius: 26px; padding: 18px; }
  .logo-wrap { margin: 30px auto 22px; width: 165px; height: 126px; }
  .quick-benefits { padding-top: 20px; }
}

.logbook-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 34px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  backdrop-filter: blur(18px);
  animation: rise .26s ease both;
}

.app-header {
  display: grid;
  grid-template-columns: 44px 1fr 64px;
  align-items: center;
  gap: 12px;
}

.app-header h2 { font-size: 29px; }
.app-header .eyebrow { margin-bottom: 5px; }
.app-header img {
  width: 64px;
  height: 48px;
  object-fit: contain;
  border-radius: 14px;
  background: white;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(0, 91, 112, .10);
  mix-blend-mode: multiply;
}

.back-btn.inline {
  position: static;
  width: 42px;
  height: 42px;
}

.officer-panel {
  margin: 22px 0 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.officer-panel div {
  border: 1px solid rgba(0,91,112,.12);
  border-radius: 17px;
  background: rgba(255,255,255,.76);
  padding: 12px;
  min-height: 68px;
}

.officer-panel span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
}

.officer-panel strong {
  display: block;
  color: #073142;
  font-size: 14px;
  line-height: 1.25;
}

.entry-form {
  display: grid;
  gap: 13px;
}

textarea {
  width: 100%;
  border: 1px solid rgba(0, 91, 112, 0.18);
  border-radius: 17px;
  background: rgba(255,255,255,.88);
  padding: 14px 15px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  min-height: 142px;
}

textarea:focus {
  border-color: rgba(0, 91, 112, 0.55);
  box-shadow: 0 0 0 4px rgba(93, 214, 228, 0.20);
}

.submitted-box {
  margin-top: 16px;
  border-radius: 17px;
  padding: 14px;
  background: rgba(36, 196, 142, .12);
  border: 1px solid rgba(36, 196, 142, .26);
  color: #075f4b;
  line-height: 1.45;
}

.submitted-box strong,
.submitted-box span { display: block; }
.submitted-box span { margin-top: 5px; font-size: 12.5px; color: #2d7666; }

@media (max-width: 370px) {
  .officer-panel { grid-template-columns: 1fr; }
  .app-header { grid-template-columns: 42px 1fr 52px; }
  .app-header img { width: 52px; }
}

/* Keep inactive screens fully hidden even when card styles are declared later. */
.hidden {
  display: none !important;
}

.officer-panel.compact {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.date-time-group {
  border: 1px solid rgba(0,91,112,.20);
  border-radius: 20px;
  background: rgba(255,255,255,.86);
  padding: 14px;
  margin: 0;
}

.date-time-group legend {
  padding: 0 8px;
  color: #073142;
  font-size: 15px;
  font-weight: 900;
}

.date-time-group p {
  margin: 2px 0 12px;
  color: #315b70;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.date-time-row {
  display: grid;
  align-items: end;
  gap: 10px;
}

.date-row { grid-template-columns: .85fr .95fr 1.25fr auto; }
.time-row { grid-template-columns: 1fr 1fr auto; }

.date-time-row label span {
  font-size: 11.5px;
  margin-left: 2px;
}

.date-time-row input {
  min-height: 50px;
  text-align: center;
  font-weight: 900;
  padding: 0 8px;
  color: #062f40;
  border-color: rgba(0,91,112,.28);
  background: #ffffff;
}

.mini-action {
  min-height: 50px;
  border: 1px solid rgba(0,91,112,.25);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0,91,112,.14), rgba(93,214,228,.24));
  color: #004a5d;
  font-weight: 950;
  padding: 0 13px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,91,112,.08);
}

.mini-action:active { transform: translateY(1px); }

@media (max-width: 390px) {
  .date-row { grid-template-columns: 1fr 1fr; }
  .date-row label:nth-child(3),
  .date-row .mini-action { grid-column: span 1; }
  .time-row { grid-template-columns: 1fr 1fr; }
  .time-row .mini-action { grid-column: 1 / -1; }
}

.datetime-control {
  margin: -4px 0 18px;
  position: relative;
  z-index: 1;
}

.secondary-btn {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(0,91,112,.28);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(224,247,250,.92));
  color: #004a5d;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,91,112,.08);
}

.datetime-editor {
  margin-top: 12px;
  border: 1px solid rgba(0,91,112,.14);
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  padding: 13px;
}

.datetime-editor input {
  margin-top: 8px;
}

.datetime-editor p {
  margin: 10px 2px 0;
  color: #315b70;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.datetime-editor p.error {
  color: #a63030;
}

.info-tile {
  border: 1px solid rgba(0,91,112,.12);
  border-radius: 17px;
  background: rgba(255,255,255,.76);
  padding: 12px;
  min-height: 68px;
  text-align: left;
  font: inherit;
}

.info-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
}

.info-tile strong {
  display: block;
  color: #073142;
  font-size: 14px;
  line-height: 1.25;
}

.info-tile em {
  display: block;
  margin-top: 5px;
  color: #006f86;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 850;
}

.editable-time {
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.editable-time:active {
  transform: translateY(1px);
}

.editable-time[aria-expanded="true"] {
  border-color: rgba(0,91,112,.36);
  box-shadow: 0 0 0 4px rgba(93,214,228,.16);
}

.inline-rule {
  position: relative;
  z-index: 1;
  margin: -4px 2px 16px;
  color: #315b70;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.inline-rule.error {
  color: #a63030;
}

.tile-editor {
  margin-top: 7px;
  min-height: 36px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 850;
  padding: 0 8px;
  text-align: left;
}

.editable-time.editing strong,
.editable-time.editing em {
  display: none;
}

.form-actions,
.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.form-actions .primary-btn,
.form-actions .secondary-btn {
  margin-top: 8px;
}

.logs-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 34px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  backdrop-filter: blur(18px);
  animation: rise .26s ease both;
}

.logs-toolbar {
  margin: 22px 0 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.export-actions {
  margin-bottom: 16px;
}

.logs-list {
  display: grid;
  gap: 12px;
  padding-bottom: 4px;
}

.log-item {
  border: 1px solid rgba(0,91,112,.22);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0,91,112,.08);
}

.log-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.log-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(0,91,112,.10);
  color: #005b70;
  font-size: 12px;
  font-weight: 950;
}

.log-date {
  color: #174c62;
  font-size: 12.5px;
  font-weight: 900;
  text-align: right;
}

.log-item p {
  margin: 8px 0 0;
  color: #062f40;
  line-height: 1.5;
  font-size: 14.5px;
  font-weight: 650;
}

.log-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  color: #315b70;
  font-size: 12px;
  font-weight: 900;
}

.empty-logs {
  margin: 20px 0 0;
  border: 1px dashed rgba(0,91,112,.22);
  border-radius: 18px;
  padding: 18px;
  color: #315b70;
  text-align: center;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

@media print {
  body { background: white; padding: 0; }
  .logs-card { box-shadow: none; border: 0; border-radius: 0; }
  .back-btn, .logs-toolbar, .export-actions { display: none !important; }
}

.date-range-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: -2px 0 12px;
}

.logs-toolbar input,
.date-range-filter input {
  min-height: 48px;
}

.export-actions {
  grid-template-columns: 1fr;
}

@media (min-width: 410px) {
  .export-actions {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 430px) {
  .logs-toolbar,
  .date-range-filter {
    grid-template-columns: 1fr;
  }
}

/* Desktop/tablet layout: keep the polished phone flow on small screens, but expand into a real workstation view on PCs. */
@media (min-width: 900px) {
  body {
    min-height: 100vh;
    padding: 42px;
    place-items: center;
    background:
      radial-gradient(circle at 12% 8%, rgba(93, 214, 228, 0.34), transparent 26%),
      radial-gradient(circle at 86% 12%, rgba(19, 87, 139, 0.28), transparent 30%),
      linear-gradient(135deg, #eaf9fb 0%, #f7fbfc 44%, #d8ebf1 100%);
  }

  .phone-shell {
    width: min(100%, 1120px);
    min-height: auto;
  }

  .hero-card,
  .login-card,
  .logbook-card,
  .logs-card {
    min-height: auto;
    border-radius: 34px;
    padding: 34px;
  }

  .hero-card,
  .login-card {
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
  }

  .hero-card {
    display: grid;
    grid-template-columns: 360px 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 24px 46px;
    align-items: center;
    min-height: 610px;
  }

  .hero-card::after,
  .login-card::after {
    inset: 26px 26px 26px auto;
    width: 42%;
    height: auto;
  }

  .top-status {
    grid-column: 1 / -1;
  }

  .logo-wrap {
    width: 300px;
    height: 235px;
    margin: 18px auto;
    border-radius: 38px;
  }

  .copy {
    text-align: left;
  }

  h1 {
    font-size: clamp(50px, 5vw, 72px);
    max-width: 520px;
  }

  h2 {
    font-size: 40px;
  }

  .subtitle {
    margin-left: 0;
    max-width: 500px;
    font-size: 17px;
  }

  .hero-card > .primary-btn {
    grid-column: 2;
    align-self: start;
    width: 260px;
    margin-top: -12px;
  }

  .quick-benefits {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding-top: 0;
  }

  .quick-benefits div {
    padding: 18px;
    text-align: left;
  }

  .quick-benefits strong { font-size: 15px; }
  .quick-benefits span { font-size: 12.5px; }

  .login-card {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px 42px;
    align-items: center;
    min-height: 580px;
  }

  .mini-logo {
    grid-row: span 2;
    width: 230px;
    height: 172px;
    margin: 0 auto;
    border-radius: 32px;
  }

  .login-heading {
    text-align: left;
    align-self: end;
  }

  .login-table {
    align-self: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .login-table .login-submit,
  .demo-note {
    grid-column: 1 / -1;
  }

  .login-table .login-submit {
    width: 260px;
  }

  .demo-note {
    text-align: left;
    margin-top: 2px;
  }

  .logbook-card,
  .logs-card {
    width: min(100%, 1120px);
    margin: 0 auto;
  }

  .app-header {
    grid-template-columns: 48px 1fr 92px;
    gap: 18px;
  }

  .app-header h2 { font-size: 42px; }

  .app-header img {
    width: 92px;
    height: 66px;
    border-radius: 18px;
  }

  .officer-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 28px 0 20px;
  }

  .officer-panel div,
  .info-tile {
    min-height: 86px;
    padding: 16px;
  }

  .officer-panel strong,
  .info-tile strong {
    font-size: 16px;
  }

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

  .entry-form label:has(textarea),
  .form-actions,
  .submitted-box {
    grid-column: 1 / -1;
  }

  textarea {
    min-height: 170px;
  }

  .form-actions {
    grid-template-columns: 220px 260px;
    justify-content: end;
  }

  .logs-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
  }

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

  .export-actions {
    grid-template-columns: repeat(3, 220px);
    justify-content: end;
    gap: 12px;
  }

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

/* iPhone/Safari fix: make select dropdowns match text inputs on phone view. */
select {
  -webkit-appearance: none;
  appearance: none;
  height: 54px;
  line-height: 1.2;
  padding-right: 46px;
  background-image:
    linear-gradient(45deg, transparent 50%, #0a2230 50%),
    linear-gradient(135deg, #0a2230 50%, transparent 50%),
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.88));
  background-position:
    calc(100% - 24px) 50%,
    calc(100% - 17px) 50%,
    0 0;
  background-size:
    7px 7px,
    7px 7px,
    100% 100%;
  background-repeat: no-repeat;
}

.login-table select,
.entry-form select,
.logs-toolbar select {
  min-height: 54px;
  height: 54px;
  font-size: 15px;
}

/* Friendly Date Range calendar for View Logs search */
.date-range-filter {
  position: relative;
  z-index: 4;
}

.date-range-picker {
  position: relative;
  width: 100%;
}

.date-range-picker > span {
  display: block;
  margin: 0 0 8px 4px;
  color: #27566a;
  font-size: 13px;
  font-weight: 800;
}

.date-range-trigger {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(0, 91, 112, 0.18);
  border-radius: 17px;
  background: rgba(255,255,255,.88);
  padding: 0 14px 0 15px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.date-range-trigger:focus {
  outline: none;
  border-color: rgba(0, 91, 112, 0.55);
  box-shadow: 0 0 0 4px rgba(93, 214, 228, 0.20);
}

.date-range-trigger strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 650;
}

.date-range-trigger em {
  color: #004a5d;
  font-size: 16px;
  font-style: normal;
  font-weight: 900;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: min(100%, 332px);
  border: 1px solid rgba(0, 91, 112, 0.16);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 18px 42px rgba(2, 36, 54, 0.20);
  z-index: 30;
}

.calendar-popover::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 28px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-left: 1px solid rgba(0, 91, 112, 0.16);
  border-top: 1px solid rgba(0, 91, 112, 0.16);
  transform: rotate(45deg);
}

.calendar-head {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-head strong {
  text-align: center;
  color: #111827;
  font-size: 18px;
  font-weight: 800;
}

.calendar-nav {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.calendar-nav:active {
  background: rgba(0,91,112,.08);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekdays {
  margin-bottom: 7px;
}

.calendar-weekdays span {
  text-align: center;
  color: #65778a;
  font-size: 13px;
  font-weight: 900;
}

.calendar-day {
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111827;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}

.calendar-day.spacer {
  pointer-events: none;
}

.calendar-day.today {
  outline: 2px solid rgba(43, 115, 190, .35);
  outline-offset: -3px;
  border-radius: 999px;
}

.calendar-day.in-range {
  background: #d9eaff;
}

.calendar-day.selected {
  border-radius: 999px;
  background: #fff;
  color: #245eaa;
  box-shadow: 0 0 0 3px rgba(43, 115, 190, .25), inset 0 0 0 2px #5c93d9;
}

.calendar-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.calendar-clear {
  border: 1px solid rgba(0,91,112,.18);
  border-radius: 999px;
  background: rgba(0,91,112,.06);
  color: #004a5d;
  padding: 8px 12px;
  font-weight: 900;
  cursor: pointer;
}

@media (min-width: 900px) {
  .date-range-filter {
    grid-template-columns: minmax(320px, 390px);
  }

  .calendar-popover {
    width: 332px;
  }
}

@media (max-width: 430px) {
  .calendar-popover {
    width: min(100%, 314px);
    padding: 14px;
  }

  .calendar-head strong {
    font-size: 17px;
  }

  .calendar-day {
    height: 32px;
    font-size: 14px;
  }
}

/* Make the selected date range easier to see. */
.calendar-day.in-range {
  background: #cfe3ff;
  color: #0f3f7a;
}

.calendar-day.range-start,
.calendar-day.range-end {
  background: #fff;
  color: #174f9f;
  font-weight: 950;
  box-shadow: 0 0 0 4px rgba(43, 115, 190, .22), inset 0 0 0 2px #4f8ed8;
}

/* Make Date Range picker reliable on desktop browsers: float above the card instead of being clipped by the logs layout. */
.logs-card {
  overflow: visible;
}

.calendar-popover {
  position: fixed;
  z-index: 9999;
  max-height: calc(100vh - 32px);
}

/* Clickable log cards + log details popup */
.log-item {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.log-item:hover,
.log-item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(0,91,112,.38);
  box-shadow: 0 16px 34px rgba(0,91,112,.14);
  outline: none;
}

.log-item:active {
  transform: translateY(0);
}

.log-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.log-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 28, 40, .42);
  backdrop-filter: blur(8px);
}

.log-modal-card {
  position: relative;
  width: min(100%, 680px);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 8%, rgba(93,214,228,.18), transparent 28%),
    rgba(255,255,255,.96);
  box-shadow: 0 28px 80px rgba(2,36,54,.34);
  padding: 24px;
  animation: modalRise .18s ease both;
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(0,91,112,.18);
  border-radius: 15px;
  background: white;
  color: #004a5d;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
}

.modal-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 52px;
  margin-right: 44px;
}

.modal-topline span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(0,91,112,.10);
  color: #005b70;
  font-size: 12px;
  font-weight: 950;
}

.modal-topline strong {
  color: #174c62;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
  line-height: 1.35;
}

.log-modal-card h3 {
  margin: 18px 0 18px;
  color: #083040;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.05em;
}

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

.modal-details-grid div,
.modal-notes {
  border: 1px solid rgba(0,91,112,.13);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  padding: 14px;
}

.modal-details-grid span,
.modal-notes span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.modal-details-grid strong {
  color: #073142;
  font-size: 15px;
  line-height: 1.35;
}

.modal-notes {
  margin-top: 12px;
}

.modal-notes p {
  margin: 0;
  white-space: pre-wrap;
  color: #062f40;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 520px) {
  .log-modal {
    padding: 12px;
    place-items: end center;
  }

  .log-modal-card {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 24px;
    padding: 20px;
  }

  .modal-topline {
    flex-direction: column;
    gap: 10px;
    margin-right: 48px;
  }

  .modal-topline strong {
    text-align: left;
  }

  .log-modal-card h3 {
    font-size: 30px;
  }

  .modal-details-grid {
    grid-template-columns: 1fr;
  }
}

/* Fixed logged-in demo user */
#loginOfficerId[readonly] {
  color: #073142;
  background: rgba(235, 248, 250, .95);
  font-weight: 850;
}

/* Login Officer ID should stay editable; demo identity is applied after login. */
#loginOfficerId {
  background: rgba(255,255,255,.88);
  font-weight: 500;
}
