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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f4f4f7;
  color: #1d1d1f;
}

body {
  display: flex;
  flex-direction: column;
}

.portal-header {
  background: #002a5c;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.portal-brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.portal-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.portal-subtitle {
  font-size: 12px;
  opacity: 0.8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.signout-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.signout-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
}

.signout-btn:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.signout-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

main {
  flex: 1;
  overflow: hidden;
  display: flex;
  background: #ffffff;
}

#chat-container {
  flex: 1;
  display: flex;
  position: relative;
  min-height: 0;
}

#chat-container iframe {
  border: 0;
  width: 100% !important;
  height: 100% !important;
}

.loading,
.error {
  margin: auto;
  text-align: center;
  padding: 32px;
  max-width: 520px;
}

.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid #e4e4e7;
  border-top-color: #002a5c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: #555;
  font-size: 14px;
}

.error h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #b00020;
}

.error p {
  margin-bottom: 16px;
  color: #444;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
}

.error button {
  background: #002a5c;
  color: #fff;
  border: 0;
  padding: 10px 24px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.error button:hover {
  background: #003a82;
}

.error button:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

.signed-out {
  margin: auto;
  text-align: center;
  padding: 32px;
  max-width: 480px;
}

.signed-out-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e8f3ed;
  color: #1f7a3a;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 20px;
}

.signed-out h2 {
  font-size: 20px;
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}

.signed-out p {
  color: #555;
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 24px;
}

.primary-action {
  background: #002a5c;
  color: #fff;
  border: 0;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease;
}

.primary-action:hover {
  background: #003a82;
}

.primary-action:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}
