/*
 * Teacher Tools shared tokens and components.
 *
 * The site is light-theme only. Every color used by the shared chrome,
 * dialogs and editor shells resolves from the --tt-* tokens below.
 */
:root {
  --tt-bg: #FFFFFF;
  --tt-surface: #FFFFFF;
  --tt-surface-alt: #FAFAFA;
  --tt-surface-muted: #F7F7F7;
  --tt-chip: #F2F2F2;
  --tt-text: #0F0F0F;
  --tt-text-secondary: #606060;
  --tt-text-tertiary: #8A8A8A;
  --tt-line: #E5E5E5;
  --tt-line-strong: #D8D8D8;
  --tt-hover: #F7F7F7;
  --tt-active: #F2F2F2;
  --tt-accent: #0F0F0F;
  --tt-on-accent: #FFFFFF;
  --tt-accent-hover: #2A2A2A;
  --tt-focus: #0F0F0F;
  --tt-overlay: rgba(15, 15, 15, .46);
  --tt-shadow: 0 18px 50px rgba(15, 15, 15, .14);
  --tt-danger: #C50028;
  --tt-danger-soft: #FFF0F3;
  --tt-danger-line: #FFCED8;
  --tt-success: #058248;
  color-scheme: light;
}

/* ------------------------------------------------------------ Site tokens */
html[data-app="site"] {
  --bg: var(--tt-bg);
  --text: var(--tt-text);
  --muted: var(--tt-text-secondary);
  --soft: var(--tt-text-tertiary);
  --chip: var(--tt-chip);
  --line: var(--tt-line);
  --red: #FF0033;
}

/* --------------------------------------------------- Shared components */
.account-popover {
  width: 244px;
}

.account-popover .popover-item {
  padding: 10px 12px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  min-width: 0;
}

.account-identity-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--tt-chip);
  color: var(--tt-text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.account-identity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-identity-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-identity-copy strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--tt-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity-copy span {
  font-size: 12.5px;
  color: var(--tt-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid var(--tt-line-strong);
  background: var(--tt-surface);
  color: var(--tt-text);
  font-size: 14px;
  font-weight: 600;
  transition: background .18s ease, border-color .18s ease;
}

.btn-signin:hover {
  background: var(--tt-hover);
  border-color: var(--tt-text-tertiary);
}

.profile-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-actions .edit-profile-btn {
  margin-left: 0;
}

.signout-btn,
.signin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--tt-line-strong);
  background: transparent;
  color: var(--tt-text);
  font-size: 14px;
  font-weight: 600;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.signout-btn:hover {
  background: var(--tt-danger-soft);
  border-color: var(--tt-danger-line);
  color: var(--tt-danger);
}

.signin-link:hover {
  background: var(--tt-hover);
  border-color: var(--tt-text-tertiary);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.share-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--tt-line);
  border-radius: 12px;
  background: var(--tt-surface-alt);
  color: var(--tt-text-secondary);
  font-size: 13.5px;
  line-height: 1.45;
  cursor: pointer;
}

.share-field input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--tt-accent);
  cursor: pointer;
}

.profile-role:empty {
  display: none;
}

/* Published content detail */
.doc-main--published {
  max-width: 1280px;
}

.doc-published-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 18px 0 22px;
  font-size: 13.5px;
  color: var(--tt-text-secondary);
}

.doc-published-meta .doc-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.doc-published-meta .doc-detail .icon {
  width: 16px;
  height: 16px;
  color: var(--tt-text-tertiary);
}

.pub-frame-wrap {
  border: 1px solid var(--tt-line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--tt-surface);
  box-shadow: var(--tt-shadow);
}

.pub-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 320px);
  min-height: 540px;
  border: 0;
  background: #FFFFFF;
}

.pub-missing {
  padding: 28px;
  font-size: 14.5px;
  color: var(--tt-text-secondary);
}

@media (max-width: 700px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .profile-actions {
    margin-left: 0;
    width: 100%;
  }

  .profile-actions .edit-profile-btn,
  .profile-actions .signout-btn,
  .profile-actions .signin-link {
    flex: 1;
  }

  .pub-frame {
    height: calc(100vh - 260px);
    min-height: 460px;
  }
}

/* --------------------------------------------------- Deployment status */
.tt-backend-banner {
  position: sticky;
  top: 0;
  z-index: 400;
  padding: 10px 18px;
  background: var(--tt-danger-soft);
  color: var(--tt-danger);
  border-bottom: 1px solid var(--tt-danger-line);
  font: 500 13.5px/1.45 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: center;
}
