/* Office PowerPoint Editor — PowerPoint-for-the-web look. Light + dark themes. */
:root {
  --accent: #C43E1C;
  --accent-dark: #A53317;
  --accent-darker: #8A2A12;
  --accent-soft: #F3C4B5;
  --accent-soft-2: #FBEFEB;
  --bg: #ffffff;
  --bg-2: #f5f6f7;
  --bg-3: #eceef0;
  --text: #242424;
  --text-2: #616161;
  --line: #e1e1e1;
  --line-2: #d1d1d1;
  --chat-bg: #ffffff;
  --bubble-user: #FBEAE4;
  --bubble-user-line: #F3D2C6;
  --bubble-user-text: #5C2413;
  --bubble-ai: #f0f1f3;
  --bubble-ai-line: #e6e7e9;
  --accent-link: #B5401F;
  --danger: #A4262C;
  --danger-bg: #FDF3F4;
  --danger-line: #F1BBC0;
  --warn-bg: #FFF4CE;
  --warn-line: #F0E6B3;
  --chip-bg: #FDF6F0;
  --chip-line: #EFD5C3;
  --chip-text: #7E4425;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  --shadow-page: 0 2px 8px rgba(0, 0, 0, 0.22);
  color-scheme: light;
}
[data-theme="dark"] {
  --accent: #d05531;
  --accent-dark: #dd6845;
  --accent-darker: #C43E1C;
  --accent-soft: #7e3620;
  --accent-soft-2: #3a231b;
  --bg: #1d1f21;
  --bg-2: #26282b;
  --bg-3: #2e3134;
  --text: #e8e8e8;
  --text-2: #a5a5a5;
  --line: #3a3d40;
  --line-2: #46494d;
  --chat-bg: #202225;
  --bubble-user: #3a231b;
  --bubble-user-line: #7e3620;
  --bubble-user-text: #f5d5c8;
  --bubble-ai: #2b2d30;
  --bubble-ai-line: #37393c;
  --accent-link: #f09377;
  --danger: #ff6b7a;
  --danger-bg: #3a2225;
  --danger-line: #5c3338;
  --warn-bg: #3a3320;
  --warn-line: #5c522f;
  --chip-bg: #33241c;
  --chip-line: #5c3a28;
  --chip-text: #eab89e;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-page: 0 2px 12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg-3);
  display: flex; flex-direction: column; overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
svg { fill: currentColor; }

/* ---------- Suite bar (PowerPoint orange in both themes) ---------- */
.suitebar {
  height: 48px; background: var(--accent); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 12px 0 0; flex: none;
}
[data-theme="dark"] .suitebar { background: #7e2b12; }
.waffle {
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  color: #fff; background: transparent; border: 0; cursor: pointer;
}
.waffle:hover { background: rgba(255,255,255,.12); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.brand-ic { flex: none; }
.docmeta { display: flex; align-items: baseline; gap: 10px; margin-left: 18px; min-width: 0; }
#docTitle {
  font-size: 14px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  outline: none; white-space: nowrap; overflow: hidden; max-width: 320px;
}
#docTitle:hover, #docTitle:focus { background: rgba(255,255,255,.16); }
.docstate { font-size: 12px; opacity: .82; white-space: nowrap; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.credits { font-size: 12px; background: rgba(255,255,255,.16); border-radius: 10px; padding: 3px 9px; font-family: ui-monospace, Menlo, monospace; }
.topup { color: #fff; font-size: 12px; text-decoration: underline; }
.top-icon-btn, .top-ghost-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.top-icon-btn { padding: 4px 8px; }
.top-icon-btn:hover, .top-ghost-btn:hover { background: rgba(255,255,255,.14); }
.top-signin-btn {
  background: #fff; color: var(--accent-darker); border: none; border-radius: 4px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
}
[data-theme="dark"] .top-signin-btn { color: #8A2A12; }
.top-signin-btn:hover { background: #faf1ee; }
.chat-toggle.active { background: rgba(255,255,255,.22); }
#themeBtn::before { content: "\2600"; font-size: 14px; }
[data-theme="dark"] #themeBtn::before { content: "\263E"; }
#helpBtn { font-weight: 700; }

/* ---------- Ribbon ---------- */
.ribbon { background: var(--bg); border-bottom: 1px solid var(--line-2); flex: none; }
.rtabs { display: flex; align-items: center; padding: 0 8px; }
.rtab {
  background: transparent; border: 0; padding: 9px 14px 7px; font-size: 14px;
  color: var(--text); cursor: pointer; border-bottom: 2.5px solid transparent;
}
.rtab:hover { color: var(--accent-dark); }
.rtab.active { color: var(--accent-dark); font-weight: 600; border-bottom-color: var(--accent-dark); }
.rtab-file { color: var(--accent-dark); font-weight: 600; }
.rtabs-spacer { flex: 1; }
.rev-count { font-size: 12px; color: var(--text-2); margin-right: 10px; }
.rbar {
  display: flex; align-items: center; gap: 4px; padding: 5px 12px 7px;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.rgroup { display: flex; align-items: center; gap: 2px; }
.rsep { width: 1px; height: 26px; background: var(--line); margin: 0 8px; }
.rbtn {
  min-width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: var(--text); cursor: pointer; padding: 0 5px; gap: 6px;
}
.rbtn:hover { background: var(--bg-2); border-color: var(--line); }
.rbtn.on { background: var(--accent-soft-2); border-color: var(--accent-soft); color: var(--accent-dark); }
.rbtn:disabled { opacity: .45; cursor: default; }
.rbtn:disabled:hover { background: transparent; border-color: transparent; }
.rbtn-lbl span { font-size: 13px; white-space: nowrap; }
.rlbl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); margin-right: 12px; }
.rsel {
  height: 28px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--bg);
  font-size: 13px; padding: 0 4px; color: var(--text);
}
.rsel:disabled { opacity: .45; }
.rsel-font { width: 124px; }
.rsel-size { width: 62px; }
.tbtn span { font-size: 14px; }
.g-b { font-weight: 700; }
.g-i { font-style: italic; font-family: Georgia, serif; }
.g-u { text-decoration: underline; }
.g-s { text-decoration: line-through; font-size: 13px; }
.g-fc { color: #C00000; font-weight: 700; border-bottom: 3px solid #C00000; line-height: 1; }

/* dropdowns */
.dropwrap { position: relative; }
.drop {
  position: absolute; top: 34px; left: 0; z-index: 60; background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow);
  padding: 8px;
}
.drop-colors { display: grid; grid-template-columns: repeat(4, 24px); gap: 6px; }
.drop-colors button {
  width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--line-2); cursor: pointer; padding: 0;
}
.drop-colors button:hover { outline: 2px solid var(--accent); }
.drop-colors .noneopt { grid-column: 1 / -1; width: auto; height: 26px; font-size: 12px; background: var(--bg); color: var(--text); }

/* ---------- File menu ---------- */
.filemenu {
  position: fixed; top: 84px; left: 10px; z-index: 100; background: var(--bg); width: 280px;
  border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px;
}
.fm-item {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  padding: 10px 12px; font-size: 13.5px; border-radius: 5px; cursor: pointer; color: var(--text);
  text-decoration: none;
}
.fm-item:hover { background: var(--bg-2); }
.fm-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.fm-note { font-size: 11.5px; color: var(--text-2); padding: 8px 12px 10px; line-height: 1.5; }

/* ---------- Main layout ---------- */
.main { flex: 1; display: flex; min-height: 0; }

/* thumbnail rail */
.thumbrail {
  width: 188px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line-2);
  overflow-y: auto; padding: 10px 8px;
}
.thumbs { display: flex; flex-direction: column; gap: 10px; }
.thumb {
  display: flex; gap: 6px; align-items: flex-start; cursor: pointer; position: relative;
  border-radius: 6px; padding: 4px;
}
.thumb:hover { background: var(--bg-3); }
.thumb.selected, .thumb.active { background: var(--accent-soft-2); }
.thumb-num { font-size: 11px; color: var(--text-2); width: 14px; text-align: right; padding-top: 2px; flex: none; }
.thumb.selected .thumb-num, .thumb.active .thumb-num { color: var(--accent-dark); font-weight: 700; }
.thumb-box {
  width: 148px; overflow: hidden; border: 1.5px solid var(--line-2); border-radius: 3px;
  background: #fff; position: relative; flex: none;
}
.thumb.selected .thumb-box { border-color: var(--accent); }
.thumb.active .thumb-box { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; }
.thumb-acts {
  position: absolute; right: 3px; bottom: 3px; display: none; gap: 2px; z-index: 5;
}
.thumb:hover .thumb-acts { display: flex; }
.thumb-acts button {
  width: 20px; height: 20px; border-radius: 3px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font-size: 11px; line-height: 1; padding: 0;
}
.thumb-acts button:hover { background: var(--accent-soft-2); border-color: var(--accent-soft); }

/* canvas */
.canvas-wrap { flex: 1; overflow: auto; padding: 28px 24px 40px; position: relative; display: flex; }
.stage-holder { margin: auto; position: relative; flex: none; }
.stage {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  background: #fff; box-shadow: var(--shadow-page);
}
.dropveil {
  position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center;
  background: rgba(196,62,28,.10); border: 2.5px dashed var(--accent); margin: 10px;
  border-radius: 10px; font-size: 18px; color: var(--accent); font-weight: 600; pointer-events: none;
}
[data-theme="dark"] .dropveil { color: #f09377; }
.dropveil.show { display: flex; }

/* slide shapes */
.shp { position: absolute; overflow: hidden; }
.shp-text { display: flex; flex-direction: column; padding: 4.8px 9.6px; line-height: 1.2; }
.shp-text .para { white-space: pre-wrap; word-wrap: break-word; min-height: 0.9em; margin: 1px 0; }
.shp-text .bullet { white-space: pre; }
.shp-img img { width: 100%; height: 100%; object-fit: fill; display: block; }
.shp-missing, .shp-frame {
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  color: #8a8a8a; background: repeating-linear-gradient(45deg, #f4f4f4, #f4f4f4 8px, #ececec 8px, #ececec 16px);
  border: 1px dashed #c9c9c9;
}
.shp-table table { border-collapse: collapse; width: 100%; height: 100%; table-layout: fixed; }
.shp-table td { border: 1px solid #cfcfcf; padding: 2px 6px; vertical-align: middle; overflow: hidden; }
.shp-table .para { white-space: pre-wrap; word-wrap: break-word; }
.shp-empty-ph { outline: 1px dashed #b9b9b9; }
.shp-empty-ph::after {
  content: "Click to add text"; color: #9a9a9a; font-size: 15px; padding: 4px 2px;
}

/* selection */
.shp.sel { outline: 2px solid var(--accent); outline-offset: 0; cursor: move; }
.shp.sel.editing { cursor: text; outline-style: dashed; }
.shp.editing { overflow: visible; }
.handle {
  position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--accent);
  border-radius: 50%; z-index: 10;
}
.handle-se { right: -5px; bottom: -5px; cursor: nwse-resize; }

/* start screen */
.empty {
  position: absolute; inset: 0; z-index: 20; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-3); padding: 16px 0;
}
.drop-card {
  max-width: 540px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 36px 40px;
  text-align: center; margin: 20px;
}
.drop-logo { margin-bottom: 10px; }
.drop-card h2 { margin: 8px 0 10px; font-size: 21px; color: var(--text); }
.drop-card p { color: var(--text-2); line-height: 1.5; margin: 0 0 18px; }
.drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
button.primary {
  background: var(--accent); border: 1px solid var(--accent); color: #fff;
  border-radius: 5px; padding: 7px 16px; font-size: 13.5px; font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.ghost {
  background: transparent; border: 1px solid var(--line-2); color: var(--text);
  border-radius: 5px; padding: 7px 14px; font-size: 13.5px;
}
button.ghost:hover { background: var(--bg-2); }
button.primary.big, button.ghost.big { padding: 9px 18px; font-size: 14px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.tut-link { color: var(--accent-dark); font-weight: 600; }
[data-theme="dark"] .tut-link { color: #f09377; }
.feature-strip { display: flex; gap: 16px; max-width: 940px; margin: 8px 20px; flex-wrap: wrap; justify-content: center; }
.feature { flex: 1 1 230px; max-width: 290px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; }
.feature h3 { margin: 0 0 6px; font-size: 13.5px; color: var(--accent-dark); }
[data-theme="dark"] .feature h3 { color: #f09377; }
.feature p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

/* ---------- Chat panel ---------- */
.chat {
  width: 372px; flex: none; background: var(--chat-bg); border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column; min-height: 0; position: relative;
}
.chat.hidden { display: none; }
.chat-resizer {
  position: absolute; left: -4px; top: 0; bottom: 0; width: 8px;
  cursor: col-resize; z-index: 30;
}
.chat-resizer:hover, body.resizing .chat-resizer { background: rgba(196,62,28,.28); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .stage { pointer-events: none; }
.chat-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.chat-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14.5px; color: var(--text); }
.spark { color: #7F5AF8; }
[data-theme="dark"] .spark { color: #a68bfc; }
.chat-model {
  margin-left: auto; max-width: 168px; height: 28px; border: 1px solid var(--line-2);
  border-radius: 4px; font-size: 12.5px; background: var(--bg); color: var(--text);
}
.chat-x { background: transparent; border: 0; cursor: pointer; color: var(--text-2); padding: 6px; border-radius: 4px; }
.chat-x:hover { background: var(--bg-2); }
.chat-auth {
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); font-size: 12.5px;
  padding: 9px 12px; display: flex; align-items: center; gap: 10px; color: var(--text);
}
.chat-auth button {
  margin-left: auto; background: var(--accent); border: 0; color: #fff; padding: 5px 12px;
  border-radius: 4px; font-size: 12.5px; font-weight: 600; cursor: pointer; flex: none;
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.chat-welcome { text-align: center; padding: 26px 10px 10px; color: var(--text-2); }
.chat-welcome h3 { margin: 10px 0 6px; font-size: 15.5px; color: var(--text); }
.chat-welcome p { font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.chips { display: flex; flex-direction: column; gap: 8px; }
.chip {
  border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--chip-text); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; cursor: pointer; text-align: left; line-height: 1.4;
}
.chip:hover { filter: brightness(.97); }
[data-theme="dark"] .chip:hover { filter: brightness(1.15); }
.chat-tutorial-link { display: inline-block; margin-top: 14px; font-size: 12.5px; color: var(--accent-link); }
.msg { max-width: 92%; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg-user { align-self: flex-end; background: var(--bubble-user); color: var(--bubble-user-text); border: 1px solid var(--bubble-user-line); }
.msg-ai { align-self: flex-start; background: var(--bubble-ai); border: 1px solid var(--bubble-ai-line); color: var(--text); }
.msg-ai.thinking { color: var(--text-2); font-style: italic; }
.msg-err { align-self: flex-start; background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger); }
.msg-note { align-self: flex-start; font-size: 11.5px; color: var(--text-2); padding: 0 4px; }
.msg-note a { color: var(--accent-link); }
.msg-signin {
  margin-left: 10px; background: var(--accent); border: 0; color: #fff; padding: 4px 12px;
  border-radius: 4px; cursor: pointer; font-weight: 600;
}
.msg-doc {
  align-self: flex-start; display: flex; gap: 7px; align-items: center;
  font-size: 12px; color: var(--accent-dark); background: var(--accent-soft-2); border: 1px solid var(--accent-soft);
  border-radius: 8px; padding: 6px 10px;
}
[data-theme="dark"] .msg-doc { color: #f09377; }
.chat-foot { border-top: 1px solid var(--line); padding: 8px 12px 10px; }
.chat-scope {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text);
  background: var(--accent-soft-2); border: 1px solid var(--accent-soft); border-radius: 6px;
  padding: 5px 9px; margin-bottom: 7px;
}
.scope-check { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 600; }
.scope-check input { accent-color: var(--accent); }
.scope-info {
  color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.chat-meter { font-size: 11.5px; color: var(--text-2); min-height: 16px; padding: 0 2px 4px; }
.chat-meter .warn { color: var(--danger); font-weight: 600; }
.chat-meter a { color: var(--accent-link); }
.chat-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.chat-inputrow textarea {
  flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px;
  font-family: inherit; font-size: 13.5px; line-height: 1.45; max-height: 130px; outline: none;
  background: var(--bg); color: var(--text);
}
.chat-inputrow textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chat-inputrow button {
  width: 38px; height: 38px; border-radius: 8px; border: 0; background: var(--accent); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none;
}
.chat-inputrow button:hover { background: var(--accent-dark); }
.chat-inputrow button:disabled { background: var(--line-2); cursor: default; }
.chat-hint { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); padding: 6px 2px 0; }

/* ---------- Status bar ---------- */
.statusbar {
  height: 26px; background: var(--bg-2); color: var(--text); font-size: 12px;
  display: flex; align-items: center; gap: 18px; padding: 0 12px; flex: none;
  border-top: 1px solid var(--line);
}
.sb-spacer { flex: 1; }
.sb-note a, .sb-link { color: var(--accent-link); text-decoration: none; }
.sb-note a:hover, .sb-link:hover { text-decoration: underline; }
.sb-zoom {
  height: 20px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg);
  font-size: 11.5px; color: var(--text);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #242424; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); max-width: 70vw;
}
[data-theme="dark"] .toast { background: #3a3d40; }

@media (max-width: 1180px) {
  .chat { width: 320px; }
  .rsel-font { width: 104px; }
  .thumbrail { width: 150px; }
  .thumb-box { width: 116px; }
}
