/* ==========================================================================
   VectorCraft Shared — app.css
   Estética: fundo escuro #0f1115, painéis #161a22, acento #e8573f.
   Sem fontes nem recursos externos (apenas fontes de sistema).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens e base
   -------------------------------------------------------------------------- */

:root {
  --bg: #0f1115;
  --bg-deep: #0a0c10;
  --panel: #161a22;
  --panel-2: #1c2130;
  --panel-3: #232a3a;
  --border: #252b38;
  --border-strong: #333c50;
  --text: #e9ecf3;
  --text-dim: #a7afc1;
  --muted: #78819a;
  --accent: #e8573f;
  --accent-hi: #ff7259;
  --accent-soft: rgba(232, 87, 63, 0.14);
  --accent-ring: rgba(232, 87, 63, 0.4);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --topbar-h: 54px;
  --statusbar-h: 30px;
  --toolrail-w: 56px;
  --sidebar-w: 300px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.6);
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open,
html.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(232, 87, 63, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.vc-canvas:focus,
.vc-canvas:focus-visible,
.text-edit-area:focus,
.text-edit-area:focus-visible {
  outline: none;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #2f3849 transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #2c3444;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #39445a;
  background-clip: padding-box;
}

.app-root {
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

.vc-icon {
  display: block;
  flex: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.clipboard-proxy {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

/* --------------------------------------------------------------------------
   2. Botões, inputs e controlos
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 87, 63, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff8168, #ec5d44);
}

.btn-ghost {
  border-color: var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-danger-ghost {
  border-color: rgba(239, 68, 68, 0.28);
  background: var(--danger-soft);
  color: #fca5a5;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.btn-danger {
  background: var(--danger);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-xs {
  height: 25px;
  padding: 0 8px;
  font-size: 11.5px;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

.btn.is-busy::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--text);
}

.icon-btn.is-active,
.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.icon-btn.mini {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.icon-btn:disabled {
  opacity: 0.32;
}

.btn-label {
  display: inline;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}

.btn-group .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}

.zoom-group .icon-btn {
  width: 27px;
  height: 28px;
  border-radius: 6px;
}

.zoom-value {
  min-width: 52px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.zoom-value:hover {
  background: var(--panel-3);
  color: var(--text);
}

.text-input,
.num-input,
.hex-input,
.select-input,
.search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 140ms ease, background 140ms ease;
}

.text-input::placeholder,
.hex-input::placeholder,
.search-input::placeholder {
  color: var(--muted);
}

.text-input:hover,
.num-input:hover,
.hex-input:hover,
.select-input:hover,
.search-input:hover {
  border-color: var(--border-strong);
}

.text-input:focus,
.num-input:focus,
.hex-input:focus,
.select-input:focus,
.search-input:focus {
  border-color: var(--accent);
  background: var(--panel-3);
  outline: none;
}

.text-input.is-mono,
.hex-input,
.share-url,
.state-hint,
.stop-color {
  font-family: var(--mono);
  font-size: 11.5px;
}

.num-input {
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.select-input {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378819a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 11px;
}

.search-input {
  padding-left: 32px;
  height: 36px;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.color-input {
  width: 34px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
}

.color-input:hover {
  border-color: var(--border-strong);
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-input::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

.hex-input {
  flex: 1;
  min-width: 0;
  height: 28px;
  text-transform: lowercase;
}

.range-input {
  flex: 1;
  min-width: 0;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-name {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.field-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.field-error {
  margin: 0;
  font-size: 12px;
  color: #fca5a5;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}

.segmented-btn {
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.segmented-btn:hover {
  color: var(--text);
}

.segmented-btn.is-active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.segmented-sm .segmented-btn {
  height: 23px;
  font-size: 10.5px;
  padding: 0 7px;
}

.stroke-head,
.fill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel-3);
  transition: background 140ms ease, border-color 140ms ease;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #cbd3e1;
  transition: transform 140ms ease, background 140ms ease;
}

.switch.is-on {
  background: var(--accent);
  border-color: var(--accent);
}

.switch.is-on .switch-knob {
  transform: translateX(15px);
  background: #fff;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hi);
  font-size: 11.5px;
  font-weight: 550;
}

.link-btn:hover {
  text-decoration: underline;
}

.full-width {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-hi);
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.kbd-plus {
  color: var(--muted);
  font-size: 9px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(232, 87, 63, 0.28);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.spinner-lg {
  width: 26px;
  height: 26px;
  border-width: 2.5px;
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dots {
  display: inline-flex;
  gap: 3px;
}

.dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.1s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

/* --------------------------------------------------------------------------
   3. Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: max-content;
  max-width: 100%;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  background: #1b2130;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12.5px;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-icon {
  margin-top: 1px;
  color: var(--accent-hi);
  flex: none;
}

.toast-success {
  border-left-color: var(--ok);
}

.toast-success .toast-icon {
  color: var(--ok);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  color: #f87171;
}

.toast-warn {
  border-left-color: var(--warn);
}

.toast-warn .toast-icon {
  color: var(--warn);
}

.toast-text {
  flex: 1;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-hi);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

.toast-close {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   4. Modais e menus
   -------------------------------------------------------------------------- */

.modal-root {
  position: relative;
  z-index: 1300;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 7, 11, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 140ms ease;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal-overlay.is-closing {
  opacity: 0;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88vh;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.99);
  transition: transform 160ms ease;
  overflow: hidden;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-sm {
  max-width: 430px;
}

.modal-md {
  max-width: 590px;
}

.modal-lg {
  max-width: 780px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
}

.modal-titles {
  min-width: 0;
}

.modal-title {
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.modal-body {
  padding: 4px 20px 18px;
  overflow-y: auto;
  min-height: 0;
}

.modal-text {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.35);
}

.menu {
  position: fixed;
  z-index: 1500;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #1b2130;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 110ms ease, transform 110ms ease;
}

.menu.is-open {
  opacity: 1;
  transform: translateY(0);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 33px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: left;
}

.menu-item:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text);
}

.menu-item.is-danger {
  color: #fca5a5;
}

.menu-item.is-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

.menu-item:disabled {
  opacity: 0.42;
}

.menu-icon {
  display: inline-flex;
  color: var(--muted);
}

.menu-item:hover:not(:disabled) .menu-icon {
  color: inherit;
}

.menu-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-hint {
  font-size: 10.5px;
  color: var(--muted);
}

.menu-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

/* --------------------------------------------------------------------------
   5. Ecrãs de estado
   -------------------------------------------------------------------------- */

.state-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

.state-card {
  width: 100%;
  max-width: 500px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.state-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.state-warning .state-mark {
  background: rgba(245, 158, 11, 0.14);
  color: var(--warn);
}

.state-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.state-message {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

.state-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.state-screen.state-warning .state-card {
  text-align: center;
}

.gate-card {
  text-align: center;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.gate-form .text-input {
  height: 38px;
  text-align: center;
}

.gate-form .btn {
  height: 38px;
}

/* --------------------------------------------------------------------------
   6. Atalhos
   -------------------------------------------------------------------------- */

.shortcuts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcuts-group {
  margin: 12px 0 4px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.shortcuts-group:first-child {
  margin-top: 2px;
}

.shortcuts-list {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 6px 14px;
  margin: 0;
  align-items: center;
}

.shortcuts-list dt {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  margin: 0;
}

.shortcuts-list dd {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   7. Biblioteca
   -------------------------------------------------------------------------- */

.library {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 30px 34px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.library-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent-hi), #c8412c);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px rgba(232, 87, 63, 0.32);
}

.library-brand-text h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.library-brand-text h1 span {
  color: var(--accent-hi);
  font-weight: 600;
}

.library-brand-text p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.library-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 20px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.sort-field .select-input {
  width: auto;
  min-width: 128px;
  height: 34px;
}

.library-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.library-main {
  flex: 1;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 18px;
}

.project-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 160ms ease;
}

.project-card:hover,
.project-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.card-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: none;
  text-align: left;
}

.card-open:hover,
.card-open:focus {
  text-decoration: none;
}

.card-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 168px;
  padding: 20px;
  background-color: #10131a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.mini-sheet {
  display: block;
  width: auto;
  height: auto;
  max-width: 84%;
  max-height: 100%;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
  user-select: none;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(10, 12, 16, 0.7);
  color: #dbe1ec;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
}

.card-badge + .card-badge {
  right: 42px;
}

.card-badge-muted {
  color: var(--muted);
}

.card-body {
  padding: 11px 14px 14px;
}

.card-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.dot-sep {
  opacity: 0.5;
}

.card-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(10, 12, 16, 0.62);
  border-color: rgba(255, 255, 255, 0.07);
  color: #dbe1ec;
  opacity: 0;
  transition: opacity 120ms ease;
  backdrop-filter: blur(4px);
}

.project-card:hover .card-menu-btn,
.project-card:focus-within .card-menu-btn,
.card-menu-btn:focus-visible {
  opacity: 1;
}

.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 480px;
  margin: 46px auto;
  padding: 36px 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.library-empty h2 {
  font-size: 17px;
  font-weight: 650;
}

.library-empty p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 360px;
}

.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.library-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.footer-actions {
  display: flex;
  gap: 14px;
}

.library .state-screen {
  min-height: 42vh;
  padding: 20px 0;
}

.library .state-card {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  max-width: 560px;
}

.skeleton {
  background: linear-gradient(90deg, #1a1f2b 0%, #232a3a 45%, #1a1f2b 90%);
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-preview {
  height: 168px;
  border-radius: 0;
}

.skeleton-line {
  height: 10px;
  width: 60%;
  margin-top: 8px;
}

.skeleton-line.wide {
  width: 82%;
  height: 12px;
}

.is-spinning .vc-icon {
  animation: spin 900ms linear infinite;
}

/* --------------------------------------------------------------------------
   8. Novo cartaz
   -------------------------------------------------------------------------- */

.new-project {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.new-project-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

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

.preset-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}

.preset-btn:hover {
  border-color: var(--border-strong);
  background: var(--panel-3);
}

.preset-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(232, 87, 63, 0.3);
}

.preset-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.preset-size {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dims-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.import-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-top: 4px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: rgba(28, 33, 48, 0.4);
  transition: border-color 120ms ease, background 120ms ease;
}

.import-box.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.import-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.import-title {
  font-size: 12.5px;
  font-weight: 600;
}

.import-hint {
  font-size: 11px;
  color: var(--muted);
}

.import-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(232, 87, 63, 0.28);
  border-radius: 7px;
  background: var(--accent-soft);
  font-size: 11.5px;
  color: var(--text-dim);
}

.import-chip-icon {
  color: var(--accent-hi);
}

.import-chip-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   9. Editor: shell
   -------------------------------------------------------------------------- */

.editor-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--topbar-h);
  flex: none;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  z-index: 30;
}

.topbar-left,
.topbar-mid,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-left {
  flex: 1;
}

.topbar-mid {
  flex: none;
}

.topbar-right {
  flex: none;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 9px;
}

.brand-btn:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

.brand-btn .brand-mark {
  width: 30px;
  height: 30px;
  font-size: 16px;
  border-radius: 8px;
}

.title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 2px;
}

.project-title {
  max-width: min(34vw, 380px);
  padding: 1px 5px;
  margin-left: -5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title:hover {
  border-color: var(--border);
  background: var(--panel-2);
}

.title-sub {
  max-width: min(34vw, 380px);
  padding-left: 0;
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peers {
  display: flex;
  align-items: center;
  padding-right: 2px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: -7px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.avatar:first-child {
  margin-left: 0;
}

.avatar.is-self {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.65);
}

.avatar.is-viewer {
  opacity: 0.82;
}

.avatar-more {
  background: var(--panel-3);
  color: var(--text-dim);
  border-color: var(--panel);
  font-size: 9.5px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.conn-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(120, 129, 154, 0.12);
}

.conn-pill.is-connected,
.status-conn.is-connected {
  color: #86efac;
}

.conn-pill.is-connected .conn-dot,
.status-conn.is-connected .conn-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.conn-pill.is-pending .conn-dot,
.status-conn.is-pending .conn-dot {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}

.conn-pill.is-offline,
.status-conn.is-offline {
  color: #fca5a5;
}

.conn-pill.is-offline .conn-dot,
.status-conn.is-offline .conn-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.export-btn {
  padding: 0 10px;
  gap: 6px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.35;
}

.banner-icon {
  display: inline-flex;
  color: var(--accent-hi);
}

.banner-readonly {
  background: rgba(232, 87, 63, 0.1);
  color: #ffd4cc;
}

.banner-readonly .banner-icon {
  color: var(--accent-hi);
}

.banner-locked {
  background: rgba(245, 158, 11, 0.1);
  color: #fde5b3;
}

.banner-locked .banner-icon {
  color: var(--warn);
}

.editor-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--toolrail-w) minmax(0, 1fr) var(--sidebar-w);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-hidden .editor-body {
  grid-template-columns: var(--toolrail-w) minmax(0, 1fr);
}

.sidebar-hidden .sidebar {
  display: none;
}

.toolrail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 10px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
}

.toolrail-spacer {
  flex: 1;
  min-height: 10px;
}

.tool-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.tool-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.tool-btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(232, 87, 63, 0.35);
  color: var(--accent-hi);
}

.tool-btn kbd {
  position: absolute;
  right: 3px;
  bottom: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 8.5px;
  opacity: 0.55;
}

.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg-deep);
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  outline: none;
}

.vc-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.text-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.text-edit-overlay {
  position: absolute;
  z-index: 12;
  pointer-events: auto;
  border-radius: 2px;
  outline: 1.5px dashed rgba(232, 87, 63, 0.85);
  outline-offset: 3px;
  background: rgba(255, 255, 255, 0.015);
}

.text-edit-area {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  overflow: hidden;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  caret-color: var(--accent);
  font-kerning: normal;
}

.text-edit-badge {
  position: absolute;
  z-index: 13;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #1b2130;
  color: var(--text-dim);
  font-size: 10.5px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

.canvas-blocker {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 11, 16, 0.72);
  backdrop-filter: blur(2px);
}

.blocker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  padding: 20px 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.blocker-text {
  font-size: 12.5px;
  color: var(--text-dim);
}

.zoom-hud {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 5;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(10, 12, 16, 0.5);
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.sidebar {
  border-left: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-bottom: 18px;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--statusbar-h);
  flex: none;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  position: relative;
  z-index: 20;
}

.status-tool {
  color: var(--text-dim);
  font-weight: 600;
}

.status-sep {
  opacity: 0.4;
}

.status-spacer {
  flex: 1;
}

.status-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.status-conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.status-conn:hover {
  background: var(--panel-2);
  border-color: var(--border);
}

#vc-status-zoom {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   10. Painéis
   -------------------------------------------------------------------------- */

.panel-section {
  border-bottom: 1px solid var(--border);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px 9px 12px;
}

.panel-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  text-align: left;
}

.panel-icon {
  display: inline-flex;
  color: var(--muted);
}

.panel-title {
  flex: 1;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-chevron {
  display: inline-flex;
  color: var(--muted);
  transition: transform 140ms ease;
}

.panel-section.is-collapsed .panel-chevron {
  transform: rotate(-90deg);
}

.panel-section.is-collapsed .panel-body {
  display: none;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.panel-body {
  padding: 0 12px 13px;
}

.panel-body-layers {
  padding: 0 8px 12px;
}

.layer-order {
  display: flex;
  gap: 1px;
}

.props-body {
  display: flex;
  flex-direction: column;
}

.props-content {
  display: flex;
  flex-direction: column;
}

.props-content.is-readonly {
  opacity: 0.92;
}

.selection-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 10px;
  min-width: 0;
}

.selection-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.selection-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.selection-title {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-sub {
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}

.multi-transform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}

.readonly-value {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(28, 33, 48, 0.5);
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.appearance {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.field-opacity {
  gap: 4px;
}

.opacity-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.opacity-value {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 62px;
  flex: none;
}

.opacity-value .num-input {
  height: 26px;
  padding: 0 4px;
  text-align: right;
  font-size: 11.5px;
}

.suffix {
  font-size: 10.5px;
  color: var(--muted);
}

.fill-section,
.stroke-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-row .num-input {
  width: 62px;
  flex: none;
}

.hex-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.gradient-stops {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gradient-stop {
  display: flex;
  align-items: center;
  gap: 7px;
}

.stop-offset {
  width: 38px;
  flex: none;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stop-color {
  color: var(--muted);
}

.text-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.align-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.props-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

.props-actions .btn {
  flex: 1;
}

.panel-note {
  margin: 8px 0;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.panel-note-readonly {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ffd4cc;
  background: rgba(232, 87, 63, 0.12);
}

.panel-note-readonly .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.panel-note-lock {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.doc-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}

.doc-title {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-size {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.doc-stats {
  display: flex;
  gap: 20px;
  margin-top: 11px;
}

.doc-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.doc-stat-value {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.doc-stat-label {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.tips-list {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.tips-list li {
  margin-bottom: 3px;
}

.layers-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background 110ms ease, border-color 110ms ease;
}

.layer-row:hover {
  background: var(--panel-2);
}

.layer-row.is-selected {
  background: var(--accent-soft);
  border-color: rgba(232, 87, 63, 0.28);
}

.layer-row.is-hidden {
  opacity: 0.55;
}

.layer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 24px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.layer-btn:hover {
  background: var(--panel-3);
  color: var(--text);
}

.layer-btn.is-on {
  color: var(--accent-hi);
}

.layer-btn.is-off {
  color: var(--muted);
}

.layer-main {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  cursor: pointer;
  border-radius: 5px;
}

.layer-row.is-selected .layer-main {
  color: var(--text);
}

.layer-kind {
  display: inline-flex;
  flex: none;
  color: var(--muted);
}

.layer-row.is-selected .layer-kind {
  color: var(--accent-hi);
}

.layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.layer-more {
  opacity: 0;
}

.layer-row:hover .layer-more,
.layer-row.is-selected .layer-more,
.layer-more:focus-visible {
  opacity: 1;
}

.layer-rename {
  flex: 1;
  min-width: 0;
  height: 23px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 12px;
}

.panel-empty {
  padding: 12px 4px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   11. Partilha
   -------------------------------------------------------------------------- */

.share-dialog {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.role-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}

.role-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.role-card.role-viewer .role-icon {
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

.role-card.role-editor .role-icon {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.role-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.role-title {
  font-size: 12.5px;
  font-weight: 600;
}

.role-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.share-section {
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.share-heading {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.share-caption {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.share-link {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}

.share-link.is-current {
  border-color: rgba(232, 87, 63, 0.4);
  background: rgba(232, 87, 63, 0.07);
}

.share-link-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-link-icon {
  display: inline-flex;
  color: var(--muted);
}

.share-link-name {
  font-size: 12px;
  font-weight: 600;
}

.share-link-hint {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.share-link-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.share-url {
  flex: 1;
  min-width: 0;
  height: 28px;
  color: var(--text-dim);
}

.share-link-missing {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--warn);
  line-height: 1.4;
}

.share-danger-zone {
  margin-top: 2px;
}

.share-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
}

.share-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.share-action-title {
  font-size: 12.5px;
  font-weight: 600;
}

.share-action-hint {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
}

.share-action-row .btn {
  flex: none;
}

.share-meta {
  font-size: 10.5px;
  color: var(--muted);
  padding-top: 4px;
}

.share-footnote {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   12. Boot / noscript
   -------------------------------------------------------------------------- */

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 100vh;
  color: var(--muted);
  font-size: 12.5px;
}

.noscript-card {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--bg);
  text-align: center;
}

.noscript-card h1 {
  font-size: 20px;
}

.noscript-card p {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   13. Animações
   -------------------------------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   14. Responsivo
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  :root {
    --sidebar-w: 284px;
  }

  .project-title,
  .title-sub {
    max-width: 26vw;
  }
}

@media (max-width: 1080px) {
  .topbar-right .export-btn .btn-label,
  .library-actions .btn-label {
    display: none;
  }

  .conn-pill {
    display: none;
  }

  .topbar-mid {
    gap: 6px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 300px;
  }

  .editor-body {
    grid-template-columns: var(--toolrail-w) minmax(0, 1fr);
  }

  .sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    z-index: 40;
    border-left: 1px solid var(--border-strong);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.5);
  }

  .title-sub {
    display: none;
  }

  .status-hint {
    max-width: 46vw;
  }
}

@media (max-width: 860px) {
  .topbar {
    gap: 6px;
    padding: 0 8px;
  }

  .topbar-mid .zoom-group {
    display: none;
  }

  .peers {
    display: none;
  }

  .project-title {
    max-width: 30vw;
  }

  .library {
    padding: 20px 18px 26px;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
  }

  .library-toolbar {
    margin: 20px 0 16px;
  }

  .library-count {
    display: none;
  }

  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar-right .btn-primary .btn-label {
    display: none;
  }

  .status-hint,
  .status-sep:last-of-type {
    display: none;
  }

  .library-header {
    align-items: flex-start;
    gap: 12px;
  }

  .library-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .search-field {
    max-width: none;
  }

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

  .card-preview {
    height: 190px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal {
    max-height: 92vh;
  }

  .modal-head,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .shortcuts-list {
    grid-template-columns: 108px 1fr;
  }

  .dims-row {
    grid-template-columns: 1fr;
  }

  .toolrail {
    width: 48px;
  }

  .tool-btn {
    width: 38px;
    height: 38px;
  }

  .statusbar {
    gap: 6px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .status-tool {
    max-width: 32vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .share-action-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .share-action-row .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --toolrail-w: 46px;
  }

  .title-wrap {
    max-width: 40vw;
  }

  .project-title {
    max-width: 40vw;
    font-size: 13px;
  }

  .topbar-mid .btn-group {
    display: none;
  }

  .topbar-mid [data-act="grid"] {
    display: none;
  }

  .state-card {
    padding: 20px;
  }

  .share-link-field {
    flex-wrap: wrap;
  }

  .share-url {
    flex-basis: 100%;
  }
}

@media (hover: none) {
  .card-menu-btn,
  .layer-more {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
