:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --border: #e7e5e4;
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.08);
  --radius: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

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

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: linear-gradient(135deg, #134e4a, #0f766e);
  color: white;
  padding: 2.5rem 0 3rem;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.site-header p {
  margin: 0;
  opacity: 0.92;
  max-width: 60ch;
}

.badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.top-nav a {
  color: white;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: #44403c; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }

.section {
  padding: 2rem 0;
}

.section h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card .price { color: var(--accent); font-weight: 700; font-size: 1.15rem; }
.card .meta { color: var(--muted); font-size: 0.9rem; }

.contact-box {
  display: grid;
  gap: 0.5rem;
}

.footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Admin */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #1c1917;
  color: white;
  padding: 1.2rem;
}

.sidebar h1 {
  font-size: 1.1rem;
  margin: 0 0 1.2rem;
}

.sidebar nav {
  display: grid;
  gap: 0.4rem;
}

.sidebar button {
  text-align: left;
  background: transparent;
  border: none;
  color: #d6d3d1;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar button.active,
.sidebar button:hover {
  background: #292524;
  color: white;
}

.admin-main {
  padding: 1.2rem 1.5rem 2rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th { background: #fafaf9; }

.form-grid {
  display: grid;
  gap: 0.8rem;
  max-width: 640px;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

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

.login-card {
  max-width: 420px;
  margin: 10vh auto;
}

.site-header.compact {
  padding: 1.5rem 0 2rem;
}

.register-page {
  padding: 2rem 0 3rem;
}

.register-form {
  padding: 1.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.form-section {
  margin-bottom: 1.8rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.form-section h2 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
}

.slug-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.slug-field span {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.slug-field input {
  flex: 1;
}

.register-actions {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.register-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hint {
  color: var(--muted);
  font-weight: normal;
  font-size: 0.85rem;
}

.hidden { display: none !important; }

.messages {
  display: grid;
  gap: 0.6rem;
  max-height: 420px;
  overflow: auto;
}

.message {
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  max-width: 85%;
}

.message.inbound { background: #ecfeff; align-self: start; }
.message.outbound { background: #f5f5f4; align-self: end; margin-left: auto; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.tenant-picker {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #d6d3d1;
}

.tenant-picker select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #57534e;
  background: #292524;
  color: #fafaf9;
}

.role-badge {
  display: inline-block;
  margin: 0 0 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #44403c;
  color: #e7e5e4;
}

.legacy-login {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.legacy-login summary {
  cursor: pointer;
}

.checkbox-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
}

.sidebar nav button.hidden {
  display: none;
}

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
}
