/* Shared chrome for every authenticated page: topbar, filters, badges,
   connection status, login card, shortcut footer, build info.
   Page-specific layout (sources grid, switch panels, etc.) lives in the
   page's own CSS file. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #0a0a0a;
  color: #eee;
  overflow: hidden;
}

/* --- topbar --- */

#topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #151515;
  border-bottom: 1px solid #2a2a2a;
  flex: 0 0 auto;
}

#topbar h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#topbar label {
  font-size: 0.85rem;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#topbar select {
  background: #222;
  color: #eee;
  border: 1px solid #333;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

#read-only-banner {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fc3;
  background: rgba(80, 60, 0, 0.4);
  border: 1px solid #5a4400;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}

#user-badge {
  font-size: 0.75rem;
  color: #aaa;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace;
}

#user-badge .role {
  color: #888;
  margin-left: 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#user-badge .role.admin { color: #f6c; }
#user-badge .role.operator { color: #8af; }
#user-badge .role.viewer { color: #8c8; }

#connection-status {
  margin-left: auto;
  font-size: 0.8rem;
  color: #888;
  font-family: ui-monospace, Menlo, monospace;
}

#connection-status.connected { color: #6c6; }
#connection-status.disconnected { color: #c66; }

#admin-link,
#switch-link,
#multiview-link {
  font-size: 0.75rem;
  color: #888;
  text-decoration: none;
  padding: 0.2rem 0.4rem;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
}

#admin-link:hover,
#switch-link:hover,
#multiview-link:hover { color: #eee; background: #222; }

#logout-link {
  font-size: 0.75rem;
  color: #888;
  text-decoration: none;
  padding: 0.2rem 0.4rem;
}

#logout-link:hover { color: #eee; }

/* --- filter dropdowns --- */

.filter-menu {
  position: relative;
  font-size: 0.85rem;
}

.filter-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  background: #222;
  color: #ddd;
  border: 1px solid #333;
  border-radius: 3px;
  user-select: none;
}

.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary:hover { background: #2a2a2a; }
.filter-menu[open] > summary { background: #2a2a2a; border-color: #08f; }

.filter-menu .badge {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7rem;
  padding: 0 0.35rem;
  border-radius: 8px;
  background: #08f;
  color: #001;
  font-weight: 700;
  vertical-align: middle;
}

.filter-menu .badge:empty { display: none; }

.filter-body {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 50;
  min-width: 180px;
  max-height: 340px;
  overflow-y: auto;
  background: #181818;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.filter-body label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.1rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.filter-body label:hover { color: #fff; }

.filter-body input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.filter-body .empty {
  color: #666;
  font-style: italic;
  padding: 0.3rem 0.1rem;
}

.filter-body .actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid #2a2a2a;
}

.filter-body .actions button {
  flex: 1;
  background: #1a1a1a;
  color: #aaa;
  border: 1px solid #2a2a2a;
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
}

.filter-body .actions button:hover { background: #222; color: #fff; }

/* --- read-only / viewer-mode chrome (TAKE is global) --- */

body.viewer-mode #take-btn,
body.read-only #take-btn { display: none; }

/* --- shortcut footer + build info --- */

#shortcut-hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 1rem;
  background: #0f0f0f;
  border-top: 1px solid #222;
  font-size: 0.75rem;
  color: #666;
  text-align: center;
}

#shortcut-hint kbd {
  background: #222;
  border: 1px solid #333;
  padding: 0 0.3rem;
  border-radius: 2px;
  font-family: ui-monospace, Menlo, monospace;
  color: #aaa;
}

#build-info {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: ui-monospace, Menlo, monospace;
  color: #555;
  font-size: 0.7rem;
}

/* --- login screen --- */

#login-shell {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

#login-card {
  width: 100%;
  max-width: 320px;
  padding: 2rem;
  background: #151515;
  border: 1px solid #252525;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#login-card h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#login-card .subhead {
  margin: 0;
  font-size: 0.85rem;
  color: #888;
}

#login-card input[type="password"],
#login-card input[type="text"] {
  background: #0c0c0c;
  border: 1px solid #2a2a2a;
  color: #eee;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  border-radius: 3px;
  outline: none;
  transition: border-color 100ms ease;
}

#login-card input[type="password"]:focus,
#login-card input[type="text"]:focus {
  border-color: #08f;
}

#login-card button[type="submit"] {
  background: #c00;
  color: #fff;
  border: none;
  padding: 0.7rem 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background 100ms ease;
}

#login-card button[type="submit"]:hover {
  background: #e00;
}

#login-card .login-error {
  background: rgba(180, 0, 0, 0.15);
  border: 1px solid rgba(255, 60, 60, 0.4);
  color: #f99;
  padding: 0.5rem 0.7rem;
  border-radius: 3px;
  font-size: 0.85rem;
}
