* { box-sizing: border-box; }
:root {
  --ui-border: #e1e6e9;
  --ui-muted: #62717c;
  --ui-work: #eef1f3;
  --ui-dark: #142532;
  --ui-accent: #b83f06;
  --ui-warm: #fff2eb;
  font: 400 14px/1.45 Lato, sans-serif;
  color: var(--ui-dark);
}
body { margin: 0; min-width: 760px; height: 100dvh; display: flex; flex-direction: column; background: white; }
button, input, textarea, select, summary { font: inherit; color: inherit; }
button, summary { -webkit-user-select: none; user-select: none; }
button, .shape-menu summary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 7px; padding: 7px 10px;
  min-height: 35px; background: none; cursor: pointer; white-space: nowrap;
}
button:is(:hover, [aria-pressed="true"]), summary:hover { background: var(--ui-work); }
button:disabled { opacity: .4; cursor: default; background: transparent; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
button.outline { border-color: #d8dfe4; }
button.primary { color: white; background: var(--navy); padding-inline: 14px; }
button.primary:hover { background: #085576; }
button.icon-button { width: 35px; padding: 6px; flex: none; }
[data-icon] { display: inline-flex; flex: none; }
[data-icon] svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.65; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  height: 69px; flex: none; display: flex; align-items: center; gap: 21px;
  padding: 0 22px; border-bottom: 1px solid var(--ui-border);
}
.brand { display: flex; align-items: center; flex: none; padding-right: 21px; border-right: 1px solid var(--ui-border); }
.brand img { height: 25px; width: auto; display: block; }
.document { display: grid; gap: 1px; align-content: center; flex: 1; min-width: 100px; }
#deck-name {
  font-size: 16px; font-weight: 700; background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 1px 4px; line-height: 1.3; width: min(390px, 100%); margin-left: -5px;
}
#deck-name:is(:hover, :focus) { border-color: var(--ui-border); }
#save-state { color: var(--ui-muted); font-size: 12px; }
.header-actions { display: flex; gap: 5px; }

.workbench { flex: 1; min-height: 0; display: grid; grid-template-columns: 204px minmax(0, 1fr) min(var(--inspector-width, 278px), 40vw); }
.slides-panel, .inspector { display: flex; flex-direction: column; min-height: 0; background: white; }
.slides-panel { border-right: 1px solid var(--ui-border); }
.inspector { position: relative; border-left: 1px solid var(--ui-border); }
.side-heading {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 15px; border-bottom: 1px solid var(--ui-border); gap: 9px;
}
.side-heading h1, .side-heading h2 { margin: 0; font-size: 15px; font-weight: 700; }
#slide-count { font-weight: 400; font-size: 12px; margin-left: 3px; color: var(--ui-muted); }
.add-slide { color: var(--navy); background: #edf4f7; font-size: 13px; font-weight: 700; }
.add-slide:hover { background: #dfedf3; }
#slides-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 12px 10px; }
#slides-list li + li { margin-top: 8px; }
.slide-row {
  display: grid; grid-template-columns: 17px minmax(0, 1fr); width: 100%; text-align: left;
  gap: 7px; padding: 6px; white-space: normal; align-items: start;
}
.slide-row[aria-current="true"] { background: var(--ui-warm); }
.slide-row .slide-number { text-align: center; font-size: 12px; font-weight: 700; padding-top: 2px; color: var(--ui-muted); }
.slide-row[aria-current="true"] .slide-number { color: var(--ui-accent); }
.mini-frame { aspect-ratio: 16/9; overflow: hidden; border-radius: 5px; box-shadow: 0 0 0 1px #dce2e5; width: 100%; display: block; position: relative; }
.slide-row[aria-current="true"] .mini-frame { box-shadow: 0 0 0 2px var(--orange); }
.mini-frame .master-slide { transform: scale(var(--mini-scale, .075)); transform-origin: top left; pointer-events: none; }
.slide-caption { display: block; margin-top: 6px; font-size: 12px; overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.slide-actions { display: flex; align-items: center; justify-content: space-evenly; padding: 8px 5px; border-top: 1px solid var(--ui-border); }

.work-area { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--ui-work); }
.toolbar { display: flex; flex: none; align-items: center; gap: 3px; min-height: 58px; padding: 8px 16px; background: #fafbfc; border-bottom: 1px solid var(--ui-border); }
.divider { width: 1px; height: 22px; background: #dbe1e4; margin: 0 6px; }
.toolbar-spacer { flex: 1; }
.shape-menu { position: relative; }
.shape-menu summary { list-style: none; }
.shape-menu summary::-webkit-details-marker { display: none; }
.popover { position: absolute; z-index: 5; display: grid; top: calc(100% + 5px); left: 0; padding: 5px; background: white; border: 1px solid var(--ui-border); border-radius: 8px; box-shadow: 0 5px 16px #1d344219; }
.popover button { justify-content: start; }
#canvas-scroll { flex: 1; min-height: 0; overflow: auto; }
#canvas-area { min-width: 100%; min-height: 100%; width: max-content; height: max-content; padding: 28px; display: grid; place-items: center; }
#slide-frame {
  position: relative; flex: none; overflow: hidden; background: white;
  box-shadow: 0 14px 36px #1631461e, 0 0 0 1px #17334b18;
}
#slide-view .master-slide { transform: scale(var(--scale, 1)); transform-origin: top left; }
#konva-stage, #guide-layer { position: absolute; inset: 0; }
#guide-layer { pointer-events: none; }
#guide-layer i { position: absolute; display: block; border-color: #f4570db3; border-style: dashed; border-width: 0; }
#guide-layer .vertical { height: 100%; border-left-width: 1px; }
#guide-layer .horizontal { width: 100%; border-top-width: 1px; }
#guide-layer .alignment-guide { border-style: solid; border-color: #d94b0c; }
.field-highlight { outline: 3px solid var(--orange); outline-offset: 4px; }
.inline-editor {
  position: absolute; z-index: 4; min-height: 28px; border: 2px solid var(--orange); padding: 0;
  border-radius: 0; background: white; color: var(--ink); resize: vertical; box-shadow: 0 4px 16px #0002;
}
.canvas-footer { flex: none; gap: 6px; min-height: 51px; display: flex; align-items: center; justify-content: space-between; padding: 7px 15px; background: #fafbfc; border-top: 1px solid var(--ui-border); color: var(--ui-muted); font-size: 12px; }
#active-slide-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toggle-notes[aria-expanded="true"] { background: #edf4f7; color: var(--navy); }
#toggle-notes[data-has-notes]::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
#notes-panel { flex: none; padding: 10px 15px 13px; background: white; border-top: 1px solid var(--ui-border); }
#notes-label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 700; }
#slide-notes { display: block; width: 100%; padding: 7px 8px; border: 1px solid #d8dfe4; border-radius: 6px; color: var(--ui-dark); min-height: 56px; max-height: min(260px, 32dvh); resize: vertical; }
.footer-controls, .zoom-controls { display: flex; gap: 3px; align-items: center; }
.zoom-controls .icon-button { font-size: 18px; }

#inspector-content { overflow: auto; padding: 15px; display: grid; gap: 14px; align-content: start; }
.master-card { display: grid; gap: 4px; align-content: start; padding: 11px 12px; border: 1px solid #dae6ec; border-radius: 8px; background: #f5f9fb; }
.master-card-label { display: flex; gap: 6px; align-items: center; color: var(--navy); font-weight: 700; }
.master-card p, .inspector-help { margin: 0; font-size: 12px; line-height: 1.55; color: var(--ui-muted); }
.master-card button { justify-self: start; margin: 0 0 -3px -6px; padding: 3px 6px; min-height: 29px; color: var(--navy); font-size: 12px; font-weight: 700; }
.fields { display: grid; gap: 12px; }
.field-label { display: grid; gap: 4px; min-width: 0; font-size: 13px; font-weight: 700; }
.field-label :is(textarea, input, select) {
  display: block; width: 100%; border: 1px solid #d8dfe4; border-radius: 6px; background: white;
  padding: 7px 8px; font-size: 13px; line-height: 1.35; font-weight: 400;
}
.field-label textarea { resize: vertical; min-height: 38px; max-height: 180px; }
.field-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.field-actions button { font-size: 12px; }
.geometry { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.element-heading { display: flex; align-items: center; justify-content: space-between; }
.element-heading strong { font-size: 15px; }
.element-heading button { color: var(--navy); font-size: 12px; }

dialog { color: inherit; padding: 0; border: 1px solid var(--ui-border); border-radius: 13px; box-shadow: 0 20px 65px #11212c45; }
dialog::backdrop { background: #14253266; }
#layout-dialog { width: min(830px, 95vw); max-height: 90dvh; }
.dialog-heading { position: sticky; top: 0; z-index: 1; background: white; border-bottom: 1px solid var(--ui-border); display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.dialog-heading h2 { font-size: 17px; margin: 0; }
#close-layout { font-size: 23px; }
#layout-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 15px; }
.layout-option { display: grid; text-align: left; width: 100%; padding: 8px; border-color: var(--ui-border); grid-template-columns: minmax(0, 1fr); }
.layout-option span:last-child { margin: 1px 2px; }
#presentation-dialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; background: #0b0f14; color: white; }
#notice { position: fixed; z-index: 9; inset: auto 16px 16px auto; max-width: 365px; padding: 12px 17px; margin: 0; border-radius: 8px; background: var(--navy); color: white; box-shadow: 0 5px 20px #0c233959; }
[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .workbench { grid-template-columns: 172px minmax(0, 1fr) min(var(--inspector-width, 228px), 40vw); }
  .topbar { padding-inline: 13px; gap: 12px; }
  .brand { padding-right: 12px; }
  .brand img { height: 20px; }
  .side-heading, #inspector-content { padding-inline: 11px; }
  #canvas-area { padding: 17px; }
}
@media (max-width: 840px) {
  .workbench { grid-template-columns: 151px minmax(0, 1fr) min(var(--inspector-width, 199px), 40vw); }
  .header-actions { gap: 0; }
  .header-actions button { padding-inline: 7px; }
  .brand img { height: 17px; }
  .toolbar { padding-inline: 5px; }
}


.shadow-toggle { display: flex; align-items: center; min-height: 30px; gap: 7px; font-size: 13px; font-weight: 400; }
.shadow-toggle input[type="checkbox"] { display: inline; width: auto; margin: 0; accent-color: var(--navy); }
.rich-editor { border: 1px solid #d8dfe4; border-radius: 7px; background: white; min-width: 0; }
.rich-editor:focus-within { border-color: var(--orange); }
.rich-toolbar { display: flex; align-items: center; gap: 2px; padding: 3px; border-bottom: 1px solid var(--ui-border); background: #fafbfc; border-radius: 7px 7px 0 0; color: var(--ui-dark); }
.rich-toolbar button { min-width: 28px; min-height: 28px; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.rich-toolbar button[aria-pressed="true"] { background: var(--ui-warm); color: var(--ui-accent); }
.rich-editable { --rich-paragraph-gap: 9; --rich-list-gap: 3; --rich-indent: 18; min-height: 78px; padding: 8px; max-height: 245px; overflow: auto; font-size: 13px; line-height: 1.4; font-weight: 400; outline: none; cursor: text; }
.rich-editable[data-is-empty]:not(:focus)::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.canvas-rich-editor { position: absolute; z-index: 4; outline: 2px solid var(--orange); border: 0; border-radius: 0; min-width: 0; }
.canvas-rich-editor .rich-toolbar { position: absolute; bottom: calc(100% + 7px); left: 0; width: max-content; border: 1px solid #d8dfe4; border-radius: 7px; box-shadow: 0 3px 14px #1425322b; }
.canvas-rich-editor.toolbar-below .rich-toolbar { top: calc(100% + 7px); bottom: auto; }
.canvas-rich-editor .rich-editable { padding: 0; }
.free-elements { position: relative; }
.free-elements summary { list-style: none; cursor: pointer; padding: 5px 7px; border-radius: 6px; color: var(--ui-muted); }
.free-elements summary::-webkit-details-marker { display: none; }
.free-elements .popover { top: auto; bottom: calc(100% + 5px); }
.free-elements .shape-menu .popover { bottom: 0; left: calc(100% + 6px); }

#konva-stage { touch-action: none; }
.crop-settings { display: grid; gap: 5px; }
.crop-title { font-size: 12px; color: var(--ui-muted); }

#slide-frame:has(.canvas-rich-editor) .field-highlight { outline: none; }

.inspector-tabs { justify-content: start; gap: 4px; }
.inspector-tabs button { font-weight: 700; }
.inspector-tabs button[aria-pressed="true"] { color: var(--navy); background: #edf4f7; }
#ai-panel { overflow: auto; padding: 15px; display: grid; gap: 12px; align-content: start; }
#ai-panel > button { justify-self: start; }
.ai-status { margin: 0; color: var(--navy); font-size: 13px; font-weight: 700; }
.ai-actions, .ai-links, .ai-suggestions { display: grid; gap: 5px; }
.ai-suggestions h3 { margin: 0 0 2px; font-size: 13px; }
.ai-suggestions button { justify-content: start; white-space: normal; }
.ai-suggestions button[aria-pressed="true"] { color: var(--navy); background: #edf4f7; }
.ai-actions button { justify-content: start; }
.client-link { padding: 7px 10px; border: 1px solid #d8dfe4; border-radius: 7px; color: var(--navy); text-decoration: none; font-weight: 700; }
.client-link:hover { background: var(--ui-work); }
.ai-details { font-size: 12px; color: var(--ui-muted); }
.ai-details summary { cursor: pointer; }
.ai-details code { display: block; overflow-wrap: anywhere; padding: 5px 0; }

.save-split { display: flex; flex: none; border: 1px solid #d8dfe4; border-radius: 7px; background: white; }
.save-split > button { border-radius: 6px 0 0 6px; min-height: 34px; }
.download-menu { position: relative; border-left: 1px solid #d8dfe4; }
.download-menu summary { display: grid; place-items: center; width: 31px; min-height: 34px; list-style: none; border-radius: 0 6px 6px 0; cursor: pointer; }
.download-menu summary::-webkit-details-marker { display: none; }
.download-menu .popover { left: auto; right: 0; min-width: 145px; z-index: 8; }

#inspector-resize {
  position: absolute;
  z-index: 4;
  inset: 0 auto 0 -4px;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
#inspector-resize::after {
  content: '';
  position: absolute;
  inset: 0 3px;
  background: var(--orange);
  opacity: 0;
}
#inspector-resize:is(:hover, :focus-visible, [data-resizing])::after { opacity: 1; }
body:has(#inspector-resize[data-resizing]) { cursor: col-resize; user-select: none; }

#save-dialog { width: min(480px, 92vw); }
.save-dialog-body { padding: 16px; }
.save-dialog-body p { margin: 0 0 14px; }
.save-dialog-body dl { display: grid; grid-template-columns: 125px 1fr; row-gap: 6px; margin: 0 0 19px; font-size: 13px; }
.save-dialog-body dt { font-weight: 700; }
.save-dialog-body dd { margin: 0; overflow-wrap: anywhere; color: var(--ui-muted); }
.save-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
#save-project-file { margin-right: auto; }

.download-menu hr { width: 100%; border: 0; border-top: 1px solid var(--ui-border); margin: 3px 0; }
.project-location-fields { display: grid; gap: 12px; margin-bottom: 16px; }
#project-save-error { color: #9e3205; font-size: 13px; }
#project-dialog { width: min(500px, 92vw); max-height: 88dvh; }
#project-dialog .dialog-heading button { font-size: 23px; }
.project-dialog-body { display: grid; gap: 12px; padding: 15px; }
.project-dialog-body > button { justify-self: start; }
#project-list { display: grid; gap: 5px; max-height: 51dvh; overflow: auto; }
.project-entry { display: grid; justify-content: stretch; text-align: left; gap: 2px; width: 100%; white-space: normal; border-color: var(--ui-border); }
.project-entry span { font-size: 12px; color: var(--ui-muted); overflow-wrap: anywhere; }
#notice { white-space: pre-line; }
