@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Medium.ttf") format("truetype");
  font-weight: 500;
}

:root {
  --background: #ffffff;
  --foreground: #000000;
  --muted: #f5f5f5;
  --muted-foreground: #525252;
  --border-light: #e5e5e5;
  --danger: #b00020;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.02)),
    repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 0, 0, 0.018) 1px, rgba(0, 0, 0, 0.018) 2px);
  background-size: auto, 100% 4px;
  color: var(--foreground);
  font-family: "Roboto", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--foreground);
  color: var(--background);
  padding: 0.75rem 1rem;
}

.skip-link:focus {
  top: 1rem;
}

.button-link {
  border-bottom: 2px solid transparent;
  text-decoration: none;
}

.button-link:hover,
.button-link:focus-visible {
  border-color: var(--foreground);
  outline: none;
}

.page-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 1rem 0rem 2rem;
}

.login-page {
  background: var(--background);
}

.login-page .page-shell {
  display: grid;
  min-height: 100vh;
  padding: 1.5rem;
}

.editor-page .page-shell {
  padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
}

.menu-page .page-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 1rem;
}

.messages,
.form-errors {
  border: 2px solid var(--foreground);
  background: var(--background);
  margin-bottom: 1.5rem;
  padding: 1rem;
}

.form-errors {
  border-color: var(--danger);
  color: var(--danger);
}

.form-errors .errorlist {
  color: inherit;
}

.login-layout {
  display: grid;
  min-height: 100%;
  place-items: center;
}

.section-heading h1,
.empty-state h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(4rem, 12vw, 10rem);
  line-height: 0.95;
  font-weight: 400;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.heavy-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  border-top: 8px solid var(--foreground);
  padding-top: 1rem;
}

.heavy-rule span {
  display: block;
  width: 24px;
  height: 24px;
  border: 4px solid var(--foreground);
}

.auth-form,
.certificate-form {
  border: 2px solid var(--foreground);
  background: var(--background);
  padding: 2rem;
}

.auth-form {
  width: min(100%, 420px);
}

.auth-form.simple-login-form {
  display: grid;
  width: min(100%, 340px);
  border: 0;
  padding: 0;
  gap: 1rem;
}

.login-logo {
  display: block;
  width: min(170px, 48vw);
  height: auto;
  max-width: 100%;
  max-height: 170px;
  margin: 0 auto 2rem;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.login-fields {
  display: grid;
  gap: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

label,
.field-group {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid var(--foreground);
  border-radius: 0;
  background: var(--background);
  color: var(--foreground);
  font: 400 1rem/1.3 "Roboto", Arial, sans-serif;
  letter-spacing: 0;
}

textarea {
  min-height: 130px;
  padding: 0.65rem 0;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent calc(50% - 1px), var(--foreground) calc(50% - 1px), var(--foreground) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(135deg, transparent calc(50% - 1px), var(--foreground) calc(50% - 1px), var(--foreground) calc(50% + 1px), transparent calc(50% + 1px));
  background-position:
    calc(100% - 1.14rem) calc(50% - 0.06rem),
    calc(100% - 0.77rem) calc(50% - 0.06rem);
  background-repeat: no-repeat;
  background-size: 0.58rem 0.58rem;
  padding-right: 2.4rem;
}

select::-ms-expand {
  display: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(0, 0, 0, 0.32);
  font-style: italic;
  opacity: 1;
}

input[data-date-display] {
  text-transform: uppercase;
}

input:focus,
select:focus,
textarea:focus {
  border-bottom-width: 4px;
  outline: none;
}

.field-label {
  display: block;
}

.required-marker {
  margin-left: 0.25rem;
  color: var(--foreground);
}

.checkbox-dropdown {
  position: relative;
  width: 100%;
  min-width: 0;
  color: var(--foreground);
  font: 400 1rem/1.3 "Roboto", Arial, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.checkbox-dropdown summary {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  border-bottom: 2px solid var(--foreground);
  cursor: pointer;
  list-style: none;
  overflow: hidden;
}

.checkbox-dropdown summary span {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox-dropdown summary::after {
  content: "";
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  margin: -0.2rem 0.2rem 0 0;
  border-right: 2px solid var(--foreground);
  border-bottom: 2px solid var(--foreground);
  transform: rotate(45deg);
}

.checkbox-dropdown summary::-webkit-details-marker {
  display: none;
}

.checkbox-dropdown[open] summary {
  border-bottom-width: 4px;
}

.checkbox-dropdown[open] summary::after {
  margin-top: 0.2rem;
  transform: rotate(225deg);
}

.checkbox-dropdown-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 4;
  display: grid;
  max-height: 190px;
  overflow-y: auto;
  border: 2px solid var(--foreground);
  background: var(--background);
  padding: 0.25rem 0;
}

.checkbox-dropdown.open-up .checkbox-dropdown-panel {
  top: auto;
  bottom: calc(100% + 0.35rem);
}

.checkbox-option {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.checkbox-option:hover,
.checkbox-option:focus-within {
  background: var(--muted);
}

.checkbox-option input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--foreground);
}

.image-placeholder {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--foreground);
  background: var(--background);
  margin: 0;
  padding: 0.75rem;
  color: rgba(0, 0, 0, 0.48);
  font: 700 0.78rem/1.2 "Roboto", Arial, sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.image-placeholder span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.image-placeholder:hover,
.image-placeholder:focus-within {
  color: var(--foreground);
  outline: 3px solid var(--foreground);
  outline-offset: 3px;
}

.image-placeholder input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.image-upload-bottom {
  margin-top: 1.4rem;
}

.image-upload-trigger {
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  box-shadow: none;
}

.image-upload-trigger.has-image {
  background: var(--foreground);
  color: var(--background);
  box-shadow: none;
}

.image-upload-help {
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

.image-upload-modal[hidden] {
  display: none;
}

.image-upload-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 1rem;
}

.image-upload-dialog {
  display: grid;
  width: min(92vw, 700px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border: 2px solid var(--foreground);
  border-radius: 0;
  background: var(--background);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.12);
  padding: 1.4rem;
  gap: 1.15rem;
  color: var(--foreground);
  text-transform: none;
  letter-spacing: 0;
}

.image-upload-header {
  position: relative;
  min-height: 36px;
  padding: 0.1rem 2rem 0;
  text-align: center;
}

.image-upload-header h4 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.image-upload-close {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 26px;
  width: 26px;
  border: 0;
  background: transparent;
  color: var(--foreground);
  padding: 0;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
}

.image-upload-close:hover,
.image-upload-close:focus-visible {
  background: var(--muted);
  color: var(--foreground);
  outline: 2px solid var(--foreground);
  outline-offset: 1px;
}

.image-upload-dropzone {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  gap: 0.5rem;
  border: 1px dashed var(--foreground);
  border-radius: 0;
  background: var(--background);
  margin: 0;
  padding: 1.7rem;
  color: var(--foreground);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.image-upload-dropzone[hidden] {
  display: none;
}

.image-upload-dropzone.is-dragging,
.image-upload-dropzone:focus-within {
  border-color: var(--foreground);
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}

.image-upload-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  min-height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.image-upload-icon {
  display: block;
  width: 52px;
  height: 52px;
  margin-bottom: 0.25rem;
  color: var(--foreground);
  opacity: 0.58;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-upload-primary {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.image-upload-secondary {
  color: var(--muted-foreground);
  font-size: 0.68rem;
}

.image-upload-error {
  margin: -0.15rem 0 0;
  color: var(--danger);
  font-size: 0.72rem;
  line-height: 1.35;
}

.image-upload-file {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  border: 2px solid var(--success);
  border-radius: 0;
  background: var(--background);
  padding: 0.55rem 0.65rem;
}

.image-upload-file[hidden] {
  display: none;
}

.image-upload-file-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
}

.image-upload-file-dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  width: 5px;
  height: 8px;
  border-right: 2px solid var(--background);
  border-bottom: 2px solid var(--background);
  transform: rotate(45deg);
}

.image-upload-file-details {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.image-upload-file-details strong,
.image-upload-file-details small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-upload-file-details strong {
  font-size: 0.74rem;
  font-weight: 700;
}

.image-upload-file-details small {
  color: var(--muted-foreground);
  font-size: 0.65rem;
}

.image-upload-remove {
  min-height: 26px;
  width: 26px;
  border: 0;
  background: transparent;
  color: var(--foreground);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
}

.image-upload-remove:hover,
.image-upload-remove:focus-visible {
  background: var(--muted);
  color: var(--foreground);
  outline: 2px solid var(--foreground);
  outline-offset: 1px;
}

.image-upload-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  color: var(--muted-foreground);
  font-size: 0.68rem;
}

.image-upload-divider[hidden] {
  display: none;
}

.image-upload-divider span {
  height: 1px;
  background: var(--border-light);
}

.image-upload-url-block {
  display: grid;
  gap: 0.55rem;
}

.image-upload-url-block label {
  margin: 0;
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.image-upload-url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 2px solid var(--foreground);
  border-radius: 0;
  overflow: hidden;
}

.image-upload-url-row input {
  min-height: 42px;
  border: 0;
  padding: 0 0.65rem;
  font-size: 0.72rem;
}

.image-upload-url-row button {
  min-height: 38px;
  min-width: 48px;
  border: 0;
  border-left: 2px solid var(--foreground);
  background: var(--background);
  color: var(--foreground);
  padding: 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.image-upload-url-row button.is-reset {
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0;
}

.image-upload-url-row button:hover,
.image-upload-url-row button:focus-visible {
  background: var(--foreground);
  color: var(--background);
  box-shadow: inset 0 0 0 2px var(--background);
  outline: none;
}

.image-upload-url-row input:disabled,
.image-upload-url-row button:disabled {
  cursor: not-allowed;
  opacity: 0.74;
}

.image-upload-url-message {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  line-height: 1.35;
}

.image-upload-url-message.is-error {
  color: var(--danger);
}

.image-upload-product-viewer {
  display: block;
}

.image-upload-product-viewer[hidden] {
  display: none;
}

.image-upload-product-images {
  display: grid;
  grid-template-columns: minmax(180px, 260px);
  justify-content: center;
  border: 2px solid var(--foreground);
  padding: 0.75rem;
}

.image-upload-product-option {
  display: grid;
  min-height: 0;
  border: 2px solid var(--border-light);
  background: var(--background);
  color: var(--foreground);
  padding: 0;
  overflow: hidden;
}

.image-upload-product-option img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.image-upload-product-option:hover,
.image-upload-product-option:focus-visible,
.image-upload-product-option.is-selected {
  border-color: var(--success);
  outline: none;
}

.image-upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.image-upload-actions button {
  min-height: 42px;
  border-width: 2px;
  border-radius: 0;
  padding: 0 1rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.image-upload-actions button:disabled {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.image-upload-actions button:disabled:hover,
.image-upload-actions button:disabled:focus-visible {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  outline: none;
}

.image-upload-cancel {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--foreground);
}

.simple-login-form input {
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0 0.9rem;
}

.simple-login-form input:focus {
  border-color: var(--foreground);
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}

button,
.button-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--foreground);
  border-radius: 0;
  background: var(--foreground);
  color: var(--background);
  padding: 0.85rem 1.4rem;
  font: 700 0.8rem/1 "Roboto", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-decoration: none;
  cursor: pointer;
}

.simple-login-form button {
  width: 100%;
}

button:hover,
button:focus-visible,
.button-link:hover,
.button-link:focus-visible {
  background: var(--background);
  color: var(--foreground);
  outline: 3px solid var(--foreground);
  outline-offset: 3px;
}

.section-heading,
.empty-state,
.editor-heading {
  border-bottom: 8px solid var(--foreground);
  margin-bottom: 2rem;
  padding-bottom: 2rem;
}

.empty-state {
  max-width: 920px;
}

.empty-state p:not(.eyebrow) {
  max-width: 620px;
  font-size: 1.1rem;
  line-height: 1.7;
}

.brand-list {
  display: grid;
  width: min(100%, 380px);
  align-content: center;
  justify-content: stretch;
  gap: 1rem;
  margin: 0;
}

.brand-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--foreground);
  background: var(--background);
  color: var(--foreground);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-button:hover,
.brand-button:focus-visible {
  background: var(--foreground);
  color: var(--background);
  outline: 3px solid var(--foreground);
  outline-offset: 3px;
}

.editor-heading {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 1rem;
  border-bottom-width: 2px;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
}

.editor-heading h3 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.profile-menu {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.profile-menu summary {
  display: inline-flex;
  min-height: 48px;
  width: 48px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--foreground);
  background: var(--background);
  color: var(--foreground);
  padding: 0;
  font: 700 0.8rem/1 "Roboto", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.profile-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-menu summary::-webkit-details-marker {
  display: none;
}

.profile-menu summary:hover,
.profile-menu summary:focus-visible,
.profile-menu[open] summary {
  background: var(--foreground);
  color: var(--background);
  outline: 3px solid var(--foreground);
  outline-offset: 3px;
}

.profile-menu-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 5;
  display: grid;
  width: min(220px, calc(100vw - 2rem));
  min-width: 180px;
  max-width: calc(100vw - 2rem);
  border: 2px solid var(--foreground);
  background: var(--background);
  padding: 0;
  gap: 0;
}

.profile-menu-user {
  display: grid;
  gap: 0.25rem;
  border-bottom: 2px solid var(--foreground);
  padding: 0.75rem 0.85rem;
}

.profile-menu-name,
.profile-menu-role,
.profile-menu-link {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.profile-menu-name {
  color: var(--foreground);
  overflow-wrap: anywhere;
}

.profile-menu-role {
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}

.profile-menu-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  color: var(--foreground);
  padding: 0 0.85rem;
  text-decoration: none;
}

.profile-menu-link + .profile-menu-link {
  border-top: 1px solid var(--border-light);
}

.profile-menu-link:hover,
.profile-menu-link:focus-visible {
  background: var(--foreground);
  color: var(--background);
  outline: none;
}

.profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
}

.profile-page .page-shell {
  width: min(100%, 860px);
  padding: 1rem clamp(0.95rem, 2.5vw, 1.25rem) 2rem;
}

.profile-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-workspace-link {
  min-height: 44px;
  min-width: 132px;
  padding: 0.75rem 1rem;
}

.profile-account-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.profile-avatar-large {
  display: flex;
  flex: 0 0 auto;
  width: clamp(64px, 8vw, 86px);
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--foreground);
  background: var(--foreground);
  color: var(--background);
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.profile-summary-text {
  min-width: 0;
}

.profile-summary-text h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
  line-height: 1.05;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.profile-summary-text p {
  margin: 0.45rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0;
}

.profile-panel {
  border: 2px solid var(--foreground);
  padding: clamp(1rem, 2vw, 1.35rem);
}

.profile-panel h2 {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-details {
  display: grid;
  gap: 0;
  margin: 0;
}

.profile-details div {
  display: grid;
  grid-template-columns: minmax(150px, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--border-light);
  padding: 0.75rem 0;
}

.profile-details div:first-child {
  border-top: 0;
  padding-top: 0;
}

.profile-details div:last-child {
  padding-bottom: 0;
}

.profile-details dt,
.profile-readonly-field .field-label {
  color: var(--muted-foreground);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-details dd {
  margin: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.profile-form {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

.profile-form label {
  gap: 0.4rem;
  margin: 0;
}

.profile-form input {
  min-width: 0;
  min-height: 44px;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.profile-form .errorlist {
  margin-top: -0.35rem;
}

.profile-form > button {
  width: auto;
  min-width: 190px;
  justify-self: start;
}

.profile-readonly-field {
  display: grid;
  gap: 0.4rem;
}

.profile-readonly-field strong {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.profile-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.profile-form-actions button,
.profile-form-actions .button-link,
.profile-edit-link {
  width: auto;
  min-width: 170px;
}

.profile-edit-link {
  margin-top: 1rem;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.profile-actions .button-link {
  width: auto;
  min-width: 180px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: stretch;
}

.certificate-form {
  position: sticky;
  top: 1rem;
  padding: 1.25rem;
}

.certificate-form label {
  gap: 0.45rem;
  margin-bottom: 1.05rem;
}

.certificate-form button[type="submit"] {
  width: 100%;
}

.certificate-form button[type="submit"]:disabled {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.certificate-form button[type="submit"]:disabled:hover,
.certificate-form button[type="submit"]:disabled:focus-visible {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  outline: none;
}

.preview-panel {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 2px solid var(--foreground);
  background: var(--muted);
  padding: 0.75rem;
  overflow: hidden;
}

.preview-panel img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  aspect-ratio: 3507 / 2481;
  background: var(--background);
}

.invoice-form {
  display: grid;
  gap: 1rem;
}

.invoice-workspace-form {
  display: contents;
}

.invoice-editor-page {
  --invoice-panel-height: min(86vh, 980px);
  --invoice-preview-width: calc(var(--invoice-panel-height) * 2480 / 3508);
}

.invoice-editor-layout {
  grid-template-columns: clamp(360px, 30vw, 460px) minmax(0, var(--invoice-preview-width));
  gap: clamp(3rem, 5.5vw, 5.5rem);
  align-items: start;
  justify-content: center;
}

.invoice-editor-layout.has-invoice-modifiers {
  grid-template-columns:
    clamp(190px, 13vw, 240px)
    clamp(360px, 30vw, 460px)
    minmax(0, var(--invoice-preview-width));
  gap: clamp(2rem, 4vw, 4.5rem);
}

.invoice-modifier-panel {
  display: grid;
  align-content: center;
  gap: 1.25rem;
  height: var(--invoice-panel-height);
  padding: 0;
}

.invoice-modifier-control {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.invoice-modifier-panel .field-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-transform: uppercase;
}

.invoice-title-control {
  border: 0;
  padding: 0;
}

.invoice-title-control legend {
  margin-bottom: 0.55rem;
}

.invoice-segment-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 2px solid var(--foreground);
}

.invoice-segment-option {
  position: relative;
  display: block;
  margin: 0;
  font-size: 0;
  letter-spacing: 0;
}

.invoice-segment-option + .invoice-segment-option {
  border-left: 2px solid var(--foreground);
}

.invoice-segment-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.invoice-segment-option span {
  display: grid;
  min-height: 46px;
  place-items: center;
  padding: 0 0.45rem;
  color: var(--foreground);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
}

.invoice-segment-option input:checked + span {
  background: var(--foreground);
  color: var(--background);
}

.invoice-segment-option input:focus-visible + span {
  outline: 2px solid var(--foreground);
  outline-offset: -5px;
}

.invoice-switch-control {
  justify-items: start;
  gap: 0.65rem;
}

.invoice-switch-control .field-label {
  margin: 0;
}

.invoice-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.invoice-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.invoice-switch-track {
  position: absolute;
  inset: 0;
  border: 2px solid var(--foreground);
  border-radius: 999px;
  background: var(--background);
}

.invoice-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--foreground);
  content: "";
  transition: transform 140ms ease;
}

.invoice-switch input:checked + .invoice-switch-track {
  background: var(--foreground);
}

.invoice-switch input:checked + .invoice-switch-track::after {
  background: var(--background);
  transform: translateX(20px);
}

.invoice-switch input:focus-visible + .invoice-switch-track {
  outline: 2px solid var(--foreground);
  outline-offset: 3px;
}

.invoice-currency-control label {
  display: grid;
  gap: 0.65rem;
}

.invoice-currency-control [hidden] {
  display: none;
}

.invoice-currency-control select,
.invoice-currency-control input {
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--foreground);
  border-radius: 0;
  padding: 0 0.8rem;
  background: var(--background);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
}

.invoice-currency-control input {
  cursor: text;
  text-transform: none;
}

.invoice-currency-control select:focus-visible,
.invoice-currency-control input:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 3px;
}

.invoice-editor-page .certificate-form.invoice-form,
.invoice-editor-page .invoice-preview-panel {
  height: var(--invoice-panel-height);
  max-height: var(--invoice-panel-height);
}

.invoice-editor-page .certificate-form.invoice-form {
  overflow-y: auto;
  scrollbar-color: var(--foreground) transparent;
  scrollbar-width: thin;
}

.invoice-editor-page .certificate-form::-webkit-scrollbar {
  width: 8px;
}

.invoice-editor-page .certificate-form::-webkit-scrollbar-track {
  border-left: 1px solid var(--border-light);
  background: transparent;
}

.invoice-editor-page .certificate-form::-webkit-scrollbar-thumb {
  border: 2px solid var(--background);
  background: var(--foreground);
  background-clip: content-box;
}

.invoice-editor-page .certificate-form::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
  background-clip: content-box;
}

.invoice-editor-page .certificate-form::-webkit-scrollbar-button {
  display: none;
}

.invoice-field-section {
  display: grid;
}

.invoice-bill-to-label-editor {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  width: min(100%, 24rem);
  max-width: 100%;
}

.certificate-form .invoice-bill-to-field {
  gap: 0.45rem;
  margin-bottom: 1.05rem;
}

.certificate-form .invoice-ship-to-field[hidden] {
  display: none;
}

.invoice-editor-page input[type="checkbox"] {
  width: 1.15rem;
  min-height: 1.15rem;
  accent-color: var(--foreground);
}

.invoice-editor-page .certificate-form .invoice-bill-to-label-input {
  flex: 1 1 18rem;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0 0 0.08rem;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-transform: none;
}

.invoice-editor-page .certificate-form .invoice-bill-to-label-input:focus {
  border: 0;
}

.invoice-editor-page .certificate-form input,
.invoice-editor-page .certificate-form textarea {
  font-family: "Times New Roman", Times, serif;
}

.invoice-editor-page .certificate-form input[type="date"],
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit,
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit-text,
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit-month-field,
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit-day-field,
.invoice-editor-page .certificate-form input[type="date"]::-webkit-datetime-edit-year-field {
  text-transform: uppercase;
}

.invoice-items {
  display: grid;
  gap: 1rem;
}

.invoice-item-row {
  display: grid;
  border: 1px solid var(--border-light);
  margin: 0;
  padding: 0.75rem 0.95rem 0;
}

.invoice-item-row[hidden] {
  display: none;
}

.invoice-item-row legend {
  display: inline-block;
  min-width: 0;
  padding: 0 0.55rem;
}

.invoice-item-toggle {
  display: flex;
  flex: 0 0 auto;
  min-height: auto;
  align-items: center;
  border: 0;
  background: var(--background);
  padding: 0;
  color: var(--foreground);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.invoice-item-toggle .invoice-item-title {
  border: 1px solid var(--border-light);
  background: var(--background);
  padding: 0.45rem 0.8rem;
}

.invoice-item-summary-row {
  display: none;
}

.invoice-item-row.is-collapsed .invoice-item-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1.35rem;
  padding: 0;
  cursor: pointer;
}

.invoice-item-summary-name,
.invoice-item-summary-price {
  min-width: 0;
  color: var(--foreground);
  font: 400 1.08rem/1.25 "Times New Roman", Times, serif;
  letter-spacing: 0;
  text-transform: none;
}

.invoice-item-summary-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-item-delete {
  flex: 0 0 auto;
  min-height: 28px;
  width: 28px;
  margin-left: 0;
  border: 0;
  background: transparent;
  color: #e30613;
  padding: 0;
  font: 400 1.35rem/1 "Times New Roman", Times, serif;
  letter-spacing: 0;
  text-transform: none;
}

.invoice-item-delete:hover,
.invoice-item-delete:focus-visible {
  background: transparent;
  color: #9f0712;
  outline: 2px solid #e30613;
  outline-offset: 2px;
}

.invoice-item-body {
  display: grid;
  padding-top: 0.65rem;
}

.invoice-item-body input,
.invoice-item-body textarea {
  border-bottom-color: var(--border-light);
}

.invoice-item-body textarea {
  min-height: 86px;
}

.invoice-item-body input:focus,
.invoice-item-body textarea:focus {
  border-bottom-color: var(--foreground);
}

.invoice-item-body[hidden] {
  display: none;
}

.invoice-item-row.is-collapsed {
  padding-bottom: 0.8rem;
}

.invoice-add-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.invoice-add-icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.invoice-add-item:disabled {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.invoice-add-item:disabled:hover,
.invoice-add-item:disabled:focus-visible {
  border-color: var(--border-light);
  background: #d9d9d9;
  color: var(--muted-foreground);
  outline: none;
}

.invoice-preview-panel {
  justify-content: center;
  align-items: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  height: var(--invoice-panel-height);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--foreground) transparent;
  scrollbar-width: thin;
}

.invoice-preview-panel::-webkit-scrollbar {
  width: 8px;
}

.invoice-preview-panel::-webkit-scrollbar-track {
  background: transparent;
}

.invoice-preview-panel::-webkit-scrollbar-thumb {
  border: 2px solid var(--background);
  background: var(--foreground);
  background-clip: content-box;
}

.invoice-preview-panel .invoice-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, calc(var(--invoice-panel-height) * 2480 / 3508));
  max-height: none;
  aspect-ratio: auto;
  border: 2px solid var(--foreground);
  background: var(--background);
}

.errorlist {
  margin: 0;
  padding: 0;
  color: var(--foreground);
  font-size: 0.8rem;
  font-weight: 400;
  list-style: none;
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 980px) {
  .editor-heading {
    align-items: center;
    flex-direction: row;
  }

  .profile-menu-panel {
    right: 0;
    left: auto;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .editor-page .page-shell {
    padding: 1rem;
  }

  .login-layout,
  .editor-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .certificate-form {
    position: static;
  }

  .invoice-editor-page .certificate-form:not(.invoice-form) {
    height: auto;
    overflow-y: visible;
  }

  .preview-panel img {
    width: 100%;
    max-height: none;
  }

  .invoice-preview-panel .invoice-preview {
    width: 100%;
    height: auto;
  }

}

@media (max-width: 560px) {
  .profile-account-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-heading-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .profile-details div {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .profile-form-actions button,
  .profile-form-actions .button-link,
  .profile-edit-link,
  .profile-actions .button-link {
    width: 100%;
  }

  .brand-button {
    min-height: 52px;
    font-size: 0.82rem;
  }
}
