:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #617086;
  --line: #ced9e5;
  --soft: #f5f8fb;
  --paper: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0a5b55;
  --orange: #f97316;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  --drawing-contour: #006cff;
  --drawing-dimension: #111;
  --drawing-stroke-width: 1.25;
  --drawing-label-font: "GOST Type AU", "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: 100%;
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 78px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-size: 10px;
  font-weight: 800;
  box-shadow: inset -3px -3px 0 var(--teal);
}

.brand strong {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.08em;
}

.shape-tabs {
  display: flex;
  gap: 8px;
  margin-left: 64px;
}

.shape-tabs a {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.shape-tabs a:hover,
.shape-tabs a:focus-visible,
.shape-tabs a.active {
  border-color: var(--teal);
  outline: 0;
  background: #f1faf8;
  color: var(--teal-dark);
}

.logout-button {
  margin-left: auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.logout-button:hover,
.logout-button:focus-visible {
  border-color: var(--teal);
  outline: 0;
  color: var(--teal-dark);
}

.logout-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 80% 10%, rgba(15, 118, 110, 0.13), transparent 34%),
    #f5f8fb;
}

.auth-shell {
  width: min(100%, 430px);
}

.auth-brand {
  margin: 0 0 18px 4px;
}

.auth-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-card .eyebrow {
  margin: 0 0 9px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.auth-card h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.management-main {
  min-height: calc(100vh - 78px);
  padding: 36px;
  background: var(--soft);
}

.management-card {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.drawings-card {
  width: min(100%, 1180px);
}

.management-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.management-heading-row > .danger-button {
  flex: 0 0 auto;
}

.management-heading h1 {
  margin: 0;
  font-size: 28px;
}

.management-heading p:not(.management-eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.management-eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.manager-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--teal-dark);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.danger-button {
  color: #b42318;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: #d92d20;
  background: #fff6f5;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.management-status {
  min-height: 20px;
  margin: 16px 0 8px;
  color: var(--teal-dark);
  font-size: 13px;
}

.management-status.error {
  color: #b42318;
}

.manager-list {
  display: grid;
  gap: 10px;
}

.manager-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 18px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.manager-active {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
}

.manager-active input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.manager-actions {
  display: flex;
  gap: 8px;
}

.manager-empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.drawing-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(2, minmax(145px, 0.8fr)) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.drawing-filter-actions {
  display: flex;
  gap: 8px;
}

.drawing-list-heading,
.drawing-row {
  display: grid;
  grid-template-columns: minmax(75px, 0.55fr) 105px minmax(135px, 0.9fr) minmax(135px, 0.9fr) 80px minmax(410px, auto);
  gap: 12px;
  align-items: center;
}

.drawing-list-heading {
  padding: 8px 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.drawing-row {
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdff;
  font-size: 13px;
}

.drawing-number {
  font-weight: 800;
}

.drawing-details-button {
  min-height: 38px;
}

.drawing-delete-button {
  min-height: 38px;
}

.drawing-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.trash-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 4px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fbfd;
}

.trash-select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trash-select-all input,
.trash-row-selection {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}

.trash-bulk-actions > div,
.trash-row-actions {
  display: flex;
  gap: 8px;
}

.trash-list-heading,
.trash-row {
  display: grid;
  grid-template-columns: 24px 62px 102px minmax(120px, 0.75fr) minmax(130px, 0.8fr) 78px minmax(165px, 1fr) minmax(230px, auto);
  gap: 12px;
  align-items: center;
}

.trash-list-heading {
  padding: 8px 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.trash-row {
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdff;
  font-size: 13px;
}

.trash-row-actions {
  justify-content: flex-end;
}

.trash-row-actions > button {
  min-height: 38px;
  padding-right: 11px;
  padding-left: 11px;
}

.trash-deleted-at {
  color: var(--muted);
  font-size: 12px;
}

.drawing-edit-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.drawing-details {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.drawing-preview {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.drawing-preview-heading {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawing-preview-heading span {
  color: var(--muted);
  font-size: 12px;
}

.drawing-preview-heading .error {
  color: var(--danger);
}

.drawing-preview-stage {
  display: grid;
  height: min(520px, 58vh);
  min-height: 320px;
  place-items: center;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.drawing-preview-stage svg {
  width: 100%;
  height: 100%;
}

.drawing-details pre {
  max-height: 280px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #eef4f7;
  color: #203047;
  font: 12px/1.5 Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.drawing-revision {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  margin-top: 10px;
}

.drawing-revision:first-child {
  margin-top: 0;
}

.drawing-revision time {
  color: var(--muted);
  font-size: 12px;
}

.drawing-revision pre {
  grid-column: 1 / -1;
}

.revision-banner {
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 9px;
  background: rgba(15, 118, 110, 0.08);
  color: #075f59;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.save-dialog {
  width: min(calc(100% - 32px), 640px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}

.save-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.save-drawing-form {
  padding: 26px;
}

.save-dialog-heading h2 {
  margin: 0;
  font-size: 23px;
}

.save-dialog-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.save-dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.save-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.delete-period-warning {
  margin: 18px 0 0;
  padding: 11px 13px;
  border: 1px solid #f1c0bc;
  border-radius: 9px;
  background: #fff8f7;
  color: #8f2118;
  font-size: 12px;
  line-height: 1.45;
}

.delete-period-status {
  margin-bottom: 12px;
}

.auth-description {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
}

.auth-field > span:first-child {
  font-size: 13px;
  font-weight: 700;
}

.auth-field .input-wrap,
.auth-field input {
  width: 100%;
}

.auth-field input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #fff;
}

.auth-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.auth-rule,
.auth-error {
  min-height: 18px;
  margin: 9px 0 0;
  font-size: 12px;
}

.auth-rule {
  color: var(--muted);
}

.auth-error {
  color: #b42318;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  outline: 0;
  background: var(--teal-dark);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 21.5%) minmax(0, 78.5%);
  min-height: calc(100vh - 78px);
  margin: 0;
  overflow: hidden;
  background: #fff;
}

.controls {
  height: calc(100vh - 78px);
  overflow-y: auto;
  padding: 8px 18px 24px;
  border-right: 1px solid var(--line);
  background: #f5f8fb;
  scrollbar-color: #b9c7d6 transparent;
  scrollbar-width: thin;
}

.controls > .field-grid:first-child {
  margin-top: 0;
}

.controls > .control-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

.field > span:first-child {
  display: flex;
  margin-bottom: 7px;
  color: #34445b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  min-height: 15px;
  align-items: flex-end;
}

.input-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  transition: border-color 150ms, box-shadow 150ms;
}

.input-wrap:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  padding: 12px 8px 12px 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.select-wrap select {
  width: 100%;
  padding: 12px 36px 12px 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.input-wrap[data-auto="true"] {
  border-style: dashed;
  background: #eef5f4;
}

.input-wrap input:read-only {
  color: var(--teal-dark);
}

.control-group {
  margin-top: 21px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.control-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.control-group-title strong {
  color: #17263c;
  font-size: 15px;
}

.control-group-title span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.compact-grid {
  margin-top: 13px;
}

.l-niche-workspace .system-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.l-niche-workspace .system-group .control-group-title {
  grid-column: 1 / -1;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.l-niche-workspace .system-group .field-grid {
  display: contents;
}

.l-niche-workspace .system-group .field > span:first-child {
  min-height: 45px;
}

.l-niche-workspace .system-group .select-wrap select {
  padding: 10px 22px 10px 8px;
  font-size: 14px;
}

.motor-fields-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

#horizontalStartSideField > span:first-child,
#verticalStartSideField > span:first-child {
  min-height: 15px;
}

.select-wrap select:disabled {
  background: #eef2f6;
  color: #8796a8;
  cursor: not-allowed;
  opacity: 1;
}

.l-niche-workspace .offsets-group .field-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.l-niche-workspace .dimensions-group .field > span:first-child,
.l-niche-workspace .offsets-group .field > span:first-child {
  min-height: 15px;
}

.l-niche-workspace .offsets-group .input-wrap input {
  padding: 12px 2px 12px 7px;
  font-size: 14px;
}

.l-niche-workspace .offsets-group .input-wrap small {
  padding-right: 5px;
  font-size: 11px;
}

.flight-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 13px;
}

.flight-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  align-items: start;
}

.flight-control .fix-toggle {
  justify-self: center;
}

.flight-control > label:first-child {
  color: #34445b;
  font-size: 12px;
  font-weight: 700;
}

.flight-control .input-wrap input {
  padding: 8px 4px 8px 8px;
  font-size: 13px;
}

.resolved-flight {
  width: 100%;
  min-width: 0;
  padding: 8px 4px 8px 8px;
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.fix-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.fix-toggle input {
  appearance: none;
  width: 30px;
  height: 18px;
  margin: 0;
  padding: 2px;
  border: 1px solid #aebdcb;
  border-radius: 999px;
  outline: 0;
  background: #dbe4ec;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, box-shadow 150ms;
}

.fix-toggle input::before {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  content: "";
  transition: transform 150ms;
}

.fix-toggle input:checked {
  border-color: var(--teal);
  background: var(--teal);
}

.fix-toggle input:checked::before {
  transform: translateX(12px);
}

.fix-toggle input:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

[hidden] {
  display: none !important;
}

.input-wrap small {
  padding-right: 11px;
  color: var(--muted);
  font-size: 11px;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  transition: transform 150ms, box-shadow 150ms, border-color 150ms;
}

.download:hover:not(:disabled),
.download:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  outline: 0;
}

.download:disabled {
  cursor: wait;
  opacity: 0.58;
}

.download.primary {
  background: var(--ink);
  color: white;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.17);
}

.download.primary:hover:not(:disabled) {
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.24);
}

.download.secondary {
  border-color: var(--line);
  background: #f8fafc;
}

.download.secondary:hover:not(:disabled) {
  border-color: #94a3b8;
  box-shadow: 0 11px 24px rgba(15, 23, 42, 0.08);
}

.download.save {
  border-color: var(--teal);
  background: #f1faf8;
  color: var(--teal-dark);
}

.download.save:hover:not(:disabled) {
  background: #e4f5f1;
  box-shadow: 0 11px 24px rgba(15, 118, 110, 0.12);
}

.download strong {
  font-size: 14px;
  line-height: 1.2;
}

.form-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-status[data-kind="error"] {
  color: #b91c1c;
}

.form-status[data-kind="success"] {
  color: var(--teal);
}

.preview-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  height: calc(100vh - 78px);
  padding: 30px 28px 22px;
  background: #fff;
}

.preview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.preview-heading span,
.preview-heading strong {
  display: block;
}

.preview-heading > div > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-heading strong {
  margin-top: 7px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.scale-note {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}

.drawing-stage {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  padding: 12px 0 0;
  background: #fff;
}

.drawing-stage svg {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 170px);
  filter: none;
}

.part {
  fill: none;
  stroke: var(--drawing-contour);
  stroke-width: var(--drawing-stroke-width);
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.dimensions line {
  stroke: var(--drawing-dimension);
  stroke-width: var(--drawing-stroke-width);
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}

.dimension-label {
  fill: var(--drawing-dimension);
  stroke: #fff;
  stroke-width: 7px;
  font-family: var(--drawing-label-font);
  font-size: 25px;
  font-style: italic;
  font-weight: 400;
  dominant-baseline: middle;
  paint-order: stroke fill;
  text-anchor: middle;
}

.dimension-label.compact {
  font-size: 25px;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .shape-tabs {
    margin-left: auto;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .shape-tabs a {
    flex: 0 0 auto;
  }

  .controls {
    height: auto;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-panel {
    height: auto;
    min-height: 620px;
  }

  .drawing-stage svg {
    height: auto;
    max-height: 560px;
  }

  .drawing-list-heading {
    display: none;
  }

  .trash-list-heading {
    display: none;
  }

  .drawing-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawing-filter-actions {
    grid-column: 1 / -1;
  }

  .drawing-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .drawing-actions,
  .drawing-preview,
  .drawing-details {
    grid-column: 1 / -1;
  }

  .trash-row {
    grid-template-columns: 24px repeat(3, minmax(0, 1fr));
  }

  .trash-deleted-at,
  .trash-row-actions {
    grid-column: 2 / -1;
  }
}

@media (max-width: 650px) {
  .topbar {
    min-height: 76px;
    padding: 0 12px;
    flex-wrap: wrap;
  }

  .brand {
    gap: 8px;
  }

  .brand strong {
    display: none;
  }

  .shape-tabs {
    flex: 1;
    width: auto;
    margin-left: auto;
  }

  .logout-button {
    margin-left: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .controls {
    padding: 8px 20px 24px;
  }

  .preview-panel {
    padding: 25px 20px;
  }

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

  .l-niche-workspace .offsets-group .field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-group-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .control-group-title span {
    text-align: left;
  }

  .preview-panel {
    min-height: 500px;
  }

  .drawing-stage {
    min-height: 310px;
  }

  .management-main {
    padding: 18px 12px;
  }

  .management-card {
    padding: 20px;
  }

  .management-heading-row {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .manager-create,
  .manager-row {
    grid-template-columns: 1fr;
  }

  .manager-row {
    gap: 10px;
  }

  .manager-actions > button {
    flex: 1;
  }

  .drawing-filters {
    grid-template-columns: 1fr;
  }

  .drawing-filter-actions > button {
    flex: 1;
  }

  .drawing-list-heading {
    display: none;
  }

  .trash-bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .trash-bulk-actions > div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .trash-list-heading {
    display: none;
  }

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

  .drawing-cell:nth-child(3),
  .drawing-cell:nth-child(4),
  .drawing-actions,
  .drawing-preview,
  .drawing-details {
    grid-column: 1 / -1;
  }

  .drawing-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .drawing-actions > * {
    flex: 1;
  }

  .trash-row {
    grid-template-columns: 24px 1fr 1fr;
  }

  .trash-row .drawing-cell:nth-of-type(3),
  .trash-row .drawing-cell:nth-of-type(4),
  .trash-row .drawing-cell:nth-of-type(6),
  .trash-deleted-at,
  .trash-row-actions {
    grid-column: 2 / -1;
  }

  .trash-row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .save-dialog-grid {
    grid-template-columns: 1fr;
  }

  .save-dialog-grid .field:last-child {
    grid-column: auto;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
