:root {
  --bg: #eef2f0;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #64716d;
  --line: #ccd7d2;
  --accent: #1f6f5b;
  --accent-dark: #165444;
  --soft: #f7faf8;
  --shadow: 0 16px 38px rgba(23, 33, 31, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.work,
.summary {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.topbar p,
.hint,
.notice,
.result-row span {
  color: var(--muted);
}

.topbar p {
  margin-top: 7px;
}

.panel,
.total,
.result-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  padding: 17px;
}

.form {
  display: grid;
  gap: 14px;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.upload-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.upload-heading h2 {
  margin-bottom: 0;
}

.upload-heading #resetButton {
  flex: 1;
}

.filename-panel {
  margin-bottom: 14px;
}

.filename-panel .hint {
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.hint,
.notice {
  font-size: 13px;
  line-height: 1.35;
}

.notice {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.status-notice:empty {
  display: none;
}

.status-notice {
  min-height: 44px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.status-notice.loading,
.status-notice.ready,
.status-notice.error {
  display: flex;
}

.status-notice.loading {
  border-color: #e35d4f;
  background: #fff1f0;
  color: #b42318;
}

.status-notice.ready {
  border-color: #38a169;
  background: #ecfdf3;
  color: #16764b;
  font-size: 18px;
}

.status-notice.error {
  border-color: #c53030;
  background: #fff5f5;
  color: #9b2c2c;
}

.status-notice.loading::after {
  display: inline-block;
  width: 24px;
  overflow: hidden;
  vertical-align: bottom;
  content: '...';
  animation: loadingDots 1s steps(4, end) infinite;
}

@keyframes loadingDots {
  0% {
    width: 0;
  }
  100% {
    width: 24px;
  }
}

.upload-guide {
  grid-column: 1 / -1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.upload-guide-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.upload-guide img {
  display: block;
  width: min(100%, 420px);
  min-width: 340px;
  height: auto;
}

.compact {
  margin: 10px 0 12px;
}

.price-notice {
  margin: 0;
}

.price-notice:empty {
  display: none;
}

.price-notice.is-loading,
.price-notice.is-error {
  border-color: #e35d4f;
  background: #fff1f0;
  color: #b42318;
  font-weight: 700;
}

.price-notice.is-ready {
  border-color: #38a169;
  background: #ecfdf3;
  color: #16764b;
  font-weight: 700;
}

.file-drop {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  gap: 4px;
  min-height: 68px;
  align-content: center;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.file-drop input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.file-drop span {
  font-weight: 700;
}

.file-drop em {
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
}

.file-drop small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop-secondary {
  grid-column: 1 / -1;
  min-height: 68px;
  background: #2d6f9f;
}

.layout-svg-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.layout-svg-button {
  width: 100%;
  margin: 0;
}

.layout-cache-note {
  display: block;
  margin-top: 8px;
  color: #587083;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.layout-svg-actions[hidden],
.layout-cache-note[hidden] {
  display: none !important;
}

.layout-svg-button:disabled,
.layout-svg-button:disabled:hover {
  border-color: #9fb6c7;
  background: #edf4f8;
  color: #587083;
  cursor: not-allowed;
  opacity: 1;
}

@media (max-width: 720px) {
  .layout-svg-actions {
    grid-template-columns: 1fr;
  }
}

.grid,
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sheet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

input[type='text'],
input[type='number'],
input[type='url'],
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fbfdfc;
  color: var(--ink);
}

input::placeholder {
  color: #8a9691;
  opacity: 1;
}

input[aria-invalid='true'],
select[aria-invalid='true'] {
  border-color: #d0342c;
  outline: 3px solid rgba(208, 52, 44, 0.14);
}

input.attention-flash-input,
select.attention-flash-input {
  animation: inputAttentionFlash 0.5s ease-in-out 6;
}

@keyframes inputAttentionFlash {
  0%,
  100% {
    border-color: #d0342c;
    background: #fff7f6;
    box-shadow: 0 0 0 0 rgba(208, 52, 44, 0);
  }
  50% {
    border-color: #ff2418;
    background: #ffd9d5;
    box-shadow: 0 0 0 8px rgba(208, 52, 44, 0.38);
  }
}

input[readonly] {
  background: #eef3f0;
  color: var(--muted);
  cursor: not-allowed;
}

.single-row {
  display: grid;
  grid-template-columns: minmax(0, 220px);
  margin-bottom: 12px;
}

.lower-control {
  margin-top: 12px;
  margin-bottom: 0;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 111, 91, 0.14);
}

select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 111, 91, 0.14);
}

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

.checks label {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
}

.checks .material-control {
  display: grid;
  align-items: stretch;
  gap: 7px;
  color: var(--muted);
}

.checks .material-control.attention-flash-control {
  animation: materialControlAttentionFlash 0.5s ease-in-out 6;
}

@keyframes materialControlAttentionFlash {
  0%,
  100% {
    border-color: var(--line);
    background: var(--soft);
    box-shadow: none;
  }
  50% {
    border-color: #ff2418;
    background: #ffd9d5;
    box-shadow: 0 0 0 7px rgba(208, 52, 44, 0.3);
  }
}

.material-control select {
  color: var(--ink);
}

.checks input {
  width: 18px;
  height: 18px;
  margin: 0 9px 0 0;
  accent-color: var(--accent);
}

.scroll-x,
.result-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.summary {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.total {
  display: grid;
  gap: 0;
  padding: 20px;
}

.total h2 {
  margin-bottom: 14px;
}

.payment-list {
  display: grid;
  gap: 7px;
  margin-top: 7px;
}

.payment-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.payment-list span {
  color: var(--muted);
  font-size: 13px;
}

.payment-list strong {
  white-space: nowrap;
}

.payment-list .unit-price {
  min-width: 92px;
  color: var(--accent-dark);
  text-align: right;
}

.result-list {
  min-width: 0;
}

.result-file-name {
  padding: 14px 15px 0;
  font-weight: 700;
  line-height: 1.35;
}

.result-title {
  margin: 0;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.result-row {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.actions {
  display: grid;
  gap: 10px;
}

.primary,
.secondary {
  min-height: 44px;
  border-radius: 6px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  border: 0;
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-dark);
}

.primary.is-disabled {
  background: #9aa7a2;
  cursor: not-allowed;
  opacity: 0.72;
}

.primary.is-disabled:hover {
  background: #9aa7a2;
}

.primary:disabled {
  background: #9aa7a2;
  cursor: not-allowed;
  opacity: 0.72;
}

.panel.attention-flash {
  animation: attentionFlash 0.55s ease-in-out 4;
}

.file-drop.attention-flash-upload {
  animation: uploadAttentionFlash 0.5s ease-in-out 6;
}

@keyframes uploadAttentionFlash {
  0%,
  100% {
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(208, 52, 44, 0);
  }
  50% {
    background: #d0342c;
    box-shadow: 0 0 0 8px rgba(208, 52, 44, 0.4);
  }
}

@keyframes attentionFlash {
  0%,
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
  50% {
    border-color: #d0342c;
    box-shadow: 0 0 0 5px rgba(208, 52, 44, 0.22);
  }
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.upload-toolbar #resetButton {
  border: 0;
  background: #c9362c;
  color: #ffffff;
}

.upload-toolbar #resetButton:hover {
  background: #a92b24;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .summary {
    position: static;
  }
}

@media (max-width: 700px) {
  .app {
    padding: 10px;
  }

  .topbar,
  .upload-panel,
  .sheet-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .grid,
  .checks,
  .single-row {
    grid-template-columns: 1fr;
  }

  .price-grid {
    grid-template-columns: repeat(3, 178px);
    width: max-content;
  }

  .panel {
    padding: 14px;
  }

  .result-list {
    min-width: 0;
  }
}

/* Modern strict interface */
:root {
  --bg: #f2f4f6;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #66727e;
  --line: #d9e0e6;
  --line-strong: #c4ced7;
  --accent: #245a86;
  --accent-dark: #173f5f;
  --accent-soft: #edf4f9;
  --success: #23705a;
  --danger: #b33b32;
  --soft: #f7f9fa;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.05), 0 12px 32px rgba(23, 33, 43, 0.06);
}

body {
  background:
    radial-gradient(circle at 18% -10%, #2b3c4b 0, #19242e 310px, transparent 620px),
    linear-gradient(180deg, #151e27 0, #0f151c 100%);
  color: var(--ink);
  font-family: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.app {
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  width: min(1440px, 100%);
  padding: 28px;
}

.topbar {
  align-items: center;
  margin-bottom: 22px;
  padding: 2px 2px 0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 230px;
  padding: 12px 14px;
  border: 1px solid rgba(185, 206, 224, 0.25);
  border-radius: 12px;
  background: rgba(8, 14, 20, 0.48);
  color: #f7f9fb;
}

.auth-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.auth-copy strong {
  font-size: 13px;
  line-height: 1.25;
}

.auth-copy span {
  overflow: hidden;
  color: #b9cee0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-login,
.auth-logout {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid #d5dde4;
  border-radius: 8px;
  background: #ffffff;
  color: #243746;
  font-size: 13px;
  font-weight: 750;
  line-height: 18px;
  text-decoration: none;
}

.google-login:hover,
.auth-logout:hover {
  border-color: #97aabc;
  background: #f2f6f9;
}

[data-auth-state="anonymous"] .file-drop[aria-disabled="true"],
[data-auth-state="loading"] .file-drop {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.brand-signature {
  width: 240px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  clip-path: none;
  box-shadow: none;
}

.brand-kicker,
.section-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-kicker {
  width: 100%;
  margin: 8px 0 0;
  color: #b9cee0;
  font-size: 9px;
  letter-spacing: 0.42em;
  line-height: 1.2;
  text-align: center;
  text-align-last: auto;
  white-space: nowrap;
}

h1 {
  max-width: 760px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.04;
  color: #f7f9fb;
}

.topbar p:not(.brand-kicker) {
  margin-top: 8px;
  color: #b3bec8;
  font-size: 14px;
}

.panel,
.total,
.result-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.form {
  gap: 18px;
}

.upload-panel {
  display: block;
  margin-bottom: 18px;
}

.filename-panel {
  margin-bottom: 18px;
}

.section-heading,
.result-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.section-heading {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5eaee;
}

.section-heading > div,
.result-heading > div {
  min-width: 0;
}

.section-heading-with-action > div {
  flex: 1 1 auto;
}

.section-heading-with-action .reset-button {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
}

.section-heading h2,
.result-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.section-index {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #c5d3df;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.section-description {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-description strong {
  color: #344452;
  font-weight: 700;
}

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

.upload-slot {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.file-drop {
  grid-column: auto;
  gap: 6px;
  min-height: 126px;
  align-content: center;
  padding: 18px;
  border: 1px dashed #9fb1c0;
  border-radius: 11px;
  background: #f8fafb;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--accent);
  background: #f1f6fa;
  box-shadow: 0 0 0 4px rgba(36, 90, 134, 0.09);
  transform: translateY(-1px);
}

.file-drop span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.file-drop span::before {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-dark);
  color: #ffffff;
  content: "SVG";
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.file-drop-secondary {
  min-height: 126px;
  border-color: #b7c4cf;
  background: #fafbfc;
}

.file-drop-secondary span::before {
  background: #536779;
  content: "UV";
}

.file-drop em {
  color: #6d7883;
  font-size: 12px;
}

.file-drop small {
  margin-top: 3px;
  color: #3f5262;
  font-size: 12px;
  font-weight: 650;
}

.status-notice {
  min-height: auto;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.status-notice.ready {
  border-color: #9bc8b9;
  background: #eff8f4;
  color: var(--success);
  font-size: 13px;
}

.upload-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 0 16px;
  border-bottom: 1px solid #e5eaee;
  color: #7a8691;
  font-size: 12px;
}

.upload-toolbar #resetButton {
  min-height: 38px;
  padding: 8px 13px;
}

.upload-support {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.notice.export-rule {
  padding: 14px 16px;
  border-color: #899199;
  border-radius: 10px;
  background: #cfd2d5;
  color: #17212b;
}

.export-rule strong {
  display: block;
  margin-bottom: 8px;
  color: #17212b;
  font-size: 13px;
}

.export-rule ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.upload-guide {
  grid-column: auto;
  overflow: hidden;
  padding: 0;
  border: 1px solid #899199;
  border-radius: 10px;
  background: #cfd2d5;
}

.upload-guide summary {
  padding: 14px 16px;
  color: #17212b;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.upload-guide[open] summary {
  border-bottom: 1px solid #899199;
}

.upload-guide img {
  width: 100%;
  min-width: 0;
  padding: 12px;
  background: #ffffff;
}

label {
  gap: 8px;
  color: #596773;
  font-size: 12px;
  font-weight: 650;
}

input[type='text'],
input[type='number'],
input[type='url'],
select {
  min-height: 46px;
  border-color: #cfd8df;
  border-radius: 9px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input[type='text']:hover,
input[type='number']:hover,
input[type='url']:hover,
select:hover {
  border-color: #aab8c4;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(36, 90, 134, 0.11);
}

.filename-input-wrap {
  position: relative;
}

.filename-input-wrap > input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-color: #899199;
  background: #cfd2d5;
  color: #17212b;
  caret-color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

.filename-input-wrap > input::placeholder {
  color: #34414c;
  font-weight: 500;
  opacity: 0.48;
}

.filename-input-wrap > input:focus:placeholder-shown {
  caret-color: transparent;
}

.filename-input-wrap::after {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 2px;
  height: 23px;
  border-radius: 2px;
  background: #163f60;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  content: "";
}

.filename-input-wrap:focus-within:has(input:placeholder-shown)::after {
  animation: filenameCaretBlink 1s steps(1, end) infinite;
}

.contact-fields-title {
  margin: 18px 0 2px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-align: left;
}

.filename-format {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.filename-format strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.contact-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.contact-field {
  min-width: 0;
}

.contact-field > label {
  display: flex;
  min-height: 34px;
  align-items: flex-end;
  margin: 0 0 7px;
  color: #2b3d4a;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
}

.contact-field .filename-input-wrap > input {
  min-height: 48px;
  padding-left: 24px;
}

@media (max-width: 760px) {
  .contact-fields {
    grid-template-columns: 1fr;
  }

  .contact-field > label {
    min-height: 0;
  }
}

@keyframes filenameCaretBlink {
  0%,
  48% {
    opacity: 1;
  }

  49%,
  100% {
    opacity: 0;
  }
}

.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid label {
  padding: 13px;
  border: 1px solid #899199;
  border-radius: 10px;
  background: #cfd2d5;
  color: #17212b;
}

input[readonly] {
  border-color: #e0e5e9;
  background: #f1f4f6;
  color: #344452;
  cursor: default;
  font-weight: 750;
}

.grid input[readonly] {
  background: #ffffff;
}

.checks {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  --material-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%230f1c26' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.assembly-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.assembly-mode-button {
  min-height: 50px;
  padding: 12px 18px;
  border: 1px solid #899199;
  border-radius: 10px;
  background: #cfd2d5;
  color: #17212b;
  cursor: pointer;
  font-family: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

.assembly-mode-button:hover {
  border-color: #627078;
  background: #c3c9cd;
  transform: translateY(-1px);
}

.assembly-mode-button:focus-visible {
  outline: 3px solid rgba(31, 111, 91, 0.22);
  outline-offset: 2px;
}

.assembly-mode-button.is-selected {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(22, 84, 68, 0.22);
}

.assembly-mode-button.is-selected:hover {
  background: var(--accent);
}

.checks label,
.checks .material-control {
  min-height: 0;
  height: auto;
  align-content: start;
  align-items: stretch;
  padding: 13px;
  border-color: #899199;
  border-radius: 10px;
  background: #cfd2d5;
  color: #17212b;
  font-family: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.material-control select,
.material-control input[type='text'],
.material-control input[type='number'] {
  margin-top: auto;
  background: #ffffff;
  color: var(--ink);
  font-weight: 500;
}

.material-control select {
  min-height: 45px;
  padding-right: 38px;
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--material-chevron);
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

.material-title {
  color: #17212b;
  font: inherit;
}

.side-combined-control,
.face-control,
.back-control {
  grid-column: auto;
  grid-row: auto;
}

.side-selection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 7px;
  padding-top: 0;
  border-top: 0;
}

.side-selection-part {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.side-selection-label {
  color: #17212b;
  font: inherit;
}

.side-selection-part select,
.side-selection-part .color-picker-trigger {
  width: 100%;
  min-height: 45px;
  margin-top: 0;
}

#sideMaterial.is-expanded-list {
  max-height: 320px;
  padding: 4px;
  appearance: auto;
}

#sideMaterial.is-expanded-list option {
  padding: 6px 10px;
}

.side-color-control.is-disabled .side-selection-label {
  opacity: 0.6;
}

.side-color-control[hidden],
.side-color-palette[hidden],
.light-type-palette[hidden] {
  display: none !important;
}

.side-color-control {
  position: relative;
  overflow: visible;
  /* Fixed palettes must participate in the page-level stacking context. */
  z-index: auto;
}

.face-control {
  position: relative;
  overflow: visible;
  /* Do not let this card cover a palette opened from a neighboring control. */
  z-index: auto;
}

.face-variant-control {
  position: relative;
  overflow: visible;
}

.face-variant-control[hidden] {
  display: none !important;
}

.face-variant-control .color-picker-trigger {
  margin-top: 0;
}

.side-color-control > .side-selection-label[hidden],
.side-color-control > .color-picker-trigger[hidden] {
  display: none !important;
}

.color-picker-trigger {
  width: 100%;
  min-height: 45px;
  margin-top: auto;
  padding: 7px 11px;
  border: 1px solid #cad4dd;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}

.color-picker-trigger:hover,
.color-picker-trigger:focus-visible,
.color-picker-trigger[aria-expanded='true'] {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 111, 91, 0.14);
}

.color-picker-trigger:disabled {
  cursor: default;
  background: #ffffff;
  color: #607281;
  opacity: 1;
}

.color-picker-preview {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(15, 28, 38, 0.28);
  border-radius: 7px;
  background: var(--selected-side-color, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.color-picker-preview.is-empty {
  background:
    linear-gradient(45deg, #edf1f4 25%, transparent 25%, transparent 75%, #edf1f4 75%),
    linear-gradient(45deg, #edf1f4 25%, #ffffff 25%, #ffffff 75%, #edf1f4 75%);
  background-position: 0 0, 6px 6px;
  background-size: 12px 12px;
}

.color-picker-arrow {
  display: block;
  width: 12px;
  height: 12px;
  overflow: hidden;
  background-image: var(--material-chevron);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  color: transparent;
  font-size: 0;
}

.side-color-palette {
  position: fixed;
  z-index: 60;
  top: 50%;
  left: 50%;
  width: min(920px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 18px;
  border: 1px solid #c9d3dc;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 22px 54px rgba(3, 15, 25, 0.3);
  color: var(--ink);
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.side-color-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

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

.palette-ok {
  min-width: 64px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid #126d47;
  border-radius: 8px;
  background: #168a57;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.palette-ok:hover,
.palette-ok:focus-visible {
  background: #107447;
  outline: 3px solid rgba(22, 138, 87, 0.2);
}

.palette-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #d6dee5;
  border-radius: 8px;
  background: #f4f6f8;
  color: #243541;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.side-color-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(92px, 1fr));
  gap: 9px;
  max-height: min(520px, calc(100vh - 170px));
  overflow: auto;
  padding: 2px;
}

.side-color-grid.is-premium-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.side-color-palette:has(.side-color-grid.is-premium-grid) {
  width: min(680px, calc(100vw - 40px));
}

.side-color-palette:has(.face-acrylic-grid),
.side-color-palette:has(.frame-acp-grid),
.side-color-palette:has(.frame-paint-grid) {
  width: min(650px, calc(100vw - 40px));
}

.side-color-palette:has(.frame-paint-grid) {
  width: min(560px, calc(100vw - 40px));
}

.face-acrylic-grid,
.frame-acp-grid {
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 12px;
}

.frame-paint-grid {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 12px;
}

.frame-paint-grid .side-color-swatch {
  min-height: 92px;
  padding: 12px 11px 10px;
  border-radius: 10px;
}

.frame-paint-grid .side-color-code {
  font-size: 15px;
}

.face-acrylic-grid .side-color-swatch,
.frame-acp-grid .side-color-swatch {
  min-height: 0;
  aspect-ratio: 1.05;
  padding: 12px 10px 10px;
  border-radius: 10px;
}

.face-acrylic-grid .side-color-code,
.frame-acp-grid .side-color-code {
  font-size: 15px;
}

.face-acrylic-grid .side-color-swatch-name,
.frame-acp-grid .side-color-swatch-name {
  font-size: 10px;
}

.side-color-grid.is-premium-grid .side-color-swatch {
  min-height: 0;
  aspect-ratio: 248 / 128;
  padding: 13px 14px 11px;
  border-radius: 12px;
}

.side-color-grid.is-premium-grid .side-color-code {
  font-size: 17px;
}

.side-color-grid.is-premium-grid .side-color-swatch-name {
  font-size: 12px;
}

.side-color-swatch {
  position: relative;
  min-height: 84px;
  padding: 10px 9px 8px;
  border: 2px solid transparent;
  border-radius: 7px;
  background: var(--swatch-color);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.62);
  cursor: pointer;
}

.side-color-swatch[hidden] {
  display: none !important;
}

.side-color-swatch.is-light {
  color: #111820;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.55);
}

.side-color-stock-label {
  position: absolute;
  top: 5px;
  left: 5px;
  max-width: calc(100% - 10px);
  padding: 1px 0 2px;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.025em;
  white-space: nowrap;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
  opacity: 0.94;
}

.side-color-swatch.is-light .side-color-stock-label {
  color: #17222b;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.72);
}

.side-color-swatch:hover,
.side-color-swatch:focus-visible,
.side-color-swatch.is-selected {
  border-color: #111c25;
  outline: 2px solid #ffffff;
  outline-offset: -4px;
  transform: translateY(-1px);
}

.side-color-swatch.is-selected::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #168a57;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
}

.side-color-swatch:disabled {
  opacity: 0.2;
  filter: grayscale(0.7);
  cursor: not-allowed;
  transform: none;
}

.side-color-code {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.side-color-swatch-name {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.05;
}

.side-color-note {
  margin: 10px 0 0;
  color: #697985;
  font-size: 11px;
  line-height: 1.35;
}

.light-combined-control {
  overflow: visible;
}

.light-type-palette {
  position: fixed;
  z-index: 61;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 18px;
  border: 1px solid #c9d3dc;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 22px 54px rgba(3, 15, 25, 0.3);
  color: var(--ink);
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.light-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 11px;
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 3px;
}

.light-type-card {
  position: relative;
  min-height: 112px;
  padding: 13px;
  border: 2px solid transparent;
  border-radius: 11px;
  background:
    radial-gradient(circle at 82% 18%, var(--light-glow, rgba(255, 255, 255, 0.9)) 0 7%, transparent 28%),
    linear-gradient(145deg, var(--light-start, #f4f6f8), var(--light-end, #dce4eb));
  color: var(--light-ink, #15232d);
  box-shadow: inset 0 0 0 1px rgba(19, 39, 52, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.light-type-card:hover,
.light-type-card:focus-visible,
.light-type-card.is-selected {
  border-color: #142b3a;
  outline: 2px solid #ffffff;
  outline-offset: -5px;
  box-shadow: 0 8px 20px rgba(8, 30, 44, 0.2), inset 0 0 0 1px rgba(19, 39, 52, 0.12);
  transform: translateY(-2px);
}

.light-type-card.is-selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #168a57;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  font-size: 14px;
  font-weight: 900;
}

.light-type-name {
  max-width: calc(100% - 10px);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.08;
}

.light-type-description {
  font-size: 10px;
  font-weight: 650;
  line-height: 1.25;
  opacity: 0.76;
}

.light-type-note {
  margin: 12px 0 0;
  color: #697985;
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .side-color-palette,
  .light-type-palette {
    top: 50%;
    left: 50%;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    transform: translate(-50%, -50%);
  }

  .side-color-grid {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    max-height: calc(100vh - 150px);
  }

  .side-color-grid.is-premium-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .face-acrylic-grid,
  .frame-acp-grid {
    grid-template-columns: repeat(3, minmax(78px, 1fr));
  }

  .frame-paint-grid {
    grid-template-columns: repeat(3, minmax(78px, 1fr));
  }

  .side-color-grid.is-premium-grid .side-color-swatch {
    min-height: 0;
  }

  .light-type-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    max-height: calc(100vh - 165px);
  }
}

.summary {
  top: 24px;
  gap: 16px;
}

.result-wrap {
  overflow: hidden;
  background: #ffffff;
}

.result-heading {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.result-title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 20px;
}

.result-file-name {
  padding: 14px 20px 0;
  color: #334452;
}

.result-row {
  padding: 13px 20px;
  border-color: #e5eaee;
}

.result-row span {
  color: #6a7681;
  font-size: 12px;
}

.total {
  padding: 20px;
}

.total h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 24px;
  letter-spacing: -0.02em;
}

.payment-list {
  gap: 0;
  margin-top: 0;
}

.payment-list div {
  gap: 10px;
  padding: 13px 0;
  border-color: #e2e7eb;
}

.payment-list span {
  color: #64717c;
  font-size: 12px;
}

.payment-list strong {
  color: #1e2b36;
  font-size: 14px;
}

.payment-list .unit-price {
  color: var(--accent-dark);
  font-weight: 800;
}

.actions {
  gap: 10px;
}

.primary,
.secondary {
  min-height: 48px;
  height: auto;
  border-radius: 9px;
  padding: 13px 17px;
  line-height: 1.25;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.primary {
  background: var(--accent-dark);
  box-shadow: 0 8px 20px rgba(23, 63, 95, 0.18);
}

.primary:hover {
  background: #102f49;
  box-shadow: 0 10px 24px rgba(23, 63, 95, 0.22);
  transform: translateY(-1px);
}

.primary.is-disabled,
.primary.is-disabled:hover,
.primary:disabled {
  background: #a8b1b9;
  box-shadow: none;
  transform: none;
}

.secondary {
  border-color: #cbd5dd;
  background: #ffffff;
  color: #334452;
}

.secondary:hover {
  border-color: #9eafbc;
  background: #f6f8fa;
}

.reset-button {
  min-width: 210px;
  min-height: 60px;
  border: 1px solid #dfb6b2;
  border-radius: 12px;
  padding: 15px 28px;
  background: #fff8f7;
  color: var(--danger);
  box-shadow: none;
  font-size: 17px;
  font-weight: 800;
}

.reset-button:hover {
  border-color: #c9827c;
  background: #fff0ee;
}

.price-notice {
  border-radius: 9px;
}

.price-notice.is-loading,
.price-notice.is-error {
  border-color: #e3b2ad;
  background: #fff3f1;
  color: #9f3028;
}

.price-notice.is-ready {
  border-color: #a6cdbc;
  background: #eff8f4;
  color: var(--success);
}

@keyframes uploadAttentionFlash {
  0%,
  100% {
    border-color: #9fb1c0;
    background: #f8fafb;
    box-shadow: 0 0 0 0 rgba(179, 59, 50, 0);
  }
  50% {
    border-color: #c84238;
    background: #fff0ee;
    box-shadow: 0 0 0 7px rgba(179, 59, 50, 0.22);
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 370px;
  }

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

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    max-width: 900px;
  }

  .summary {
    position: static;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .auth-panel {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    padding: 18px;
  }

  .upload-grid,
  .upload-support {
    grid-template-columns: 1fr;
  }

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

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

  .section-heading-with-action {
    flex-wrap: wrap;
  }

  .section-heading-with-action .reset-button {
    width: 100%;
    flex-basis: 100%;
    margin-left: 0;
  }

  .face-control,
  .side-combined-control,
  .back-control {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 0;
  }

  .brand-signature {
    width: 180px;
    padding: 0;
    border-radius: 0;
  }

  .brand-kicker {
    display: block;
    margin-top: 5px;
    font-size: 7px;
    letter-spacing: 0.38em;
  }

  h1 {
    font-size: 27px;
  }

  .topbar p:not(.brand-kicker) {
    font-size: 13px;
  }

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

  .upload-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-toolbar #resetButton {
    width: 100%;
  }

  .payment-list div {
    grid-template-columns: 1fr auto;
  }

  .payment-list .unit-price {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* Completed steps use the same visual language as the selected assembly mode. */
.filename-input-wrap > input.is-complete {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(22, 84, 68, 0.22);
}

.filename-input-wrap > input.is-complete::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.file-drop.is-complete,
.file-drop-secondary.is-complete {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(22, 84, 68, 0.22);
}

.file-drop.is-complete:hover,
.file-drop.is-complete:focus-within {
  border-color: var(--accent);
  background: var(--accent);
}

.file-drop.is-complete span,
.file-drop.is-complete em,
.file-drop.is-complete small {
  color: #ffffff;
}

.file-drop.is-complete span::before {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.grid label.is-complete {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(22, 84, 68, 0.18);
}

.grid label.is-complete input[readonly] {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.grid label,
.grid input[readonly] {
  cursor: pointer;
}

.checks .material-control.is-complete {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(22, 84, 68, 0.22);
}

.material-control.is-complete .material-title,
.material-control.is-complete .side-selection-label {
  color: #ffffff;
}

.material-control.is-complete select,
.material-control.is-complete .color-picker-trigger {
  border-color: rgba(255, 255, 255, 0.34);
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.material-control.is-complete select option {
  background: #ffffff;
  color: var(--ink);
}
body.proposal-preview-open {
  overflow: hidden;
}

.proposal-preview {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #0e151d;
}

.proposal-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #e8edf2;
}

body.svg-rule-open {
  overflow: hidden;
}

.file-drop-gated input {
  pointer-events: none;
}

.file-drop-gated:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(36, 90, 134, 0.22);
  outline-offset: 3px;
  background: #f1f6fa;
}

.svg-rule-backdrop[hidden] {
  display: none;
}

.svg-rule-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(8, 17, 24, 0.84);
  backdrop-filter: blur(5px);
}

.svg-rule-modal {
  width: min(1160px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.44);
}

.svg-rule-modal:focus {
  outline: none;
}

.svg-rule-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid #d9e2e8;
}

.svg-rule-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.svg-rule-header h2 {
  max-width: 800px;
  margin: 0;
  color: #13212d;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.svg-rule-body {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 22px;
  padding: 20px 28px 22px;
}

.svg-rule-list {
  counter-reset: svg-rule;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.svg-rule-list li {
  counter-increment: svg-rule;
  position: relative;
  min-height: 31px;
  padding: 3px 0 3px 42px;
  color: #293d4b;
  font-size: 14px;
  line-height: 1.34;
}

.svg-rule-list li::before {
  content: counter(svg-rule, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #c7d6df;
  border-radius: 9px;
  color: #245a86;
  background: #eef4f7;
  font-size: 10px;
  font-weight: 800;
}

.svg-rule-list strong {
  color: #13212d;
}

.svg-rule-example {
  align-self: start;
  padding: 12px;
  border: 1px solid #cfdae1;
  border-radius: 15px;
  background: #f2f6f8;
}

.svg-rule-example-title {
  margin: 0 0 5px;
  color: #13212d;
  font-size: 15px;
  font-weight: 800;
}

.svg-rule-example-hint {
  margin: 0 0 9px;
  color: #61717d;
  font-size: 12px;
  line-height: 1.35;
}

.svg-rule-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: #303030;
  cursor: zoom-in;
}

.svg-rule-image-button::after {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  color: #ffffff;
  background: rgba(8, 17, 24, 0.8);
  font-size: 11px;
  font-weight: 700;
  content: "Нажмите, чтобы увеличить";
}

.svg-rule-image-button:focus-visible {
  outline: 3px solid rgba(36, 90, 134, 0.34);
  outline-offset: 3px;
}

.svg-rule-example img {
  display: block;
  width: 100%;
  height: min(260px, 35vh);
  object-fit: contain;
  object-position: center;
  border-radius: 9px;
  background: #303030;
  box-shadow: 0 10px 24px rgba(15, 31, 43, 0.18);
}

.svg-rule-image-button.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 14000;
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 20px;
  place-items: center;
  overflow: hidden;
  border-radius: 0;
  background: rgba(4, 10, 15, 0.96);
  cursor: zoom-out;
}

.svg-rule-image-button.is-expanded::after {
  top: 18px;
  right: 18px;
  bottom: auto;
  padding: 8px 11px;
  content: "Нажмите, чтобы уменьшить";
}

.svg-rule-image-button.is-expanded img {
  width: auto;
  height: auto;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.svg-rule-checks {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: #2e4758;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.3;
}

.svg-rule-checks span::before {
  margin-right: 7px;
  color: var(--accent);
  font-weight: 900;
  content: "✓";
}

.svg-rule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px 14px;
  border-top: 1px solid #d9e2e8;
  background: #f7f9fa;
}

.svg-rule-footer p {
  margin: 0;
  color: #61717d;
  font-size: 13px;
  line-height: 1.4;
}

.svg-rule-ok {
  width: auto;
  min-width: 150px;
  min-height: 44px;
  padding: 10px 26px;
}

@media (max-width: 860px) {
  .svg-rule-backdrop {
    padding: 10px;
  }

  .svg-rule-modal {
    max-height: calc(100vh - 20px);
    border-radius: 15px;
  }

  .svg-rule-header {
    padding: 20px 18px 16px;
  }

  .svg-rule-body {
    grid-template-columns: 1fr;
    padding: 20px 18px;
  }

  .svg-rule-example {
    width: min(100%, 540px);
  }

  .svg-rule-example img {
    height: min(360px, 48vh);
  }

  .svg-rule-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 16px 18px 18px;
  }

  .svg-rule-ok {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .svg-rule-header h2 {
    font-size: 25px;
  }

  .svg-rule-list li {
    padding-left: 40px;
    font-size: 13px;
  }
}
