* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #161616;
  background: var(--ade-surface, #f3f4f6);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 32px;
  line-height: 1.12;
}

.page-copy {
  max-width: 680px;
  margin: 0;
  color: #52525b;
  line-height: 1.5;
}

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

.size-card {
  display: block;
  min-height: 118px;
  padding: 18px;
  color: #101010;
  text-decoration: none;
  background: #fff;
  border: 1px solid #d7d7dc;
  border-radius: 8px;
}

.size-card:hover,
.size-card:focus {
  border-color: #111;
  outline: none;
}

.size-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
}

.size-card span {
  color: #61616b;
}

.designer-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.designer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #fff;
  background: var(--ade-toolbar, #1e1f24);
}

.designer-brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 270px;
  padding: 4px 12px 4px 6px;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px;
}

.designer-brand:hover,
.designer-brand:focus {
  background: rgba(255, 255, 255, .14);
  outline: none;
}

.designer-brand.has-logo {
  max-width: 300px;
  padding: 4px 12px 4px 6px;
}

.designer-brand img {
  max-width: 118px;
  max-height: 42px;
  object-fit: contain;
}

.designer-brand span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  color: #d7dbe2;
  font-size: 12px;
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.size-pill {
  min-width: 96px;
  padding: 7px 10px;
  font-weight: 700;
  background: #32343b;
  border-radius: 6px;
}

.tool-button,
.tool-input,
.tool-select {
  height: 38px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: #111;
  background: #fff;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.tool-button.primary {
  color: #fff;
  background: var(--ade-primary, #0f766e);
  border-color: var(--ade-primary, #0f766e);
}

.tool-button.dark {
  color: #fff;
  background: #111;
  border-color: #111;
}

.tool-button.danger {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.tool-button:disabled {
  cursor: wait;
  opacity: .65;
}

.tool-input {
  width: 78px;
  padding: 0 8px;
}

.tool-input[type="color"] {
  width: 44px;
  padding: 3px;
}

.tool-select {
  width: 132px;
  padding: 0 8px;
}

.designer-workspace {
  min-width: 0;
  position: relative;
  padding: 20px;
  overflow: hidden;
}

.designer-stage {
  min-width: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.canvas-frame {
  width: min(100%, calc(var(--canvas-w) + 92px));
  margin: 0 auto;
  padding: 28px 28px 58px 64px;
  position: relative;
  background: #dfe2e8;
  border: 1px solid #c7cad1;
  border-radius: 8px;
}

.dimension-guide {
  position: absolute;
  z-index: 1;
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.dimension-guide::before,
.dimension-guide::after {
  content: "";
  position: absolute;
  background: #4b5563;
}

.dimension-guide span {
  position: absolute;
  background: #dfe2e8;
  white-space: nowrap;
}

.dimension-guide-y {
  top: 28px;
  bottom: 58px;
  left: 28px;
  border-left: 1px solid #4b5563;
}

.dimension-guide-y::before,
.dimension-guide-y::after {
  left: -7px;
  width: 14px;
  height: 1px;
}

.dimension-guide-y::before {
  top: 0;
}

.dimension-guide-y::after {
  bottom: 0;
}

.dimension-guide-y span {
  top: 50%;
  left: -2px;
  padding: 4px 0;
  transform: translate(-50%, -50%);
}

.dimension-guide-x {
  right: 28px;
  bottom: 24px;
  left: 64px;
  border-top: 1px solid #4b5563;
}

.dimension-guide-x::before,
.dimension-guide-x::after {
  top: -7px;
  width: 1px;
  height: 14px;
}

.dimension-guide-x::before {
  left: 0;
}

.dimension-guide-x::after {
  right: 0;
}

.dimension-guide-x span {
  top: 0;
  left: 50%;
  padding: 0 10px;
  transform: translate(-50%, -50%);
}

.canvas-frame .canvas-container {
  background: #fff;
  border: 1px solid #9ca3af;
}

.canvas-frame canvas {
  display: block;
  width: min(100%, var(--canvas-w));
  height: auto;
}

.canvas-text-editor {
  position: absolute;
  z-index: 7;
  min-width: 80px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  color: #111;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--ade-primary, #0f766e);
  border-radius: 2px;
  outline: 2px solid rgba(15, 118, 110, .18);
  overflow: hidden;
  resize: none;
  transform-origin: center center;
  white-space: pre;
}

.canvas-text-editor[hidden] {
  display: none;
}

.canvas-frame canvas.lower-canvas {
  background: #fff;
}

.canvas-frame canvas.upper-canvas {
  background: transparent;
}

.status-bar {
  min-height: 42px;
  padding: 10px 16px;
  color: #333;
  background: #fff;
  border-top: 1px solid #dadde3;
}

.status-bar.error {
  color: #8a1f11;
}

.hidden-file {
  display: none;
}

.floating-toolbar {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: #1f2937;
  border: 1px solid #111827;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.floating-toolbar[hidden] {
  display: none;
}

.floating-toolbar button,
.floating-toolbar input,
.floating-toolbar select {
  min-width: 58px;
  height: 32px;
  padding: 0 10px;
  color: #111827;
  background: #fff;
  border: 1px solid #d6d9df;
  border-radius: 6px;
  font: inherit;
}

.floating-toolbar button {
  cursor: pointer;
}

.floating-toolbar button.primary-mini {
  color: #fff;
  background: #0f766e;
  border-color: #0f766e;
}

.floating-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.floating-toolbar input[type="color"] {
  min-width: 38px;
  width: 38px;
  padding: 3px;
}

.floating-toolbar input[type="number"] {
  min-width: 62px;
  width: 62px;
}

.floating-toolbar input[type="range"] {
  width: 112px;
  min-width: 96px;
  padding: 0;
  background: transparent;
  border: 0;
  accent-color: var(--ade-primary, #0f766e);
}

.floating-toolbar output {
  min-width: 38px;
  color: #fff;
  font-size: 12px;
  text-align: right;
}

.floating-toolbar select {
  min-width: 112px;
}

.slider-tool {
  gap: 7px;
}

.range-pack {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.range-pack output {
  min-width: 32px;
}

.designer-docked-tools .canvas-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.designer-docked-tools .canvas-frame canvas {
  order: 2;
}

.designer-docked-tools .floating-toolbar {
  order: 1;
  position: relative;
  inset: auto;
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: center;
  overflow: hidden;
  box-shadow: none;
  transform: none;
}

.designer-docked-tools .floating-toolbar label,
.designer-docked-tools .floating-toolbar .stroke-toolset,
.designer-docked-tools .floating-toolbar .image-toolset,
.designer-docked-tools .floating-toolbar .quick-actions {
  flex: 0 1 auto;
}

.designer-docked-tools .floating-toolbar .slider-tool {
  flex: 1 1 180px;
}

.designer-docked-tools .floating-toolbar .range-pack {
  flex: 1 1 120px;
}

.designer-docked-tools .floating-toolbar input[type="range"] {
  flex: 1 1 80px;
  min-width: 70px;
  width: auto;
}

.designer-docked-tools .floating-toolbar button,
.designer-docked-tools .floating-toolbar select {
  min-width: 0;
}

.stroke-toolset,
.image-toolset,
.quick-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.box-toolset[hidden],
.radius-toolset[hidden],
.stroke-toolset[hidden],
.image-toolset[hidden],
.quick-actions[hidden],
.image-toolset button[hidden] {
  display: none;
}

.layers-panel,
.assets-panel {
  width: min(280px, calc(100% - 40px));
  max-height: calc(100% - 40px);
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 6;
  padding: 12px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .18);
  overflow: auto;
}

.layers-panel[hidden],
.assets-panel[hidden] {
  display: none;
}

.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.layers-title {
  font-weight: 700;
}

.layers-close {
  height: 30px;
  padding: 0 10px;
  color: #111827;
  background: #fff;
  border: 1px solid #d6d9df;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.layers-list {
  display: grid;
  gap: 8px;
}

.layer-row {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  color: #202124;
  background: #f7f8fa;
  border: 1px solid #d9dde5;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.layer-actions {
  display: flex;
  gap: 4px;
}

.layer-actions button {
  height: 26px;
  padding: 0 7px;
  color: #111827;
  background: #fff;
  border: 1px solid #d6d9df;
  border-radius: 5px;
  font: inherit;
  cursor: pointer;
}

.layer-row.active {
  border-color: var(--ade-primary, #0f766e);
  box-shadow: inset 3px 0 0 var(--ade-primary, #0f766e);
}

.layer-row.dragging {
  opacity: .55;
}

.layer-kind {
  color: #667085;
  font-size: 12px;
}

.assets-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.graphics-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.graphics-controls select,
.graphics-controls input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.asset-item {
  min-width: 0;
  min-height: 96px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  padding: 8px;
  color: #202124;
  background: #f7f8fa;
  border: 1px solid #d9dde5;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.asset-item img {
  width: 100%;
  height: 62px;
  object-fit: contain;
}

.asset-item span,
.asset-item small,
.assets-empty {
  color: #667085;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.asset-item small {
  display: block;
  font-size: 11px;
}

.admin-job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.admin-job-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.admin-job-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f7f8fa;
  border: 1px solid #e1e4ea;
  border-radius: 6px;
}

.admin-job-card strong,
.admin-job-card span {
  display: block;
}

.admin-job-card span {
  color: #667085;
  font-size: 13px;
}

.admin-notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  color: #065f46;
  background: #ecfdf3;
  border: 1px solid #a6f4c5;
  border-radius: 6px;
}

.admin-notice.error {
  color: #912018;
  background: #fef3f2;
  border-color: #fecdca;
}

.admin-actions,
.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions a {
  text-decoration: none;
}

.admin-nav .tool-button.active {
  color: #fff;
  background: var(--ade-primary, #0f766e);
  border-color: var(--ade-primary, #0f766e);
}

.admin-inline-form input {
  min-width: 0;
  flex: 1 1 130px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.admin-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.admin-home-card {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  color: #111827;
  text-decoration: none;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.admin-home-card:hover,
.admin-home-card:focus {
  border-color: var(--ade-primary, #0f766e);
  outline: none;
}

.admin-home-card strong {
  font-size: 24px;
}

.admin-home-card span {
  color: #667085;
  line-height: 1.4;
}

.login-card {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 22px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.login-card form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.login-input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.branding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  align-items: start;
}

.branding-form,
.branding-preview {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.branding-form label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.branding-form input[type="text"],
.branding-form input[type="number"],
.branding-form input[type="file"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

.branding-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.branding-colors input {
  width: 100%;
  height: 42px;
  padding: 3px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
}

.branding-preview {
  background: var(--ade-surface, #f3f4f6);
}

.branding-preview-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: #fff;
  background: var(--ade-toolbar, #1e1f24);
  border-radius: 8px;
}

.branding-preview-toolbar img {
  max-width: 42px;
  max-height: 34px;
  object-fit: contain;
}

.branding-preview-toolbar strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding-preview-toolbar span {
  margin-left: auto;
  padding: 6px 8px;
  background: rgba(255, 255, 255, .12);
  border-radius: 6px;
}

.branding-preview-body {
  min-height: 160px;
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 16px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--ade-accent, #d72638) 14%, transparent);
}

.library-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.library-tools form,
.library-row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.library-tools input,
.library-tools select,
.library-row-form input,
.library-row-form select {
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.library-section {
  min-width: 0;
}

.library-section h2 {
  margin: 0;
  font-size: 22px;
}

.library-section-head,
.library-category-actions,
.library-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.library-bulk-actions {
  justify-content: flex-start;
}

.library-category-actions {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.library-category-actions form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-category-actions input {
  min-width: 180px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.library-bulk-actions form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-bulk-actions select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfd2d8;
  border-radius: 6px;
  font: inherit;
}

.library-select-all,
.library-check {
  color: #374151;
  font-size: 13px;
}

.library-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.library-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.library-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #111827;
  text-decoration: none;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.library-folder span {
  color: #667085;
  font-size: 12px;
}

.library-folder.active {
  border-color: var(--ade-primary, #0f766e);
  box-shadow: inset 3px 0 0 var(--ade-primary, #0f766e);
}

.library-folder.drop-ready {
  color: var(--ade-primary, #0f766e);
  background: #f0fdfa;
  border-color: var(--ade-primary, #0f766e);
}

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

.library-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 8px;
}

.library-card.dragging,
.admin-job-card.dragging {
  opacity: .55;
}

.library-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: #f7f8fa;
  border: 1px solid #e1e4ea;
  border-radius: 6px;
}

.library-card strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 1180px);
    padding: 22px 0;
  }

  .page-header {
    display: block;
  }

  .page-title {
    font-size: 26px;
  }

  .designer-toolbar {
    align-items: stretch;
  }

  .designer-workspace {
    padding: 12px;
  }

  .library-layout {
    grid-template-columns: 1fr;
  }

  .library-sidebar {
    position: static;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    max-height: none;
  }

  .branding-layout {
    grid-template-columns: 1fr;
  }

  .layers-panel,
  .assets-panel {
    width: min(280px, calc(100% - 24px));
    top: 12px;
    right: 12px;
  }

  .toolbar-group {
    flex-wrap: wrap;
  }

  .toolbar-spacer {
    display: none;
  }

  .tool-button,
  .tool-select {
    flex: 1 1 auto;
  }
}
