/* Tecora IMS shell — ported from Apps Script Centralizer header.html + tokens */
:root {
  --hdr-bg-from: #0f172a;
  --hdr-bg-mid: #1e3a8a;
  --hdr-bg-to: #2563eb;
  --c-muted: #64748b;
  --c-text: #0f172a;
  --c-bg: #f4f7fb;
  --c-border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

body.dashboard-body {
  background: var(--c-bg);
  padding: 24px;
}

.dashboard-card {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.dashboard-card h2 {
  margin: 0 0 12px;
  color: var(--c-text);
  font-size: 22px;
}

.dashboard-card p {
  margin: 0 0 12px;
  line-height: 1.5;
  color: var(--c-text);
}

.dashboard-hint {
  font-size: 13px;
  color: var(--c-muted);
}

.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(90deg, var(--hdr-bg-from), var(--hdr-bg-mid), var(--hdr-bg-to));
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 1000;
  gap: 12px;
}

.shell-brand strong {
  font-size: 18px;
  letter-spacing: 0.02em;
}

.shell-brand small {
  display: block;
  opacity: 0.9;
  font-size: 12px;
  margin-top: 2px;
}

.shell-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.shell-menu button {
  background: transparent;
  border: none;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

.shell-menu button:hover,
.shell-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.shell-menu button.is-active {
  background: rgba(255, 255, 255, 0.28);
}

/* Fail-safe: before login, only the Login button should be visible */
body.pre-login .shell-menu button[data-auth-required="1"] {
  display: none;
}
body.pre-login .shell-menu .menu-group[data-auth-required="1"] {
  display: none;
}

.menu-group {
  position: relative;
}

.menu-group-toggle {
  background: transparent;
  border: none;
  color: white;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.menu-group-toggle:hover,
.menu-group-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.menu-group-list {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  z-index: 1500;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
  padding: 6px;
}
.menu-group.open .menu-group-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-group-list button {
  border: none;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
}
.menu-group-list button:hover {
  background: #eff6ff;
}
.menu-group-list button.is-active {
  background: #dbeafe;
  color: #1e3a8a;
}

#moduleFrame {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  height: calc(100vh - 70px);
  border: none;
  background: #fff;
}

#centralBusyOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}

#centralBusyOverlay.central-busy-visible {
  display: flex;
}

.central-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: central-spin 0.75s linear infinite;
}

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

#centralBusyMsg {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

#centralAlertOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 21000;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}

#centralAlertOverlay.central-open {
  display: flex;
}

#centralAlertBox {
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.22);
}

#centralAlertTitle {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
}

#centralAlertMsg {
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: 18px;
  line-height: 1.45;
}

.central-alert-actions {
  text-align: right;
}

.btn-primary {
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  background: #2563eb;
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.frame-error-banner {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  z-index: 900;
  display: none;
  padding: 10px 20px;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  font-size: 13px;
  color: #78350f;
}

.frame-error-banner.visible {
  display: block;
}

@media (max-width: 920px) {
  .shell-header {
    height: auto;
    min-height: 70px;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .shell-menu {
    width: 100%;
    justify-content: flex-start;
  }

  .menu-group-list {
    right: auto;
    left: 0;
  }

  #moduleFrame {
    top: var(--hdr-offset, 70px);
    height: calc(100vh - var(--hdr-offset, 70px));
  }
}
