:root {
  color-scheme: light;
  --ink: #17213f;
  --muted: #65728f;
  --line: #dfe6f5;
  --paper: #f7faff;
  --panel: #ffffff;
  --mint: #e5fbff;
  --green: #19a5b8;
  --green-dark: #2555bd;
  --coral: #ff7a00;
  --sun: #ffb23f;
  --sky: #eef3ff;
  --violet: #5936e8;
  --blue: #2e63d9;
  --cyan: #5bd7df;
  --orange: #ff850f;
  --orange-dark: #e35f00;
  --gold: #e4a500;
  --shadow: 0 20px 48px rgba(25, 45, 120, 0.14);
  --soft-shadow: 0 10px 28px rgba(25, 45, 120, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.28), transparent 26%),
    radial-gradient(circle at 84% 8%, rgba(255, 138, 0, 0.2), transparent 24%),
    linear-gradient(180deg, #6140ef 0%, #2f66de 48%, #55d1dc 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family:
    "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px 24px 28px;
}

.workspace {
  max-width: 1500px;
  margin: 0 auto;
}

.topbar,
.account-strip,
.document-toolbar,
.toolbar-actions,
.cost-row {
  display: flex;
  align-items: center;
}

.topbar {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  margin: -4px 0 10px 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo img {
  width: min(520px, calc(100vw - 116px));
  height: 160px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 18px 38px rgba(9, 35, 126, 0.28));
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  max-width: 980px;
  color: #ffffff;
  font-size: clamp(2rem, 3.35vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: 0;
  text-shadow: 0 14px 34px rgba(14, 28, 96, 0.26);
}

h2 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.2;
}

.account-strip {
  position: fixed;
  top: 226px;
  right: 22px;
  z-index: 29;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 12px;
  min-width: min(100%, 250px);
  padding-top: 0;
  transition: opacity 160ms ease;
}

body.menu-open .account-strip > div,
body.menu-open .share-button {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.account-strip div {
  width: 220px;
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.account-strip span,
.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.account-strip strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 1.05rem;
}

.menu-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: fixed;
  top: 58px;
  right: 22px;
  z-index: 30;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 30px rgba(40, 39, 143, 0.18);
}

.ghost-button.menu-button {
  min-width: 56px;
  min-height: 56px;
  padding: 0;
}

.menu-button span {
  display: block;
  width: 42px;
  height: 7px;
  border-radius: 4px;
  background: #ff7a00;
  box-shadow: 0 2px 10px rgba(255, 122, 0, 0.32);
}

.menu-popover {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 11;
  display: grid;
  gap: 10px;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 124px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 76px rgba(20, 36, 110, 0.28);
  opacity: 0;
  transform: translateY(-8px);
  transition: 180ms ease;
  pointer-events: none;
}

.menu-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-head p {
  margin: 0;
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 900;
}

#closeMenu {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sky);
  color: var(--green-dark);
  font-size: 1.1rem;
  font-weight: 900;
}

.menu-section {
  border: 1px solid rgba(222, 230, 246, 0.95);
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
}

.menu-section summary {
  min-height: 48px;
  padding: 13px 14px;
  color: var(--green-dark);
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.menu-section summary::-webkit-details-marker {
  display: none;
}

.menu-section summary::after {
  float: right;
  content: "⌄";
  font-weight: 900;
}

.menu-section[open] summary::after {
  content: "⌃";
}

.menu-section > div {
  padding: 0 12px 12px;
}

.share-menu-block {
  display: grid;
  gap: 12px;
}

.consultant-menu-block {
  display: grid;
  gap: 12px;
}

.consultant-menu-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.consultant-history-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.consultant-history-block summary {
  min-height: 44px;
  padding: 12px;
  color: var(--green-dark);
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.consultant-history-block summary::-webkit-details-marker {
  display: none;
}

.consultant-history-block ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
}

.consultant-history-block li {
  padding: 10px;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.consultant-history-block strong {
  display: block;
  color: var(--ink);
}

.consultant-analytics {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.84rem;
}

.consultant-analytics strong {
  color: var(--green-dark);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 84px;
}

.control-panel,
.editor-area,
.insights-panel {
  min-width: 0;
}

.control-panel,
.metric-tile,
.referral-box,
.partner-dashboard,
.model-box,
.payment-block {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.control-panel {
  padding: 18px;
}

.audience-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 8px 8px 18px;
  border: 1px solid rgba(222, 230, 246, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
}

.audience-tabs button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  padding: 0 14px;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(25, 45, 120, 0.07);
}

.audience-tabs button.active {
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 42%, #ff7a00 68%, var(--orange-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(255, 122, 0, 0.22);
}

.audience-tabs button::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -13px;
  width: 14px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #ffffff;
  box-shadow: -4px 6px 12px rgba(25, 45, 120, 0.06);
}

.audience-tabs button.active::before {
  border-color: rgba(255, 138, 0, 0.54);
  background: linear-gradient(180deg, var(--sun) 0%, var(--orange) 100%);
}

.document-type-field[hidden] {
  display: none;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  outline: 0;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #49c8d0;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(91, 215, 223, 0.2);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  background: #edf2fa;
  color: #8b96ad;
  border-color: #d8e1ef;
  box-shadow: none;
}

.cost-row {
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(91, 215, 223, 0.22), rgba(255, 138, 0, 0.1));
  color: var(--green-dark);
  font-size: 0.9rem;
  border: 1px solid rgba(91, 215, 223, 0.18);
}

.primary-button,
.secondary-button,
.ghost-button,
.payment-grid button,
.model-chip {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.primary-button {
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 42%, #ff7a00 68%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.3);
  transition:
    transform 180ms ease,
    background-position 420ms ease;
}

.share-button {
  width: 220px;
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 42%, #ff7a00 68%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.28);
  transition:
    transform 180ms ease,
    background-position 420ms ease;
}

.share-button:hover {
  background-position: right center;
}

.secondary-button {
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 48%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.26);
  transition:
    transform 180ms ease,
    background-position 420ms ease;
}

.ghost-button,
.payment-grid button,
.model-chip {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--green-dark);
}

.ghost-button.share-button {
  width: 220px;
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 42%, #ff7a00 68%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.28);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.payment-grid button:hover,
.model-chip:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.gold-button:active {
  transform: translateY(0);
}

#downloadPptx,
#downloadPdf,
#generatePromptPresentation {
  border: 1px solid rgba(255, 138, 0, 0.35);
  background: #fff7ed;
  color: #b84c00;
  box-shadow: none;
}

#downloadPptx:hover,
#downloadPdf:hover,
#generatePromptPresentation:hover {
  background: #ffefd8;
}

#downloadDocx,
#makeSlides,
#generatePresentation,
#confirmGift,
#copyShareLink,
#copyMenuReferral {
  box-shadow: 0 14px 30px rgba(255, 122, 0, 0.24);
}

.toolbar-actions button:disabled,
.presentation-generate-actions button:disabled,
.presentation-actions button:disabled {
  border-color: var(--line);
  background: #edf2fa;
  color: #8b96ad;
  box-shadow: none;
}

.payment-block {
  margin-top: 16px;
  padding: 16px;
  box-shadow: none;
}

.menu-payment {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.token-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.token-actions .gold-button {
  width: 100%;
}

.gold-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(120deg, var(--gold) 0%, #ffd76d 44%, #e9ab00 72%, #b77a00 100%);
  background-size: 220% 100%;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(217, 154, 0, 0.28);
  transition:
    transform 180ms ease,
    background-position 420ms ease;
}

.gold-button:hover {
  background-position: right center;
  transform: translateY(-1px);
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-grid button {
  position: relative;
  min-height: 62px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.58);
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 42%, #ff7a00 68%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.3);
  transition:
    transform 180ms ease,
    background-position 420ms ease;
}

.payment-grid button::before {
  position: absolute;
  inset: 0;
  height: auto;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  transform: translateX(-110%);
  transition: transform 420ms ease;
}

.payment-grid button::after {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.86);
  content: "AI-токены";
  font-size: 0.72rem;
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.payment-grid button:hover {
  background-position: right center;
}

.payment-grid button:hover::before {
  transform: translateX(110%);
}

#paymentText {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.editor-area {
  display: grid;
  gap: 16px;
}

.preview-hero {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  box-shadow: var(--shadow);
}

.preview-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(30, 46, 126, 0.86), rgba(25, 165, 184, 0.22));
}

.preview-hero img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  display: block;
}

.preview-hero div {
  position: absolute;
  z-index: 1;
  left: 24px;
  right: 24px;
  bottom: 22px;
}

.preview-hero p {
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

.preview-hero strong {
  display: block;
  max-width: 650px;
  font-size: clamp(1.35rem, 3vw, 2.3rem);
  line-height: 1.1;
}

.document-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(222, 230, 246, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.document-status {
  display: grid;
  gap: 8px;
}

#statusPill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

#statusPill.ready {
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 48%, var(--orange-dark) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 122, 0, 0.24);
}

#lastAction {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.control-panel .document-toolbar {
  margin-top: 16px;
  padding: 14px;
  grid-template-columns: 1fr;
  box-shadow: var(--soft-shadow);
}

.control-panel .toolbar-actions {
  grid-template-columns: 1fr;
  gap: 10px;
}

.toolbar-actions button,
.presentation-actions button {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

#lessonPlan {
  min-height: 590px;
  border-color: rgba(222, 230, 246, 0.95);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.58;
}

.revision-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.revision-box label {
  font-size: 1rem;
  color: var(--green-dark);
}

.revision-box textarea {
  min-height: 118px;
  background: var(--paper);
}

.revision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.revision-actions button {
  justify-self: start;
}

.voice-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 48%, var(--orange-dark) 100%);
  background-size: 220% 100%;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(255, 122, 0, 0.26);
}

.voice-button.listening {
  background: linear-gradient(120deg, #111827 0%, #ff8a00 48%, #111827 100%);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.18), 0 14px 32px rgba(255, 122, 0, 0.32);
}

.presentation-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.presentation-panel[hidden] {
  display: none;
}

.presentation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.presentation-head span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.presentation-head span.ready {
  background: linear-gradient(120deg, var(--orange) 0%, var(--sun) 48%, var(--orange-dark) 100%);
  color: #fff;
}

.presentation-head h2 {
  margin: 8px 0 4px;
}

.presentation-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

#presentationHint {
  margin-top: 8px;
  max-width: 520px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.presentation-generate-actions,
.presentation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.presentation-generate-actions button,
.presentation-actions button {
  border-radius: 8px;
}

.toolbar-actions button:disabled,
.presentation-generate-actions button:disabled,
.presentation-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.25);
  transform: none;
}

.presentation-cost-row {
  margin-top: 0;
}

.presentation-prompt-label {
  display: grid;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 800;
}

.presentation-prompt-label textarea {
  min-height: 110px;
  background: var(--paper);
}

.slide-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.slide-card {
  min-height: 158px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(222, 230, 246, 0.9);
  border-left: 7px solid var(--slide-accent, #ff8a00);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 250, 255, 0.94) 100%),
    radial-gradient(circle at top right, var(--slide-accent, #ff8a00) 0%, transparent 34%);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(34, 59, 165, 0.08);
}

.slide-media {
  display: grid;
  place-items: center;
  min-height: 112px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 138, 0, 0.14), rgba(28, 184, 200, 0.18)),
    #f8fafc;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.slide-media img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.slide-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--slide-accent, #ff8a00);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.slide-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--green-dark);
  font-size: 1.05rem;
}

.slide-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.slide-card li {
  color: var(--muted);
  line-height: 1.45;
}

.teacher-note {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.insights-panel {
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-tile,
.referral-box,
.partner-dashboard,
.model-box {
  padding: 16px;
}

.metric-tile {
  border-top: 4px solid rgba(255, 138, 0, 0.72);
}

.partner-dashboard {
  display: grid;
  gap: 14px;
}

.dashboard-head,
.partner-stats {
  display: flex;
  gap: 10px;
}

.dashboard-head {
  align-items: flex-start;
  justify-content: space-between;
}

.dashboard-head span,
.partner-stats span,
.referral-link-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-head h2 {
  margin: 3px 0 0;
  font-size: 1.25rem;
}

.cabinet-logo {
  display: block;
  width: 260px;
  max-width: 100%;
  height: 54px;
  margin-top: 4px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 8px 22px rgba(0, 102, 255, 0.18));
}

.cabinet-logo-vector {
  width: min(360px, 100%);
  height: auto;
  filter: none;
}

.cabinet-logo-vector svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.logo-book {
  fill: none;
  stroke: #005cd2;
  stroke-width: 7;
  stroke-linejoin: round;
}

.logo-book-line {
  fill: none;
  stroke: #005cd2;
  stroke-width: 5;
  stroke-linecap: round;
}

.logo-cap {
  fill: #000;
}

.logo-tassel {
  fill: none;
  stroke: #ff8a00;
  stroke-width: 5;
  stroke-linecap: round;
}

.logo-text,
.logo-ai {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 0;
}

.logo-text {
  fill: #005cd2;
}

.logo-ai,
.logo-bulb {
  fill: #ff8a00;
}

.logo-bulb path {
  fill: none;
  stroke: #ff8a00;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #e8fbff;
  color: var(--green-dark);
  font-weight: 900;
}

.partner-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.partner-stats div {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid rgba(222, 230, 246, 0.78);
}

.partner-stats strong {
  display: block;
  margin-top: 5px;
  color: var(--green-dark);
  line-height: 1.2;
}

.referral-link-label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.referral-link-label input {
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 700;
}

.invited-colleagues {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.invited-colleagues summary {
  min-height: 44px;
  padding: 12px;
  color: var(--green-dark);
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.invited-colleagues summary::-webkit-details-marker {
  display: none;
}

.invited-colleagues summary::after {
  float: right;
  content: "⌄";
}

.invited-colleagues[open] summary::after {
  content: "⌃";
}

.invited-colleagues ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
}

.invited-colleagues li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fbff;
}

.invited-colleagues strong {
  color: var(--ink);
}

.invited-colleagues span {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.metric-tile strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  color: var(--green-dark);
  line-height: 1.15;
}

.metric-tile p,
.referral-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.referral-box ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.referral-box li {
  color: var(--ink);
}

#referralTotal {
  margin-top: 14px;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(91, 215, 223, 0.2), rgba(255, 138, 0, 0.1));
  color: var(--green-dark);
  font-weight: 800;
}

.model-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-box h2 {
  width: 100%;
  margin-bottom: 4px;
}

.model-chip {
  min-height: 36px;
  padding: 0 12px;
}

.model-chip.active {
  border-color: var(--cyan);
  background: var(--mint);
  color: var(--green-dark);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #17213f;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: 180ms ease;
  pointer-events: none;
}

.share-popover,
.gift-popover,
.consultant-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 90;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 76px rgba(20, 36, 110, 0.28);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.98);
  transition: 180ms ease;
  pointer-events: none;
}

.share-popover.visible,
.gift-popover.visible,
.consultant-popover.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

body.share-open::before,
body.gift-open::before,
body.consultant-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(17, 24, 62, 0.42);
  backdrop-filter: blur(4px);
}

.consultant-popover {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.share-popover > div,
.gift-popover > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-popover p,
.gift-popover p {
  margin: 0;
  color: var(--green-dark);
  font-weight: 900;
}

.share-popover span,
.gift-popover span {
  color: var(--muted);
  line-height: 1.45;
}

.share-popover label,
.gift-popover label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.share-popover input,
.gift-popover input,
.gift-popover textarea {
  color: var(--green-dark);
  font-weight: 800;
}

#closeShare,
#closeGift,
#closeConsultant {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--green-dark);
  font-size: 1.1rem;
  font-weight: 900;
}

.consultant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.consultant-head span,
.consultant-session-line span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.consultant-head p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  line-height: 1.1;
}

.consultant-start,
.consultant-chat {
  display: grid;
  gap: 14px;
}

.consultant-start[hidden],
.consultant-chat[hidden] {
  display: none;
}

.consultant-start p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.5;
}

.consultant-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.consultant-mode-grid button,
.consultant-rewrite-actions button {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: left;
}

.consultant-mode-grid button.active {
  border-color: rgba(255, 138, 0, 0.5);
  background: #fff7ed;
  color: #b84c00;
}

.consultant-session-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.consultant-session-line strong {
  color: var(--muted);
  font-size: 0.86rem;
}

.consultant-messages {
  display: grid;
  gap: 10px;
  max-height: min(420px, 44vh);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.consultant-message {
  max-width: 82%;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(34, 59, 165, 0.08);
  line-height: 1.48;
  white-space: pre-line;
}

.consultant-message.user {
  justify-self: end;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.14), rgba(255, 211, 106, 0.18));
}

.consultant-message.assistant {
  justify-self: start;
}

.consultant-message span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.consultant-rewrite-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.consultant-rewrite-actions button {
  min-height: 38px;
  font-size: 0.78rem;
  text-align: center;
}

.consultant-chat-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 10px;
}

.gift-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.12), rgba(91, 215, 223, 0.18));
  border: 1px solid rgba(255, 138, 0, 0.14);
}

.gift-summary strong {
  color: var(--green-dark);
  text-align: right;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .main-grid {
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  }

  .insights-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 841px) and (max-width: 1120px) {
  .workspace {
    max-width: 1080px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    min-height: 188px;
    margin-bottom: 18px;
    column-gap: 22px;
  }

  .brand-logo img {
    width: min(390px, calc(100vw - 390px));
    height: 120px;
  }

  h1 {
    white-space: normal;
    font-size: clamp(2rem, 3vw, 2.6rem);
  }

  .account-strip {
    position: static;
    display: grid;
    grid-template-columns: 240px 56px;
    align-items: start;
    justify-content: start;
    justify-self: start;
    gap: 10px 12px;
    min-width: 0;
    margin-top: 6px;
  }

  .account-strip div,
  .share-button,
  .ghost-button.share-button {
    width: 240px;
    min-width: 240px;
  }

  .share-button,
  .ghost-button.share-button {
    grid-column: 1;
    grid-row: 2;
    min-height: 56px;
  }

  .menu-button {
    grid-column: 2;
    grid-row: 1;
    position: static;
    align-self: start;
  }

  .menu-popover {
    top: 88px;
    right: 18px;
  }

  .main-grid {
    margin-top: 0;
  }
}

@media (min-width: 1121px) {
  .workspace {
    max-width: 1320px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(500px, 520px);
    align-items: start;
    min-height: 172px;
    margin-bottom: 18px;
    padding-right: 24px;
    column-gap: 26px;
  }

  .brand-logo {
    margin: -8px 0 2px;
  }

  .brand-logo img {
    width: min(420px, calc(100vw - 540px));
    height: 120px;
  }

  h1 {
    max-width: 850px;
    font-size: clamp(2.2rem, 2.8vw, 3rem);
    white-space: nowrap;
  }

  .account-strip {
    position: static;
    z-index: 20;
    display: grid;
    grid-template-columns: 260px 1fr 56px;
    align-items: start;
    width: 500px;
    min-width: 0;
    gap: 10px 12px;
    justify-content: start;
    justify-self: end;
    margin-top: 6px;
  }

  .account-strip div,
  .share-button,
  .ghost-button.share-button {
    width: 260px;
    min-width: 260px;
  }

  .share-button,
  .ghost-button.share-button {
    grid-column: 1;
    grid-row: 2;
    min-height: 56px;
  }

  .menu-button {
    grid-column: 3;
    grid-row: 1;
    position: static;
    align-self: start;
  }

  .menu-popover {
    top: 88px;
    right: 0;
  }

  .main-grid {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 22px;
    margin-top: 0;
  }

  .control-panel {
    position: sticky;
    top: 18px;
  }

  .editor-area {
    gap: 14px;
  }

  .preview-hero {
    min-height: 132px;
  }

  .preview-hero img {
    height: 132px;
    min-height: 132px;
  }

  .preview-hero div {
    bottom: 18px;
  }

  .preview-hero strong {
    font-size: clamp(1.25rem, 2vw, 1.65rem);
  }

  .document-toolbar {
    order: -1;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr);
    align-items: center;
  }

  .toolbar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar-actions button {
    min-height: 50px;
    font-size: 0.94rem;
  }

  #lessonPlan {
    min-height: 540px;
  }

  .revision-box,
  .presentation-panel {
    padding: 18px;
  }

  .insights-panel {
    margin-top: 2px;
  }

  .metric-tile {
    display: grid;
    min-height: 132px;
    align-content: start;
  }
}

@media (max-width: 840px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .document-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-logo img {
    width: min(420px, calc(100vw - 88px));
    height: 130px;
  }

  h1 {
    white-space: normal;
  }

  .account-strip {
    position: static;
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }

  .account-strip,
  .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .account-strip div,
  .toolbar-actions button {
    flex: 1;
  }

  .main-grid,
  .insights-panel {
    grid-template-columns: 1fr;
  }

  .presentation-head {
    flex-direction: column;
  }

  .presentation-generate-actions,
  .presentation-actions,
  .consultant-mode-grid,
  .consultant-rewrite-actions,
  .consultant-chat-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .presentation-generate-actions button,
  .presentation-actions button {
    flex: 1;
  }

  .slide-preview {
    grid-template-columns: 1fr;
  }

  .insights-panel {
    grid-column: auto;
  }

  #lessonPlan {
    min-height: 520px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2rem;
  }

  .payment-grid {
    grid-template-columns: 1fr;
  }

  .audience-tabs {
    grid-template-columns: 1fr;
  }

  .preview-hero div {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .menu-popover {
    top: 66px;
    right: 16px;
  }

  .menu-button {
    top: 58px;
    right: 16px;
  }
}
