/* Shared visual layer for all tenant-dashboard pages.
 * Theme driven by CSS custom properties injected per tenant in the page head.
 */
:root {
  --primary: #2c5f8d;
  --accent: #f39c12;
  --bg: #ffffff;
  --panel: #f6f8fa;
  --text: #24292e;
  --muted: #6a737d;
  --border: #e1e4e8;
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--bg); }

body {
  font-family: var(--font-family, 'Inter'), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ===== header ===== */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header .mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 7px;
  flex-shrink: 0;
}
header .logo {
  height: 32px; width: auto; max-width: 140px; flex-shrink: 0;
}
header .brand {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header .spacer { flex: 1; min-width: 8px; }

header .user-chip {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
header .user-chip .avatar {
  width: 28px; height: 28px; border-radius: 14px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
header .user-chip .email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header .user-chip form { display: inline; margin: 0; }
header .user-chip button {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-family: inherit; font-size: 12px; padding: 4px 8px;
  border-radius: var(--radius-sm); min-height: 32px;
}
header .user-chip button:hover { color: var(--primary); background: var(--bg); }

/* ===== main layout ===== */
main { flex: 1; padding: 28px 20px; }
.container { max-width: 960px; margin: 0 auto; }
.narrow { max-width: 480px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.card h1 {
  font-size: 22px; font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.3;
}
.card h2 {
  font-size: 17px; font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
}
.card p { color: var(--muted); margin-bottom: 14px; }

/* ===== forms ===== */
input[type="email"], input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  padding: 12px 13px;
  font-size: 16px; /* iOS won't zoom on focus if >= 16px */
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  min-height: 44px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44,95,141,0.15);
}

button.primary, .btn.primary {
  width: 100%;
  padding: 12px 16px;
  background: var(--primary); color: #fff;
  border: 0; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s, transform .05s;
  min-height: 44px;
}
button.primary:hover, .btn.primary:hover { opacity: 0.92; }
button.primary:active, .btn.primary:active { transform: translateY(1px); }
button.primary:disabled, .btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== banners ===== */
.banner {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 14px;
}
.banner.error { background: #ffeef0; border: 1px solid #fdaeb7; color: #86181d; }
.banner.info  { background: #dbedff; border: 1px solid #79b8ff; color: #032f62; }

/* ===== utilities ===== */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-row {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 14px 20px;
  margin-top: 20px;
}
.status-row strong { color: var(--text); font-weight: 500; }

/* ===== footer ===== */
footer {
  text-align: center; padding: 18px;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
}
footer a { color: var(--muted); margin: 0 8px; text-decoration: none; }
footer a:hover { color: var(--primary); text-decoration: underline; }

/* ===== mobile ===== */
@media (max-width: 640px) {
  header { padding: 12px 14px; gap: 10px; }
  header .brand { font-size: 14px; }
  header .user-chip .email { max-width: 120px; font-size: 11px; }
  header .user-chip button { padding: 4px 6px; }

  main { padding: 20px 14px; }
  .card { padding: 22px 18px; border-radius: 8px; }
  .card h1 { font-size: 20px; }

  .status-row { gap: 8px 14px; font-size: 11px; }
}

@media (max-width: 380px) {
  header .user-chip .avatar { width: 24px; height: 24px; font-size: 11px; }
  header .user-chip .email { display: none; } /* keep just the avatar + sign-out on very small screens */
}
