:root {
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-accent: #f28f5c;
  --color-accent-hover: #e07d4a;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body[data-service-page="login"] {
  background: #000;
  color: #f3f4f6;
}

.service-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.service-card {
  width: 100%;
  max-width: 320px;
  padding: 1.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body[data-service-page="login"] .service-card {
  background: #2d2d2d;
  border-color: #404040;
  color: #f3f4f6;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.service-card h1 {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
}

.service-field {
  margin-bottom: 0.875rem;
}

.service-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

body[data-service-page="login"] .service-field label {
  color: #9ca3af;
}

.service-field input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9375rem;
}

.service-field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9375rem;
}

body[data-service-page="login"] .service-field input {
  background: #1a1a1a;
  border-color: #525252;
  color: #f9fafb;
}

body[data-service-page="home"] .service-field select {
  background: #111;
  border-color: #333;
  color: #fff;
}

body[data-service-page="login"] .service-field input::placeholder {
  color: #6b7280;
}

.service-field input:focus {
  outline: 2px solid rgba(242, 143, 92, 0.35);
  border-color: var(--color-accent);
}

body[data-service-page="login"] .service-field input:focus {
  outline-color: rgba(242, 143, 92, 0.4);
  border-color: var(--color-accent);
}

.service-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--color-accent);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.service-submit:hover {
  background: var(--color-accent-hover);
}

body[data-service-page="login"] .service-submit {
  background: #525252;
  color: #f9fafb;
}

body[data-service-page="login"] .service-submit:hover {
  background: #6b7280;
}

body[data-service-page="login"] .service-submit:disabled {
  background: #525252;
}

.service-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.service-error {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 8px;
}

.service-error[hidden] {
  display: none;
}

body[data-service-page="login"] .service-error {
  color: #fca5a5;
  background: #3f1f1f;
}

.service-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body[data-service-page="home"] {
  background: #000;
  color: #fff;
  --service-accent: #5c5cff;
  --service-nav-font: Arial, Helvetica, "Segoe UI", sans-serif;
  --service-gutter: 20%;
}

html.service-auth-pending .service-app {
  visibility: hidden;
}

body[data-service-page="home"] .service-app {
  background: #000;
  color: #fff;
}

.service-layout {
  min-height: 100vh;
  padding: 1.25rem var(--service-gutter) 0;
}

.service-app-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 0 0.75rem;
  background: #000;
}

.service-header-top {
  display: flex;
  justify-content: flex-end;
}

.service-app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.service-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  margin-left: auto;
}

.service-app-brand {
  font-family: var(--service-nav-font);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.2;
  flex-shrink: 0;
}

.service-main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.15rem 1.75rem;
  font-family: var(--service-nav-font);
}

.service-nav-item {
  padding: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.service-nav-item.is-active {
  color: var(--service-accent);
}

.service-nav-item--disabled {
  color: #555;
  cursor: not-allowed;
  opacity: 0.65;
}

.service-nav-item--disabled:hover {
  color: #555;
}

.service-sub-nav {
  display: none;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.15rem 1.5rem;
  padding: 0.15rem 0 0;
  font-family: var(--service-nav-font);
}

.service-sub-nav.is-visible {
  display: flex;
}

.service-sub-nav-item {
  padding: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.service-sub-nav-item.is-active {
  color: var(--service-accent);
}

.service-sub-nav-item--disabled {
  color: #555;
  cursor: not-allowed;
  opacity: 0.65;
}

.service-logout {
  padding: 0.3rem 0.6rem;
  border: 1px solid #333;
  border-radius: 4px;
  background: transparent;
  font-family: var(--service-nav-font);
  font-size: 0.75rem;
  font-weight: 600;
  color: #ccc;
  cursor: pointer;
}

body[data-service-page="home"] .service-logout:hover {
  background: #111;
  color: #fff;
}

.service-app-main {
  flex: 1;
  padding: 1rem 0 2rem;
}

.service-panel {
  display: none;
}

.service-panel.is-active {
  display: block;
}

.service-sub-panel {
  display: none;
}

.service-sub-panel.is-active {
  display: block;
}

.service-panel-title {
  margin: 0;
  font-family: var(--service-nav-font);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
}

.service-favorites-summary {
  margin: 0 0 0.75rem;
  font-family: var(--service-nav-font);
  font-size: 0.8125rem;
  color: #9ca3af;
}

.service-favorites-status {
  margin: 0;
  font-family: var(--service-nav-font);
  font-size: 0.875rem;
  color: #9ca3af;
}

.service-favorites-status.is-error {
  color: #fca5a5;
}

.service-favorites-status[hidden] {
  display: none;
}

.service-favorites-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.service-favorites-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--service-nav-font);
  font-size: 0.875rem;
}

.service-favorites-table th,
.service-favorites-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #222;
}

.service-favorites-table th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ca3af;
}

.service-favorites-table tbody tr:hover {
  background: #111;
}

.service-favorites-table tr.is-missing td {
  color: #9ca3af;
}

.service-favorites-rank {
  width: 3rem;
  color: #6b7280;
}

.service-favorites-type {
  width: 6rem;
  color: #d1d5db;
}

.service-favorites-count {
  width: 6rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
  font-weight: 700;
}

.service-marketing-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
  margin: 0.5rem 0 0.75rem;
  margin-left: auto;
  max-width: 34rem;
}

.service-filter-item {
  min-width: 9rem;
}

.service-filter-item label {
  display: block;
  margin: 0 0 0.3rem;
  font-family: var(--service-nav-font);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

body[data-service-page="home"] .service-filter-item select,
body[data-service-page="home"] .service-filter-item input[type="date"] {
  width: 100%;
  height: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  background: #2f3136;
  color: #fff;
  font-family: var(--service-nav-font);
  font-size: 0.95rem;
}

body[data-service-page="home"] .service-filter-item input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.service-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.service-filter-button {
  height: 2rem;
  padding: 0 0.85rem;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  background: #2f3136;
  color: #fff;
  font-family: var(--service-nav-font);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.service-filter-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.service-renewal-header {
  margin: 0.35rem auto 0;
  max-width: 32rem;
  text-align: center;
}

.service-renewal-status {
  margin: 0;
  font-family: var(--service-nav-font);
  font-size: 0.875rem;
  color: #9ca3af;
}

.service-renewal-status.is-error {
  color: #fca5a5;
}

.service-renewal-notes {
  margin-top: 0.5rem;
}

.service-renewal-note {
  margin: 0.35rem 0 0;
  font-family: var(--service-nav-font);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--service-muted, #6b7280);
}

.service-renewal-note:first-child {
  margin-top: 0;
}

.service-renewal-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.service-renewal-table {
  width: 100%;
  max-width: 32rem;
  border-collapse: collapse;
  font-family: var(--service-nav-font);
  font-size: 0.875rem;
}

.service-renewal-table th,
.service-renewal-table td {
  padding: 0.55rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid #222;
}

.service-renewal-table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ca3af;
}

.service-renewal-table tbody th[scope="row"],
.service-renewal-table tfoot th[scope="row"] {
  text-align: left;
  font-weight: 400;
  color: #fff;
}

.service-renewal-table tbody td,
.service-renewal-table tfoot td {
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.service-renewal-table td .service-renewal-metric {
  display: inline-block;
  cursor: help;
}

.service-renewal-table td .service-renewal-rate {
  display: block;
  font-weight: 600;
}

.service-renewal-table td .service-renewal-fraction {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: #888;
  font-weight: 400;
}

.service-renewal-table tfoot .service-renewal-total-row th,
.service-renewal-table tfoot .service-renewal-total-row td {
  border-top: 1px solid #fff;
  border-bottom: none;
  padding-top: 0.75rem;
}

.service-renewal-table tfoot .service-renewal-total-row th {
  font-weight: 700;
}

.service-sub-panel[data-sub-panel="retention"] .service-renewal-table-wrap {
  margin-left: auto;
  margin-right: auto;
  max-width: 32rem;
}

@media (max-width: 900px) {
  body[data-service-page="home"] {
    --service-gutter: 10%;
  }

  .service-main-nav {
    gap: 0.15rem 1rem;
  }

  .service-sub-nav {
    gap: 0.15rem 1rem;
  }
}
