:root {
  --ink: #10151d;
  --navy: #15273f;
  --gold: #c2a14a;
  --gold-soft: #d4b25a;
  --cream: #fbf8f2;
  --line: #e3ddce;
  --panel: #15273f;
  --txt-on-navy: #f4eede;
  --txt-on-cream: #15273f;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  font-family:
    "Montserrat",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--cream);
  color: var(--navy);
}
#topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
}
#topbar .brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}
#topbar .brand span {
  color: var(--gold);
}
#topbar select {
  background: #1d2a3d;
  color: #fff;
  border: 1px solid #2c3c52;
  border-radius: 7px;
  padding: 5px 8px;
  font: inherit;
}
.page-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b9c2cf;
}
/* Editing-language switcher (Module D). Navy/gold, AA on the navy top bar. */
.gs-locale-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gs-locale-btn {
  background: #1d2a3d;
  color: #fff;
  border: 1px solid #2c3c52;
  border-radius: 7px;
  padding: 5px 9px;
  font: inherit;
  cursor: pointer;
}
.gs-locale-btn:hover {
  border-color: var(--gold);
}
.gs-locale-meter {
  font: 600 11px Montserrat, sans-serif;
  color: var(--gold);
}
.gs-locale-meter.gs-locale-done {
  color: #7bbf6a;
}
.gs-locale-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  margin: 0;
  padding: 4px;
  list-style: none;
  min-width: 160px;
  background: var(--navy);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.gs-locale-opt {
  padding: 7px 10px;
  border-radius: 6px;
  color: #e9edf3;
  font-size: 13px;
  cursor: pointer;
}
.gs-locale-opt:hover,
.gs-locale-opt:focus {
  background: var(--gold);
  color: var(--navy);
  outline: none;
}
.gs-locale-opt[aria-selected="true"] {
  color: var(--gold);
  font-weight: 700;
}
.gs-locale-opt[aria-selected="true"]:hover,
.gs-locale-opt[aria-selected="true"]:focus {
  color: var(--navy);
}

/* Ghosted English on the canvas for an untranslated leaf, with a "translate" chip. */
.gs-untranslated {
  opacity: 0.45;
  outline: 1px dashed var(--gold);
  position: relative;
}
.gs-untranslated[data-gs-translate-affordance="1"]::after {
  content: "translate";
  position: absolute;
  top: -1.1em;
  left: 0;
  font: 600 10px Montserrat, sans-serif;
  background: var(--navy);
  color: var(--gold);
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.devices,
.history {
  display: flex;
  gap: 4px;
}
.devices button,
.history button {
  background: transparent;
  color: #cdd5e0;
  border: 1px solid #2c3c52;
  border-radius: 7px;
  width: 34px;
  height: 30px;
  cursor: pointer;
}
.devices button.active {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.history button:disabled {
  opacity: 0.4;
  cursor: default;
}
.pill {
  margin-left: auto;
  font-size: 13px;
  color: #cfe6cf;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pill.saving {
  color: #e7d6a3;
}
.pill.error {
  color: #f1a9a9;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.btn.gold {
  background: var(--gold);
  color: var(--navy);
}
.btn.gold:hover {
  background: var(--gold-soft);
}
.btn.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
#canvasMatte {
  height: calc(100vh - 56px);
  overflow: auto;
  display: flex;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 0, #fff 0, var(--cream) 60%);
}
#canvasFrameWrap {
  margin: 18px 0;
  width: 100%;
  display: flex;
  justify-content: center;
}
#canvas {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 110px);
  border: 0;
  background: #fff;
  box-shadow: 0 10px 40px rgba(16, 21, 29, 0.1);
  border-radius: 6px;
}
/* hover + selection are drawn on overlay rings, not by mutating the iframe */
.gs-hover-ring,
.gs-sel-ring {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  border-radius: 3px;
}
.gs-hover-ring {
  border: 1.5px dashed var(--gold);
}
.gs-sel-ring {
  border: 2px solid var(--gold);
  transition: all 0.12s ease;
}
#nameChip {
  position: fixed;
  z-index: 31;
  background: var(--ink);
  color: #fff;
  font:
    600 11px/1 "Montserrat",
    sans-serif;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}
#toolbar {
  position: fixed;
  z-index: 35;
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(16, 21, 29, 0.35);
}
#toolbar button {
  background: #1d3354;
  color: #fff;
  border: 1px solid #2c4569;
  border-radius: 7px;
  padding: 6px 9px;
  font: 600 12.5px "Montserrat";
  cursor: pointer;
}
#toolbar button:hover {
  border-color: var(--gold);
}
#toolbar .seg {
  display: flex;
  border: 1px solid #2c4569;
  border-radius: 7px;
  overflow: hidden;
}
#toolbar .seg button {
  border: 0;
  border-radius: 0;
}
#toolbar .seg button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--navy);
}
#toolbar input {
  background: #fff;
  color: var(--navy);
  border: 1px solid #2c4569;
  border-radius: 7px;
  padding: 6px 8px;
  font: 600 12.5px "Montserrat";
}
#toolbar input.invalid {
  outline: 2px solid #f1a9a9;
}
#scrim {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(16, 21, 29, 0.42);
}
#menuPanel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 45;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--cream);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(16, 21, 29, 0.25);
  display: flex;
  flex-direction: column;
}
/* The explicit `display:flex/block` above overrides the UA `[hidden]{display:none}`,
   so restore hide-on-attribute for the toolbar + panel + scrim (toolbar.hide() /
   menu-panel close()/open() toggle the `hidden` attribute). */
#toolbar[hidden],
#menuPanel[hidden],
#scrim[hidden] {
  display: none;
}
@media (max-width: 640px) {
  #menuPanel {
    width: 100vw;
  }
  body[data-mode="mobile"] #canvasMatte,
  body[data-mode="mobile"] #topbar .devices {
    display: none;
  }
}
/* AA: gold #c2a14a on navy #15273f passes AA for >=18px bold/UI; verified in Task 16 */

/* Cropper modal */
#cropRoot {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.crop-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.78);
}
.crop-box {
  position: relative;
  margin: 4vh auto;
  max-width: 900px;
  width: 92%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.crop-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.crop-head button {
  border: 0;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: #8a8170;
}
.crop-stage {
  background: #1c1c1c;
  min-height: 280px;
  max-height: 56vh;
  overflow: hidden;
}
.crop-stage img {
  max-width: 100%;
  display: block;
}
.crop-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.crop-tools button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
}
.crop-tools .ar {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.crop-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.crop-foot button {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Menu slide-in panel (categories rail + dish rows) */
.mp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.mp-head h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
}
.mp-head button {
  border: 0;
  background: none;
  font-size: 18px;
  cursor: pointer;
}
.mp-body {
  flex: 1;
  display: grid;
  grid-template-columns: 150px 1fr;
  min-height: 0;
}
.mp-cats {
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-cat {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
}
.mp-cat.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.mp-count {
  float: right;
  opacity: 0.7;
  font-size: 12px;
}
.mp-add {
  border: 1px dashed var(--gold);
  background: transparent;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}
.mp-items {
  overflow: auto;
  padding: 10px;
}
.mp-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mp-toolbar button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}
.mp-row {
  display: grid;
  grid-template-columns: 18px 1fr 80px 70px 30px;
  gap: 6px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.mp-row .mp-desc {
  grid-column: 2 / -1;
  min-height: 42px;
}
.mp-row input.invalid {
  outline: 2px solid #f1a9a9;
}
.mp-drag {
  cursor: grab;
  color: var(--gold);
}

/* Task 11 — mobile stacked editor (<640px) */
#mobileRoot {
  padding-bottom: env(safe-area-inset-bottom);
}
.mob-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
}
.mob-bar button {
  font-size: 14px;
}
.mob-sections {
  list-style: none;
  margin: 0;
  padding: 8px;
}
.mob-sections button {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 16px;
}
.mob-cards {
  padding: 12px;
}
.mob-photo {
  width: 100%;
  padding: 18px;
  border: 1px dashed var(--gold);
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  margin-bottom: 12px;
}
.mob-field {
  display: block;
  margin-bottom: 14px;
}
.mob-field span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #8a8170;
  margin-bottom: 4px;
}
.mob-field input,
.mob-field textarea {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.mob-field .invalid {
  outline: 2px solid #f1a9a9;
}

/* POS-sync panel (Module C): change rows, conflict amber, link wizard, actions */
.gs-sync-mount {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}
.gs-sync-head h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.gs-sync-empty {
  color: #6b7684;
  font-size: 13px;
}
.gs-sync-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
}
.gs-sync-row.gs-sync-conflict {
  background: #fff7e6;
  border-color: #e6c15a;
}
.gs-sync-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef2f7;
  color: #33506f;
  white-space: nowrap;
}
.gs-sync-label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex: 1;
}
.gs-sync-desc {
  font-size: 13px;
}
.gs-sync-choices {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.gs-sync-choice {
  font-size: 12px;
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.gs-sync-editval {
  width: 90px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.gs-sync-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.gs-sync-strategy {
  font-size: 12px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.gs-sync-wizard {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.gs-sync-wizard h4 {
  margin: 0 0 4px;
  font-size: 14px;
}
.gs-sync-note {
  font-size: 12px;
  color: #6b7684;
  margin: 0 0 8px;
}
.gs-sync-linkrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.gs-sync-linkname {
  flex: 1;
  font-size: 13px;
}
.gs-sync-linkrow.gs-sync-linked {
  opacity: 0.6;
}

/* Two-pane EN<->translation review (Module D, M08 Task 12): a right slide-in dialog.
   EN (read-only, .7 opacity) on the left, an editable translation on the right, with
   Apply / Keep-mine per row and an "Untranslated only" filter. Navy/gold, AA contrast. */
.gs-review-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  background: var(--navy, #15273f);
  color: #f3ead6;
  overflow: auto;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
  z-index: 60;
}
.gs-review-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--navy, #15273f);
  border-bottom: 1px solid rgba(194, 161, 74, 0.35);
}
.gs-review-head h2 {
  margin: 0;
  flex: 1;
  font: 600 15px Montserrat, sans-serif;
  color: var(--gold, #c2a14a);
}
.gs-review-filter {
  font: 400 12px Montserrat, sans-serif;
  color: #f3ead6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.gs-review-close {
  background: transparent;
  border: 1px solid rgba(194, 161, 74, 0.5);
  color: #f3ead6;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.gs-review-close:hover {
  border-color: var(--gold, #c2a14a);
}
.gs-review-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gs-review-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(194, 161, 74, 0.2);
}
.gs-review-en {
  opacity: 0.7;
  font: 400 13px Montserrat, sans-serif;
}
.gs-review-ta {
  width: 100%;
  background: #10151d;
  color: #fff;
  border: 1px solid var(--gold, #c2a14a);
  border-radius: 4px;
  font: 400 14px Montserrat, sans-serif;
  padding: 6px 8px;
  box-sizing: border-box;
  resize: vertical;
}
.gs-review-proposal .gs-review-ta {
  border-color: #7bbf6a;
}
.gs-review-acts {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.gs-review-acts button {
  font: 600 12px Montserrat, sans-serif;
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  border: 1px solid rgba(194, 161, 74, 0.5);
}
.gs-review-acts .gs-apply {
  background: var(--gold, #c2a14a);
  color: var(--navy, #15273f);
  border-color: var(--gold, #c2a14a);
}
.gs-review-acts .gs-keep {
  background: transparent;
  color: #f3ead6;
}
