:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --wa: #25d366;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.25);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2c;
    --surface-2: #0f1727;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2a3f;
    --accent: #14b8a6;
    --accent-ink: #042f2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

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

svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }

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

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 55%, #0f172a 100%);
  color: #fff;
  text-align: center;
  padding: 48px 0 72px;
}

.avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.hero h1 { margin: 0; font-size: clamp(26px, 5vw, 36px); letter-spacing: -0.5px; }
.subtitle { margin: 6px 0 0; opacity: 0.8; }

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: -28px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.search:focus-within { border-color: var(--accent); }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
}

.tab.is-active { background: var(--accent); color: var(--accent-ink); }

/* ---------- grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 14px;
  margin: 20px 0 32px;
}

.card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.card__body { display: flex; flex-direction: column; min-width: 0; width: 100%; }
.card__name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); margin: 32px 0; }

/* ---------- logo ---------- */

.logo {
  --brand: #0f766e;
  width: 116px;
  height: 84px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #eef2f6;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  flex: none;
}

.logo { position: relative; }
.logo img { position: absolute; inset: var(--pad, 10px); width: calc(100% - 2 * var(--pad, 10px)); height: calc(100% - 2 * var(--pad, 10px)); object-fit: contain; }

.logo--mono {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.logo--lg { --pad: 8px; width: 96px; height: 72px; border-radius: 16px; padding: 8px; }
.logo--lg.logo--mono { font-size: 20px; }

/* ---------- sheet (dialog) ---------- */

.sheet {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.sheet::backdrop { background: rgba(2, 6, 23, 0.55); backdrop-filter: blur(3px); }

.sheet[open] { animation: pop 0.18s ease-out; }

@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.sheet__inner { position: relative; padding: 22px; }

.sheet__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sheet__head { display: flex; align-items: center; gap: 14px; padding-right: 40px; margin-bottom: 18px; }
.sheet__head h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.sheet__head p { margin: 2px 0 0; font-size: 14px; }

.details { margin: 0 0 18px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }

.row { padding: 10px 14px; background: var(--surface-2); }
.row + .row { border-top: 1px solid var(--border); }

.row dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); font-weight: 600; }

.row dd {
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  word-break: break-word;
}

.mono { font-family: var(--mono); font-size: 15px; letter-spacing: 0.3px; }

.copy {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.copy:hover { border-color: var(--accent); }

.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, border-color 0.15s ease;
}

.btn:hover { border-color: var(--accent); }
.btn--primary { grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn--primary:hover,
.btn--wa:hover { filter: brightness(1.05); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */

.footer { padding: 8px 0 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .logo { max-width: 100%; }
  .logo { width: 108px; height: 76px; }
  .tabs { width: 100%; }
  .tab { flex: 1; }
  .sheet {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
  }
  .sheet__inner { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
