:root {
  color-scheme: light;
  --bg: #eef1ef;
  --panel: #ffffff;
  --panel-alt: #f7f8f7;
  --sidebar: #18211d;
  --sidebar-muted: #a7b2ac;
  --text: #18201c;
  --muted: #66716b;
  --border: #d8dedb;
  --accent: #c84e3a;
  --accent-dark: #a63e2d;
  --green: #287a57;
  --green-soft: #e5f2eb;
  --blue: #326b8a;
  --blue-soft: #e8f1f5;
  --amber: #a46b16;
  --amber-soft: #f7eedc;
  --danger: #a63e3e;
  --shadow: 0 8px 28px rgb(24 32 28 / 8%);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  align-items: center;
  display: flex;
  gap: 11px;
  padding: 0 8px 26px;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 5px;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand div > span {
  color: var(--sidebar-muted);
  font-size: 11px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--sidebar-muted);
  display: flex;
  font-size: 13px;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  color: #d9e2dd;
  font-size: 18px;
  width: 18px;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgb(255 255 255 / 9%);
  color: white;
}

.sidebar-summary {
  border-top: 1px solid rgb(255 255 255 / 12%);
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 18px 10px 4px;
}

.sidebar-summary strong {
  font-size: 13px;
}

.sidebar-summary > span:last-child {
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 0 28px 36px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 104px;
}

.topbar h1 {
  font-size: 24px;
  letter-spacing: 0;
  margin: 4px 0 0;
}

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

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.recommend-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
}

.profile-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.section-heading {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-heading h2,
.result-panel h2,
.data-panel h2 {
  font-size: 17px;
  margin: 0;
}

.section-heading p,
.result-panel p,
.data-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 6px 0 0;
}

.field {
  border: 0;
  display: grid;
  gap: 7px;
  margin: 0 0 18px;
  padding: 0;
}

.field > span,
.field legend {
  font-size: 12px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 11px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid #cbd3cf;
  border-radius: 5px;
  min-height: 41px;
  outline: none;
  padding: 9px 11px;
  width: 100%;
}

textarea {
  line-height: 1.5;
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(50 107 138 / 13%);
}

.inline-input {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.button-primary {
  background: var(--sidebar);
  color: white;
}

.button-primary:hover {
  background: #2a3730;
}

.button-accent {
  background: var(--accent);
  color: white;
}

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

.button-secondary {
  background: white;
  border-color: var(--border);
}

.button-secondary:hover {
  background: var(--panel-alt);
}

.button-danger {
  background: white;
  border-color: #e2bbbb;
  color: var(--danger);
}

.segmented {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  min-height: 40px;
  padding: 3px;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  min-width: 0;
  padding: 7px 8px;
}

.segmented button.is-selected {
  background: white;
  box-shadow: 0 1px 4px rgb(20 30 25 / 12%);
  color: var(--text);
}

.extracted-details {
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  margin: 4px 0 20px;
  padding: 14px 0;
}

.extracted-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.extracted-details[open] summary {
  margin-bottom: 16px;
}

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

.form-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

#analysis-message {
  color: var(--muted);
  font-size: 11px;
  margin-right: auto;
}

.result-panel {
  min-height: 560px;
}

.empty-result {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 500px;
  text-align: center;
}

.empty-gauge {
  align-items: center;
  border: 8px solid #e6ebe8;
  border-radius: 50%;
  color: #839089;
  display: flex;
  font-size: 28px;
  font-weight: 800;
  height: 110px;
  justify-content: center;
  margin-bottom: 20px;
  width: 110px;
}

.score-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px;
  padding-bottom: 22px;
}

.score-gauge {
  align-items: baseline;
  background: var(--green-soft);
  border: 8px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  display: flex;
  height: 112px;
  justify-content: center;
  min-width: 112px;
}

.score-gauge strong {
  font-size: 35px;
}

.score-gauge span {
  font-size: 11px;
}

.status-label {
  background: var(--green-soft);
  border-radius: 4px;
  color: var(--green);
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 8px;
  padding: 5px 7px;
  text-transform: uppercase;
}

.result-section {
  padding: 22px 0 6px;
}

.result-section h3,
.result-columns h3,
.nearest-match h3 {
  font-size: 12px;
  margin: 0 0 8px;
}

.result-columns {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.result-columns ul {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  padding-left: 17px;
}

.result-columns li {
  margin-bottom: 7px;
}

.nearest-match {
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
  margin-top: 22px;
  padding: 14px 16px;
}

.nearest-match strong {
  display: block;
  font-size: 13px;
  margin-top: 5px;
}

.nearest-match p {
  font-size: 11px;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.saved-recommendations-panel {
  margin-top: 18px;
}

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

.journal-actions input {
  min-width: 220px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  padding: 13px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.score-cell {
  color: var(--green);
  font-weight: 800;
}

.table-action {
  min-height: 32px;
  padding: 0 10px;
}

.empty-table {
  padding: 45px 20px;
  text-align: center;
}

.empty-table h3 {
  font-size: 15px;
}

.empty-table p {
  color: var(--muted);
  font-size: 12px;
}

.profile-summary {
  display: grid;
  gap: 22px;
}

.profile-block {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.profile-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.profile-block h3 {
  font-size: 12px;
  margin: 0 0 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--blue-soft);
  border-radius: 4px;
  color: #285d77;
  font-size: 11px;
  padding: 5px 7px;
}

.tag.negative {
  background: #f5e6e4;
  color: #8e3e33;
}

.data-panel > p {
  margin-bottom: 20px;
}

.stacked-actions {
  display: grid;
  gap: 8px;
}

.file-button input {
  display: none;
}

.modal {
  border: 0;
  border-radius: 7px;
  box-shadow: 0 24px 70px rgb(10 20 15 / 28%);
  max-height: min(820px, 92vh);
  max-width: 720px;
  padding: 0;
  width: calc(100% - 32px);
}

.modal::backdrop {
  background: rgb(12 20 16 / 56%);
}

.modal-compact {
  max-width: 640px;
}

.modal-header,
.modal-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 19px;
  margin: 4px 0 0;
}

.modal-body {
  max-height: calc(92vh - 150px);
  overflow-y: auto;
  padding: 22px 24px 4px;
}

.modal-footer {
  border-top: 1px solid var(--border);
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer > :first-child {
  margin-right: auto;
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex;
  font-size: 25px;
  height: 34px;
  justify-content: center;
  width: 34px;
}

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

.choice-grid label {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex;
  font-size: 12px;
  gap: 7px;
  min-height: 42px;
  padding: 9px;
}

.choice-grid input {
  accent-color: var(--accent);
  min-height: auto;
  width: auto;
}

.chip-picker {
  display: grid;
  gap: 11px;
}

.chip-group {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 9px;
}

.chip-section-label {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.chip-section-label:first-child {
  border-top: 0;
  padding-top: 0;
}

.chip-section-label h4 {
  font-size: 12px;
  margin: 0;
}

.chip-section-label p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: 3px 0 0;
}

.chip-group h4 {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.chip-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-group-unknown {
  border-style: dashed;
  display: flex;
  padding: 8px;
}

.chip-group-broad {
  background: var(--panel-alt);
}

.advanced-flavours {
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.advanced-flavours summary {
  align-items: center;
  background: var(--panel-alt);
  cursor: pointer;
  display: grid;
  gap: 3px;
  list-style: none;
  min-height: 52px;
  padding: 10px 12px;
}

.advanced-flavours summary::-webkit-details-marker {
  display: none;
}

.advanced-flavours summary::after {
  color: var(--muted);
  content: "+";
  font-size: 18px;
  font-weight: 700;
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

.advanced-flavours[open] summary::after {
  content: "-";
}

.advanced-flavours summary span {
  font-size: 12px;
  font-weight: 800;
}

.advanced-flavours summary small {
  color: var(--muted);
  font-size: 11px;
}

.advanced-flavour-groups {
  display: grid;
  gap: 9px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px;
}

.chip-picker button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  padding: 7px 9px;
}

.chip-picker button.is-selected {
  background: var(--blue-soft);
  border-color: #9ebdcc;
  color: #285d77;
}

#disliked-flavours button.is-selected {
  background: #f5e6e4;
  border-color: #dbafa8;
  color: #8e3e33;
}

.coffee-cell {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: 210px;
}

.coffee-cell img,
.coffee-thumb-placeholder,
#tasting-photo-preview {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: block;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.coffee-thumb-placeholder::before {
  color: #9aa49e;
  content: "CM";
  display: grid;
  font-size: 10px;
  font-weight: 800;
  height: 100%;
  place-items: center;
}

.tasting-photo-field {
  grid-row: span 2;
}

#tasting-photo-preview {
  height: 92px;
  width: 92px;
}

.profile-visual {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 18px;
  margin: -4px 0 22px;
  padding-bottom: 22px;
}

.profile-visual-toggle {
  justify-self: center;
  max-width: 340px;
  width: min(100%, 340px);
}

.profile-visual-panel {
  display: none;
}

.profile-visual-panel.is-visible {
  display: block;
}

.taste-compass {
  margin: 0 auto;
  max-width: 540px;
  width: min(100%, 540px);
}

.taste-compass svg {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

.compass-help {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: -8px 0 0;
  text-align: center;
}

.compass-ring {
  fill: none;
  stroke: #dce2df;
  stroke-width: 1;
}

.compass-spoke {
  stroke: #e6ebe8;
  stroke-width: 1;
}

.compass-area {
  fill: rgb(50 107 138 / 16%);
  stroke: none;
}

.compass-line {
  fill: none;
  stroke: var(--blue);
  stroke-linejoin: round;
  stroke-width: 3;
}

.compass-dot {
  fill: white;
  stroke: var(--blue);
  stroke-width: 2;
}

.compass-label {
  fill: var(--text);
  font-size: 10px;
  font-weight: 750;
}

.compass-value {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.compass-centre,
.compass-centre-sub {
  fill: var(--text);
  font-weight: 800;
  text-anchor: middle;
}

.compass-centre {
  font-size: 22px;
}

.compass-centre-sub {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.detail-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 138px minmax(0, 1fr);
  margin-bottom: 20px;
}

.detail-photo {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  height: 138px;
  object-fit: cover;
  width: 138px;
}

.detail-photo-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: center;
}

.detail-summary dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-summary dl > div {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 5px;
  padding-bottom: 9px;
}

.detail-summary dt,
.detail-section h3 {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  margin: 0;
  text-transform: uppercase;
}

.detail-summary dd {
  font-size: 13px;
  margin: 0;
}

.detail-section {
  border-top: 1px solid var(--border);
  padding: 16px 0 0;
}

.detail-section + .detail-section {
  margin-top: 16px;
}

.detail-section p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.flavour-wheel-wrap {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.flavour-wheel {
  max-width: 500px;
  width: min(100%, 500px);
}

.flavour-wheel svg {
  display: block;
  height: auto;
  width: 100%;
}

.flavour-wheel path {
  stroke: white;
  stroke-width: 1.8;
}

.flavour-wheel .wheel-leaf {
  stroke-width: 1.1;
}

.wheel-labels text {
  fill: #39433e;
  font-size: 7.4px;
  font-weight: 700;
  pointer-events: none;
  text-anchor: middle;
}

.wheel-centre,
.wheel-centre-sub {
  fill: var(--text);
  font-weight: 800;
  text-anchor: middle;
}

.wheel-centre {
  font-size: 22px;
}

.wheel-centre-sub {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.wheel-legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 12px;
  justify-content: center;
}

.wheel-legend span {
  align-items: center;
  display: inline-flex;
  gap: 5px;
}

.wheel-legend b {
  border: 1px solid var(--border);
  border-radius: 3px;
  display: inline-block;
  height: 11px;
  width: 17px;
}

.legend-positive {
  background: #a9d8b8;
}

.legend-negative {
  background: #e2aba3;
}

.legend-neutral {
  background: #f5f6f4;
}

output {
  color: var(--accent);
  font-weight: 800;
}

.toast {
  background: var(--sidebar);
  border-radius: 5px;
  bottom: 22px;
  color: white;
  font-size: 12px;
  left: 50%;
  opacity: 0;
  padding: 11px 15px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 10px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 20;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .recommend-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 420px;
  }

  .empty-result {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    bottom: 0;
    height: 64px;
    min-height: 0;
    padding: 7px 10px;
    position: fixed;
    top: auto;
    width: 100%;
    z-index: 10;
  }

  .brand,
  .sidebar-summary {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-item {
    flex-direction: column;
    font-size: 10px;
    gap: 1px;
    justify-content: center;
    min-height: 50px;
    padding: 3px 6px;
  }

  .nav-item span {
    font-size: 17px;
    text-align: center;
  }

  .workspace {
    padding: 0 14px 88px;
  }

  .topbar {
    min-height: 88px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar .button {
    min-height: 36px;
    padding: 0 10px;
  }

  .panel {
    padding: 18px;
  }

  .inline-input,
  .form-grid,
  .range-grid,
  .result-columns {
    grid-template-columns: 1fr;
  }

  .inline-input .button {
    width: 100%;
  }

  .segmented {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
  }

  .section-heading {
    display: grid;
  }

  .journal-actions {
    display: grid;
  }

  .journal-actions input {
    min-width: 0;
  }

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

  .score-row {
    align-items: flex-start;
  }

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

  .score-gauge {
    border-width: 6px;
    height: 88px;
    min-width: 88px;
  }

  .score-gauge strong {
    font-size: 27px;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer > :first-child {
    margin-right: 0;
    width: 100%;
  }
}
