/* Builder Partner Platform — same style as login panel (teal, pill, clean) */
:root {
  --bg-page: #f7f4ee;
  --bg-card: #ffffff;
  --bg-card-alt: #fffaf2;
  --bg-sidebar: #fff9f2;
  --bg-sidebar-hover: rgba(45,95,95,0.08);
  --text-primary: #171717;
  --text-secondary: #4b5563;
  --text-muted: #7b8794;
  --text-inverse: #f8fafc;
  --sidebar-link: #1f2937;
  --border: rgba(31, 41, 55, 0.08);
  --border-focus: #2d5f5f;
  --accent: #2d5f5f;
  --accent-hover: #245050;
  --accent-soft: rgba(45,95,95,0.08);
  --accent-light: #d7ede6;
  --success: #2d8f6f;
  --error: #dc2626;
  --radius: 0.9rem;
  --radius-lg: 1.6rem;
  --radius-xl: 2rem;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 28px 60px rgba(15, 23, 42, 0.12);
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* ----- App shell ----- */
.app-body {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent) 0, transparent 34%),
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 8%, transparent) 0, transparent 28%),
    linear-gradient(180deg, #fffdf9 0%, var(--bg-page) 100%);
  color: var(--text-primary);
  min-height: 100vh;
}
.app-shell { display: flex; min-height: 100vh; }

/* ----- Sidebar ----- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  border-right: 1px solid var(--border);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}
.sidebar-brand-text { font-weight: 600; font-size: 1rem; }
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--sidebar-link);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--bg-sidebar-hover); color: var(--text-inverse); }
.sidebar-link-active { background: var(--bg-sidebar-hover); color: var(--accent-light); border-left: 3px solid var(--accent-light); padding-left: calc(1rem - 3px); }
.sidebar-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-link-logout,
.sidebar-link-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  color: var(--sidebar-link);
}
.sidebar-link-logout:hover,
.sidebar-link-toggle:hover { color: var(--text-inverse); }
.sidebar-link-logout:hover { color: #fecaca; }

/* Sidebar icon-only mode */
.sidebar--icon-only {
  width: 72px;
  min-width: 72px;
}
.sidebar--icon-only .sidebar-brand {
  justify-content: center;
  padding-left: 1rem;
  padding-right: 1rem;
}
.sidebar--icon-only .sidebar-brand-text {
  display: none;
}
.sidebar--icon-only .sidebar-nav {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.sidebar--icon-only .sidebar-link {
  justify-content: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.sidebar--icon-only .sidebar-link-text {
  display: none;
}
.sidebar--icon-only .sidebar-link-active {
  padding-left: 0.75rem;
}
.sidebar--icon-only .sidebar-footer .sidebar-link {
  justify-content: center;
}

/* ----- Main ----- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: rgba(255,255,255,0.74);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.04);
}
.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.topbar-menu-btn:hover { background: var(--bg-page); }
.topbar-menu-icon { width: 1.375rem; height: 1.375rem; }
.topbar-title { margin: 0; font-size: 1.45rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; }
.topbar-subtitle { margin: 0.25rem 0 0 0; font-size: 0.875rem; color: var(--text-secondary); }
.topbar-home {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-pill);
  transition: background 0.15s, color 0.15s;
}
.topbar-home:hover { background: rgb(45 95 95 / 0.08); color: var(--accent-hover); }
.main-content { flex: 1; padding: 1.65rem; }

/* ----- Bottom nav (mobile only) ----- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  z-index: 800;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 -2px 10px rgb(0 0 0 / 0.1);
}
.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  padding: 0.375rem 0.5rem;
  color: var(--sidebar-link);
  text-decoration: none;
  font-size: 0.625rem;
  font-weight: 500;
  border-radius: var(--radius);
  min-width: 56px;
  flex: 1;
  max-width: 80px;
}
.bottom-nav-link:hover { color: var(--text-inverse); background: var(--bg-sidebar-hover); }
.bottom-nav-link.bottom-nav-link-active { color: var(--accent-light); }
.bottom-nav-link .sidebar-icon { width: 1.25rem; height: 1.25rem; }
.bottom-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ----- Mobile: single breakpoint (overlay sidebar + bottom nav) ----- */
@media (max-width: 768px) {
  .topbar-menu-btn { display: flex; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
  }
  .app-body.sidebar-open .sidebar-overlay { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 260px;
    min-width: 260px;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    border-radius: 0;
  }
  .app-body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar--icon-only { width: 72px; min-width: 72px; }
  .sidebar-nav { flex-direction: column; display: flex; flex: 1; padding: 1rem 0.75rem; }
  .app-shell .main { margin-left: 0; padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 1rem); }
  .topbar { padding: 0.75rem 1rem; gap: 0.5rem; }
  .topbar-title { font-size: 1.0625rem; }
  .topbar-subtitle { font-size: 0.8125rem; }
  .main-content { padding: 1rem; }
  .bottom-nav { display: flex; }
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }
  .field-group,
  .field-group--compact {
    min-width: 0;
    width: 100%;
  }
  .data-table {
    min-width: 760px;
  }
}

/* ----- Cards ----- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header { padding: 1.35rem 1.5rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-title { margin: 0; font-size: 1.28rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.card-body { padding: 1.5rem; }

.section-shell {
  display: grid;
  gap: 1.15rem;
}

.section-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-intro-copy h2,
.section-intro-copy h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-intro-copy p {
  margin: 0.35rem 0 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.field-group {
  min-width: 180px;
  flex: 1 1 180px;
}

.field-group--compact {
  min-width: 140px;
  flex: 0 1 160px;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.82rem 0.95rem;
  font-size: 0.94rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: rgba(255,255,255,0.96);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 35%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, white);
  background: #ffffff;
}

.btn-primary,
.btn-outline,
.toolbar-link {
  min-height: 2.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.btn-primary {
  padding: 0.72rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn-outline {
  padding: 0.72rem 1rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(255,255,255,0.96);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, white);
  border-radius: var(--radius-pill);
}

.btn-outline:hover {
  background: color-mix(in srgb, var(--accent) 7%, white);
}

.toolbar-link {
  text-decoration: none;
}

.section-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  padding: 0.85rem 0.75rem;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 1rem 0.75rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 10%, white);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, white);
}

.data-title {
  margin: 0;
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--text-primary);
}

.data-meta {
  margin: 0.2rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.34rem 0.68rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 10%, white);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
}

.text-link:hover {
  text-decoration: underline;
}

/* ----- Login page ----- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}
.login-container { width: 100%; max-width: 420px; }
.login-card {
  background: var(--bg-card);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  border: 1px solid var(--border);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
.login-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
}
.login-logo-text { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.login-title { font-size: 1.5rem; font-weight: 600; margin: 0 0 0.25rem 0; color: var(--text-primary); }
.login-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin: 0 0 1.5rem 0; }
.login-form .field { margin-bottom: 1.25rem; }
.login-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}
.login-form input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgb(45 95 95 / 0.2);
}
.login-form input::placeholder { color: var(--text-muted); }
.login-error { font-size: 0.8125rem; color: var(--error); margin-top: 0.25rem; }
.login-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.btn-primary {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); opacity: 0.95; }
.btn-primary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.login-form input:focus-visible { outline: none; }
.login-back { font-size: 0.875rem; color: var(--text-secondary); text-decoration: none; }
.login-back:hover { color: var(--accent); text-decoration: underline; }
.login-demo {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f1f5f9;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.login-demo strong { color: var(--text-primary); }
.login-demo code { background: #e2e8f0; padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.75rem; }

/* ----- Register form: select, textarea, sections ----- */
.login-form select,
.login-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  background: var(--bg-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form select:focus,
.login-form textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgb(45 95 95 / 0.2);
}
.login-form textarea {
  min-height: 4rem;
  resize: vertical;
}
.register-section { margin-bottom: 1.75rem; }
.register-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.register-section:first-child .register-section-title { margin-top: 0; }
.login-container.register-wide { max-width: 480px; }
.login-card.register-card { padding: 2rem 2.25rem; }
.msg-success {
  font-size: 0.9375rem;
  color: var(--success);
  font-weight: 500;
  margin: 0 0 1rem 0;
  padding: 0.75rem 1rem;
  background: rgb(45 95 95 / 0.1);
  border-radius: var(--radius);
}

/* ----- Dashboard ----- */
.dashboard-welcome { margin-bottom: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }
.profile-card { max-width: 400px; }
.profile-row { display: flex; padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.9375rem; }
.profile-row:last-child { border-bottom: none; }
.profile-row dt { margin: 0; color: var(--text-secondary); width: 120px; flex-shrink: 0; }
.profile-row dd { margin: 0; color: var(--text-primary); font-weight: 500; }
.role-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-radius: var(--radius-pill);
  background: rgb(45 95 95 / 0.12);
  color: var(--accent-hover);
}
.role-badge.super_admin { background: #fef3c7; color: #b45309; }
.role-badge.builder_admin { background: #d4f0e8; color: #245050; }

/* ----- Forms page: actions and links ----- */
.forms-create-block {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.forms-create-block .forms-create-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.forms-create-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.forms-create-buttons .btn-primary { padding: 0.375rem 0.75rem; font-size: 0.875rem; }
.forms-create-blank {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.forms-create-blank:hover { text-decoration: underline; }
.btn-outline {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline.copied { border-color: var(--success); color: var(--success); }
.form-link-cell {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 280px;
}
.form-link-url {
  display: block;
  word-break: break-all;
  margin-bottom: 0.5rem;
}
.form-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}
.form-link-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.form-actions .form-action-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.form-actions .form-action-link:hover { text-decoration: underline; }
.form-actions .form-action-btn {
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.form-actions .form-action-btn.set-active { color: var(--accent); }
.form-actions .form-action-btn.set-active:hover { text-decoration: underline; }
.form-actions .form-action-btn.delete { color: var(--error); }
.form-actions .form-action-btn.delete:hover { text-decoration: underline; }
.forms-table-section { margin-top: 1.5rem; }
.forms-table-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.badge-active {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: rgb(45 95 95 / 0.12);
  color: var(--success);
}
.badge-inactive {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--border);
  color: var(--text-secondary);
}

/* ----- Responsive (desktop only; mobile uses 768px block above) ----- */
