:root {
  --bg: #f9f5fa;
  --panel: #ffffff;
  --text: #1e1a24;
  --muted: #6b637a;
  --line: #e2d9ea;
  --accent: #7c3d85;
  --accent-dark: #5f2d66;
  --danger: #b42318;
  --success: #6f3979;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 0% 0%, #ede4f2, var(--bg) 35%);
  color: var(--text);
}

.wrap {
  width: min(1180px, 94vw);
  margin: 32px auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.site-header img {
  height: 2rem;
  width: auto;
  margin-left: auto;
  display: block;
  flex-shrink: 0;
}

nav {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  align-items: center;
  flex-wrap: wrap;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 650;
}

nav a.active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

.nav-spacer {
  flex: 1;
}

.status-pill {
  color: var(--accent);
  font-weight: 650;
}

.logout-form {
  margin: 0;
}

.logout-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
  padding: 7px 10px;
}

.panel,
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel + .panel {
  margin-top: 16px;
}

.page-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.page-head h2,
.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

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

.button,
button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

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

.table-scroll {
  overflow-x: auto;
}

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

th {
  color: var(--muted);
  font-size: 0.92rem;
}

td {
  word-break: break-word;
}

a {
  color: var(--accent);
}

p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.5;
}

code {
  color: var(--accent-dark);
  white-space: normal;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: white;
}

select {
  min-width: 150px;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

.row {
  margin: 12px 0;
}

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

.tile {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text);
}

.tile strong {
  color: var(--accent);
  font-size: 1.1rem;
}

.error {
  color: var(--danger);
}

.success {
  color: var(--success);
}

.notice-list {
  margin: 8px 0 0 20px;
  color: var(--muted);
}

.pager {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.metric {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.metric strong {
  display: block;
  color: var(--accent);
  font-size: 1.45rem;
}

.metric span,
.count-pill {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.report-tabs {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 18px;
  margin: 16px 0;
}

.report-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-top: 16px;
  scroll-margin-top: 12px;
}

.report-section h3 {
  margin: 0 0 10px;
}

.empty {
  color: var(--muted);
}

.success-message,
.error-message {
  border-radius: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  font-weight: 650;
}

.success-message {
  background: #edf8f0;
  border: 1px solid #b9e4c2;
  color: #216b35;
}

.error-message {
  background: #fff0ed;
  border: 1px solid #ffd0c7;
  color: var(--danger);
}

.lp-range-form {
  max-width: 420px;
}

.lp-filter-form {
  min-width: min(520px, 100%);
}

.lp-filter-form input,
.lp-filter-form select {
  width: auto;
}

.lp-result {
  border-color: #b9e4c2;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: rgb(255 255 255 / 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgb(95 45 102 / 0.16);
  padding: 32px;
}

.auth-card img {
  width: 54px;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0 0 8px;
}

.auth-card form {
  margin-top: 20px;
}

.auth-card button {
  width: 100%;
  margin-top: 12px;
}

.auth-error {
  background: #fff0ed;
  border: 1px solid #ffd0c7;
  border-radius: 8px;
  color: var(--danger);
  margin-top: 14px;
  padding: 10px 12px;
  font-weight: 650;
}

@media (max-width: 720px) {
  .wrap {
    margin: 20px auto;
  }

  .page-head {
    display: block;
  }

  .actions {
    margin-top: 10px;
  }

  table {
    font-size: 0.92rem;
  }
}
