/* SBC Associate Portal — v0.1-preview-portal-shell
   Professional dark restrained theme, teal accents, accessible focus */

:root {
  --bg: #0e1419;
  --bg-elevated: #151d25;
  --bg-panel: #1a2430;
  --bg-hover: #223040;
  --border: #2a3a4a;
  --text: #e8eef4;
  --text-muted: #9aabbc;
  --text-dim: #6b7d8f;
  --teal: #2dd4bf;
  --teal-dim: #14b8a6;
  --teal-bg: rgba(45, 212, 191, 0.12);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --focus: #5eead4;
  --radius: 6px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1100px;
  --nav-w: 240px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.65rem 0 0.25rem;
}

.field-input {
  display: block;
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.identity-form {
  margin-top: 0.5rem;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--teal);
  color: #042f2e;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.env-banner {
  background: linear-gradient(90deg, #0f766e, #134e4a);
  color: #ecfdf5;
  text-align: center;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #2dd4bf55;
}
.env-banner code {
  font-family: var(--mono);
  font-size: 0.75rem;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--teal); }
a:hover { color: #5eead4; }

#app { min-height: calc(100vh - 2rem); }

/* Layout shell */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: calc(100vh - 2.2rem);
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  padding: 0 0.5rem;
}
.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.brand-sub {
  font-size: 0.7rem;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.2rem 0 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-list a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.nav-list a:hover { background: var(--bg-hover); color: var(--text); }
.nav-list a[aria-current="page"] {
  background: var(--teal-bg);
  color: var(--teal);
  font-weight: 600;
}

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.75rem 0.65rem 0.25rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid #2dd4bf44;
}

.privacy-banner {
  margin: 0;
  padding: 0.65rem 1.5rem;
  background: var(--warn-bg);
  border-bottom: 1px solid #f59e0b44;
  color: #fcd34d;
  font-size: 0.8rem;
}

.fixture-banner {
  margin: 0 0 1.25rem;
  padding: 0.5rem 0.85rem;
  background: var(--danger-bg);
  border: 1px solid #f8717144;
  border-radius: var(--radius);
  color: #fecaca;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.page {
  padding: 1.5rem;
  max-width: var(--max);
  width: 100%;
}

.page h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 700;
}
.page .lede {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  max-width: 42rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.65rem;
  font-weight: 600;
}
h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

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

.stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--teal);
  margin: 0;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.panel p:last-child { margin-bottom: 0; }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); font-size: 0.85em; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: #042f2e;
  background: var(--teal);
}
.btn:hover { background: #5eead4; color: #042f2e; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: #f8717144;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1rem 0;
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.hint {
  font-size: 0.8rem;
  color: var(--warn);
  margin-top: 0.35rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--teal-bg);
  color: var(--teal);
}
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Public pages (login / access-denied) */
.public-wrap {
  max-width: 520px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
}
.public-wrap h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.25rem;
}
.login-warn {
  background: var(--warn-bg);
  border: 1px solid #f59e0b55;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: #fcd34d;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.preview-selector-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.65rem;
  background: var(--danger-bg);
  border: 1px solid #f8717144;
  border-radius: var(--radius);
}

.list-plain {
  margin: 0;
  padding-left: 1.2rem;
}
.list-plain li { margin-bottom: 0.4rem; }

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}
.status-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.status-pill.warn { border-color: #f59e0b55; color: var(--warn); }
.status-pill.ok { border-color: #2dd4bf55; color: var(--teal); }

.p0-thread {
  margin-top: 1rem;
}
.p0-msg-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.p0-msg {
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.p0-msg p { margin: 0 0 0.35rem; }
.p0-conv-item {
  margin: 0.75rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.p0-comment-form .field-input {
  max-width: 100%;
}
textarea.field-input {
  resize: vertical;
  min-height: 4.5rem;
}
select.field-input[multiple] {
  max-width: 100%;
  min-height: 6rem;
}
.p0-notes {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  overflow-x: auto;
  font-family: inherit;
  font-size: 0.9rem;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0.25rem 0 0.75rem;
}

@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-footer { display: none; }
  .page { padding: 1rem; }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
