:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #e4e9f2;
  --accent: #0499e5;
  --accent-soft: #eaf3ff;
  --warn: #d92d20;
  --good: #079455;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.07);
}

@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/Manrope-Variable.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

button,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
}

input,
select,
textarea {
  margin-top: 8px;
  padding: 12px 13px;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 118px;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
}

button {
  border: 0;
  padding: 13px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

label {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

th:not(:first-child),
td:not(:first-child) {
  width: 104px;
  white-space: nowrap;
}

.muted,
.topbar span {
  color: var(--muted);
}

.truncate-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0 16px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 220px;
  min-height: 78px;
  margin: 0 12px 28px;
  color: var(--text);
}

.topbar .brand {
  margin: 0;
}

.app-logo {
  display: block;
  object-fit: contain;
  object-position: left center;
}

.topbar-brand {
  gap: 18px;
}

.brand-logo {
  width: 200px;
  height: 52px;
  flex: 0 0 auto;
}

.auth-logo {
  width: 260px;
  height: 61px;
  margin-bottom: 18px;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 12px;
  color: #344054;
  font-weight: 700;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 22px;
  color: #667085;
}

.nav-icon {
  flex: 0 0 22px;
  height: 22px;
  background: currentColor;
  mask: var(--nav-icon) center / 22px 22px no-repeat;
  -webkit-mask: var(--nav-icon) center / 22px 22px no-repeat;
}

.nav-icon.all-sites {
  --nav-icon: url("/assets/icons/all-sites.svg");
}

.nav-icon.overview {
  --nav-icon: url("/assets/icons/overview.svg");
}

.nav-icon.pages {
  --nav-icon: url("/assets/icons/pages.svg");
}

.nav-icon.sources {
  --nav-icon: url("/assets/icons/sources.svg");
}

.nav-icon.settings {
  --nav-icon: url("/assets/icons/settings.svg");
}

.nav-icon.logout {
  --nav-icon: url("/assets/icons/logout.svg");
}

.nav-item.active,
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.active span,
.nav-item:hover span {
  color: var(--accent);
}

.sidebar-meta {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 16px;
  color: #344054;
}

.sidebar-meta strong {
  font-size: 14px;
  line-height: 1.25;
}

.sidebar-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.workspace {
  min-width: 0;
}

.project-topbar,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
}

.project-title,
.topbar div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.topbar .topbar-brand {
  align-items: center;
  gap: 18px;
}

.topbar-brand span {
  line-height: 1.2;
}

.project-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-heading-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.project-heading-main strong {
  font-size: 20px;
  line-height: 1.2;
}

.project-domain {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secondary-link,
.soft-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #344054;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 18px;
  width: auto;
  margin: 20px 24px 36px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 570px);
  gap: 30px;
  width: calc(100% - 56px);
  margin: 24px auto;
}

.panel,
.auth-box {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.span-2 {
  grid-column: 1 / -1;
}

.section-title,
.snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h1,
.snippet-header h2 {
  margin: 0;
}

.section-title h1 span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
}

.section-title > span {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.stack,
.settings-form,
.cron-fields {
  display: grid;
  gap: 14px;
}

.site-list {
  display: grid;
  gap: 12px;
}

.site-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.site-row:hover {
  border-color: rgba(4, 153, 229, 0.45);
}

.site-row strong,
.site-row small {
  display: block;
}

.site-main,
.site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-main > span {
  min-width: 0;
}

.site-favicon {
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  flex: 0 0 auto;
}

.site-row small {
  margin-top: 4px;
  color: var(--muted);
}

.stats-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.stats-mini b {
  color: var(--text);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metrics div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f9fbff);
}

.metrics strong {
  display: block;
  margin-bottom: 6px;
  font-size: 30px;
}

.metrics span {
  color: var(--muted);
}

.pages-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.pages-main,
.top-pages {
  min-width: 0;
}

.pages-main h2,
.top-pages h2 {
  margin-bottom: 14px;
}

.pages-subtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pages-subtitle h2 {
  margin-bottom: 0;
}

.pages-subtitle span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pages-list-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.per-page-form {
  margin: 0;
}

.per-page-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.per-page-form select {
  width: auto;
  min-width: 88px;
  margin-top: 0;
  padding: 8px 34px 8px 12px;
  color: #344054;
  font-weight: 700;
  cursor: pointer;
}

.page-list,
.top-page-list {
  display: grid;
  gap: 10px;
}

.page-card {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
  color: var(--text);
}

.page-card:hover,
.top-page-item:hover {
  border-color: rgba(4, 153, 229, 0.45);
  background: var(--accent-soft);
}

.page-path,
.top-page-path {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-metrics {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.page-metrics b {
  color: var(--text);
}

.page-last {
  color: var(--muted);
  font-size: 12px;
}

.top-page-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.top-page-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.top-page-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.top-page-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.top-page-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.top-page-count {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #344054;
  font-weight: 700;
}

.pagination a.active,
.pagination a:hover {
  border-color: rgba(4, 153, 229, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.pagination span {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.pagination span.disabled {
  border-color: var(--line);
  background: #f8fafc;
  color: #b5bfce;
}

.pagination .pagination-current {
  width: auto;
  padding: 0 12px;
  border-color: var(--line);
  background: #fff;
}

.chart {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: clamp(16px, 4vw, 72px);
  height: 240px;
  margin-top: 24px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
}

.chart .muted {
  align-self: center;
}

.bar-wrap {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: end;
  flex: 1 1 0;
  min-width: 46px;
  max-width: 140px;
  height: 100%;
}

.bar {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #44c2f2, var(--accent));
  box-shadow: 0 10px 20px rgba(4, 153, 229, 0.16);
}

.bar-wrap small {
  color: var(--muted);
  text-align: center;
}

.periods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.period-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.periods a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #344054;
  font-weight: 700;
}

.periods a.active {
  border-color: rgba(4, 153, 229, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.period-settings {
  position: relative;
}

.period-settings summary {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  list-style: none;
}

.period-settings summary::-webkit-details-marker {
  display: none;
}

.period-settings[open] summary,
.period-settings summary:hover {
  border-color: rgba(4, 153, 229, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.custom-period {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  width: min(680px, calc(100vw - 56px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.custom-period label {
  color: var(--muted);
  font-size: 13px;
}

.custom-period input {
  margin-top: 6px;
}

.custom-period button {
  min-height: 45px;
  white-space: nowrap;
}

.secondary-button,
.icon-button {
  width: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.secondary-button.active,
.secondary-button:hover,
.icon-button:hover {
  border-color: rgba(4, 153, 229, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.danger-button {
  width: auto;
  min-width: 110px;
  border: 1px solid #fecdca;
  background: #fff3f2;
  color: var(--warn);
}

.danger-button:hover {
  background: #fee4e2;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-button.copied {
  border-color: #98d2bb;
  background: #eaf8f2;
  color: var(--good);
}

.availability-card {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
}

.availability-card > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.availability-card p {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f6fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.up {
  border-color: #98d2bb;
  background: #eaf8f2;
  color: var(--good);
}

.status-pill.down {
  border-color: #fecdca;
  background: #fff3f2;
  color: var(--warn);
}

.status-pill.muted-status {
  color: var(--muted);
}

.status-error {
  color: var(--warn);
  font-size: 13px;
}

.settings-form {
  margin-top: 16px;
}

.inline-form,
.delete-form {
  margin: 0;
}

.project-delete {
  margin-top: 16px;
}

.field-label {
  display: grid;
  gap: 8px;
}

.field-label input {
  margin-top: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.cron-card {
  display: grid;
  gap: 12px;
}

.cron-card h2,
.cron-card p {
  margin-bottom: 0;
}

.cron-card textarea {
  min-height: 78px;
}

.settings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.rename-form {
  display: grid;
  gap: 8px;
  margin: 0;
}

.rename-view {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rename-view h1 {
  margin: 0;
}

.edit-name-button {
  width: 42px;
  min-width: 42px;
  justify-content: center;
  padding: 9px;
}

.edit-name-button svg {
  width: 18px;
  height: 18px;
}

.rename-edit {
  display: none;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  align-items: center;
}

.rename-edit input {
  margin: 0;
}

.rename-form.is-editing-name .rename-view {
  display: none;
}

.rename-form.is-editing-name .rename-edit {
  display: grid;
}

.settings-hero p {
  margin-bottom: 6px;
}

.settings-hero h1 {
  margin-bottom: 4px;
}

.settings-hero span {
  color: var(--muted);
}

.alert {
  margin-bottom: 14px;
  padding: 12px 13px;
  border: 1px solid #fecdca;
  border-radius: 12px;
  background: #fff3f2;
  color: var(--warn);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-box {
  width: min(420px, 100%);
  padding: 28px;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .brand {
    width: 220px;
    margin: 0 0 16px;
  }

  .main-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .period-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-item {
    min-width: max-content;
  }

  .sidebar-meta {
    margin-top: 12px;
    padding: 0;
  }

  .project-topbar,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

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

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

  .site-row,
  .section-title,
  .snippet-header,
  .pages-subtitle,
  .settings-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-mini {
    align-items: flex-start;
    flex-direction: column;
    white-space: normal;
  }

  .pages-list-controls,
  .per-page-form,
  .per-page-form label,
  .per-page-form select {
    width: 100%;
  }

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

  .custom-period {
    position: static;
    width: 100%;
    margin-top: 10px;
    grid-template-columns: 1fr;
  }

  .delete-form,
  .danger-button,
  .secondary-button,
  .secondary-link {
    width: 100%;
  }

  .chart {
    overflow-x: auto;
  }
}
