:root {
  --primary: #5c35d5;
  --primary-dark: #4726b8;
  --primary-light: #ece7fd;
  --bg-color: #f8f9fc;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #1a1a24;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --soft: #f9fafb;
  --soft-strong: #f3f4f6;
  --green: #1f7a50;
  --green-soft: #e9f7ef;
  --blue: #0369a1;
  --blue-soft: #e0f2fe;
  --amber: #9a5a13;
  --amber-soft: #fff6e8;
  --red: #b4232e;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --shadow: 0 10px 24px rgba(26, 26, 36, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
}

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

button,
.file-button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

button:hover,
.file-button:hover,
.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

button.primary,
.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

button.primary:hover,
.btn-primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: #ffffff;
}

button.selected,
.language-chip.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

button.small-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-outline {
  border-color: transparent;
  background: var(--primary-light);
  color: var(--primary);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-hidden {
  display: none;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background: var(--bg-color);
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.danger-notice {
  border-color: rgba(180, 35, 46, 0.28);
  background: #fff1f2;
  color: var(--red);
}

.login-card .notice {
  margin: 0;
}

.translation-tools .notice {
  margin: 0;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--border-color);
  background: var(--sidebar-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.login-card .brand {
  min-height: auto;
  padding: 0 0 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--text-main);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.brand strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
}

.badge-free {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--text-muted);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-item {
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 10px 20px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.nav-item .nav-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-item i {
  flex: 0 0 auto;
  font-size: 18px;
}

.nav-item:hover {
  background: var(--soft-strong);
  color: var(--text-main);
}

.nav-item.active {
  border-left-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-stats {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.whats-new-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-stats span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
}

.topbar-left,
.topbar-right,
.topbar-product {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-center {
  min-width: 0;
}

.topbar-product {
  gap: 8px;
  font-weight: 700;
}

.topbar-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--text-main);
  color: #ffffff;
}

.topbar-right {
  justify-content: flex-end;
}

.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.progress-circle {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 34%, #eeeeee 0);
}

.progress-circle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #ffffff;
}

.icon-btn {
  position: relative;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
}

.dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #60a5fa;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1,
.panel h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  overflow: hidden;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 28px 32px 40px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.panel {
  width: 100%;
  max-width: 1240px;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.form-panel {
  max-width: 960px;
}

.generator-panel,
.document-library-panel {
  max-width: 1320px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.panel h2 {
  font-size: 18px;
  font-weight: 800;
}

.panel h3 {
  font-size: 14px;
  font-weight: 800;
}

.file-button {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(92, 53, 213, 0.12);
}

.rich-editor {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 7px;
  border-bottom: 1px solid var(--border-color);
  background: var(--soft);
}

.editor-toolbar button {
  width: 34px;
  min-height: 30px;
  padding: 0;
}

.editor-surface {
  min-height: 150px;
  padding: 11px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  outline: none;
}

.editor-surface:focus {
  box-shadow: inset 0 0 0 3px rgba(92, 53, 213, 0.12);
}

.wide {
  grid-column: 1 / -1;
}

.field-group {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--soft);
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

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

.list,
.template-list,
.generator-controls {
  padding: 20px 24px 24px;
}

.list {
  display: grid;
  gap: 12px;
}

.product-card,
.template-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.product-card:hover,
.template-card:hover {
  box-shadow: 0 6px 18px rgba(26, 26, 36, 0.06);
}

.product-card.active {
  border-color: var(--primary);
  background: #fbfaff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.product-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-flag,
.review-flag {
  display: block;
  margin-top: 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.review-flag {
  padding: 8px 10px;
  border: 1px solid rgba(154, 90, 19, 0.25);
  border-radius: 6px;
  background: var(--amber-soft);
}

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

.product-preview-panel {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--soft);
}

.product-language-preview {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
}

.product-language-preview summary {
  cursor: pointer;
  font-weight: 700;
}

.product-language-preview > div {
  margin-top: 8px;
  line-height: 1.55;
}

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

.template-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.template-kind {
  align-self: start;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.template-preview {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--soft);
}

.template-preview summary {
  cursor: pointer;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 800;
}

.template-preview-scroll {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
}

.template-preview table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 11px;
}

.template-preview td {
  max-width: 240px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  vertical-align: top;
}

.generator-controls {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  border-bottom: 1px solid var(--border-color);
}

.generator-source,
.generator-controls > .form-actions {
  grid-column: 1;
}

.format-picker,
.language-picker {
  grid-column: 2;
}

.generator-source {
  display: grid;
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--soft);
}

.segmented button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  font-weight: 800;
}

.segmented button.selected {
  border-color: var(--border-color);
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(26, 26, 36, 0.08);
}

.draft-box {
  display: grid;
  gap: 12px;
}

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

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

.choice-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
}

.choice-item:hover {
  border-color: var(--primary);
  background: #fbfaff;
}

.choice-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.choice-description {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

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

.language-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(46px, 1fr));
  gap: 7px;
}

.language-chip {
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 800;
}

.notice,
.warnings {
  margin: 16px 24px 0;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.notice {
  border: 1px solid rgba(3, 105, 161, 0.22);
  background: var(--blue-soft);
  color: var(--blue);
}

.warnings {
  border: 1px solid rgba(154, 90, 19, 0.26);
  background: var(--amber-soft);
  color: var(--amber);
}

.hidden {
  display: none;
}

.preview {
  padding: 20px 24px 24px;
}

.preview-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px 14px;
  padding: 10px 14px;
  border: 1px solid rgba(99, 59, 219, 0.2);
  border-radius: 8px;
  background: rgba(99, 59, 219, 0.08);
  color: var(--primary);
  font-weight: 700;
}

.preview-status.hidden {
  display: none;
}

.preview-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(99, 59, 219, 0.2);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.75s linear infinite;
  flex: 0 0 auto;
}

.loading-spinner.button-spinner {
  width: 15px;
  height: 15px;
  border-width: 2px;
}

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

.empty-state {
  color: var(--text-muted);
}

.preview-section {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.preview-section + .preview-section {
  margin-top: 12px;
}

.preview-line[dir="rtl"] {
  text-align: right;
  unicode-bidi: plaintext;
}

.preview-section h3 {
  margin-bottom: 10px;
  color: var(--primary);
}

.preview-lines {
  display: grid;
  gap: 5px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.preview-lines b,
.preview-lines strong {
  font-weight: 800;
}

.preview-line.machine-translation-line {
  color: #b45309;
}

.machine-generated-text,
.preview-lines mark,
.product-preview-panel mark {
  color: #b45309;
  background: transparent;
}

.machine-translation-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.symbols-preview {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.symbol-thumb {
  display: grid;
  gap: 6px;
  justify-items: center;
  max-width: 110px;
  color: var(--text-muted);
  font-size: 12px;
}

.symbol-thumb img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.nutrition-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: Verdana, sans-serif;
  font-size: 12px;
}

.nutrition-table td {
  border: 1px solid #222222;
  padding: 7px 9px;
  vertical-align: middle;
  white-space: pre-line;
}

.nutrition-table td:first-child {
  width: 50%;
  text-align: center;
}

.nutrition-table td:last-child {
  width: 50%;
  text-align: center;
}

.nutrition-table td.left-cell {
  text-align: left;
}

.nutrition-table td.right-cell {
  text-align: right;
}

.nutrition-table .full-cell {
  text-align: center;
}

.nutrition-table .bold-cell {
  font-weight: 700;
}

.nutrition-label-part.source-changed {
  color: var(--red);
}

.danger {
  color: var(--red);
}

.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.danger-button {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--red);
}

.danger-button:hover {
  border-color: var(--red);
  background: #fef2f2;
  color: var(--red);
}

.document-library {
  padding: 20px 24px 24px;
}

.document-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.document-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.document-table th,
.document-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.document-table th {
  background: var(--soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.document-row.active td {
  background: #fbfaff;
}

.document-expanded-row td {
  padding: 0;
  background: var(--soft);
}

.document-expanded {
  padding: 16px;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.table-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.extra-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.checkbox-label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--text-main);
}

.checkbox-label input {
  width: 16px;
  height: 16px;
}

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

.generator-symbol-selection {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--soft);
}

.symbol-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 24px 24px;
}

.symbol-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.symbol-card img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #ffffff;
}

.symbol-option {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-muted);
  font-size: 12px;
}

.symbol-option:hover {
  border-color: var(--primary);
}

.symbol-option input {
  width: 16px;
  height: 16px;
}

.symbol-option img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-center {
    order: 3;
    grid-column: 1 / -1;
    padding-bottom: 12px;
  }

  .topbar h1 {
    white-space: normal;
  }

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

  .language-grid {
    grid-template-columns: repeat(6, minmax(46px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sidebar,
  .workspace {
    width: 100%;
    height: auto;
  }

  .sidebar {
    flex: none;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .nav-item {
    border-left: 0;
    border-radius: 6px;
  }

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

  .whats-new-title {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .sidebar-stats span {
    margin: 0;
  }

  .topbar {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 14px 16px;
  }

  .topbar-left,
  .topbar-right {
    justify-content: space-between;
  }

  .content {
    overflow: visible;
    padding: 16px;
  }

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

  .generator-source,
  .generator-controls > .form-actions,
  .format-picker,
  .language-picker {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .brand,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-height: auto;
    padding: 16px;
  }

  .topbar-left,
  .topbar-right {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .form-grid,
  .nutrition-grid,
  .choice-list,
  .template-list,
  .symbol-library,
  .symbol-picker,
  .side-nav,
  .sidebar-stats {
    grid-template-columns: 1fr;
  }

  .language-grid {
    grid-template-columns: repeat(4, minmax(46px, 1fr));
  }

  .list,
  .template-list,
  .symbol-library,
  .generator-controls,
  .document-library,
  .preview,
  .form-grid {
    padding: 16px;
  }
}

/* Qensa professional interface */
:root {
  --primary: #173c7a;
  --primary-dark: #102d61;
  --primary-light: #eaf2ff;
  --bg-color: #f4f7fb;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #172033;
  --text-muted: #667085;
  --border-color: #dfe5ee;
  --soft: #f8fafc;
  --soft-strong: #eef3f8;
  --green: #16794c;
  --green-soft: #eaf8f1;
  --blue: #175cd3;
  --blue-soft: #eff6ff;
  --amber: #a15c08;
  --amber-soft: #fff7e8;
  --red: #b42318;
  --font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 50px rgba(16, 45, 97, 0.12);
}

body {
  background:
    radial-gradient(circle at 90% 0%, rgba(62, 144, 226, 0.08), transparent 28rem),
    var(--bg-color);
  letter-spacing: -0.005em;
}

button,
.file-button,
.btn {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  font-weight: 650;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

button:hover,
.file-button:hover,
.btn:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid rgba(32, 115, 205, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

button.primary,
.btn-primary {
  box-shadow: 0 1px 2px rgba(16, 45, 97, 0.22);
}

.sidebar {
  width: 270px;
  flex-basis: 270px;
  border-right-color: #e3e8ef;
  box-shadow: 8px 0 28px rgba(16, 24, 40, 0.025);
  z-index: 2;
}

.brand {
  min-height: 112px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 18px 24px;
}

.brand-logo {
  display: block;
  width: 184px;
  max-height: 60px;
  object-fit: contain;
  object-position: left center;
}

.brand-product-name {
  color: #344054;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-card {
  gap: 22px;
  padding: 32px;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.login-card .brand {
  gap: 8px;
  padding: 0 0 20px;
}

.login-card .brand-logo {
  width: 220px;
}

.side-nav {
  gap: 6px;
  padding: 18px 14px;
}

.nav-item {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 600;
}

.nav-item:hover {
  border-color: #e7ecf2;
  background: #f7f9fc;
  transform: none;
}

.nav-item.active {
  border: 1px solid #d8e6fa;
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item i {
  font-size: 19px;
}

.sidebar-stats {
  padding: 18px;
  background: #fbfcfe;
}

.sidebar-stats span {
  border: 0;
  background: transparent;
  min-height: 28px;
  margin: 0;
  padding: 4px 8px;
}

.topbar {
  min-height: 76px;
  grid-template-columns: minmax(260px, auto) minmax(220px, 1fr) auto;
  gap: 24px;
  padding: 0 32px;
  border-bottom-color: #e3e8ef;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.topbar-mark {
  background: var(--primary);
}

.topbar h1 {
  color: #101828;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.progress-pill {
  border-color: #d7e5da;
  background: #f0f9f3;
  color: #287348;
}

.progress-circle {
  width: 9px;
  height: 9px;
  background: #32a062;
}

.progress-circle::after {
  display: none;
}

.content {
  padding: 32px 36px 48px;
}

.panel {
  max-width: 1460px;
  border-color: #e0e6ed;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.form-panel {
  max-width: 1100px;
}

.panel-heading {
  min-height: 88px;
  padding: 22px 26px;
}

.panel h2 {
  color: #101828;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.panel h3 {
  color: #24324a;
  font-size: 15px;
}

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

.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field {
  position: relative;
  display: block;
  width: min(340px, 38vw);
  color: var(--text-muted);
}

.search-field > i {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  font-size: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  min-height: 42px;
  padding: 9px 13px 9px 40px;
  border-radius: 9px;
  font-weight: 500;
}

input,
textarea,
select {
  min-height: 42px;
  border-color: #d5dce6;
  border-radius: 8px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #4b78b8;
  box-shadow: 0 0 0 3px rgba(23, 60, 122, 0.1);
}

.list,
.template-list,
.generator-controls {
  padding: 22px 26px 28px;
}

.product-table-wrap,
.document-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  background: #fff;
}

.product-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.product-table th,
.product-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e9edf2;
  text-align: left;
  vertical-align: middle;
}

.product-table th {
  background: #f8fafc;
  color: #667085;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.product-table th:first-child {
  width: 36%;
}

.product-table th:last-child {
  width: 238px;
}

.product-table tr:last-child > td {
  border-bottom: 0;
}

.product-row:hover td,
.product-row.active td {
  background: #f9fbff;
}

.table-product-name {
  color: #182230;
  font-weight: 700;
  line-height: 1.35;
}

.table-note {
  max-width: 440px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-badge,
.version-badge,
.selection-count {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid #d9e1ec;
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.nutrition-summary {
  display: block;
  margin-bottom: 3px;
  color: #344054;
  font-weight: 650;
}

.actions-heading {
  text-align: right !important;
}

.table-actions-right {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
}

.table-actions-right button {
  gap: 5px;
  padding-right: 9px;
  padding-left: 9px;
}

.icon-action {
  width: 34px;
  padding: 0;
}

.product-expanded-row > td {
  padding: 0;
  background: #f7f9fc;
}

.product-preview-panel {
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
}

.search-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 52px 20px;
  border: 1px dashed #cfd8e5;
  border-radius: 11px;
  text-align: center;
}

.search-empty i {
  margin-bottom: 4px;
  color: #8b9bb1;
  font-size: 28px;
}

.search-empty strong {
  color: #344054;
}

.generator-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  background: #fbfcfe;
}

.generator-section,
.generator-source,
.generator-controls > .form-actions,
.format-picker,
.language-picker {
  grid-column: 1;
}

.generator-section {
  padding: 20px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025);
}

.section-heading-inline,
.section-heading-copy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-heading-inline {
  margin-bottom: 16px;
}

.row-heading.section-heading-inline {
  justify-content: space-between;
}

.section-step {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.section-heading-inline .meta {
  margin-top: 3px;
}

.generator-source-row {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(320px, 1fr);
  gap: 16px;
  align-items: end;
}

.segmented {
  height: 44px;
  padding: 4px;
  border-color: #d9e0e9;
  border-radius: 10px;
}

.segmented button {
  min-height: 34px;
  border-radius: 7px;
}

.segmented button:hover {
  transform: none;
}

.segmented button.selected {
  border-color: #d8e0eb;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
}

.product-combobox-wrap {
  position: relative;
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.product-combobox {
  position: relative;
}

.product-combobox > i {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  color: #7a899e;
  font-size: 18px;
  transform: translateY(-50%);
}

.product-combobox input {
  padding-left: 40px;
  padding-right: 44px;
}

.combobox-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #667085;
  font-size: 20px;
}

.combobox-toggle:hover {
  background: #f2f5f8;
  color: var(--primary);
  transform: none;
}

.combobox-options {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d7dfe9;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.combobox-option {
  position: relative;
  display: grid;
  align-content: center;
  justify-content: stretch;
  justify-items: start;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px 8px 30px;
  border: 0;
  background: transparent;
  text-align: left;
}

.combobox-option::before {
  position: absolute;
  top: 18px;
  left: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aabc1;
  content: "";
}

.combobox-option:hover,
.combobox-option.selected {
  background: var(--primary-light);
  color: var(--primary);
  transform: none;
}

.combobox-option:hover::before,
.combobox-option.selected::before {
  background: var(--primary);
}

.combobox-option span {
  width: 100%;
  overflow: hidden;
  max-width: 100%;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option small {
  width: 100%;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
}

.combobox-empty {
  padding: 20px 12px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

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

.draft-box {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

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

.choice-item {
  position: relative;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 112px;
  gap: 10px;
  padding: 15px 48px 15px 15px;
  border-radius: 10px;
  overflow: hidden;
}

.choice-item:hover,
.choice-item.selected {
  border-color: #7fa3d4;
  background: #f7faff;
  box-shadow: inset 0 0 0 1px rgba(23, 60, 122, 0.08);
}

.choice-item input {
  position: absolute;
  top: 16px;
  right: 14px;
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.choice-index {
  color: #8a9ab0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.choice-icon {
  position: absolute;
  right: 14px;
  bottom: 13px;
  color: #9eb2ce;
  font-size: 22px;
}

.choice-copy {
  display: block;
}

.choice-copy strong {
  color: #26364e;
  font-size: 13px;
  line-height: 1.35;
}

.choice-description {
  margin-top: 6px;
  font-size: 11px;
}

.language-grid {
  grid-template-columns: repeat(12, minmax(52px, 1fr));
  gap: 8px;
}

.language-chip {
  min-height: 38px;
  border-radius: 8px;
  font-size: 12px;
}

.language-chip:hover {
  transform: none;
}

.generator-symbol-selection {
  margin: 0;
  padding: 20px;
  background: #fff;
}

.symbol-picker {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.symbol-option {
  border-radius: 10px;
  cursor: pointer;
}

.symbol-option input {
  accent-color: var(--primary);
}

.generator-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 5px 0 0;
}

.generator-actions button {
  min-height: 44px;
}

.generator-actions #savePreviewButton {
  margin-left: auto;
}

.document-library > .list {
  padding: 0;
}

.document-table-wrap {
  border-radius: 11px;
}

.document-table th,
.document-table td {
  padding: 14px 16px;
  border-bottom-color: #e9edf2;
  vertical-align: middle;
}

.document-table th {
  background: #f8fafc;
  font-size: 11px;
  letter-spacing: 0.055em;
}

.document-table th:last-child,
.document-table td:last-child {
  text-align: right;
}

.document-table td:last-child .table-actions {
  justify-content: flex-end;
}

@media (max-width: 1260px) {
  .language-grid {
    grid-template-columns: repeat(8, minmax(52px, 1fr));
  }

  .symbol-picker {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }
}

@media (max-width: 1050px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-center {
    order: 3;
    grid-column: 1 / -1;
    padding-bottom: 14px;
  }

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }

  .sidebar,
  .workspace,
  .topbar,
  .content {
    min-width: 0;
    max-width: 100%;
  }

  .sidebar {
    width: 100%;
  }

  .brand {
    min-height: 72px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
  }

  .brand-logo {
    width: 134px;
    max-height: 44px;
  }

  .brand-product-name {
    padding-left: 14px;
    border-left: 1px solid var(--border-color);
    font-size: 10px;
  }

  .side-nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 8px 11px;
    white-space: nowrap;
  }

  .sidebar-stats {
    display: none;
  }

  .generator-source-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .symbol-picker {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }
}

@media (max-width: 680px) {
  .content {
    padding: 14px;
  }

  .panel-heading,
  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools,
  .search-field {
    width: 100%;
  }

  .brand {
    align-items: center;
    flex-direction: row;
    padding: 10px 14px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 11px 14px;
  }

  .topbar-left,
  .topbar-right {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .topbar-product,
  .topbar-right .icon-btn,
  .topbar-right .user-avatar {
    display: none;
  }

  .topbar-center {
    padding: 6px 0 2px;
  }

  .choice-list,
  .symbol-picker {
    grid-template-columns: 1fr;
  }

  .language-grid {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
  }

  .generator-section {
    padding: 16px;
  }

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

  .generator-actions #savePreviewButton {
    margin-left: 0;
  }

  .table-actions-right button span {
    display: none;
  }
}

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

.net-weight-wrap {
  display: grid;
  gap: 7px;
  max-width: 340px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

button.link-button {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  justify-self: center;
  padding: 4px;
}

button.link-button:hover {
  border: 0;
  background: none;
  color: var(--primary-dark);
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.product-doc-preview {
  margin-top: 12px;
}

.product-doc-preview > summary {
  cursor: pointer;
  font-weight: 700;
}

.product-doc-preview-body {
  margin-top: 10px;
}
