* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #292633;
  background: #f5f5f8;
  font-size: 12px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  border: 1px solid #ddd9e5;
  background: #fff;
  border-radius: 5px;
  padding: 7px 9px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  background: #f1eefa;
  border-color: #a79cdb;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
button[aria-pressed="true"],
.layer-row.selected {
  background: #eee9ff;
  border-color: #aa9add;
  color: #5846b5;
}
input,
select,
textarea {
  border: 1px solid #ddd9e5;
  border-radius: 4px;
  padding: 6px 7px;
  background: #fff;
  width: 100%;
  min-width: 0;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: #f5f4f7;
  color: #aaa;
}
input[type="color"] {
  padding: 2px;
  height: 30px;
}
input[type="checkbox"] {
  width: auto;
  accent-color: #7764e8;
}
input:focus,
textarea:focus,
select:focus,
button:focus-visible,
canvas:focus-visible {
  outline: 2px solid #9b89ec;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
h2,
h3,
p {
  margin: 0;
}
h2,
h3 {
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 12px;
}
label {
  display: block;
  font-size: 11px;
  margin: 9px 0 5px;
  color: #716a80;
}
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid #dedbe5;
  background: #fff;
}
.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.brand:focus-visible {
  outline: 2px solid #7764e8;
  outline-offset: 4px;
}
.brand b {
  background: #7764e8;
  color: white;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 18px;
}
.file-actions,
.history-actions {
  display: flex;
  gap: 5px;
}
.document-name {
  flex: 1;
  max-width: 280px;
  border-color: transparent;
  font-weight: 600;
}
.topbar #autosave-status {
  margin-left: auto;
  max-width: 220px;
  font-size: 11px;
  color: #857b97;
}
.workspace {
  height: calc(100% - 82px);
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) 280px;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.left-sidebar,
.inspector {
  background: #fff;
  min-height: 0;
  overflow: auto;
}
.left-sidebar {
  border-right: 1px solid #dedbe5;
  display: flex;
  flex-direction: column;
}
.insert-panel {
  padding: 18px 14px;
  border-bottom: 1px solid #e6e2ec;
}
.shape-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.shape-tools button {
  padding: 9px 6px;
  text-align: left;
}
.tool-row,
.layer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}
.layers-panel {
  padding: 16px 12px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #91869e;
}
.panel-heading h2 {
  color: #292633;
}
.layer-list {
  overflow: auto;
  min-height: 70px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.layer-row {
  white-space: normal;
  text-align: left;
  padding: 9px;
  font-size: 11px;
}
.canvas-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #eeedf2;
}
.canvas-meta {
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  color: #8b819c;
  font-size: 10px;
}
.canvas-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.canvas-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  position: absolute;
  inset: 0;
}
.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  color: #93889e;
}
.empty-hint strong {
  font-size: 15px;
  font-weight: 500;
}
.canvas-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}
.zoom-controls button {
  padding: 5px 8px;
}
.zoom-controls input {
  width: 58px;
}
.canvas-panel > #canvas-help {
  padding: 0 16px 12px;
  font-size: 10px;
}
.inspector {
  border-left: 1px solid #dedbe5;
}
.inspector-tabs {
  display: flex;
  position: sticky;
  top: 0;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid #e6e2ec;
  gap: 6px;
  z-index: 1;
}
.inspector-tabs button {
  flex: 1;
}
.inspector section {
  display: none;
}
.workspace[data-panel="properties"] #panel-properties,
.workspace[data-panel="artboard"] #panel-artboard,
.workspace[data-panel="export"] #panel-export,
.workspace[data-panel="layers"] #panel-properties {
  display: block;
}
.control-section {
  padding: 16px;
  border-bottom: 1px solid #e6e2ec;
}
.selection-name {
  font-weight: 600;
  margin-bottom: 12px;
}
.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 10px;
}
.color-fields {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
}
.align-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 10px;
}
.panel-note {
  font-size: 10px;
  line-height: 1.6;
  color: #94899e;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.field-error,
.load-error {
  color: #b1485a;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.field-error {
  padding: 0 16px 10px;
}
.statusbar {
  height: 28px;
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 0 14px;
  border-top: 1px solid #dedbe5;
  background: #fff;
  font-size: 10px;
  color: #877c95;
  overflow: hidden;
}
.statusbar p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statusbar #project-status {
  margin-left: auto;
}
.statusbar .feedback-links {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: #625672;
}
.feedback-links a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.panel-switcher {
  display: none;
}
.recovery-controls {
  position: fixed;
  bottom: 32px;
  left: 220px;
  right: 292px;
  padding: 10px;
  background: #fff8df;
  border: 1px solid #e5d7a6;
  border-radius: 5px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recovery-controls span {
  flex: 1;
  font-size: 11px;
}
@media (max-width: 999px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    font-size: 12px;
  }
  .topbar {
    height: auto;
    min-height: 88px;
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
  }
  .brand {
    font-size: 12px;
  }
  .document-name {
    width: 130px;
    flex: 1;
  }
  .topbar #autosave-status {
    max-width: 100%;
    flex: 1;
    margin: 0;
  }
  .file-actions button,
  .history-actions button {
    padding: 5px 7px;
  }
  .workspace {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 390px auto auto;
    overflow: visible;
  }
  .left-sidebar {
    display: contents;
  }
  .insert-panel {
    grid-row: 1;
    background: white;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .insert-panel h2 {
    display: none;
  }
  .shape-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }
  .shape-tools button {
    text-align: center;
  }
  .tool-row {
    margin: 0;
    flex: 1;
  }
  .insert-panel .checkbox-label {
    margin: 0;
  }
  .insert-panel .panel-note {
    width: 100%;
    margin: 0;
  }
  .canvas-panel {
    grid-row: 2;
    height: 390px;
  }
  .canvas-meta {
    padding: 9px 12px;
  }
  .canvas-footer {
    padding: 8px;
  }
  .canvas-panel > #canvas-help {
    font-size: 9px;
    padding: 0 10px 8px;
  }
  .panel-switcher {
    display: flex;
    grid-row: 3;
    gap: 5px;
    padding: 10px;
    background: white;
    border-block: 1px solid #dedbe5;
  }
  .panel-switcher button {
    flex: 1;
  }
  .layers-panel {
    grid-row: 4;
    display: none;
    background: white;
    padding: 14px;
  }
  .workspace[data-panel="layers"] #panel-layers {
    display: flex;
    min-height: 240px;
    max-height: 500px;
  }
  .inspector {
    grid-row: 4;
    border: none;
    overflow: visible;
  }
  .inspector-tabs {
    display: none;
  }
  .workspace[data-panel="layers"] .inspector {
    display: none;
  }
  .control-section {
    padding: 16px;
  }
  .statusbar {
    height: auto;
    min-height: 28px;
    flex-wrap: wrap;
    padding: 8px;
    gap: 5px;
  }
  .statusbar p {
    white-space: normal;
  }
  .recovery-controls {
    left: 10px;
    right: 10px;
    bottom: 10px;
    flex-wrap: wrap;
  }
  .recovery-controls span {
    width: 100%;
    flex: none;
  }
}
summary {
  font-weight: 650;
  cursor: pointer;
  margin-bottom: 10px;
}
details:not([open]) summary {
  margin-bottom: 0;
}
.inspector-tabs button[aria-pressed="true"] {
  background: #eee9ff;
  color: #5846b5;
}
.topbar #top-export {
  color: #6853c6;
}
.topbar #autosave-status {
  overflow-wrap: anywhere;
}

.layer-row {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.template-link { color: var(--text, #292536); font-size: .85rem; text-decoration: none; }
.template-link:hover { text-decoration: underline; }
.template-prompt { margin: 12px; padding: 16px; background: #fff8dd; border: 1px solid #d0b957; border-radius: 10px; }
.template-prompt h2 { margin: 0 0 8px; font-size: 1rem; }
.template-prompt p { margin: 0 0 12px; max-width: 75ch; }
.template-prompt div { display: flex; flex-wrap: wrap; gap: 8px; }
.template-prompt[hidden] { display: none; }

#text-overlay { position:absolute;left:0;top:0;transform-origin:0 0;white-space:pre-wrap;overflow:hidden;outline:2px solid #705de0;background:transparent;z-index:2;min-width:8px;min-height:8px;cursor:text;user-select:text; }

.layer-item {border:1px solid #e7e3ef;border-radius:7px;padding:4px;} .layer-item>.layer-row{width:100%;} .layer-metadata{display:flex;gap:3px;margin-top:3px;} .layer-metadata input{min-width:0;width:100%;font-size:10px;} .layer-metadata button{font-size:10px;padding:4px;} .member-layer{margin:4px 0 4px 12px;}

.gradient-stop{display:grid;grid-template-columns:40px 1fr 1fr 25px;gap:4px;margin:5px 0;} .gradient-stop input{min-width:0;width:100%;padding:3px;}
