:root {
  --bg: #eef3ee;
  --card: rgba(255, 255, 255, 0.9);
  --text: #10211f;
  --muted: #62716e;
  --accent: #2f6f68;
  --accent-2: #88a95d;
  --line: #dae5dd;
  --shadow: 0 20px 40px rgba(18, 46, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(136, 169, 93, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(47, 111, 104, 0.16), transparent 35%),
    var(--bg);
  color: var(--text);
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 18px;
  background: rgba(14, 29, 27, 0.96);
  color: #fff;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
}

.brand-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  border: 0;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content {
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 36px;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.api-card,
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.api-card {
  padding: 20px;
  display: grid;
  gap: 10px;
}

.api-card label {
  font-size: 12px;
  color: var(--muted);
}

.api-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
}

.primary,
.ghost {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: #ecf3ef;
  color: var(--accent);
}

.status {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5faf5;
  color: var(--accent);
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 18px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.stat-card {
  padding: 18px;
}

.stat-label {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 32px;
}

.section {
  padding: 18px;
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.section-head > div:first-child h2 {
  margin-bottom: 4px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-toolbar input,
.compact-toolbar select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
}

.compact-toolbar input {
  width: 170px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td small {
  display: block;
  max-width: 210px;
  margin-top: 3px;
  overflow: hidden;
  color: #8a9793;
  font-size: 10px;
  text-overflow: ellipsis;
}

.user-cell,
.profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell img,
.user-fallback {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  object-fit: cover;
}

.user-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f1e9;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.profile-summary {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.profile-summary img,
.user-fallback.large {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
}

.profile-summary strong {
  font-size: 18px;
}

.profile-summary p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

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

.table-action {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f5f9f6;
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
}

.table-action.danger {
  border-color: #efd4d1;
  background: #fff7f6;
  color: #a33e38;
}

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

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

.list-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
}

.template-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.template-actions button {
  padding: 7px 12px;
  border: 1px solid #d9e5dd;
  border-radius: 10px;
  color: #315f56;
  background: #f7faf7;
  cursor: pointer;
}

.template-actions button:last-child {
  color: #a33e38;
  border-color: #efd4d1;
  background: #fff7f6;
}

.item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-badge {
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff4d8;
  color: #946c19;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.approved {
  background: #e6f3e9;
  color: #387455;
}

.status-badge.rejected {
  background: #fae9e7;
  color: #a34e46;
}

.review-reason {
  margin-top: 8px !important;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff8ed;
  color: #8b6741 !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 24, 21, 0.48);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: min(620px, calc(100vw - 40px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: #f8faf7;
  box-shadow: 0 30px 80px rgba(11, 35, 30, 0.24);
}

.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 247, 0.94);
  backdrop-filter: blur(14px);
}

.modal-head h2 {
  margin: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #e8efea;
  color: #52635e;
  font-size: 24px;
  cursor: pointer;
}

.detail-content {
  padding: 22px 24px 32px;
}

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

.detail-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid strong {
  font-size: 20px;
}

.detail-block {
  margin-top: 16px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.detail-block h3 {
  margin: 0 0 10px;
}

.detail-block p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.list-item strong {
  display: block;
  margin-bottom: 6px;
}

.list-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.code-block {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: #0f1e1d;
  color: #d7f1df;
  overflow: auto;
}

.section#checkins,
.section#rankings {
  min-height: 280px;
}

.api-card button + button {
  margin-top: 4px;
}

.api-card #testConnection {
  background: #eaf3ef;
  color: var(--accent);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav {
    grid-auto-flow: column;
    overflow: auto;
  }

  .hero,
  .stats,
  .two-cols {
    grid-template-columns: 1fr;
  }

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

  .compact-toolbar {
    flex-wrap: wrap;
  }

  .compact-toolbar input {
    flex: 1;
    min-width: 150px;
  }

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