@import url("/world.css");
:root {
  font-family: system-ui, -apple-system, Arial, sans-serif;
  color: #f4e6cf;
  color-scheme: dark;
  /* BrainO Aid red/gold theme — matches the homepage */
  --gold: #f2b544; --gold-hi: #f9d27a; --gold-lo: #b9821f;
  --ink: #2a0708; --text: #f4e6cf; --muted: #c39a86;
  --line: rgba(242,181,68,.24); --line-soft: rgba(242,181,68,.14);
  --box-bg: rgba(0,0,0,.22); --box-bg-soft: rgba(0,0,0,.14);
  --field-bg: rgba(0,0,0,.30); --panel-bg: rgba(30,6,7,.97);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse 950px 560px at 50% -8%, #8a1a1e 0%, rgba(138,26,30,0) 60%),
    radial-gradient(ellipse 700px 500px at 88% 12%, #6d1216 0%, rgba(109,18,22,0) 55%),
    linear-gradient(180deg, #430b0e 0%, #360a0c 55%, #2c080a 100%);
  background-attachment: fixed;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

.dash-shell { display: flex; min-height: 100vh; }

.dash-sidebar {
  width: 236px;
  flex-shrink: 0;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(30, 6, 7, .55);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dash-side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-brand { color: var(--gold); text-decoration: none; font-size: 1.15rem; font-weight: 900; padding: 0 8px; }
.dash-menu-toggle { display: none; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(242,181,68,.12); color: var(--gold); font-weight: 800; font-size: .9rem; cursor: pointer; }
.dash-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #e9d7c2;
  font-size: .92rem;
  font-weight: 600;
}
.dash-nav a:hover { background: rgba(242,181,68,.10); }
.dash-nav a.active { background: var(--gold); color: var(--ink); }
.dash-account { padding: 10px 8px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.dash-account strong { display: block; color: var(--text); font-size: .88rem; margin-bottom: 2px; }
.dash-logout {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.dash-logout:hover { background: rgba(242,181,68,.10); }

.dash-main { flex: 1; min-width: 0; padding: 28px min(4vw, 48px) 60px; }
.dash-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.dash-header h1 { margin: 0; font-size: 1.5rem; color: var(--gold-hi); }
.dash-header p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

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

.dash-card {
  background: var(--box-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(242,181,68,.06) inset, 0 18px 38px rgba(0,0,0,.32);
}
.dash-card h2, .dash-card h3 { margin-top: 0; color: var(--gold-hi); }
.dash-card + .dash-card { margin-top: 16px; }

.tile { display: flex; flex-direction: column; gap: 8px; }
.tile-top { display: flex; justify-content: space-between; align-items: center; }
.tile-title { font-weight: 800; font-size: 1.02rem; }
.tile-sub { color: var(--muted); font-size: .84rem; }
.tile-cta { margin-top: 6px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.badge-active { background: rgba(80, 200, 120, .18); color: #7fe3a8; }
.badge-pending { background: rgba(242, 181, 68, .18); color: var(--gold); }
.badge-not { background: rgba(255,255,255,.08); color: var(--muted); }
.badge-warn { background: rgba(230, 90, 90, .2); color: #ff9b9b; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--box-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-card strong { font-size: 1.3rem; color: var(--gold-hi); }
.stat-card span { color: var(--muted); font-size: .78rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: none;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-size: .88rem;
  box-shadow: 0 8px 20px rgba(242,181,68,.22);
}
.button:hover { background: var(--gold-hi); }
.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.button.secondary:hover { background: rgba(242,181,68,.10); }
.button.danger { background: transparent; color: #ff9b9b; border: 1px solid #6b2f2f; box-shadow: none; }
.button:disabled { opacity: .5; cursor: default; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: #e9d7c2; margin-bottom: 10px; }
input, select, textarea {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,181,68,.16); }
input::placeholder, textarea::placeholder { color: #a1897c; }
textarea { resize: vertical; min-height: 70px; }
input[type="checkbox"] { width: auto; accent-color: var(--gold); }
.checkbox-row { flex-direction: row; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab-btn {
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: .88rem;
}
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }

.status-msg { font-size: .84rem; color: var(--muted); min-height: 1.1em; }
.status-msg.error { color: #ff9b9b; }
.status-msg.ok { color: #7fe3a8; }

.empty-state { color: var(--muted); font-size: .88rem; padding: 20px 0; text-align: center; }

.business-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: var(--box-bg-soft); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }

.chat-thread { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; padding: 4px; }
.chat-bubble { align-self: flex-start; max-width: 70%; background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: .88rem; }
.chat-bubble.mine { align-self: flex-end; background: rgba(242,181,68,.15); border-color: var(--gold); }
.chat-time { display: block; font-size: .7rem; color: var(--muted); margin-top: 4px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel-bg); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.login-card h1 { color: var(--gold); margin: 0 0 6px; font-size: 1.3rem; }
.login-card p.lead { color: var(--muted); margin: 0 0 24px; font-size: .88rem; }
.pairing-details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.pairing-details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.pairing-details form { margin-top: 12px; }

@media (max-width: 820px) {
  .dash-shell { flex-direction: column; }
  /* Sidebar becomes a compact top bar; the nav collapses into a tap-to-open dropdown. */
  .dash-sidebar { width: auto; flex-direction: column; gap: 0; padding: 12px 14px;
    position: sticky; top: 0; z-index: 40; border-right: 0; border-bottom: 1px solid var(--line); }
  .dash-menu-toggle { display: inline-flex; }
  .dash-nav { display: none; margin-top: 12px; max-height: 70vh; overflow-y: auto; }
  .dash-sidebar.menu-open .dash-nav { display: flex; flex-direction: column; }
  .dash-account { display: none; }
  .dash-sidebar.menu-open .dash-account { display: block; }
  .dash-logout { display: none; }
  .dash-sidebar.menu-open .dash-logout { display: block; }
}
