:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dde4df;
  --accent: #117c6f;
  --accent-strong: #095f55;
  --indigo: #405f9f;
  --amber: #c47a2c;
  --danger: #b23b4a;
  --shadow-sm: 0 8px 22px rgba(23, 33, 31, 0.06);
  --shadow-md: 0 20px 48px rgba(23, 33, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(17, 124, 111, 0.1), transparent 320px),
    linear-gradient(120deg, rgba(196, 122, 44, 0.09), transparent 360px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

input {
  min-width: 0;
}

.shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.admin-shell {
  width: min(1220px, calc(100vw - 32px));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.hero {
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid rgba(221, 228, 223, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(249, 250, 247, 0.72)),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.compact-hero {
  margin-bottom: 18px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.subtitle {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

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

.search {
  display: flex;
  align-items: center;
  width: min(340px, 38vw);
  min-height: 44px;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.search-icon {
  display: inline-flex;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.text-link,
.icon-button,
.ghost-button,
.small-button,
.primary-button,
.open-button {
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--accent);
  font-weight: 780;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent-strong);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover,
.ghost-button:hover,
.small-button:hover {
  transform: translateY(-1px);
  border-color: rgba(17, 124, 111, 0.45);
  color: var(--accent);
}

.status {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 22px;
  padding: 10px 14px;
  border: 1px solid rgba(221, 228, 223, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.status.error {
  border-color: rgba(178, 59, 74, 0.35);
  color: var(--danger);
}

.services {
  display: grid;
  gap: 28px;
}

.group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: #24302d;
  font-size: 16px;
}

.group h2::before {
  content: "";
  width: 8px;
  height: 20px;
  border-radius: 8px;
  background: var(--accent);
}

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

.service-card {
  display: grid;
  min-height: 176px;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(221, 228, 223, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.service-card:hover {
  border-color: rgba(17, 124, 111, 0.36);
  box-shadow: var(--shadow-md);
}

.card-main {
  display: flex;
  min-width: 0;
  gap: 13px;
}

.service-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.service-mark::before {
  content: attr(data-initial);
}

.service-card:nth-child(3n + 2) .service-mark {
  background: var(--amber);
}

.service-card:nth-child(3n) .service-mark {
  background: var(--indigo);
}

.service-text {
  min-width: 0;
}

.service-text h3 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 19px;
  line-height: 1.22;
}

.note,
.meta {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.note {
  color: #43514d;
}

.note:empty {
  display: none;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.open-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.quick-action.active {
  outline: 2px solid rgba(17, 124, 111, 0.18);
  outline-offset: 2px;
}

.open-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.admin-console {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.admin-sidebar,
.admin-list-card,
.admin-panel {
  border: 1px solid rgba(221, 228, 223, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.admin-sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 16px;
}

.token-field {
  margin-bottom: 16px;
}

.admin-tabs {
  display: grid;
  gap: 8px;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 780;
  cursor: pointer;
  text-align: left;
}

.tab-button:hover {
  background: var(--surface-soft);
}

.tab-button.active {
  border-color: rgba(17, 124, 111, 0.28);
  background: rgba(17, 124, 111, 0.1);
  color: var(--accent-strong);
}

.admin-status {
  margin: 16px 0 0;
  box-shadow: none;
}

.admin-workspace {
  min-width: 0;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.admin-panel.admin-section.active {
  display: grid;
}

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

.admin-section:not(.active) {
  display: none;
}

.auth-panel {
  padding: 14px;
}

.panel-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.settings-form,
.service-form {
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: 0;
}

.field input:focus {
  border-color: rgba(17, 124, 111, 0.6);
  background: #fff;
}

.form-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 10px;
}

.ghost-button,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.ghost-button {
  padding: 0 16px;
}

.small-button {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 760;
}

.danger-button {
  border-color: rgba(178, 59, 74, 0.32);
  color: var(--danger);
}

.danger-button:hover {
  border-color: rgba(178, 59, 74, 0.58);
  color: var(--danger);
}

.admin-list-wrap {
  overflow-x: auto;
}

.admin-list-card {
  padding: 18px;
}

.list-heading {
  margin-bottom: 12px;
}

.admin-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.admin-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.url-cell {
  max-width: 380px;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .shell,
  .admin-shell {
    width: min(100vw - 24px, 1220px);
    padding-top: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    padding: 20px;
  }

  .actions {
    justify-content: stretch;
    width: 100%;
  }

  .search {
    width: 100%;
    flex: 1 1 220px;
  }

  .admin-panel {
    grid-template-columns: 1fr;
  }

  .admin-console {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-button {
    justify-content: center;
    padding: 0 8px;
    text-align: center;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .ghost-button,
  .form-actions .primary-button {
    flex: 1;
  }

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