:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #52606d;
  --accent: #0f766e;
  --danger: #b42318;
  --ok: #05603a;
  --border: #d9e2ec;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at top right, #d9f2ff 0%, var(--bg) 35%);
  color: var(--ink);
  font-family: "Segoe UI", "Tahoma", sans-serif;
}

body.nav-drawer-open {
  overflow: hidden;
}

.topbar {
  background:
    radial-gradient(circle at top right, rgba(122, 203, 255, 0.22), transparent 26%),
    linear-gradient(135deg, #082f49 0%, #0d4a6c 55%, #14597d 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 32px rgba(8, 32, 52, 0.18);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0.95rem 1rem;
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.brand {
  display: inline-grid;
  gap: 0.18rem;
  color: #fff;
  text-decoration: none;
}

.brand-kicker {
  color: rgba(217, 238, 248, 0.82);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-title {
  font-size: 1.4rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-left: 1.5rem;
}

.desktop-nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  position: relative;
  color: rgba(234, 245, 252, 0.88);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.25rem 0;
}

.desktop-nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35rem;
  height: 2px;
  background: #9fe7da;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.desktop-nav-link:hover,
.desktop-nav-link.active {
  color: #ffffff;
}

.desktop-nav-link:hover::after,
.desktop-nav-link.active::after {
  transform: scaleX(1);
}

.desktop-nav-group {
  position: relative;
}

.desktop-nav-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  color: rgba(234, 245, 252, 0.88);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.25rem 0;
}

.desktop-nav-group-toggle::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35rem;
  height: 2px;
  background: #9fe7da;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.desktop-nav-group-toggle:hover,
.desktop-nav-group-toggle.active,
.desktop-nav-group:hover .desktop-nav-group-toggle,
.desktop-nav-group:focus-within .desktop-nav-group-toggle {
  color: #ffffff;
}

.desktop-nav-group-toggle:hover::after,
.desktop-nav-group-toggle.active::after,
.desktop-nav-group:hover .desktop-nav-group-toggle::after,
.desktop-nav-group:focus-within .desktop-nav-group-toggle::after {
  transform: scaleX(1);
}

.desktop-nav-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.85;
}

.desktop-nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 0;
  background: #ffffff;
  border: 1px solid rgba(11, 60, 93, 0.18);
  border-radius: 10px;
  box-shadow: 0 16px 32px rgba(11, 60, 93, 0.22);
  padding: 0.35rem 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 50;
}

.desktop-nav-group:hover .desktop-nav-menu,
.desktop-nav-group:focus-within .desktop-nav-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.desktop-nav-menu-link {
  display: block;
  padding: 0.62rem 0.85rem;
  color: #123b56;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.89rem;
  border-left: 3px solid transparent;
}

.desktop-nav-menu-link:hover,
.desktop-nav-menu-link.active {
  background: #e9f3fb;
  color: #0a334d;
  border-left-color: #0f766e;
}

.nav-hamburger {
  display: none;
  width: 46px;
  height: 46px;
  padding: 0.75rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-hamburger span {
  display: block;
  width: 18px;
  min-width: 18px;
  height: 2px;
  min-height: 2px;
  border-radius: 999px;
  background: #fff;
  opacity: 1;
}

.nav-drawer-shell[hidden] {
  display: none;
}

.nav-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.nav-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 22, 34, 0.5);
  border: none;
  padding: 0;
}

.nav-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(360px, 88vw);
  height: 100%;
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at top right, rgba(118, 206, 255, 0.18), transparent 26%),
    linear-gradient(180deg, #082f49 0%, #0d4a6c 52%, #0e3b56 100%);
  color: #fff;
  box-shadow: -20px 0 40px rgba(6, 24, 36, 0.28);
  overflow-y: auto;
}

.nav-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.nav-drawer-kicker {
  display: block;
  color: rgba(217, 238, 248, 0.76);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-drawer-title {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.2rem;
}

.nav-drawer-close {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
}

.nav-drawer-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-drawer-group {
  display: grid;
  gap: 0;
}

.nav-drawer-label {
  color: rgba(217, 238, 248, 0.76);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.nav-drawer-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.8rem 0;
  border-radius: 0;
  color: #f7fbff;
  text-decoration: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.nav-drawer-link.active {
  color: #9fe7da;
  border-bottom-color: rgba(159, 231, 218, 0.45);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.nav-drawer-link:hover {
  background: transparent;
  color: #ffffff;
}

.link-button {
  color: #d5eefc;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  color: #fff;
}

.account-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #e6f5ff;
}

.account-name {
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
}

.audit-table .link-button {
  color: #0b3c5d;
}

.audit-table .link-button:hover {
  color: #06233a;
}

.container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem 2rem;
}

.hero,
.panel,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 16px 40px rgba(11, 60, 93, 0.08);
}

.auth-card {
  max-width: 460px;
  margin: 2rem auto 0;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
}

.auth-card p {
  margin: 0 0 1rem;
}

.auth-card form {
  display: grid;
  gap: 0.65rem;
}

.auth-card label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-card input,
.auth-card button {
  width: 100%;
  min-height: 44px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.hero-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.hero-copy h1,
.hero-copy p {
  margin: 0;
}

.hero-scope-chip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: #edf7f5;
  color: #0b5b54;
  font-size: 0.84rem;
}

.hero-scope-chip strong {
  font-size: 0.84rem;
}

.month-form {
  display: grid;
  gap: 0.25rem;
  min-width: min(100%, 360px);
}

.month-form label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.month-form select,
.month-form input[type="month"] {
  width: 100%;
  min-height: 42px;
}

.month-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.table-toolbar {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

.table-toolbar-copy h2 {
  margin: 0;
  font-size: 1rem;
}

.table-toolbar-copy p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.7rem;
}

.summary-grid article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  min-width: 0;
}

.invoice-period-panel {
  margin-top: 1rem;
}

.invoice-period-panel h2,
.invoice-period-panel p {
  margin-top: 0;
}

.summary-grid h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.summary-grid p {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.audit-table th,
.audit-table td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.9rem;
}

.audit-table th {
  background: #f0f4f8;
}

.stacked-form {
  display: grid;
  gap: 0.55rem;
}

input,
button {
  font: inherit;
}

input[type="text"],
input[type="date"],
input[type="month"],
input[type="password"],
input[type="file"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: #fff;
}

button {
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

.action-link {
  color: #0f4f78;
  margin-right: 0.6rem;
  text-decoration: none;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.action-link:hover {
  color: #0a3d63;
}

.danger-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  color: #fff;
}

.danger-button {
  background: var(--danger);
}

.secondary-button {
  background: #265d85;
}

.danger-button:hover,
.secondary-button:hover {
  filter: brightness(0.95);
  color: #fff;
}

.screenshot-modal[hidden] {
  display: none;
}

.screenshot-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.screenshot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 26, 42, 0.72);
}

.screenshot-modal-content {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  z-index: 1;
  background: #0b3c5d;
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}

.screenshot-modal-content img {
  display: block;
  max-width: 90vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 8px;
}

.close-button {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.success,
.alert {
  border-radius: 8px;
  padding: 0.65rem;
  margin-bottom: 0.7rem;
}

.success {
  background: #dff7eb;
  border: 1px solid #8fdcb5;
  color: var(--ok);
}

.alert {
  background: #ffe4e8;
  border: 1px solid #f6b3bc;
  color: var(--danger);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

@media (max-width: 1024px) {
  .container {
    margin: 1rem auto;
    padding: 0 0.75rem 1.5rem;
  }

  .desktop-nav {
    display: none;
  }

  .nav-hamburger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
  }

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

  .audit-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .capture-layout {
    grid-template-columns: 1fr;
  }

  .capture-sidebar {
    order: 2;
  }

  .capture-proxy-card {
    min-width: 0;
    width: 100%;
  }

  .recent-sessions-accordion {
    padding: 0.75rem;
  }

  .recent-sessions-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .month-form {
    width: 100%;
  }

  .month-toolbar {
    width: 100%;
  }

  .table-toolbar {
    align-items: flex-start;
  }

  .topbar-main {
    align-items: center;
  }

  .capture-layout {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-card {
    margin-top: 1rem;
    padding: 0.9rem;
  }

  .capture-proxy-card,
  .capture-history-card,
  .capture-session-card,
  .capture-instructions {
    min-width: 0;
  }

  .capture-session-grid,
  .capture-live-preview-days {
    grid-template-columns: 1fr;
  }

  .capture-history-header {
    align-items: flex-start;
  }
}
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.day-header h1 {
    margin: 0;
}

.day-detail-modal[hidden] {
  display: none;
}

.day-detail-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1150;
}

.day-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 26, 42, 0.72);
}

.day-detail-content {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  overflow: auto;
  z-index: 1;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}

.day-detail-content > :first-child,
.day-detail-content h2:first-child {
  padding-right: 2.5rem;
}

.day-detail-content .summary-grid {
  margin-top: 0.55rem;
}

.day-detail-content .alert {
  margin-bottom: 0.7rem;
}

.day-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 0.25rem;
}

.tracking-rerun-content {
  max-width: min(92vw, 560px);
}

.tracking-rerun-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.8rem;
}

.tracking-rerun-actions button {
  min-height: 52px;
  font-weight: 700;
}

.small-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 1rem;
}

.capture-main {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.capture-sidebar {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  min-width: 0;
}

.recent-sessions-accordion {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  padding: 0.6rem 0.75rem;
}

.capture-sidebar-summary {
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.capture-sidebar-summary::marker,
.recent-sessions-accordion summary::-webkit-details-marker {
  color: var(--muted);
}

.recent-sessions-list {
  display: grid;
  gap: 0.8rem;
  max-height: 56vh;
  overflow: auto;
  padding-right: 0.3rem;
}

.capture-proxy-card,
.capture-history-card,
.capture-session-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  padding: 0.9rem;
}

.capture-proxy-card {
  min-width: 190px;
  display: grid;
  gap: 0.2rem;
}

.capture-proxy-label,
.capture-session-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.capture-session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.8rem;
}

.capture-live-preview {
  margin: 0 0 0.9rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.capture-live-preview-header {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.7rem;
}

.capture-live-preview-header h3 {
  margin: 0;
  font-size: 1rem;
}

.capture-live-preview-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.capture-live-preview-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.capture-preview-day {
  display: grid;
  gap: 0.18rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #d7ebea;
  background: linear-gradient(180deg, #f8fffd 0%, #eef9f6 100%);
}

.capture-preview-day strong {
  font-size: 0.95rem;
}

.capture-preview-day span,
.capture-live-preview-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.capture-history-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-size: 0.78rem;
  font-weight: 700;
}

.capture-day-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0;
}

.capture-day-list span {
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: #edf7f5;
  color: #0b5b54;
  font-size: 0.8rem;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.45rem;
}

.manifest-parcel-list {
  max-height: 260px;
  overflow: auto;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.manifest-parcel-list table {
  margin-top: 0;
  border: none;
}

.tracking-search-events {
  padding: 0.75rem 0;
}

.tracking-search-events strong {
  display: block;
  margin-bottom: 0.5rem;
}

.export-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.exporter-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.exporter-actions .export-link {
  width: 100%;
  min-height: 48px;
}


