.workspace-view-toggle {
  flex: none;
  min-height: 29px;
  padding: 4px 8px;
  border: 1px solid var(--line, #e0d3c7);
  border-radius: 6px;
  background: var(--surface, light-dark(#fff8f2, #36271f));
  color: light-dark(#934018, #ffbd96);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.workspace-view-toggle[aria-expanded="true"] {
  border-color: #ce713d;
  background: light-dark(#fff0e4, #513224);
}

.workspace-view-toggle[hidden], #workspace-view-editbar[hidden], #workspace-view-editor [hidden], #workspace-view-editor[hidden] { display: none !important; }

#workspace-view-editbar {
  position: sticky;
  inset-block-start: var(--wve-topbar-height, 0px);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  margin-block-end: 8px;
  padding: 5px 8px;
  border: 1px solid light-dark(#e5c5ad, #77513d);
  border-radius: 7px;
  background: light-dark(#fff8f1, #332720);
  color: light-dark(#584438, #efdbcb);
  font-size: 11px;
}

.wve-bar-actions { display: flex; gap: 5px; margin-inline-start: auto; }
#workspace-view-editbar button {
  padding: 4px 8px;
  min-height: 27px;
  border: 1px solid var(--line, #e0d3c7);
  border-radius: 5px;
  background: light-dark(#fff, #423128);
  color: inherit;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
}
#workspace-view-editbar [data-wve-bar="save"] { color: #fff; background: #a84920; border-color: #a84920; font-weight: 650; }
#workspace-view-editbar [data-wve-bar="settings"][aria-expanded="true"] { border-color: #c5845e; }
#workspace-view-editbar [data-wve-status]:empty { display: none; }
#workspace-view-editbar [data-wve-status] { color: light-dark(#ad3326, #ffa897); }
#gc-view-editor[data-wve-direct] > footer { display: none; }
#gc-view-editor[data-wve-direct] {
  inset-block-start: var(--wve-settings-top, 74px) !important;
  inset-block-end: auto !important;
  max-height: min(720px, calc(100dvh - var(--wve-settings-top, 74px) - 12px)) !important;
}

#workspace-view-editor {
  position: fixed;
  z-index: 1200;
  inset-block-start: var(--wve-settings-top, 74px);
  inset-inline-end: 14px;
  display: flex;
  flex-direction: column;
  width: min(335px, calc(100vw - 20px));
  max-height: min(680px, calc(100dvh - var(--wve-settings-top, 74px) - 12px));
  overflow: hidden;
  border: 1px solid var(--line, #e0d3c7);
  border-radius: 10px;
  background: light-dark(#fffcf9, #28211d);
  color: light-dark(#302720, #f2e7df);
  box-shadow: 0 12px 36px #0002;
  font: inherit;
  font-size: 12px;
}

#workspace-view-editor header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
}

#workspace-view-editor header { border-bottom: 1px solid var(--line, #e0d3c7); }
#workspace-view-editor header b { display: block; font-size: 14px; }
#workspace-view-editor header small { color: var(--muted, #74675f); }
.workspace-view-body { padding: 6px 11px 8px; overflow: auto; }
#workspace-view-editor summary { padding: 6px 0; cursor: pointer; font-weight: 650; }
#workspace-view-editor details + details { border-top: 1px solid var(--line, #e0d3c7); }

#workspace-view-editor label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, 45%);
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

#workspace-view-editor :is(select, input, button) {
  min-width: 0;
  min-height: 27px;
  padding: 3px 6px;
  border: 1px solid var(--line, #e0d3c7);
  border-radius: 5px;
  background: light-dark(#fff, #352b25);
  color: inherit;
  font: inherit;
}

#workspace-view-editor button { cursor: pointer; }
#workspace-view-editor button:disabled { opacity: .45; cursor: default; }
#workspace-view-editor :is(button, input, select):focus-visible, .wve-resize-grip:focus-visible { outline: 2px solid #d97c47; outline-offset: 1px; }
#workspace-view-editor [data-wve-order] { list-style: none; padding: 0; margin: 2px 0 6px; }
#workspace-view-editor [data-wve-order] li { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; padding: 3px 0; }
#workspace-view-editor [data-wve-order] li + li { border-top: 1px solid var(--line, #e0d3c7); }
#workspace-view-editor .wve-font-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; margin-block: 5px; }
#workspace-view-editor .wve-font-control label { display: block; margin: 0; }
#workspace-view-editor .wve-font-control output { color: var(--muted, #74675f); }
#workspace-view-editor .wve-font-control input { width: 100%; padding: 0; accent-color: #bb6033; }

[data-wve-position] { position: relative !important; }
[data-wve-card] { outline: 1px dashed light-dark(#c88b65, #a77656); outline-offset: -1px; }
[data-wve-card][data-wve-drop] { outline: 2px solid light-dark(#ad5728, #f1a273); }
.wve-card-grip, .wve-resize-grip { position: absolute; z-index: 3; user-select: none; }
.wve-card-grip { inset-block-start: 2px; inset-inline-end: 3px; display: grid; place-items: center; inline-size: 23px; block-size: 20px; background: light-dark(#fff1e5, #493326); color: light-dark(#a34f25, #ffbd91); border-radius: 4px; cursor: grab; }
.wve-resize-grip { touch-action: none; color: light-dark(#aa6238, #e1a37d); }
.wve-resize-grip:hover { background: light-dark(#ffceb07a, #8e624c7a); }
.wve-column-grip { inset-block: 0; inset-inline-end: 0; inline-size: 13px; cursor: col-resize; border-inline-end: 2px solid currentColor; }
.wve-table-grip { inset-block-end: 2px; inset-inline-end: 15px; display: grid; place-items: center; inline-size: 18px; block-size: 16px; border-radius: 3px; cursor: ew-resize; background: light-dark(#fff2e7, #493326); }
.wve-table-grip::before { content: '↔'; }
.wve-row-grip { inset-block-end: 0; inset-inline-start: 2px; inline-size: min(28px, calc(100% - 4px)); block-size: 10px; border-block-end: 2px solid currentColor; cursor: row-resize; }
body.wve-resizing-x { cursor: col-resize; user-select: none; }
body.wve-resizing-y { cursor: row-resize; user-select: none; }
[data-wve-scroll-host] { min-inline-size: 0; max-inline-size: 100%; overflow-x: auto !important; }
table[data-wve-width] { min-width: var(--wve-table-width) !important; }
table[data-wve-fixed] { table-layout: fixed !important; }
col[data-wve-column] { width: var(--wve-column-width) !important; }
.workspace > [data-view][data-wve-height] table :is(th, td) { height: var(--wve-row-height) !important; }
.workspace > [data-view][data-wve-padding] table :is(th, td) { padding-block: var(--wve-cell-padding) !important; }
.workspace [data-wve-font] table :is(th, td) { font-size: var(--wve-table-font) !important; }
.workspace [data-wve-font] table :is(th, td) :is(a, b, strong, label, button) { font-size: inherit !important; }
.workspace [data-wve-font] table :is(th, td) small { font-size: .88em !important; }

@media (max-width: 670px) {
  .workspace-view-toggle { min-height: 32px; padding-inline: 5px; }
  #workspace-view-editbar .wve-bar-hint { display: none; }
  #workspace-view-editbar button { min-height: 32px; }
  #workspace-view-editor { inset-inline-end: 8px; max-height: min(56dvh, calc(100dvh - var(--wve-settings-top, 74px) - 66px)); }
  #workspace-view-editor button { min-height: 31px; }
}
