@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');
:root{--ink:#26382e;--muted:#788174;--paper:#fcfaf5;--line:#e6e7dd;--accent:#d57c48;--olive:#e8ecd9}*{box-sizing:border-box}body{margin:0;background:#e9ebdf;color:var(--ink);font-family:'DM Sans',system-ui,sans-serif;display:flex;justify-content:center;gap:100px;padding:48px 32px;align-items:center;min-height:100vh}.intro{width:380px}.brand{font-family:Manrope,system-ui;font-size:32px;font-weight:800;letter-spacing:-2px}.dot{color:var(--accent)}.eyebrow{font-size:10px;font-weight:700;letter-spacing:2px;color:var(--muted);margin:26px 0 10px}h1{font-family:Manrope,system-ui;font-size:54px;line-height:1.1;letter-spacing:-2.7px;font-weight:500;margin:18px 0 24px}.intro>p:not(.eyebrow){max-width:290px;line-height:1.7;color:#687568;font-size:15px}.prototype-note{font-size:10px;letter-spacing:1.5px;border-top:1px solid #ced3c3;margin-top:60px;padding-top:20px;line-height:2}.prototype-note span{letter-spacing:0;color:#788174;font-size:12px}.app{width:430px;min-height:820px;background:var(--paper);border-radius:32px;box-shadow:0 24px 80px #34412c18;border:1px solid #ffffff;overflow:hidden}header{display:flex;align-items:center;justify-content:space-between;padding:22px 26px 18px}header small{display:block;font-size:8px;letter-spacing:2px;margin-top:2px;color:var(--muted)}button{font:inherit;border:0;cursor:pointer;color:inherit}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.icon{background:transparent;font-size:22px;padding:12px}nav{display:flex;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}nav button{width:50%;background:transparent;padding:15px;font-size:10px;color:var(--muted);letter-spacing:1px}nav span{font-size:13px;letter-spacing:0;margin-left:10px}nav .active{background:var(--olive);color:var(--ink)}#screen{padding:24px 26px}h2{font-family:Manrope,system-ui;font-size:26px;letter-spacing:-1px;font-weight:600;margin:0 0 7px}.sub{font-size:13px;color:var(--muted);line-height:1.6;margin:0 0 24px}.section-label{font-size:10px;letter-spacing:1.8px;font-weight:700;margin:26px 0 15px;display:flex;align-items:center;gap:10px}.section-label:after{content:'';height:1px;background:var(--line);flex:1}.grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.wide{grid-column:1/-1}label{display:block;font-size:11px;color:#60705f}input,textarea{font:inherit;width:100%;padding:12px;margin-top:6px;border:1px solid var(--line);border-radius:9px;background:#fffefa;color:var(--ink);min-width:0}input{font-size:13px}input::placeholder{color:#a1a79a}textarea{resize:vertical}.hint{font-size:11px;line-height:1.5;color:var(--muted);margin:12px 0 20px}.primary{background:var(--ink);color:var(--paper);padding:15px 18px;border-radius:10px;font-weight:600;font-size:13px}.full{width:100%}.secondary{background:var(--olive);padding:12px;border-radius:9px;font-size:12px}.text-btn{background:none;font-size:11px;text-decoration:underline;color:var(--muted);padding:8px}footer{text-align:center;color:#989e8d;font-size:10px;letter-spacing:1px;padding:20px}.timer-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px}.clock{font-family:Manrope,system-ui;font-size:30px;letter-spacing:-1px}.badge{font-size:10px;border:1px solid var(--line);border-radius:20px;padding:6px 10px}.badge:before{content:'●';color:var(--accent);margin-right:6px}.graph{background:#f1f3e9;border-radius:14px;padding:10px 4px;margin-bottom:12px}svg{display:block;width:100%;height:auto}svg text{font-family:inherit;font-size:10px;fill:#7d8975}.reading{display:flex;gap:9px;align-items:end}.reading label{flex:1}.reading button{height:42px}.reminder{font-size:11px;color:var(--muted);margin:10px 0}.reminder.due{color:#ab4d22;font-weight:700}.phases{display:flex;gap:7px}.phase{flex:1;text-align:left;background:#f1f0e8;border:1px solid var(--line);border-radius:9px;padding:11px 7px;font-size:10px}.phase.marked{background:#e5ead7;border-color:#b6c2a6}.phase strong{display:block;font-size:12px;margin-top:7px}.phase span{display:block;color:var(--muted);font-size:9px;margin-top:5px}.adjustment{display:flex;gap:6px;align-items:center;margin-bottom:8px;font-size:11px}.adjustment input{width:90px;margin:0;padding:10px}.adjustment input.time{width:80px}.adjustment .remove{margin-left:auto;background:none;color:#a26547;font-size:20px;padding:5px}.section-label button{background:var(--olive);border-radius:50%;width:28px;height:28px;font-size:20px}.stop{margin-top:20px;border:1px solid #d8bca7;background:#fcf0e7;color:#96532e}.stats{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid var(--line);border-radius:12px;margin:18px 0;overflow:hidden}.stat{padding:14px 7px;text-align:center;border-right:1px solid var(--line)}.stat:last-child{border:0}.stat small{font-size:10px;display:block;color:var(--muted)}.stat strong{display:block;font-size:17px;margin-top:7px}.stat span{font-size:10px;color:var(--muted)}.loss{background:var(--olive);padding:14px;border-radius:10px;font-size:12px;margin:15px 0}.loss strong{float:right}.actions{display:flex;gap:10px;margin-top:24px}.actions>*{flex:1}dialog{border:0;border-radius:18px;padding:26px;max-width:370px;color:var(--ink);background:var(--paper)}dialog::backdrop{background:#172b2466}dialog>p{font-size:13px;line-height:1.6}#toast{position:fixed;bottom:25px;background:var(--ink);color:white;padding:12px 18px;border-radius:12px;display:none;font-size:12px;z-index:10}#toast button{background:none;color:#f0c494;margin-left:12px}.history-card{display:block;width:100%;text-align:left;padding:17px;background:#f1f3e9;border-radius:12px;margin-bottom:10px}.history-card small{display:block;color:var(--muted);margin-top:6px}.empty{font-size:12px;color:var(--muted);line-height:1.6}.history-row{display:flex;gap:8px}.history-row .history-card{flex:1}.history-row .text-btn{align-self:center}button:disabled{opacity:.5;cursor:not-allowed}@media(max-width:900px){body{padding:20px;gap:30px}.intro{width:280px}h1{font-size:40px}}@media(max-width:650px){body{display:block;padding:0;background:var(--paper)}.intro{display:none}.app{width:100%;min-height:100vh;border:0;border-radius:0;box-shadow:none}#screen{padding:22px}header{padding:20px 22px}.app footer{padding-bottom:30px}}@media(max-height:550px) and (orientation:landscape){.intro{display:none}.app{width:100%;border-radius:0}.live-layout{display:grid;grid-template-columns:1.3fr 1fr;gap:24px}.live-layout .section-label{margin-top:15px}body{padding:0}}

/* Compact controls for the reconstructed live and saved-record screens. */
.roast-title{display:flex;align-items:center;gap:8px;min-width:0}
.bean-title{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.live-layout{display:flex;flex-direction:column;gap:2px}
.chart-panel,.controls-panel{min-width:0}
.control-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:20px 0 10px;font-size:12px;font-weight:700}
.control-heading small{font-weight:400;color:var(--muted)}
.control-heading .text-btn{font-weight:400;white-space:nowrap}
.reminder-line{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:0 10px}
.reminder-line .reminder{margin:8px 0;flex:1;min-width:140px}
.reminder-line .text-btn{padding:6px 0}
#missing-readings{color:#a65d37;font-weight:600}
#missing-readings[hidden]{display:none}
.adjustment-panel{margin:20px 0 4px}
.adjustment-panel .control-heading{margin-bottom:12px}
.add-adjustment{background:var(--olive);border-radius:8px;padding:8px 11px;font-size:11px;font-weight:600}
.empty-adjustment{font-size:12px;color:var(--muted);padding:12px;background:#f1f3e9;border-radius:10px}
.adjustment-pager{display:flex;justify-content:center;align-items:center;gap:10px;color:var(--muted);font-size:11px;margin:11px 0}
.adjustment-pager button{background:var(--olive);border-radius:7px;padding:4px 11px;font-size:18px}
.adjustment-pager span{min-width:90px;text-align:center}
.saved-detail{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid var(--line);padding:11px 0;font-size:12px}
.saved-detail span{color:var(--muted)}
.saved-detail strong{text-align:right}
.graph .point:focus-visible{outline:none;filter:drop-shadow(0 0 3px var(--accent))}

/* Iteration 2: a stable-height chart and grouped event/phase controls. */
.live-view header{padding:13px 21px 9px}
.live-view header .brand{font-size:28px}
.live-view nav button{padding:11px 12px}
.live-view #screen{padding:15px 19px 12px}
.live-view footer{display:none}
.live-view .timer-row{margin-bottom:9px}
.live-view .clock{font-size:29px}
.live-view .live-layout{gap:1px}
#graph{height:181px;min-height:181px;max-height:181px;overflow:hidden;padding:8px 4px;margin-bottom:9px}
#graph svg{height:100%;width:100%;display:block}
.live-view .reading input{padding:10px 12px}
.live-view .reading button{height:39px}
.live-view .reminder-line .reminder{margin:7px 0}
.live-view .control-heading{margin:10px 0 8px;font-size:12px}
.live-view .control-heading small{font-size:10px;color:var(--muted);font-weight:400}
.phase-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.phase-card{min-width:0;border:1px solid var(--line);border-radius:11px;overflow:hidden;background:#f7f6f0}
.phase-card .phase{display:flex;flex-direction:column;justify-content:space-between;gap:5px;width:100%;min-height:58px;padding:9px 9px 8px;border:0;border-radius:0;background:#f1f0e8;font-size:11px;text-align:left;cursor:pointer}
.phase-card .phase.marked{background:#e5ead7}
.phase-card .phase:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.phase-card .phase strong{font-size:11px;margin:0}
.phase-card .phase-event{font-size:11px;font-weight:600}
.phase-stat{padding:7px 8px 8px;display:flex;flex-direction:column;min-height:65px}
.phase-stat small{color:var(--muted);font-size:10px}
.phase-stat strong{font-size:17px;line-height:1.25;font-weight:700;margin:2px 0}
.phase-stat span{font-size:10px;color:var(--muted);white-space:nowrap}
.live-view .adjustment-panel{margin:10px 0 3px}
.live-view .adjustment-panel .control-heading{margin-bottom:7px}
.live-view .empty-adjustment{font-size:11px;padding:8px 10px}
.live-view .adjustment input{padding:8px}
.live-view .adjustment-pager{margin:6px 0}
.live-view .stop{margin:9px 0 0;padding:11px}
@media(max-width:375px){
  .live-view #screen{padding:13px 13px 10px}
  .phase-cards{gap:5px}
  .phase-card .phase{padding:8px 6px}
  .phase-stat{padding:7px 6px}
  .phase-stat strong{font-size:15px}
  .phase-stat span{font-size:9px}
}
@media(max-height:710px){
  #graph{height:155px;min-height:155px;max-height:155px}
  .live-view header{padding-top:8px;padding-bottom:5px}
  .live-view nav button{padding:9px 12px}
  .live-view .phase-card .phase{min-height:51px}
  .phase-stat{min-height:56px}
}

/* Iteration 3: phase controls must look tappable without hover or mouse cues. */
.phase-card{overflow:visible; border-color:#dbd9ce; background:#f7f6f0}
.phase-card .phase{
  position:relative;
  min-height:64px;
  padding:9px 34px 9px 9px;
  border:1px solid #bc7449;
  border-radius:10px;
  background:#fff4e7;
  box-shadow:0 3px 0 #ac6741, 0 5px 9px rgba(38,56,46,.13);
  color:var(--ink);
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition:transform .1s ease, box-shadow .1s ease;
}
.phase-card .phase.marked{
  /* Persistent, distinctly green state after an event is marked on touch. */
  border-color:#398252;
  background:#a3d9af;
  color:#174b30;
  box-shadow:0 3px 0 #398252, 0 5px 9px rgba(23,75,48,.18);
}
.phase-card .phase-event{font-size:11px;line-height:1.2;font-weight:700}
.phase-card .phase strong{font-size:12px;line-height:1.1;font-variant-numeric:tabular-nums}
.phase-tap-icon{
  position:absolute;right:8px;top:50%;transform:translateY(-50%);
  display:grid;place-items:center;
  width:25px;height:25px;border-radius:50%;
  background:#bd7447;color:#fff;
  font-size:19px;font-weight:600;line-height:1;
  box-shadow:0 1px 2px rgba(38,56,46,.2);
}
.phase-card .phase.marked .phase-tap-icon{background:#256e41;font-size:15px}
.phase-card .phase:active{
  transform:translateY(2px);
  box-shadow:0 1px 0 #ac6741, 0 2px 4px rgba(38,56,46,.1);
}
.phase-card .phase.marked:active{box-shadow:0 1px 0 #398252, 0 2px 4px rgba(23,75,48,.18)}
.phase-card .phase:focus-visible{outline:3px solid var(--ink);outline-offset:3px}
@media(prefers-reduced-motion:reduce){.phase-card .phase{transition:none}}

/* Every adjustment remains in a simple, vertically scrollable page list.
   Avoid a second nested scroller: the whole page provides the overview. */
.adjustment-list{display:flex;flex-direction:column;gap:6px}
.adjustment-columns,.adjustment-row{
  display:grid;
  grid-template-columns:22px minmax(0,1fr) minmax(0,1fr) 30px;
  align-items:center;
  column-gap:6px;
}
.adjustment-columns{font-size:10px;color:var(--muted);padding:0 6px 3px}
.adjustment-row{
  background:#f6f5ed;
  border:1px solid var(--line);
  border-radius:9px;
  padding:5px 6px;
  margin:0;
  min-width:0;
}
.adjustment-order{font-size:11px;font-weight:700;color:#60705f;text-align:center}
.adjustment-row input,.adjustment-row input.time{
  box-sizing:border-box;
  width:100%;min-width:0;
  margin:0;padding:9px 6px;
  font-size:13px;border-radius:6px;
}
.adjustment-row .remove{padding:5px 0;margin:0;font-size:20px;min-width:30px;min-height:36px}
.live-view .adjustment-row input,.live-view .adjustment-row input.time{padding:9px 6px}
@media(max-width:375px){
  .phase-card .phase{padding:8px 28px 8px 6px}
  .phase-tap-icon{right:5px;width:22px;height:22px}
  .phase-card .phase-event{font-size:10px}
  .adjustment-columns,.adjustment-row{column-gap:4px;grid-template-columns:18px minmax(0,1fr) minmax(0,1fr) 27px}
}
/* Use a single, dimensioned SVG for each phase icon, rather than font glyphs.
   Flex centering keeps the checkmark centered at every phone width. */
.phase-card .phase .phase-tap-icon {
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  margin:0;
  font-size:0;
  line-height:0;
  color:#fff;
}
.phase-card .phase .phase-tap-icon > .phase-icon-svg {
  display:block;
  flex:none;
  width:18px;
  height:18px;
  overflow:visible;
}
@media(max-width:375px){
  .phase-card .phase .phase-tap-icon > .phase-icon-svg { width:16px; height:16px; }
}


/* Adjustment deletion is intentionally behind an explicit Edit mode. The Add
   control disappears in that mode so the two actions never compete for space. */
.adjustment-actions{display:flex;align-items:center;gap:10px;flex-shrink:0}
.adjustment-actions .add-adjustment{min-height:44px;display:flex;align-items:center;justify-content:center}
.adjustment-edit{border:1px solid #b7c2ab;background:#f3f5ed;color:#40553e;border-radius:8px;padding:8px 11px;font-size:11px;font-weight:700;min-height:44px}
.adjustment-edit.active{background:#dce9d8;border-color:#759b75;color:#245334}
.adjustment-edit:disabled{opacity:.45;cursor:default}
.adjustment-edit-hint{margin:0 0 8px;font-size:11px;line-height:1.4;color:#8b503c}
/* Only three columns during normal logging; full-width inputs remain editable. */
.adjustment-panel .adjustment-columns,.adjustment-panel .adjustment-row{grid-template-columns:22px minmax(0,1fr) minmax(0,1fr)}
.adjustment-panel .adjustment-columns.delete-mode,.adjustment-panel .adjustment-row.delete-mode{grid-template-columns:22px minmax(0,1fr) minmax(0,1fr) 44px}
.adjustment-panel .adjustment-row.delete-mode .remove{display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border-radius:8px;background:#fae8e3;color:#a34431;touch-action:manipulation}
.adjustment-panel .adjustment-row .remove svg,.review-adjustment-remove svg{width:18px;height:18px;display:block}
.review-adjustment-remove{display:grid;place-items:center;width:44px;min-width:44px;height:44px;margin-left:auto!important;padding:0!important;border-radius:8px;background:#fae8e3!important;color:#a34431!important}
@media(max-width:375px){
  .adjustment-panel .adjustment-columns,.adjustment-panel .adjustment-row{grid-template-columns:18px minmax(0,1fr) minmax(0,1fr)}
  .adjustment-panel .adjustment-columns.delete-mode,.adjustment-panel .adjustment-row.delete-mode{grid-template-columns:18px minmax(0,1fr) minmax(0,1fr) 44px}
}

/* Undo history is independent of the 8-second toast: multiple deletions can be
   recovered one by one even after logging resumes or the notification fades. */
.adjustment-undo-bar{
  display:flex;align-items:center;justify-content:space-between;
  gap:10px;flex-wrap:wrap;margin:9px 0 2px;padding:6px 9px;
  background:#f1f3e9;border:1px solid #d9dfce;border-radius:8px;
  color:#5d6957;font-size:11px;
}
.adjustment-undo-button{
  background:#e1ead7;color:#2f5939;border:1px solid #b4cbaa;
  border-radius:7px;min-height:40px;padding:7px 12px;font-weight:700;
  touch-action:manipulation;
}
.adjustment-undo-button:active{background:#cedfca}


/* Read-only adjustment history mirrors a familiar paper notation:
   Set to: 350°F at 9:25. Editing remains behind the pencil. */
.adjustment-record{
  display:flex;justify-content:space-between;align-items:center;gap:5px;
  padding:3px 4px 3px 10px;min-width:0;
  background:#f6f5ed;border:1px solid var(--line);border-radius:9px;
  font-size:13px;
}
.adjustment-sentence{display:flex;align-items:baseline;gap:5px;min-width:0;flex-wrap:wrap}
.adjustment-sentence>span{color:#60705f}
.adjustment-reading{font-size:13px;font-weight:700;white-space:nowrap}
.adjustment-record-time{font-variant-numeric:tabular-nums;font-size:13px;color:#3d5a42;white-space:nowrap}
.adjustment-pencil{
  flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;
  border-radius:8px;color:#6d786d;background:transparent;
  touch-action:manipulation;
}
.adjustment-pencil svg{width:18px;height:18px;display:block}
.adjustment-pencil[aria-expanded="true"]{background:#e1e9dc;color:#31593a}
.adjustment-pencil:active{background:#e0e8d8}
.adjustment-panel #add:disabled{opacity:.5}
.adjustment-form{
  border:1px solid #cbd7bf;background:#f2f5ea;
  padding:12px;border-radius:10px;display:flex;flex-direction:column;gap:9px;
}
.adjustment-form-title{font-size:12px;font-weight:700;color:#3e5541}
.adjustment-inline-fields{
  display:flex;align-items:center;gap:7px;flex-wrap:nowrap;min-width:0;
}
.adjustment-word{font-size:13px;color:#405742;white-space:nowrap;flex-shrink:0}
.adjustment-temp-field{
  position:relative;display:block;flex:0 1 87px;min-width:0;
}
.adjustment-temp-field input{
  display:block;width:100%;min-width:0;height:45px;margin:0;
  padding:9px 26px 9px 8px;border-radius:7px;
  font-size:15px;font-variant-numeric:tabular-nums;
}
.adjustment-unit{
  position:absolute;right:8px;top:50%;transform:translateY(-50%);
  font-size:11px;color:#7b897c;pointer-events:none;
}
.saved-adjustment{justify-content:flex-start}
.saved-adjustment span{color:var(--ink)}
.saved-adjustment strong{font-weight:700}
.saved-adjustment time{font-variant-numeric:tabular-nums}
/* Numeric-only input layered over a visual 00:00 mask. The colon is fixed;
   faded zeroes signal empty slots rather than an entered 0:00 value. */
.masked-time-field{
  position:relative;display:flex;align-items:center;justify-content:center;
  flex:0 0 100px;width:100px;height:45px;margin:0;border:1px solid var(--line);
  border-radius:7px;background:#fffefa;overflow:hidden;cursor:text;
}
.masked-time-field:focus-within{outline:none;border:2px solid var(--accent)}
.time-mask-display{
  display:flex;align-items:center;justify-content:center;gap:1px;
  pointer-events:none;user-select:none;white-space:nowrap;
  font:600 21px/1 'DM Sans',system-ui,sans-serif;font-variant-numeric:tabular-nums;
}
.time-mask-digit{display:inline-block;width:13px;text-align:center}
.time-mask-digit.placeholder{color:#b7bfb2}
.time-mask-digit.entered{color:var(--ink)}
.time-mask-colon{color:#637260;padding:0 2px}
.masked-time-field input[name="digits"]{
  position:absolute;inset:0;display:block;width:100%;height:100%;
  margin:0;padding:0;border:0;border-radius:0;background:transparent;
  opacity:0;font-size:16px;cursor:text;
}

.adjustment-form-error {font-size:11px;color:#a23a25;font-weight:600;line-height:1.5}
.adjustment-form-error[hidden]{display:none}
.adjustment-form-actions{display:flex;align-items:center;flex-wrap:wrap;gap:7px}
.adjustment-form-actions button{min-height:44px;border-radius:8px;font-size:11px;font-weight:700;padding:9px 11px;touch-action:manipulation}
.adjustment-save{background:#305640;color:white}
.adjustment-cancel{background:#e4e9dd;color:#39513f}
.adjustment-delete{margin-left:auto;display:flex;gap:5px;align-items:center;background:#f7e6e2;color:#a34431}
.adjustment-delete svg{width:16px;height:16px;display:block}
@media(max-width:375px){
  .adjustment-form{padding:10px}
  .adjustment-inline-fields{gap:5px}
  .adjustment-temp-field{flex-basis:77px}
  .masked-time-field{flex-basis:95px;width:95px}
  .adjustment-record{padding-left:8px}
  .adjustment-sentence{gap:4px}
}
/* Library and post-roast workspace. The live logging layout is intentionally untouched. */
.library-toolbar{background:#f5f5ed;border:1px solid var(--line);border-radius:13px;padding:12px;margin:14px 0 20px}
.library-search-label{display:block;font-size:11px;font-weight:600}
.library-toolbar input[type=search]{background:#fffefa;margin-top:6px;padding:10px 12px}
.library-filters{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}
.library-filters label{font-size:11px}
.library-filters select{font:inherit;color:var(--ink);width:100%;margin-top:5px;padding:11px 8px;border:1px solid var(--line);border-radius:8px;background:#fffefa}
.bean-library-card{width:100%;display:flex;align-items:center;justify-content:space-between;gap:9px;text-align:left;background:#f1f3e9;border:1px solid #e0e5d8;border-radius:12px;margin:0 0 9px;padding:14px 13px;touch-action:manipulation;min-height:70px}
.bean-library-card:active,.library-roast-card:active{background:#e3ebd9}
.bean-library-info{display:flex;flex-direction:column;gap:5px;min-width:0}
.bean-library-info strong,.library-roast-card strong{font-size:13px}
.bean-library-info small,.library-roast-card small{font-size:11px;color:#6b7869;line-height:1.35}
.bean-arrow{font-size:28px;color:#697e65;flex-shrink:0}
.library-roast-row{display:flex;align-items:stretch;gap:8px;margin-bottom:9px}
.library-roast-card{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px;align-items:flex-start;text-align:left;padding:13px;background:#f1f3e9;border-radius:11px;touch-action:manipulation}
.roast-card-meta{font-size:11px;color:#4d6650;line-height:1.5;max-width:100%;overflow-wrap:anywhere}
.favorite-button{flex-shrink:0;display:grid;place-items:center;width:46px;min-height:46px;font-size:25px;border-radius:11px;background:#f3f2e8;border:1px solid #dedfd0;color:#8a8b7d;touch-action:manipulation}
.favorite-button.is-favorite{background:#fff2d6;border-color:#e6c982;color:#a16713}
.favorite-button:active{transform:scale(.97)}
.favorite-button.large{width:52px;height:52px;font-size:30px}
.saved-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.saved-heading .eyebrow{margin-top:11px}
.saved-heading .sub{margin-bottom:16px}
.draft-row{display:flex;gap:8px;align-items:center}
.draft-row .history-card{flex:1;min-width:0}
.library-new{margin:17px 0}
.danger-text{color:#a34431!important}
.favorite-note-panel{background:#f9f5e7;border:1px solid #e7e0c8;border-radius:11px;padding:12px;margin:12px 0 15px}
.favorite-note-panel>strong{font-size:12px}
.favorite-note-panel p{font-size:12px;line-height:1.5;margin:7px 0;color:#4e5e4b;overflow-wrap:anywhere}
.favorite-note-panel input{margin-top:8px}
.small-actions{display:flex;align-items:center;gap:10px;margin-top:6px}
.tasting-note{border:1px solid var(--line);background:#fbfaf4;padding:12px;border-radius:11px;margin:9px 0}
.note-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.note-top strong{font-size:12px;color:#4d654c}
.note-top .text-btn{padding:7px 5px}
.tasting-note p,.saved-notes{font-size:12px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0 2px}
.tasting-note-form{padding:13px;border:1px solid #d9e1d2;border-radius:12px;background:#f3f5ed;margin:12px 0}
.tasting-note-form label{margin-bottom:12px}
.tasting-note-form .actions{margin-top:10px}
.saved-edit-list{display:flex;flex-direction:column;gap:8px;margin-bottom:20px}
.saved-edit-row{display:flex;align-items:center;gap:8px;padding:9px;background:#f3f5ed;border-radius:9px;flex-wrap:wrap}
.saved-edit-row>span{font-size:11px;color:#526550;min-width:54px}
.saved-edit-row label{flex:1;min-width:72px;max-width:180px}
.saved-edit-row input{padding:9px 8px}
.form-error{color:#a34431;font-size:12px;line-height:1.5}
.form-error[hidden]{display:none}
#saved-edit-form textarea{margin-bottom:15px}
@media(max-width:350px){.library-filters{gap:7px}.library-filters select{font-size:11px}.saved-edit-row{gap:5px}.saved-edit-row label{min-width:66px}}
.saved-delete-button{margin:24px 0 10px;padding:12px 5px}

/* Home & drawer navigation (v14). Native-feeling, mobile-first, no hover dependency. */
.app{position:relative}
.app header{justify-content:flex-start;gap:10px}
.app header .header-brand{min-width:0}
.menu-trigger{flex:0 0 auto;font-size:24px;line-height:1;padding:9px 10px;border-radius:9px;color:var(--ink)}
.menu-trigger:active{background:var(--olive)}
nav[hidden],.drawer-layer[hidden]{display:none!important}
.drawer-layer{position:absolute;inset:0;z-index:20;min-height:100%;display:block}
.drawer-scrim{position:absolute;inset:0;width:100%;height:100%;background:rgba(17,35,25,.35);border:0;border-radius:0;cursor:pointer}
.app-drawer{position:absolute;left:0;top:0;bottom:0;width:47%;max-width:220px;min-height:100%;overflow:auto;background:#fcfaf5;border-radius:0 17px 17px 0;box-shadow:12px 0 22px rgba(25,42,31,.16);padding:19px 9px 20px 11px;display:flex;flex-direction:column;gap:5px}
.drawer-top{display:flex;align-items:center;justify-content:space-between;padding:3px 4px 20px 8px;gap:5px}
.drawer-top strong{font:700 13px Manrope,system-ui;letter-spacing:.1px;color:#6d796c}
.drawer-top button{font-size:25px;line-height:1;background:transparent;padding:5px 9px;color:#687568}
.drawer-link{display:flex;gap:8px;align-items:center;min-height:48px;width:100%;padding:10px 8px;text-align:left;border-radius:10px;background:transparent;font-size:17px;line-height:1.2;color:#6d796c}
.drawer-link span{font-size:13px;font-weight:600;color:var(--ink)}
.drawer-link.selected{background:#e8ecd9;color:#415c42}
.drawer-separator{border-top:1px solid #e6e7dd;margin:10px 3px}
.drawer-link:active{background:#dce3ce}
/* v16: quiet, task-first Home. The wordmark appears once in the app header. */
.header-brand .brand{font-size:27px;letter-spacing:-1.5px}
.app header{padding-top:18px;padding-bottom:18px}
.home-screen{padding-top:2px}
.home-roast-cta{background:#26382e;color:#fcfaf5;width:100%;border-radius:13px;padding:17px 16px;min-height:74px;display:flex;align-items:center;gap:12px;text-align:left;box-shadow:0 4px 12px rgba(33,53,38,.12);touch-action:manipulation}
.home-roast-cta:active{transform:translateY(1px);background:#334c3b}
.home-roast-flame{font-size:23px;color:#ecc7a9;flex:0 0 auto}
.home-roast-copy{display:flex;flex:1;flex-direction:column;gap:3px;min-width:0}
.home-roast-copy strong{font:700 18px Manrope,system-ui;line-height:1.25}
.home-roast-copy small{font-size:11px;color:#dfebde;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-arrow{font-size:22px;flex-shrink:0}
.home-section-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:23px 0 12px}
.home-section-heading h2{margin:0;font:700 18px Manrope,system-ui;letter-spacing:-.3px}
.home-section-heading .text-btn{white-space:nowrap;font-size:12px;text-decoration:none}
.home-recent-list{display:flex;flex-direction:column;gap:8px}
.home-recent-item{display:flex;align-items:center;gap:4px;background:#f1f3e9;border:1px solid #e2e8db;border-radius:11px;padding:4px}
.home-open-roast{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px;align-items:stretch;text-align:left;background:transparent;padding:9px 9px}
.home-open-roast:active{background:#e6ecd9;border-radius:8px}
.home-recent-title{font-size:13px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.home-favorite{color:#ba7c45;font-size:12px;margin-left:5px}
.home-recent-info{font-size:11px;color:#5c6b60}
.home-note-preview{font-size:11px;line-height:1.25;color:#617262;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.home-add-note{flex:0 0 auto;min-height:44px;padding:10px 10px;border-radius:9px;background:#e1e8d7;color:#314c37;font-size:12px;font-weight:700}
.home-add-note:active{background:#ccdcbf}
.settings-group{margin:20px 0 26px}
.settings-chips{display:flex;gap:7px;flex-wrap:wrap;margin:10px 0 15px}
.settings-chip{background:#e8ecd9;border-radius:8px;padding:10px 9px;font-size:11px}
.settings-chip span{color:#a34b36;font-weight:700;padding-left:5px}
.settings-add-form{display:flex;gap:8px;align-items:center}
.settings-add-form input{margin-top:0;flex:1;min-width:0}
.settings-add-form button{min-height:43px}
@media(max-width:350px){.app-drawer{width:49%;padding-left:7px;padding-right:7px}.drawer-link{gap:5px;padding:8px 6px}.drawer-link span{font-size:12px}.home-roast-cta{padding:14px 12px}.home-add-note{padding:9px 7px}}


/* v15 — Events are taps; phases are continuously measured intervals.
   Separating their visual grouping prevents Browning from appearing to
   start Maillard. Percentage = share of elapsed roasting time, not progress. */
.phase-event-desc{display:block;font-size:9px;line-height:1.2;font-weight:500;color:#726e62;max-width:100%;}
.phase-card .phase.marked .phase-event-desc{color:#2d6345;}
.phase-panel .phase-card .phase{min-height:73px;gap:2px;}
.phase-progress{margin-top:11px;}
.phase-progress-heading{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px;}
.phase-progress-heading > span{font-size:11px;font-weight:700;}
.phase-progress-heading > small{font-size:10px;color:var(--muted);}
.phase-progress-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.phase-progress-grid .phase-stat{min-width:0;min-height:67px;background:#f3f4ec;border:1px solid #e1e4d9;border-radius:9px;padding:7px 8px 6px;display:flex;flex-direction:column;justify-content:center;}
.phase-progress-grid .phase-stat.active{background:#e4eddb;border-color:#82a083;box-shadow:inset 0 0 0 1px #b9cdb1;}
.phase-progress-grid .phase-stat small{font-size:10px;color:#62735f;}
.phase-progress-grid .phase-stat.active small{font-weight:700;color:#315b3f;}
.phase-progress-grid .phase-stat.active small::after{content:' ●';color:#398252;}
.phase-progress-grid .phase-stat strong{font-size:16px;line-height:1.2;margin:2px 0;font-variant-numeric:tabular-nums;}
.phase-progress-grid .phase-stat span{font-size:9px;line-height:1.2;white-space:normal;color:#687666;}
@media(max-width:375px){
 .phase-panel .phase-card .phase{min-height:70px;}
 .phase-event-desc{font-size:8px;}
 .phase-progress-grid{gap:4px;}
 .phase-progress-grid .phase-stat{padding:6px 5px;}
 .phase-progress-grid .phase-stat span{font-size:8.5px;}
}

/* v18 — Recorded milestones remain visibly green but are not re-tappable.
   A passed but unrecorded milestone gets a muted lock, not an active plus. */
.phase-card .phase.recorded,
.phase-card .phase.recorded:disabled {
  opacity:1;
  border-color:#398252;
  background:#a3d9af;
  color:#174b30;
  box-shadow:0 3px 0 #398252, 0 5px 9px rgba(23,75,48,.18);
  cursor:default;
}
.phase-card .phase.recorded .phase-event-desc {color:#2d6345}
.phase-card .phase.recorded .phase-tap-icon {background:#256e41}
.phase-card .phase.past,
.phase-card .phase.past:disabled {
  opacity:1;
  background:#eeeee9;
  border-color:#c8c9c0;
  color:#76796f;
  box-shadow:none;
  cursor:default;
}
.phase-card .phase.past .phase-event-desc {color:#888b81}
.phase-card .phase.past .phase-tap-icon {background:#9a9c91;box-shadow:none}
.phase-card .phase:disabled:active {transform:none}

/* v20: keep coffee details available during a roast without shifting its graph. */
.live-view .timer-row .roast-title{flex:1;min-width:0}
.roast-details-trigger{display:flex;align-items:center;justify-content:space-between;gap:5px;min-width:0;max-width:100%;min-height:42px;padding:7px 8px;border:1px solid #e4e7da;border-radius:9px;background:#f1f3e9;color:var(--ink);text-align:left;touch-action:manipulation}
.roast-details-trigger .bean-title{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.roast-details-trigger svg{flex:0 0 15px;width:15px;height:15px;color:#687568}
.roast-details-trigger:active{background:#e1e8d7}
.roast-details-trigger:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
dialog.roast-details-sheet{position:fixed;inset:auto auto 0 50%;transform:translateX(-50%);margin:0;width:min(430px,100vw);max-width:430px;max-height:min(84dvh,740px);border:0;border-radius:20px 20px 0 0;padding:0;background:var(--paper);color:var(--ink);box-shadow:0 -12px 34px rgba(24,38,29,.24);overflow:hidden}
dialog.roast-details-sheet[open]{display:flex;flex-direction:column}
dialog.roast-details-sheet::backdrop{background:rgba(14,29,20,.48)}
.roast-details-top{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 20px 12px;border-bottom:1px solid var(--line);flex:0 0 auto}
.roast-details-top h2{font-size:19px;letter-spacing:-.4px;margin:0}
.roast-details-close{font-size:24px;line-height:1;min-width:40px;min-height:40px;border-radius:9px;background:#f1f3e9;color:#647264}
#roast-details-form{display:flex;flex-direction:column;min-height:0;flex:1;overflow:hidden}
.roast-details-fields{padding:0 20px 18px;overflow-y:auto;overscroll-behavior:contain;min-height:0}
.roast-details-fields .section-label{margin:18px 0 12px}
.roast-details-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
.roast-details-grid .wide{grid-column:1/-1}
.roast-details-field{font-size:11px;min-width:0;color:#60705f}
.roast-details-field input{margin-top:6px;min-width:0;width:100%;padding:11px 10px;font-size:14px}
.roast-details-error{font-size:12px;color:#a23b32;margin:14px 0 0}
.roast-details-error[hidden]{display:none}
.roast-details-actions{display:flex;gap:10px;flex:0 0 auto;padding:13px 20px max(15px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--paper)}
.roast-details-actions button{flex:1;min-height:44px}
@media(max-width:375px){.roast-details-top{padding:12px 15px 9px}.roast-details-fields{padding:0 15px 14px}.roast-details-actions{padding:11px 15px max(12px,env(safe-area-inset-bottom))}.roast-details-grid{gap:9px}.roast-details-trigger{padding:6px 7px;min-height:40px}}


/* v21 — The same roast has a preparation state and a live state, not tabs.
   Save folds the editable coffee information into the roast heading. */
.roast-ready-screen{display:flex;flex-direction:column;gap:18px}
.coffee-prep{background:#f4f5ed;border:1px solid #dce4d8;border-radius:14px;overflow:hidden;scroll-margin-top:12px}
.coffee-prep-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:63px;text-align:left;background:#e8ecd9;padding:12px 15px;color:var(--ink)}
.coffee-prep-heading:disabled{opacity:1;cursor:default}
.coffee-prep-title{min-width:0;display:flex;flex-direction:column;gap:5px}
.coffee-prep-title strong{font:700 14px Manrope,system-ui;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.coffee-prep-title small{font-size:11px;color:#596d5b;white-space:normal;line-height:1.4}
.coffee-prep-chevron{font-size:23px;line-height:1;color:#657663;flex:none;transition:transform .30s ease}
.coffee-prep:not(.is-collapsed) .coffee-prep-chevron{transform:rotate(180deg)}
.coffee-prep-collapse{display:grid;grid-template-rows:1fr;opacity:1;transition:grid-template-rows .34s ease,opacity .26s ease,visibility .34s ease}
.coffee-prep-collapse-inner{min-height:0;overflow:hidden}
.coffee-prep.is-collapsed .coffee-prep-collapse{grid-template-rows:0fr;opacity:0;visibility:hidden;pointer-events:none}
.coffee-prep-form{padding:3px 14px 15px}
.coffee-prep-form .section-label{margin:19px 0 12px}
.coffee-prep-form .roast-details-grid{gap:11px}
.coffee-prep-form .roast-details-field input{padding:11px 9px}
.setup-save{margin-top:17px;min-height:46px}
.ready-timer-row{margin:0 0 12px}
.ready-roast-graph{height:181px;min-height:181px;overflow:hidden;margin-bottom:14px;padding:8px 4px}
.ready-roast-graph svg{display:block;width:100%;height:100%}
.ready-graph-empty{min-height:150px;display:grid;place-items:center;color:var(--muted);font-size:12px}
.start-logging{min-height:50px;touch-action:manipulation}
.start-logging-hint{font-size:11px;line-height:1.6;color:#667465;margin:10px 0 2px}
.review-details-link{display:inline-block;color:#41634e;background:#e9eee0;border-radius:7px;font-size:11px;padding:9px 11px;margin:3px 0 11px;text-align:left}
@media(max-width:375px){.coffee-prep-heading{padding:11px 12px}.coffee-prep-form{padding:3px 11px 13px}.coffee-prep-form .roast-details-grid{gap:9px}}
@media(prefers-reduced-motion:reduce){.coffee-prep-collapse,.coffee-prep-chevron{transition:none}}


/* One workspace for ready and active roasts; compact event controls. */
.roast-unified-workspace{gap:11px}
.roast-unified-workspace .ready-timer-row{margin:0 0 9px}
.roast-unified-workspace .ready-roast-graph,
.live-view .roast-unified-workspace #graph{height:181px;min-height:181px;max-height:181px;margin-bottom:10px;padding:8px 4px;overflow:hidden}
.roast-unified-workspace #graph svg{width:100%;height:100%}
.roast-unified-workspace .reading button{white-space:nowrap;min-height:43px}
.roast-unified-workspace .compact-controls-panel{margin-top:6px}
.roast-unified-workspace .stage-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:7px 0 10px;font-weight:700;font-size:13px}
.gesture-instruction{font-size:10px;color:#6e786e;line-height:1.4;margin:8px 1px 10px;min-height:14px}
.stage-tile-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.stage-tile{position:relative;min-width:0;border:1px solid #d8dcd1;border-radius:10px;background:#f7f7f1;overflow:hidden}
.stage-action{position:relative;display:flex;flex-direction:column;justify-content:center;gap:5px;align-items:center;text-align:center;width:100%;min-height:62px;background:transparent;padding:9px 4px;overflow:hidden;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.stage-action .stage-name{font-size:11px;font-weight:700;line-height:1.2;z-index:1}
.stage-action .stage-reading{font-size:10px;color:#7a8479;white-space:nowrap;z-index:1}
.stage-action:disabled{opacity:1;cursor:default}
.stage-tile.recorded{border-color:#92b59b;background:#eaf2e7}
.stage-tile.recorded .stage-name{color:#2c754b}
.stage-tile.recorded .stage-reading{color:#4f715a}
.stage-tile.recorded .stage-action{padding-right:26px}
.stage-tile.past{background:#eeefea}
.stage-tile.past .stage-name,.stage-tile.past .stage-reading{color:#9b9f96}
.stage-pencil{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:28px;height:40px;border-radius:7px;background:transparent;color:#5b7a60;z-index:3}
.stage-pencil svg{width:15px;height:15px;display:block}
.stage-pencil:focus-visible,.stage-action:focus-visible{outline:2px solid #c47945;outline-offset:1px}
.compact-phase-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;border-top:1px solid #e6e7dd;padding-top:10px}
.compact-phase-stats .phase-stat{display:flex;flex-direction:column;gap:3px;min-height:50px;padding:5px 4px;text-align:center;background:transparent;border:none;border-radius:6px;box-shadow:none}
.compact-phase-stats .phase-stat.active{background:#eaf2e7}
.compact-phase-stats .phase-stat small{font-size:10px;line-height:1.2;color:#687768}
.compact-phase-stats .phase-stat small::after{content:none}
.compact-phase-stats .phase-stat strong{font-size:15px;line-height:1.1;margin:0}
.compact-phase-stats .phase-stat span{font-size:10px;line-height:1.3;white-space:normal;color:#6f7b6c}
.live-only-tools[hidden]{display:none}
@media(max-width:350px){.stage-tile-grid{gap:4px}.stage-tile.recorded .stage-action{padding-right:23px}.stage-action .stage-name{font-size:10px}}


/* v23 — Visible stage editing and a predictable temporary Undo notice. */
dialog.event-editor{width:min(370px,calc(100vw - 28px));max-width:370px;padding:0;border-radius:16px;box-shadow:0 14px 48px rgba(25,40,30,.20)}
#event-editor-form{padding:19px;display:flex;flex-direction:column;gap:14px}
.event-editor-header{display:flex;justify-content:space-between;align-items:center;gap:12px}
.event-editor-header h2{font-size:20px;letter-spacing:-.4px;margin:0}
.event-editor-close{border-radius:8px;background:#e9eee0;min-width:38px;min-height:38px;font-size:21px}
.event-editor label{font-size:12px;color:#5f715f}
.event-editor input,.event-editor select{display:block;width:100%;margin-top:7px;padding:12px 10px;border:1px solid #d8ded2;border-radius:9px;background:#fffefa;color:var(--ink);font-size:16px}
.event-editor .event-editor-tip{margin:0;font-size:11px;color:var(--muted);line-height:1.4}
.event-editor-error{font-size:12px;color:#a23b32;margin:0}
.event-editor-error[hidden],#event-stage-field[hidden],#event-delete[hidden]{display:none}
.event-editor-actions{display:flex;gap:9px}
.event-editor-actions button{flex:1;min-height:44px}
.event-delete{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;border:1px solid #e9cbc2;background:#fff1ed;color:#9a4033;border-radius:9px;font-size:12px;font-weight:600}
.event-delete svg{width:17px;height:17px}
#toast{left:50%;transform:translateX(-50%);bottom:max(22px,env(safe-area-inset-bottom));max-width:calc(100vw - 28px);width:max-content;min-width:min(230px,calc(100vw - 28px));display:none;line-height:1.4;box-shadow:0 7px 24px rgba(20,38,24,.20)}
#toast.with-undo{padding-bottom:19px}
#toast button{font-size:12px;font-weight:700;text-decoration:underline}
#toast .toast-expiry{font-size:10px;color:#e4e9dc;white-space:nowrap;margin-left:7px}
#toast .toast-progress{position:absolute;bottom:0;left:0;height:4px;width:100%;background:#f0c494;border-radius:0 0 12px 12px;transform-origin:left;animation:undo-time-left 8s linear both}
@keyframes undo-time-left{to{transform:scaleX(0)}}
@media(prefers-reduced-motion:reduce){#toast .toast-progress{animation:none;display:none}}


/* v24 — Keep roasting events and percentages compact so the temperature
   setting controls are easier to find during a roast. */
.roast-unified-workspace .compact-controls-panel{margin-top:0}
.roast-unified-workspace .stage-heading{margin:2px 0 7px;font-size:13px}
.roast-unified-workspace .stage-tile-grid{gap:6px}
.roast-unified-workspace .stage-action{min-height:56px;gap:3px;padding:7px 3px}
.roast-unified-workspace .stage-action .stage-name{font-size:11px}
.roast-unified-workspace .stage-action .stage-reading{font-size:10px}
.roast-unified-workspace .stage-tile.recorded .stage-action{padding-right:35px}
.roast-unified-workspace .stage-pencil{right:0;width:36px;min-height:44px;height:100%;border-left:1px solid #d3e1d2;border-radius:0}
.roast-unified-workspace .stage-pencil:active{background:#dcead9}
.roast-unified-workspace .gesture-instruction{margin:5px 0 7px}
.roast-unified-workspace .compact-phase-stats{gap:6px;margin-top:8px;padding-top:7px}
.roast-unified-workspace .compact-phase-stats .phase-stat{min-height:47px;padding:4px 2px;gap:2px}
.roast-unified-workspace .compact-phase-stats .phase-stat small{font-size:10px}
.roast-unified-workspace .compact-phase-stats .phase-stat strong{font-size:15px;line-height:1.15}
.roast-unified-workspace .compact-phase-stats .phase-stat span{font-size:10px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
/* Space saved above allows the adjustment control to read as an action,
   rather than a small '+' next to a narrow heading. */
.roast-unified-workspace .adjustment-panel{margin:12px 0 4px;padding:12px;background:#f3f5ed;border:1px solid #dbe3d7;border-radius:12px}
.roast-unified-workspace .adjustment-heading{margin:0 0 3px;font-size:13px}
.roast-unified-workspace .adjustment-heading small{font-size:11px;margin-left:3px}
.roast-unified-workspace .adjustment-explanation{font-size:11px;color:#627261;line-height:1.35;margin:0 0 10px}
.roast-unified-workspace .add-adjustment-prominent{width:100%;min-height:44px;display:flex;align-items:center;justify-content:center;gap:8px;padding:10px 9px;margin:0 0 10px;background:#315b43;color:#fff;border-radius:9px;font-size:12px;font-weight:700;touch-action:manipulation}
.roast-unified-workspace .add-adjustment-prominent span{font-size:20px;font-weight:400;line-height:1}
.roast-unified-workspace .add-adjustment-prominent:active{background:#254933}
.roast-unified-workspace .adjustment-record{background:#fffefa}
.roast-unified-workspace .empty-adjustment{background:#e8eddf;padding:10px;font-size:11px}
@media(max-width:350px){
  .roast-unified-workspace .stage-tile-grid{gap:4px}
  .roast-unified-workspace .stage-action .stage-name{font-size:10px}
  .roast-unified-workspace .stage-tile.recorded .stage-action{padding-right:34px}
  .roast-unified-workspace .adjustment-panel{padding:10px}
}


/* v25 — Keep stage label and timestamp as one centered group; give editing
   its own full-height side target. No change to event recording behavior. */
.roast-unified-workspace .stage-tile.recorded{
  display:grid;
  grid-template-columns:minmax(0,1fr) 34px;
  align-items:stretch;
}
.roast-unified-workspace .stage-tile.recorded .stage-action{
  min-width:0;
  min-height:60px;
  padding:7px 2px;
  text-align:center;
  align-items:center;
  justify-content:center;
}
.roast-unified-workspace .stage-tile.recorded .stage-pencil{
  position:static;
  transform:none;
  display:grid;
  place-items:center;
  width:34px;
  height:auto;
  min-height:60px;
  border-left:1px solid #d3e1d2;
  border-radius:0;
  padding:0;
}
.roast-unified-workspace .stage-action .stage-name,
.roast-unified-workspace .stage-action .stage-reading{
  display:block;
  width:100%;
  max-width:100%;
  line-height:1.18;
  text-align:center;
  overflow-wrap:normal;
}
.roast-unified-workspace .stage-action .stage-name{
  white-space:normal;
}
.roast-unified-workspace .stage-check{
  position:absolute;
  top:4px;
  left:5px;
  color:#2c754b;
  font-weight:700;
  font-size:10px;
  line-height:1;
  pointer-events:none;
}
@media(max-width:350px){
  .roast-unified-workspace .stage-tile.recorded{grid-template-columns:minmax(0,1fr) 32px}
  .roast-unified-workspace .stage-tile.recorded .stage-pencil{width:32px}
  .roast-unified-workspace .stage-action .stage-name{font-size:10px}
}


/* v26 — Separate the three logging sections with two quiet dividers.
   Keep all existing controls, colors, and section layouts unchanged. */
.roast-unified-workspace .compact-controls-panel{
  border-top:1px solid #d9ddd3;
  padding-top:9px;
}
.roast-unified-workspace .live-only-tools{
  border-top:1px solid #d9ddd3;
  margin-top:10px;
}


/* v29 — Wheel-only adjustment time entry after touchscreen comparison. */
.adjustment-time-preview{font-size:16px;color:#33553d;font-variant-numeric:tabular-nums;white-space:nowrap}
.adjustment-time-entry{display:flex;flex-direction:column;gap:8px}
.adjustment-time-hint{margin:0;font-size:11px;color:#657766;line-height:1.4;text-align:center}
.adjustment-time-wheels{display:flex;justify-content:center;align-items:center;gap:12px;padding-top:4px}
.adjustment-wheel-column{flex:0 1 112px;min-width:0;display:flex;flex-direction:column;gap:5px;text-align:center}
.adjustment-wheel-label{font-size:11px;font-weight:600;color:#516750}
.adjustment-wheel-window{position:relative;height:132px;border-radius:9px;background:#fffefa;border:1px solid #d4dfcf;overflow:hidden}
.adjustment-wheel-window:after{content:"";position:absolute;left:4px;right:4px;top:43px;height:44px;border-top:1px solid #bfd0bc;border-bottom:1px solid #bfd0bc;border-radius:5px;pointer-events:none;background:#dfeada32}
.adjustment-wheel{height:132px;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:pan-y;scroll-snap-type:y mandatory;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding:44px 0}
.adjustment-wheel::-webkit-scrollbar{display:none}
.adjustment-wheel-option{height:44px;display:flex;align-items:center;justify-content:center;scroll-snap-align:center;scroll-snap-stop:normal;font-size:18px;font-variant-numeric:tabular-nums;color:#89998a;user-select:none;cursor:pointer}
.adjustment-wheel-option.selected{color:#284d34;font-weight:700;font-size:22px}
.adjustment-wheel-colon{font-size:24px;color:#617360;align-self:center;margin-top:15px}
@media(max-width:350px){.adjustment-time-wheels{gap:8px}}
@media(prefers-reduced-motion:reduce){.adjustment-wheel{scroll-behavior:auto}}

/* v30 — iPhone/Capacitor usability pass. Keep the desktop prototype intact. */
/* iOS paints a rectangular tap highlight independent of a button's radius.
   Preserve each button's authored :active styling without the sharp overlay. */
button, a, summary, [role="button"] { -webkit-tap-highlight-color: transparent; }

@media (max-width: 650px) {
  /* viewport-fit=cover makes native iOS safe area insets available. Protect
     both the Dynamic Island/status area and the rounded lower home-indicator
     area without hardcoding a particular iPhone model's pixel dimensions. */
  .app {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .coffee-prep {
    scroll-margin-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  /* The navigation drawer follows the device viewport (not a long scrolling
     document) and opens above all of the content, including the roast graph. */
  .drawer-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    z-index: 100;
  }
  .app-drawer {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding-top: calc(19px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* 16px prevents iOS WebKit's automatic form-focus page zoom. Do not
     disable browser zoom, so users retain the accessibility gesture. */
  input, textarea, select,
  .roast-details-field input,
  .coffee-prep-form .roast-details-field input,
  .adjustment-temp-field input,
  .adjustment-row input,
  .adjustment-row input.time,
  .live-view .adjustment-row input,
  .event-editor input, .event-editor select,
  .saved-edit-row input,
  .library-filters select {
    font-size: 16px;
  }

  /* Give End roast a comfortable touch target and keep it off the rounded
     bottom corners. Use the existing quiet separator/spacing structure. */
  .live-view .stop {
    min-height: 48px;
    padding: 13px 16px;
    border-radius: 10px;
  }
}

/* v31 — iPhone touch behavior and a centered coffee-details chevron.
   Keep pinch zoom and scrolling available; suppress only double-tap zoom. */
@media (max-width: 650px) {
  html, body, .app {
    touch-action: manipulation;
  }
}

/* Draw the chevron instead of rotating a font glyph. A fixed square and
   centered border shape make the collapsed and expanded icons align. */
.coffee-prep-heading .coffee-prep-chevron {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  font-size: 0;
  line-height: 0;
  transform-origin: center center;
}
.coffee-prep-heading .coffee-prep-chevron::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}


/* v32 — Consistent iOS coffee information controls and stable navigation. */
/* Prevent native date/number widgets from expanding their grid cell.
   Date keeps the iPhone's native date picker, with a common field outline. */
.roast-details-grid { min-width:0; }
.roast-details-grid > * { min-width:0; max-width:100%; }
.roast-details-field { min-width:0; max-width:100%; }
.roast-details-field input {
  display:block;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  max-width:100%;
  height:46px;
  line-height:normal;
  border-radius:9px;
}
.roast-details-field input[type="date"] {
  display:block;
  width:100%;
  min-width:0;
  max-width:100%;
  height:46px;
  min-height:46px;
  padding:10px 9px;
  font-variant-numeric:tabular-nums;
  -webkit-appearance:none;
  appearance:none;
  text-align:left;
}
.roast-details-field input[type="date"]::-webkit-date-and-time-value {
  min-height:1.5em;
  text-align:left;
}
.roast-details-field input[type="number"] {
  -moz-appearance:textfield;
  appearance:textfield;
}
.roast-details-field input[type="number"]::-webkit-inner-spin-button,
.roast-details-field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }

/* An editable text field with suggestions that appear only while choosing.
   Unlike native datalist, it does not show a second small dropdown arrow. */
.roast-suggestion-field { position:relative; }
.roast-suggestion-field > label { display:block; font-size:11px; color:#60705f; }
.roast-suggestion-field > input { margin-top:6px; }
.roast-suggestion-list {
  position:absolute;
  top:calc(100% + 3px);
  left:0;
  right:0;
  z-index:15;
  border:1px solid #ccd7c7;
  border-radius:9px;
  background:#fffefa;
  box-shadow:0 6px 18px rgba(30,47,31,.14);
  padding:4px;
  max-height:194px;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.roast-suggestion-list[hidden] { display:none!important; }
.roast-suggestion-caption,
.roast-suggestion-help { display:block; padding:7px 9px; color:#677968; font-size:11px; line-height:1.45; }
.roast-suggestion-option {
  display:block;
  width:100%;
  min-height:39px;
  padding:9px;
  border-radius:6px;
  background:transparent;
  text-align:left;
  font-size:13px;
  touch-action:manipulation;
}
.roast-suggestion-option:active,
.roast-suggestion-option:focus-visible { background:#e8ecd9; }

/* One shared toolbar geometry, regardless of which screen is active. */
.app > header,
.live-view .app > header {
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  min-height:70px;
  padding:18px 22px;
}
.app > header .header-brand .brand,
.live-view .app > header .header-brand .brand {
  font-size:27px;
  line-height:1.1;
  letter-spacing:-1.5px;
}
.app > header .menu-trigger,
.live-view .app > header .menu-trigger {
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:grid;
  place-items:center;
  padding:0;
  font-size:24px;
  line-height:1;
}
@media (max-width:650px) {
  .roast-details-field input { font-size:16px; }
  .app > header, .live-view .app > header { min-height:70px; }
}

/* v34 — Reference comparison: small, stable controls in the roast workspace. */
.reference-toolbar{display:flex;align-items:center;justify-content:space-between;gap:9px;margin:0 0 7px;min-width:0}
.reference-toolbar-label{font:700 12px Manrope,system-ui;color:#405740}
.compare-open{display:inline-flex;align-items:center;justify-content:center;max-width:67%;min-height:38px;padding:8px 12px;border:1px solid #b8c9b2;border-radius:9px;background:#e8ecd9;color:#36503b;font-size:12px;font-weight:700;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.compare-open:active{background:#dce6d3}
.reference-controls{border:1px solid #d9e1d4;border-radius:11px;padding:9px;margin:-4px 0 3px;background:#f8f9f3}
.reference-key{display:flex;flex-wrap:wrap;align-items:center;gap:12px;font-size:10px;color:#596d5b}
.reference-key span{display:flex;align-items:center;gap:5px}
.reference-key i{display:block;width:17px;height:0;border-top:3px solid #c47945}
.reference-key i.key-previous{border-top-color:#486f56;border-top-style:dashed}
.reference-key button{margin-left:auto;font-size:10px;text-decoration:underline;background:transparent;color:#687d69;min-height:32px}
.compare-mode{display:grid;grid-template-columns:1fr 1fr;gap:3px;border-radius:9px;background:#e7eadd;padding:3px;margin-top:6px}
.compare-mode button{min-width:0;min-height:39px;border-radius:7px;font-size:12px;font-weight:600;background:transparent;color:#647665}
.compare-mode button.selected{background:#fffefb;color:#294c34;box-shadow:0 1px 3px #31462b22}
.reference-align-note{font-size:10px;line-height:1.5;color:#697c66;margin:8px 2px 0}
.reference-details{margin-top:8px;font-size:11px;color:#4f654f}
.reference-details summary{padding:5px 2px;cursor:pointer;font-weight:650}
.reference-details > div{border-top:1px solid #dfe6d9;margin-top:5px;padding-top:4px}
.reference-details p{margin:8px 2px;color:#7c8577;font-size:11px}
.reference-event{display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid #e7e9df;padding:8px 0;font-size:11px}
.reference-event span,.reference-event strong{min-width:0}
.reference-event span small{display:block;font-size:10px;color:#778775;margin-top:3px}
.reference-event strong{text-align:right;font-size:11px}
.reference-next{padding:9px 0 3px;font-size:11px}
.reference-next strong{font-size:11px}
.reference-next span{display:block;color:#728172;margin-top:4px;font-size:10px}

/* The comparison dialog itself never grows as a preview expands. Its list
   scrolls independently. Expansion preserves scrollTop and never auto-centers. */
dialog.compare-sheet{
  position:fixed;left:50%;bottom:0;top:auto;right:auto;transform:translateX(-50%);
  margin:0;padding:0;width:min(430px,100vw);max-width:430px;
  height:min(83dvh,770px);max-height:calc(100dvh - env(safe-area-inset-top,0px) - 10px);
  border:0;border-radius:20px 20px 0 0;
  background:var(--paper);color:var(--ink);box-shadow:0 -16px 42px #243f2a38;
  overflow:hidden;
}
dialog.compare-sheet[open]{display:flex;flex-direction:column}
dialog.compare-sheet::backdrop{background:rgba(14,29,20,.46)}
.compare-header{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;padding:17px 18px 10px;flex:none}
.compare-header h2{font:700 19px Manrope,system-ui;letter-spacing:-.5px;margin:0}
.compare-header p{font-size:11px;color:var(--muted);margin:5px 0 0;line-height:1.4}
#compare-close{display:grid;place-items:center;flex:0 0 40px;width:40px;height:40px;border-radius:9px;background:#f1f3e9;font-size:24px;color:#607260}
.compare-top-controls{padding:1px 18px 11px;flex:none;border-bottom:1px solid var(--line)}
.compare-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;padding:3px;border-radius:9px;background:#e7eadd}
.compare-tabs button{padding:8px 2px;min-width:0;min-height:38px;border-radius:7px;background:transparent;font-size:10px;font-weight:700;color:#677666}
.compare-tabs button.selected{background:#fffefa;color:#284a34;box-shadow:0 1px 3px #293a2824}
.compare-top-controls label{display:block;margin-top:11px;font-size:10px;color:#697b6a;font-weight:600}
.compare-top-controls input{display:block;margin-top:5px;font-size:16px;min-height:43px;padding:10px 11px}
.compare-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y;padding:11px 17px max(18px,env(safe-area-inset-bottom,0px));scrollbar-gutter:stable}
.compare-empty{font-size:12px;line-height:1.6;color:#738273;padding:16px 8px}
.compare-bean{border:1px solid #dae2d5;border-radius:12px;background:#fffefa;overflow:hidden;margin-bottom:9px}
.compare-bean-heading{display:flex;align-items:center;justify-content:space-between;gap:9px;min-height:66px;text-align:left;padding:12px 13px;width:100%;background:#f1f4eb}
.compare-bean-heading>span:first-child{min-width:0;display:flex;flex-direction:column;gap:4px}
.compare-bean-heading strong{font-size:13px;color:#2a4533;line-height:1.3}
.compare-bean-heading small{display:block;color:#7a8778;font-size:10px;line-height:1.4}
.compare-bean-heading>span:last-child{font-size:20px;color:#667a65}
.compare-roasts{padding:4px 8px 8px}
.compare-roast{border:1px solid #e2e7da;border-radius:9px;margin-top:7px;overflow:hidden;background:#fffefb}
.compare-roast.is-selected{border-color:#9cac91}
.compare-roast-heading{display:flex;align-items:center;gap:2px;min-width:0}
.compare-roast-toggle{flex:1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:5px;padding:10px 7px 10px 10px;background:transparent;text-align:left}
.compare-roast-date{font-size:12px;font-weight:700;line-height:1.3}
.compare-roast-meta{font-size:10px;color:#708170;line-height:1.4}
.compare-roast-note{font-size:11px;line-height:1.4;color:#576d59;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;text-overflow:ellipsis}
.compare-fav,.compare-chevron{display:grid;place-items:center;align-self:stretch;flex:0 0 33px;min-height:48px;background:transparent;font-size:21px;color:#839282}
.compare-fav.is-favorite{color:#b68236}
.compare-chevron{flex-basis:25px;font-size:20px}
.compare-preview{padding:9px 10px 12px;border-top:1px solid #edf0e7;background:#f9faf5}
.compare-preview-graph{width:100%;max-width:330px;margin:0 auto}
.compare-preview-graph svg{display:block;width:100%;height:auto;overflow:visible}
.compare-preview-graph svg .preview-phase-label{font-size:10px;font-weight:750;paint-order:stroke;stroke:#fffefa;stroke-width:1.3px;stroke-opacity:.8}
.compare-preview-graph svg .preview-marker{font-size:10px;font-weight:700;fill:#58765f}
.compare-phase-unavailable{margin:2px 0 0;font-size:10px;color:#7b857b;text-align:center}
.compare-preview-stats{display:flex;align-items:center;justify-content:space-between;gap:9px;border-top:1px solid #e5eadf;margin-top:5px;padding-top:11px;font-size:11px;color:#6c7d6b}
.compare-preview-stats strong{display:block;margin-top:2px;color:#294533;font-size:15px;font-variant-numeric:tabular-nums}
.compare-use{min-height:44px;margin-top:10px;padding:11px 14px}
@media(max-width:375px){
  .compare-header{padding:13px 13px 8px}
  .compare-top-controls{padding:0 13px 10px}
  .compare-list{padding:9px 12px max(15px,env(safe-area-inset-bottom,0px))}
  .compare-tabs button{font-size:9px}
  .compare-roast-heading{gap:0}
  .compare-fav{flex-basis:29px}
  .compare-chevron{flex-basis:22px}
}
@media(prefers-reduced-motion:reduce){.compare-sheet *{scroll-behavior:auto!important}}


/* v35 — Highlight the tapped preview without moving it. A saved reference
   gets a stronger, persistent indicator on subsequent sheet openings. */
.compare-roast.is-expanded{border-color:#91ae95;background:#edf4ea;box-shadow:0 0 0 1px #91ae9540}
.compare-roast.is-expanded .compare-roast-heading{background:#e4f0e2}
.compare-roast.is-expanded .compare-roast-toggle{color:#214d31}
.compare-roast.is-selected{border-color:#568a66;background:#e9f3e7;box-shadow:inset 3px 0 #568a66,0 0 0 1px #568a6633}
.compare-roast.is-selected .compare-roast-heading{background:#dcebdc}
.compare-roast.is-selected .compare-roast-date{color:#25583a}
.compare-roast.is-expanded.is-selected .compare-roast-heading{background:#d4e9d4}
/* A single SVG arrow replaces different-font up/down glyphs, which had
   different optical centers on iOS. Fixed tap dimensions don't change. */
.compare-bean-chevron{width:28px;height:32px;flex:none;display:grid;place-items:center;color:#667a65}
.compare-chevron{align-self:stretch;flex:0 0 35px;width:35px;min-height:48px;padding:0;display:grid;place-items:center;background:transparent;color:#667a65}
.compare-chevron-icon{display:block!important;width:18px!important;height:18px!important;flex:none;transition:transform .12s ease}
.compare-chevron-icon.is-up{transform:rotate(180deg)}
.compare-fav{align-self:stretch;flex:0 0 36px;width:36px;min-height:48px;display:grid;place-items:center}/* Freeze the covered page; only .compare-list scrolls while the sheet is open.
   The JS also guards iOS overscroll at either end of the list. */
html.compare-modal-lock{overflow:hidden!important}
body.compare-modal-lock{position:fixed!important;top:var(--compare-locked-top,0px)!important;left:0!important;right:0!important;width:100%!important;overflow:hidden!important}
@media(max-width:375px){.compare-chevron{flex-basis:35px;width:35px}.compare-fav{flex-basis:36px;width:36px}}
@media(prefers-reduced-motion:reduce){.compare-chevron-icon{transition:none}}

/* v36 — Keep the coffee information in the finished-roast page, in the
   same expandable card and document scroll used before End roast. */
.roast-review-screen .coffee-prep{margin:0 0 18px}
.roast-review-screen .review-eyebrow{margin:18px 0 9px}
.roast-review-screen .coffee-prep-form{min-width:0}
.roast-review-screen .coffee-prep .roast-details-grid{min-width:0}
.roast-review-screen .coffee-prep .roast-details-field{min-width:0}
.roast-review-screen .coffee-prep .roast-details-field input{font-size:16px}


/* v37 — Reference prompt at the moment before starting; no interruption. */
.reference-prestart-prompt{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:3px 0 13px;padding:12px 13px;border:1px solid #cad9bd;border-radius:12px;background:#eef3e7;color:#344c38;min-width:0}
.reference-prestart-prompt.has-reference{background:#e7f0e3;border-color:#a5c2a2}
.reference-prompt-copy{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.reference-prompt-kicker{font-size:9px;letter-spacing:.07em;font-weight:750;color:#64816b}
.reference-prompt-copy strong{font-size:13px;font-weight:750;line-height:1.3}
.reference-prompt-copy small{font-size:11px;color:#607661;line-height:1.45}
.reference-prompt-action{min-height:42px;flex:0 0 auto;padding:10px 12px;border:1px solid #a8bca4;border-radius:9px;background:#fffdf8;color:#355b41;font-size:12px;font-weight:750;touch-action:manipulation}
.reference-prompt-action span{margin-left:3px}
.reference-prompt-action:active{background:#e2ecde}
.reference-prompt-action:focus-visible{outline:2px solid #447950;outline-offset:2px}
.review-autosave-note{display:flex;align-items:flex-start;gap:8px;margin:17px 0 0;padding:11px 12px;border-radius:10px;background:#eff2e9;color:#5d6e61;font-size:11px;line-height:1.6}
.review-autosave-note span{font-weight:800;color:#3b7653;font-size:13px}
.review-save-actions{margin-top:12px;margin-bottom:max(18px,env(safe-area-inset-bottom))}
@media(max-width:365px){.reference-prestart-prompt{gap:8px;padding:10px}.reference-prompt-action{padding:9px 10px;font-size:11px}.reference-prompt-copy small{font-size:10px}}


/* v38: Settings controls */
.preferences-panel{margin:0 0 22px;padding:1px 12px 12px;border:1px solid var(--line);border-radius:13px;background:var(--olive)}
.preferences-panel .section-label{margin-top:15px;margin-bottom:7px}
.preference-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:13px 2px;border-bottom:1px solid var(--line)}
.preference-row:last-child{border:0}
.preference-row>div:first-child{min-width:0;flex:1}
.preference-row strong{font-size:12px;display:block;line-height:1.4}
.preference-row small{font-size:10px;color:var(--muted);display:block;margin-top:4px;line-height:1.45}
.preference-options{flex:none;display:grid;grid-template-columns:1fr 1fr;gap:3px;padding:3px;background:var(--paper);border:1px solid var(--line);border-radius:9px}
.preference-options button{min-width:44px;min-height:38px;padding:7px 9px;background:transparent;border-radius:7px;font-size:12px;font-weight:700;color:var(--muted)}
.preference-options button.selected{background:#dce8d9;color:#254b30}
/* The title area acts as the invisible downward-dismissal gesture surface. */
.compare-header{touch-action:none;user-select:none;-webkit-user-select:none}
#compare-close{touch-action:manipulation}
.compare-list{touch-action:pan-y}
@media(max-width:355px){.preference-row{gap:7px}.preference-options button{min-width:36px;padding:7px 6px}}

/* v38 generated dark remapping of legacy fixed colors across existing screens. */
html[data-theme="dark"] body{background:#181d19}
html[data-theme="dark"] .intro>p:not(.eyebrow){color:#c6d0c6}
html[data-theme="dark"] .prototype-note{border-top:1px solid #48544a}
html[data-theme="dark"] .prototype-note span{color:#c6d0c6}
html[data-theme="dark"] .app{box-shadow:0 24px 80px rgba(10,18,13,0.094);border:1px solid #343c35}
html[data-theme="dark"] label{color:#b4c1b5}
html[data-theme="dark"] input, html[data-theme="dark"] textarea{background:#181d19}
html[data-theme="dark"] input::placeholder{color:#a8b3a9}
html[data-theme="dark"] footer{color:#b4c1b5}
html[data-theme="dark"] .graph{background:#181d19}
html[data-theme="dark"] svg text{fill:#b4c1b5}
html[data-theme="dark"] .reminder.due{color:#dfad89}
html[data-theme="dark"] .phase{background:#181d19}
html[data-theme="dark"] .phase.marked{background:#181d19;border-color:#48544a}
html[data-theme="dark"] .adjustment .remove{color:#dfad89}
html[data-theme="dark"] .stop{border:1px solid #635145;background:#181d19;color:#dfad89}
html[data-theme="dark"] dialog::backdrop{background:rgba(12,21,16,0.33)}
html[data-theme="dark"] #toast button{color:#e2c1a4}
html[data-theme="dark"] .history-card{background:#181d19}
html[data-theme="dark"] #missing-readings{color:#dfad89}
html[data-theme="dark"] .empty-adjustment{background:#181d19}
html[data-theme="dark"] .phase-card{background:#181d19}
html[data-theme="dark"] .phase-card .phase{background:#181d19}
html[data-theme="dark"] .phase-card .phase.marked{background:#181d19}
html[data-theme="dark"] .phase-card{border-color:#343c35;background:#181d19}
html[data-theme="dark"] .phase-card .phase{border:1px solid #635145;background:#181d19;box-shadow:0 3px 0 #090c09, 0 5px 9px rgba(38,56,46,.13)}
html[data-theme="dark"] .phase-card .phase.marked{border-color:#48544a;background:#252b25;color:#b4c1b5;box-shadow:0 3px 0 #090c09, 0 5px 9px rgba(23,75,48,.18)}
html[data-theme="dark"] .phase-tap-icon{background:#4b4035;color:#eef1eb}
html[data-theme="dark"] .phase-card .phase.marked .phase-tap-icon{background:#496350}
html[data-theme="dark"] .phase-card .phase:active{box-shadow:0 1px 0 #090c09, 0 2px 4px rgba(38,56,46,.1)}
html[data-theme="dark"] .phase-card .phase.marked:active{box-shadow:0 1px 0 #090c09, 0 2px 4px rgba(23,75,48,.18)}
html[data-theme="dark"] .adjustment-row{background:#181d19}
html[data-theme="dark"] .adjustment-order{color:#b4c1b5}
html[data-theme="dark"] .phase-card .phase .phase-tap-icon{color:#eef1eb}
html[data-theme="dark"] .adjustment-edit{border:1px solid #48544a;background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .adjustment-edit.active{background:#181d19;border-color:#48544a;color:#b4c1b5}
html[data-theme="dark"] .adjustment-edit-hint{color:#dfad89}
html[data-theme="dark"] .adjustment-panel .adjustment-row.delete-mode .remove{background:#181d19;color:#c6d0c6}
html[data-theme="dark"] .review-adjustment-remove{background:#181d19!important;color:#c6d0c6!important}
html[data-theme="dark"] .adjustment-undo-bar{background:#181d19;border:1px solid #48544a;color:#b4c1b5}
html[data-theme="dark"] .adjustment-undo-button{background:#181d19;color:#b4c1b5;border:1px solid #48544a}
html[data-theme="dark"] .adjustment-undo-button:active{background:#252b25}
html[data-theme="dark"] .adjustment-record{background:#181d19}
html[data-theme="dark"] .adjustment-sentence>span{color:#b4c1b5}
html[data-theme="dark"] .adjustment-record-time{color:#b4c1b5}
html[data-theme="dark"] .adjustment-pencil{color:#c6d0c6}
html[data-theme="dark"] .adjustment-pencil[aria-expanded="true"]{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .adjustment-pencil:active{background:#181d19}
html[data-theme="dark"] .adjustment-form{border:1px solid #48544a;background:#181d19}
html[data-theme="dark"] .adjustment-form-title{color:#b4c1b5}
html[data-theme="dark"] .adjustment-word{color:#b4c1b5}
html[data-theme="dark"] .adjustment-unit{color:#a8b3a9}
html[data-theme="dark"] .masked-time-field{background:#181d19}
html[data-theme="dark"] .time-mask-digit.placeholder{color:#a8b3a9}
html[data-theme="dark"] .time-mask-colon{color:#b4c1b5}
html[data-theme="dark"] .adjustment-form-error{color:#c6d0c6}
html[data-theme="dark"] .adjustment-save{background:#496350}
html[data-theme="dark"] .adjustment-cancel{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .adjustment-delete{background:#181d19;color:#c6d0c6}
html[data-theme="dark"] .library-toolbar{background:#181d19}
html[data-theme="dark"] .library-toolbar input[type=search]{background:#181d19}
html[data-theme="dark"] .library-filters select{background:#181d19}
html[data-theme="dark"] .bean-library-card{background:#181d19;border:1px solid #343c35}
html[data-theme="dark"] .bean-library-card:active, html[data-theme="dark"] .library-roast-card:active{background:#181d19}
html[data-theme="dark"] .bean-library-info small, html[data-theme="dark"] .library-roast-card small{color:#c6d0c6}
html[data-theme="dark"] .bean-arrow{color:#b4c1b5}
html[data-theme="dark"] .library-roast-card{background:#181d19}
html[data-theme="dark"] .roast-card-meta{color:#b4c1b5}
html[data-theme="dark"] .favorite-button{background:#181d19;border:1px solid #343c35;color:#a8b3a9}
html[data-theme="dark"] .favorite-button.is-favorite{background:#181d19;border-color:#635145;color:#dfad89}
html[data-theme="dark"] .danger-text{color:#c6d0c6!important}
html[data-theme="dark"] .favorite-note-panel{background:#181d19;border:1px solid #635145}
html[data-theme="dark"] .favorite-note-panel p{color:#b4c1b5}
html[data-theme="dark"] .tasting-note{background:#181d19}
html[data-theme="dark"] .note-top strong{color:#b4c1b5}
html[data-theme="dark"] .tasting-note-form{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .saved-edit-row{background:#181d19}
html[data-theme="dark"] .saved-edit-row>span{color:#b4c1b5}
html[data-theme="dark"] .form-error{color:#c6d0c6}
html[data-theme="dark"] .drawer-scrim{background:rgba(12,21,16,0.33)}
html[data-theme="dark"] .app-drawer{background:#181d19}
html[data-theme="dark"] .drawer-top strong{color:#c6d0c6}
html[data-theme="dark"] .drawer-top button{color:#c6d0c6}
html[data-theme="dark"] .drawer-link{color:#c6d0c6}
html[data-theme="dark"] .drawer-link.selected{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .drawer-separator{border-top:1px solid #343c35}
html[data-theme="dark"] .drawer-link:active{background:#252b25}
html[data-theme="dark"] .home-roast-cta{background:#496350;color:#eef1eb}
html[data-theme="dark"] .home-roast-cta:active{background:#496350}
html[data-theme="dark"] .home-roast-flame{color:#e2c1a4}
html[data-theme="dark"] .home-roast-copy small{color:#eef1eb}
html[data-theme="dark"] .home-recent-item{background:#181d19;border:1px solid #343c35}
html[data-theme="dark"] .home-open-roast:active{background:#181d19}
html[data-theme="dark"] .home-favorite{color:#dfad89}
html[data-theme="dark"] .home-recent-info{color:#c6d0c6}
html[data-theme="dark"] .home-note-preview{color:#b4c1b5}
html[data-theme="dark"] .home-add-note{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .home-add-note:active{background:#252b25}
html[data-theme="dark"] .settings-chip{background:#181d19}
html[data-theme="dark"] .settings-chip span{color:#c6d0c6}
html[data-theme="dark"] .phase-event-desc{color:#c6d0c6}
html[data-theme="dark"] .phase-card .phase.marked .phase-event-desc{color:#b4c1b5}
html[data-theme="dark"] .phase-progress-grid .phase-stat{background:#181d19;border:1px solid #343c35}
html[data-theme="dark"] .phase-progress-grid .phase-stat.active{background:#181d19;border-color:#48544a;box-shadow:inset 0 0 0 1px #090c09}
html[data-theme="dark"] .phase-progress-grid .phase-stat small{color:#b4c1b5}
html[data-theme="dark"] .phase-progress-grid .phase-stat.active small{color:#b4c1b5}
html[data-theme="dark"] .phase-progress-grid .phase-stat.active small::after{color:#b4c1b5}
html[data-theme="dark"] .phase-progress-grid .phase-stat span{color:#b4c1b5}
html[data-theme="dark"] .phase-card .phase.recorded, html[data-theme="dark"] .phase-card .phase.recorded:disabled{border-color:#48544a;background:#252b25;color:#b4c1b5;box-shadow:0 3px 0 #090c09, 0 5px 9px rgba(23,75,48,.18)}
html[data-theme="dark"] .phase-card .phase.recorded .phase-event-desc{color:#b4c1b5}
html[data-theme="dark"] .phase-card .phase.recorded .phase-tap-icon{background:#496350}
html[data-theme="dark"] .phase-card .phase.past, html[data-theme="dark"] .phase-card .phase.past:disabled{background:#181d19;border-color:#343c35;color:#c6d0c6}
html[data-theme="dark"] .phase-card .phase.past .phase-event-desc{color:#a8b3a9}
html[data-theme="dark"] .phase-card .phase.past .phase-tap-icon{background:#34423b}
html[data-theme="dark"] .roast-details-trigger{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .roast-details-trigger svg{color:#c6d0c6}
html[data-theme="dark"] .roast-details-trigger:active{background:#181d19}
html[data-theme="dark"] dialog.roast-details-sheet::backdrop{background:rgba(12,21,16,0.33)}
html[data-theme="dark"] .roast-details-close{background:#181d19;color:#c6d0c6}
html[data-theme="dark"] .roast-details-field{color:#b4c1b5}
html[data-theme="dark"] .roast-details-error{color:#c6d0c6}
html[data-theme="dark"] .coffee-prep{background:#181d19;border:1px solid #343c35}
html[data-theme="dark"] .coffee-prep-heading{background:#181d19}
html[data-theme="dark"] .coffee-prep-title small{color:#b4c1b5}
html[data-theme="dark"] .coffee-prep-chevron{color:#b4c1b5}
html[data-theme="dark"] .start-logging-hint{color:#c6d0c6}
html[data-theme="dark"] .review-details-link{color:#b4c1b5;background:#181d19}
html[data-theme="dark"] .gesture-instruction{color:#c6d0c6}
html[data-theme="dark"] .stage-tile{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .stage-action .stage-reading{color:#c6d0c6}
html[data-theme="dark"] .stage-tile.recorded{border-color:#48544a;background:#181d19}
html[data-theme="dark"] .stage-tile.recorded .stage-name{color:#b4c1b5}
html[data-theme="dark"] .stage-tile.recorded .stage-reading{color:#b4c1b5}
html[data-theme="dark"] .stage-tile.past{background:#181d19}
html[data-theme="dark"] .stage-tile.past .stage-name, html[data-theme="dark"] .stage-tile.past .stage-reading{color:#a8b3a9}
html[data-theme="dark"] .stage-pencil{color:#b4c1b5}
html[data-theme="dark"] .stage-pencil:focus-visible, html[data-theme="dark"] .stage-action:focus-visible{outline:2px solid #3c483e}
html[data-theme="dark"] .compact-phase-stats{border-top:1px solid #343c35}
html[data-theme="dark"] .compact-phase-stats .phase-stat.active{background:#181d19}
html[data-theme="dark"] .compact-phase-stats .phase-stat small{color:#c6d0c6}
html[data-theme="dark"] .compact-phase-stats .phase-stat span{color:#c6d0c6}
html[data-theme="dark"] .event-editor-close{background:#181d19}
html[data-theme="dark"] .event-editor label{color:#b4c1b5}
html[data-theme="dark"] .event-editor input, html[data-theme="dark"] .event-editor select{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .event-editor-error{color:#c6d0c6}
html[data-theme="dark"] .event-delete{border:1px solid #343c35;background:#181d19;color:#c6d0c6}
html[data-theme="dark"] #toast .toast-expiry{color:#eef1eb}
html[data-theme="dark"] #toast .toast-progress{background:#252b25}
html[data-theme="dark"] .roast-unified-workspace .stage-pencil{border-left:1px solid #343c35}
html[data-theme="dark"] .roast-unified-workspace .stage-pencil:active{background:#181d19}
html[data-theme="dark"] .roast-unified-workspace .adjustment-panel{background:#181d19;border:1px solid #343c35}
html[data-theme="dark"] .roast-unified-workspace .adjustment-explanation{color:#b4c1b5}
html[data-theme="dark"] .roast-unified-workspace .add-adjustment-prominent{background:#496350;color:#eef1eb}
html[data-theme="dark"] .roast-unified-workspace .add-adjustment-prominent:active{background:#496350}
html[data-theme="dark"] .roast-unified-workspace .adjustment-record{background:#181d19}
html[data-theme="dark"] .roast-unified-workspace .empty-adjustment{background:#181d19}
html[data-theme="dark"] .roast-unified-workspace .stage-tile.recorded .stage-pencil{border-left:1px solid #343c35}
html[data-theme="dark"] .roast-unified-workspace .stage-check{color:#b4c1b5}
html[data-theme="dark"] .roast-unified-workspace .compact-controls-panel{border-top:1px solid #343c35}
html[data-theme="dark"] .roast-unified-workspace .live-only-tools{border-top:1px solid #343c35}
html[data-theme="dark"] .adjustment-time-preview{color:#b4c1b5}
html[data-theme="dark"] .adjustment-time-hint{color:#b4c1b5}
html[data-theme="dark"] .adjustment-wheel-label{color:#b4c1b5}
html[data-theme="dark"] .adjustment-wheel-window{background:#181d19;border:1px solid #48544a}
html[data-theme="dark"] .adjustment-wheel-window:after{border-top:1px solid #48544a;border-bottom:1px solid #48544a;background:rgba(12,21,16,0.33)}
html[data-theme="dark"] .adjustment-wheel-option{color:#b4c1b5}
html[data-theme="dark"] .adjustment-wheel-option.selected{color:#b4c1b5}
html[data-theme="dark"] .adjustment-wheel-colon{color:#b4c1b5}
html[data-theme="dark"] .roast-suggestion-field > label{color:#b4c1b5}
html[data-theme="dark"] .roast-suggestion-list{border:1px solid #48544a;background:#181d19}
html[data-theme="dark"] .roast-suggestion-caption, html[data-theme="dark"] .roast-suggestion-help{color:#b4c1b5}
html[data-theme="dark"] .roast-suggestion-option:active, html[data-theme="dark"] .roast-suggestion-option:focus-visible{background:#181d19}
html[data-theme="dark"] .reference-toolbar-label{color:#b4c1b5}
html[data-theme="dark"] .compare-open{border:1px solid #48544a;background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .compare-open:active{background:#181d19}
html[data-theme="dark"] .reference-controls{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .reference-key{color:#b4c1b5}
html[data-theme="dark"] .reference-key i{border-top:3px solid #635145}
html[data-theme="dark"] .reference-key button{color:#b4c1b5}
html[data-theme="dark"] .compare-mode{background:#181d19}
html[data-theme="dark"] .compare-mode button{color:#b4c1b5}
html[data-theme="dark"] .compare-mode button.selected{background:#181d19;color:#b4c1b5;box-shadow:0 1px 3px rgba(10,18,13,0.133)}
html[data-theme="dark"] .reference-align-note{color:#b4c1b5}
html[data-theme="dark"] .reference-details{color:#b4c1b5}
html[data-theme="dark"] .reference-details > div{border-top:1px solid #343c35}
html[data-theme="dark"] .reference-details p{color:#c6d0c6}
html[data-theme="dark"] .reference-event{border-bottom:1px solid #343c35}
html[data-theme="dark"] .reference-event span small{color:#b4c1b5}
html[data-theme="dark"] .reference-next span{color:#c6d0c6}
html[data-theme="dark"] dialog.compare-sheet{box-shadow:0 -16px 42px rgba(10,18,13,0.220)}
html[data-theme="dark"] dialog.compare-sheet::backdrop{background:rgba(12,21,16,0.33)}
html[data-theme="dark"] #compare-close{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .compare-tabs{background:#181d19}
html[data-theme="dark"] .compare-tabs button{color:#b4c1b5}
html[data-theme="dark"] .compare-tabs button.selected{background:#181d19;color:#b4c1b5;box-shadow:0 1px 3px rgba(10,18,13,0.141)}
html[data-theme="dark"] .compare-top-controls label{color:#b4c1b5}
html[data-theme="dark"] .compare-empty{color:#c6d0c6}
html[data-theme="dark"] .compare-bean{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .compare-bean-heading{background:#181d19}
html[data-theme="dark"] .compare-bean-heading strong{color:#b4c1b5}
html[data-theme="dark"] .compare-bean-heading small{color:#c6d0c6}
html[data-theme="dark"] .compare-bean-heading>span:last-child{color:#b4c1b5}
html[data-theme="dark"] .compare-roast{border:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .compare-roast.is-selected{border-color:#48544a}
html[data-theme="dark"] .compare-roast-meta{color:#b4c1b5}
html[data-theme="dark"] .compare-roast-note{color:#b4c1b5}
html[data-theme="dark"] .compare-fav, html[data-theme="dark"] .compare-chevron{color:#b4c1b5}
html[data-theme="dark"] .compare-fav.is-favorite{color:#dfad89}
html[data-theme="dark"] .compare-preview{border-top:1px solid #343c35;background:#181d19}
html[data-theme="dark"] .compare-preview-graph svg .preview-phase-label{stroke:#eef1eb}
html[data-theme="dark"] .compare-preview-graph svg .preview-marker{fill:#b4c1b5}
html[data-theme="dark"] .compare-phase-unavailable{color:#c6d0c6}
html[data-theme="dark"] .compare-preview-stats{border-top:1px solid #343c35;color:#b4c1b5}
html[data-theme="dark"] .compare-preview-stats strong{color:#b4c1b5}
html[data-theme="dark"] .compare-roast.is-expanded{border-color:#48544a;background:#181d19;box-shadow:0 0 0 1px rgba(10,18,13,0.251)}
html[data-theme="dark"] .compare-roast.is-expanded .compare-roast-heading{background:#181d19}
html[data-theme="dark"] .compare-roast.is-expanded .compare-roast-toggle{color:#b4c1b5}
html[data-theme="dark"] .compare-roast.is-selected{border-color:#48544a;background:#181d19;box-shadow:inset 3px 0 #090c09,0 0 0 1px rgba(10,18,13,0.200)}
html[data-theme="dark"] .compare-roast.is-selected .compare-roast-heading{background:#181d19}
html[data-theme="dark"] .compare-roast.is-selected .compare-roast-date{color:#b4c1b5}
html[data-theme="dark"] .compare-roast.is-expanded.is-selected .compare-roast-heading{background:#181d19}
html[data-theme="dark"] .compare-bean-chevron{color:#b4c1b5}
html[data-theme="dark"] .compare-chevron{color:#b4c1b5}
html[data-theme="dark"] .reference-prestart-prompt{border:1px solid #48544a;background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .reference-prestart-prompt.has-reference{background:#181d19;border-color:#48544a}
html[data-theme="dark"] .reference-prompt-kicker{color:#b4c1b5}
html[data-theme="dark"] .reference-prompt-copy small{color:#b4c1b5}
html[data-theme="dark"] .reference-prompt-action{border:1px solid #48544a;background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .reference-prompt-action:active{background:#181d19}
html[data-theme="dark"] .reference-prompt-action:focus-visible{outline:2px solid #3c483e}
html[data-theme="dark"] .review-autosave-note{background:#181d19;color:#b4c1b5}
html[data-theme="dark"] .review-autosave-note span{color:#b4c1b5}

/* v38: Shared design tokens and final contrast corrections for dark appearance. */
html[data-theme="dark"] {
  --ink:#e7ebe5; --muted:#acb9ad; --paper:#101511;
  --line:#373f38; --accent:#d9a07b; --olive:#252f27;
  --chart-grid:#414c42; --chart-live:#dfa47f;
  --chart-reference:#9dbba4; --chart-marker:#9eafa0;
  --chart-surface:#1b211c;
  color-scheme:dark;
}
html[data-theme="dark"] body{background:#0c100d;color:var(--ink)}
html[data-theme="dark"] .app{background:var(--paper);border-color:#314039;box-shadow:0 20px 70px #0006}
html[data-theme="dark"] header{background:#101511;color:var(--ink)}
html[data-theme="dark"] #screen{color:var(--ink)}
html[data-theme="dark"] .primary{background:#6e9676;color:#101c14}
html[data-theme="dark"] .primary:disabled{opacity:.48}
html[data-theme="dark"] input,html[data-theme="dark"] textarea,html[data-theme="dark"] select{
 background:#171e19;color:#e7ebe5;border-color:#44584b; color-scheme:dark;
}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#829d8a}
html[data-theme="dark"] .graph,html[data-theme="dark"] .ready-roast-graph{background:#1b221d}
html[data-theme="dark"] .graph svg text,html[data-theme="dark"] .compare-preview-graph svg text{fill:#aabbad}
html[data-theme="dark"] .compare-preview-graph svg .preview-marker{fill:#bfd8be}
html[data-theme="dark"] .compare-preview-graph svg .preview-phase-label{stroke:#202c23;stroke-width:2.4px;stroke-opacity:.92}
html[data-theme="dark"] .reference-curve{opacity:1}
html[data-theme="dark"] dialog{background:#191f1a;color:#e6f0e6}
html[data-theme="dark"] dialog::backdrop{background:rgba(0,0,0,.7)}
html[data-theme="dark"] .compare-roast.is-selected .compare-roast-heading{background:#354a3a}
html[data-theme="dark"] .compare-roast.is-expanded .compare-roast-heading{background:#2b3a2d}
html[data-theme="dark"] .compare-roast.is-expanded.is-selected .compare-roast-heading{background:#3c5241}
html[data-theme="dark"] .compare-roast.is-selected{border-color:#7b9e84;background:#252f27;box-shadow:inset 3px 0 #8eab94}
html[data-theme="dark"] .compare-roast.is-selected .compare-roast-date,html[data-theme="dark"] .compare-roast.is-expanded .compare-roast-toggle{color:#e4f3e4}
html[data-theme="dark"] .compare-roast-note{color:#b0bbb1}
html[data-theme="dark"] .compare-preview{background:#1a211b}
html[data-theme="dark"] .compare-preview-stats strong{color:#e8f1e9}
html[data-theme="dark"] .preference-options button.selected{background:#425d49;color:#f0faf0}
html[data-theme="dark"] .reference-prompt-action{background:#34493a;color:#eaf3e7}
html[data-theme="dark"] .adjustment-wheel-option.selected{color:#e4f1e3}
html[data-theme="dark"] .roast-suggestion-option{background:#262e27;color:#e2f0e4}
html[data-theme="dark"] .roast-suggestion-option:active{background:#354638}
html[data-theme="dark"] #toast{background:#080e0a;color:#f4f7f2}
html[data-theme="dark"] .compare-sheet .compare-tabs button.selected{background:#3b4f3e;color:#ebefe9}
html[data-theme="dark"] .compare-bean-heading strong{color:#e3eee5}
html[data-theme="dark"] .compare-roast-date{color:#ecf4ea}
html[data-theme="dark"] .app-drawer{background:#202d25;color:#e3eee5}
html[data-theme="dark"] .drawer-link.selected{background:#344c3a;color:#f1f5ed}
html[data-theme="dark"] .preference-row{border-color:#394a3f}
@media(max-width:650px){html[data-theme="dark"] body{background:#101511}}

html[data-theme="dark"] .preview-phase-drying{fill:#e9dc94!important}
html[data-theme="dark"] .preview-phase-maillard{fill:#e5b28c!important}
html[data-theme="dark"] .preview-phase-development{fill:#dfa491!important}
/* Keep the comparison legend faithful to the two curve colors in dark mode. */
html[data-theme="dark"] .reference-key i.key-current{border-top-color:var(--chart-live)}
html[data-theme="dark"] .reference-key i.key-previous{border-top-color:var(--chart-reference);border-top-style:dashed}

/* v39: grounded charcoal dark mode; header and workspace share one surface. */
html[data-theme="dark"] {
  --paper:#101511; --ink:#e7ebe5; --muted:#aeb9af;
  --line:#353d36; --olive:#252e27; --accent:#d69b78;
  --chart-surface:#1b211c; --chart-grid:#414b42;
  --chart-live:#dfa47f; --chart-reference:#9dbba4;
}
html[data-theme="dark"] body {background:#0c100d}
html[data-theme="dark"] .app,
html[data-theme="dark"] .app > header {background:#101511;color:var(--ink)}
html[data-theme="dark"] .app > header {border-bottom:1px solid #222a23}
html[data-theme="dark"] dialog.compare-sheet {background:#171d18}
html[data-theme="dark"] .graph,html[data-theme="dark"] .ready-roast-graph {background:#1b221c}
html[data-theme="dark"] .app-drawer {background:#171c18}
html[data-theme="dark"] .drawer-link.selected {background:#303c32;color:#edf1eb}
html[data-theme="dark"] .coffee-prep-heading {background:#222b24}
html[data-theme="dark"] .coffee-prep {background:#191f1a}
html[data-theme="dark"] input,html[data-theme="dark"] textarea,html[data-theme="dark"] select{background:#171e19;color:#e7ebe5;border-color:#444e45}
@media(max-width:650px){html[data-theme="dark"] body{background:#101511}}

/* v39: icon alignment and a drawer that recedes left instead of disappearing. */
.drawer-layer {overflow:hidden;pointer-events:none}
.drawer-layer.is-visible {pointer-events:auto}
.drawer-scrim {opacity:0;transition:opacity .25s ease}
.drawer-layer.is-visible .drawer-scrim {opacity:1}
.app-drawer {transform:translate3d(-105%,0,0);transition:transform .3s cubic-bezier(.22,1,.36,1);will-change:transform}
.drawer-layer.is-visible .app-drawer {transform:translate3d(0,0,0)}
.drawer-link {gap:11px;align-items:center}
.drawer-link .drawer-icon {width:21px;height:21px;flex:0 0 21px;display:block;stroke:currentColor;stroke-width:1.8;fill:none;stroke-linecap:round;stroke-linejoin:round}
.drawer-link span {line-height:1.4}

/* v39: accidental double-tap zoom prevention without disabling pinch zoom. */
.coffee-prep-heading,.coffee-prep-chevron,.coffee-prep-title {
  touch-action:manipulation;-webkit-tap-highlight-color:transparent;
  -webkit-user-select:none;user-select:none;
}

/* v39: compare sheet opens gently and follows the finger downward. */
dialog.compare-sheet {transform:translate3d(-50%,var(--compare-drag-y,0px),0);opacity:1;
  transition:transform .32s cubic-bezier(.22,1,.36,1),opacity .26s ease;will-change:transform}
dialog.compare-sheet.is-opening,dialog.compare-sheet.is-dismissing {transform:translate3d(-50%,100%,0);opacity:.82}
dialog.compare-sheet.is-dragging {transition:none}
.compare-list {transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s ease;will-change:transform}
.compare-list.is-swiping {transition:none}

/* v39: real height expansion, so entries below an adjustment form move smoothly. */
.adjustment-form.is-revealing {overflow:hidden;max-height:0;opacity:0;transition:max-height .33s cubic-bezier(.22,1,.36,1),opacity .23s ease,margin .33s ease;}
@media(prefers-reduced-motion:reduce){
  .app-drawer,.drawer-scrim,dialog.compare-sheet,.compare-list,.adjustment-form.is-revealing {transition:none!important;animation:none!important}
}


/* v40 — Same Roastline header divider in both appearances. */
html[data-theme="light"] .app > header {border-bottom:1px solid var(--line)}

/* v40 — Swipe back from a Library bean or saved roast detail. */
#screen.is-edge-swiping {will-change:transform;transition:none!important;box-shadow:-12px 0 28px rgba(0,0,0,.09)}
#screen.is-edge-settling {will-change:transform;transition:transform .24s cubic-bezier(.22,1,.36,1)!important}
@media (prefers-reduced-motion:reduce) {
  #screen.is-edge-swiping,#screen.is-edge-settling {transition:none!important}
}


/* v41: plain-language backup, restore, and gentle in-app reminders. */
.backup-panel{border-top:1px solid var(--line);padding-top:2px;scroll-margin-top:24px}
.backup-description{font-size:12px;line-height:1.6;color:var(--muted);margin:0 0 10px}
.backup-status{font-size:11px;line-height:1.5;color:var(--muted);margin:0 0 14px}
.backup-action-panel{padding:15px 13px;margin:12px 0;border:1px solid var(--line);border-radius:13px;background:var(--olive)}
.backup-action-panel>strong{display:block;font-size:13px;margin-bottom:5px}
.backup-action-panel>p{color:var(--muted);font-size:11px;line-height:1.55;margin:6px 0 12px}
.backup-action-panel .full{min-height:43px}
.backup-tip{font-size:10px!important;line-height:1.55;color:var(--muted);margin:10px 0 4px!important}
.backup-confirm,.backup-import-preview{border-top:1px solid var(--line);margin-top:14px;padding-top:14px}
.backup-confirm strong,.backup-import-preview strong{font-size:12px}
.backup-confirm p,.backup-import-preview p{font-size:11px;line-height:1.55;color:var(--muted)}
.backup-button-row{display:flex;gap:8px;flex-wrap:wrap}
.backup-button-row button{flex:1;min-width:100px;padding:12px 8px}
.backup-import-preview>button{margin-top:9px}
.backup-danger{color:#934b36}
.backup-message{font-size:11px;line-height:1.6;margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:9px;background:var(--olive)}
.backup-message.is-error{color:#a54131;border-color:#bf8c79}
.backup-reminder{border:1px solid #c2d2bb;background:#edf2e9;border-radius:12px;padding:13px;margin:14px 0;display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.backup-reminder-copy{display:flex;flex:1 1 165px;flex-direction:column;gap:5px}
.backup-reminder-copy strong{font-size:12px}
.backup-reminder-copy span{font-size:11px;line-height:1.5;color:#586c58}
.backup-reminder-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.backup-reminder-actions .text-btn{text-decoration:none;white-space:nowrap}
.backup-reminder-actions .secondary{white-space:nowrap}
html[data-theme="dark"] .backup-action-panel{background:#1a211c;border-color:#39443a}
html[data-theme="dark"] .backup-reminder{background:#1d2a20;border-color:#435348}
html[data-theme="dark"] .backup-reminder-copy span{color:#b1c2b4}
html[data-theme="dark"] .backup-import-preview,html[data-theme="dark"] .backup-confirm{border-color:#39443a}
html[data-theme="dark"] .backup-message{background:#202b22;border-color:#48544a;color:#dce7db}
html[data-theme="dark"] .backup-message.is-error{color:#efb6a6;border-color:#936b60}
html[data-theme="dark"] .backup-danger{color:#e5aea0}
[hidden]{display:none!important}
@media(max-width:360px){.backup-reminder-actions{width:100%}.backup-button-row{flex-direction:column}}

.restore-quick-link{margin:18px 0;padding:12px;border-radius:11px;border:1px solid var(--line);display:flex;align-items:center;flex-wrap:wrap;gap:10px;background:var(--olive)}
.restore-quick-link span{font-size:11px;line-height:1.5;flex:1 1 140px;color:var(--muted)}
.restore-quick-link button{min-height:42px}
html[data-theme="dark"] .restore-quick-link{background:#1a241d;border-color:#39443a}

.backup-action-panel #backup-import{background:var(--paper);border:1px solid var(--line);font-weight:600;color:var(--ink)}
html[data-theme="dark"] .backup-action-panel #backup-import{background:#283229;color:#e7ebe5;border-color:#4b5c4e}

/* Scroll-return navigation: only appears after the regular header is out of view
   and the user scrolls upward. It is positioned over the document, not in it. */
body .floating-header{
  position:fixed;
  top:0;
  z-index:90; /* below the navigation drawer; above page content */
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  min-height:70px;
  padding:18px 22px;
  background:var(--paper);
  color:var(--ink);
  border-bottom:1px solid var(--line);
  box-shadow:0 5px 18px rgba(23,39,28,.13);
  visibility:hidden;
  pointer-events:none;
  transform:translate3d(0,-110%,0);
  transition:transform .24s cubic-bezier(.2,.7,.25,1),visibility 0s linear .24s;
  will-change:transform;
}
body .floating-header.is-visible{
  visibility:visible;
  pointer-events:auto;
  transform:translate3d(0,0,0);
  transition:transform .24s cubic-bezier(.2,.7,.25,1),visibility 0s;
}
body .floating-header .header-brand .brand{
  font-size:27px;
  line-height:1.1;
  letter-spacing:-1.5px;
}
body .floating-header .menu-trigger{
  display:grid;
  place-items:center;
  width:44px;
  height:44px;
  flex:0 0 44px;
  padding:0;
  font-size:24px;
  line-height:1;
}
@media(max-width:650px){
  body .floating-header{
    padding-top:calc(18px + env(safe-area-inset-top,0px));
  }
}
@media(prefers-reduced-motion:reduce){
  body .floating-header,body .floating-header.is-visible{
    transition:none;
    will-change:auto;
  }
}

/* v44 — Quiet saved-roast results: category headings remain the dividers.
   Remove the repetitive rule under every batch/phase/adjustment row. */
.saved-detail{border-bottom:0;padding:9px 0;min-width:0}
.saved-detail strong{min-width:0;overflow-wrap:anywhere}

/* The native iOS date picker has an intrinsic width. Contain it within the
   dated-note form even on narrow phones and with larger system text. */
.tasting-note-form{box-sizing:border-box;min-width:0;max-width:100%;overflow:hidden}
.tasting-note-form label{display:block;min-width:0;max-width:100%}
.tasting-note-form input[type="date"]{
  display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;
  overflow:hidden;font-size:16px;
}
.tasting-note-form textarea{box-sizing:border-box;min-width:0;max-width:100%;width:100%}

/* Back to Home/Library should look like a genuine navigation button,
   not another small underlined text action. */
#back-to-collection,#back-library{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:46px;max-width:100%;padding:11px 15px;margin:0 0 15px;
  border:1px solid #c7d4c5;border-radius:11px;
  background:#e7eee1;color:#2c4a36;font-size:13px;font-weight:700;
  line-height:1.3;text-decoration:none;touch-action:manipulation;
}
#back-to-collection:active,#back-library:active{background:#d3e1cf;transform:translateY(1px)}
html[data-theme="dark"] #back-to-collection,
html[data-theme="dark"] #back-library{
  background:#29372d;border-color:#4e6855;color:#e1e9e1;
}
html[data-theme="dark"] #back-to-collection:active,
html[data-theme="dark"] #back-library:active{background:#3a4d3d}

/* Recent roasts have two distinct, equally discoverable touch targets:
   an open-roast surface with a trailing chevron and a separated note action. */
.home-recent-item{gap:0;padding:4px;align-items:stretch;min-width:0}
.home-open-roast{
  position:relative;flex:1 1 0;min-width:0;min-height:61px;
  padding:11px 29px 11px 11px;
  background:#fbfbf6;border:1px solid #dce4d6;border-radius:8px;
  touch-action:manipulation;
}
.home-open-roast::after{
  content:'›';position:absolute;right:10px;top:50%;transform:translateY(-50%);
  font-size:23px;line-height:1;color:#637b64;font-weight:400;
}
.home-open-roast:active{background:#e6ecd9}
.home-add-note{
  flex:0 0 auto;align-self:stretch;min-width:76px;min-height:48px;
  margin-left:5px;padding:9px 10px;border:1px solid #b5cbb5;
  border-radius:8px;background:#e1ecdf;color:#34583e;
  font-size:12px;font-weight:750;touch-action:manipulation;
}
.home-add-note:active{background:#ccddcc}
html[data-theme="dark"] .home-open-roast{
  background:#242e26;border-color:#3f4e42;
}
html[data-theme="dark"] .home-open-roast::after{color:#b5cbb7}
html[data-theme="dark"] .home-open-roast:active{background:#324035}
html[data-theme="dark"] .home-add-note{
  background:#304638;border-color:#526d57;color:#e2eee3;
}
html[data-theme="dark"] .home-add-note:active{background:#42604b}
@media(max-width:350px){.home-add-note{min-width:68px;padding:8px 7px}}

/* Following the finger makes the opening gesture match the already animated
   menu button. Release uses the existing drawer transition to settle. */
.drawer-layer.is-edge-dragging{pointer-events:none}
.drawer-layer.is-edge-dragging .app-drawer{
  transform:translate3d(calc(-100% + var(--drawer-drag,0px)),0,0);
  transition:none!important;
}
.drawer-layer.is-edge-dragging .drawer-scrim{
  opacity:var(--drawer-progress,0);transition:none!important;
}
@media(prefers-reduced-motion:reduce){
  .drawer-layer.is-edge-dragging .app-drawer,
  .drawer-layer.is-edge-dragging .drawer-scrim{will-change:auto}
}


/* v45 — Saved-roast date alignment, preheat edit, and deletion safety. */
/* Date controls are replaced elements on iOS; clamp the entire field, not
   only its overflow. Match the surrounding inputs and their insets. */
.roast-details-field input[type="date"] {
  height:46px;
  min-height:46px;
  padding:0 10px;
  line-height:normal;
  vertical-align:middle;
  -webkit-appearance:none;
  appearance:none;
}
.roast-details-field input[type="date"]::-webkit-date-and-time-value {
  display:flex;
  align-items:center;
  height:100%;
  min-height:0;
  text-align:left;
  padding:0;
  margin:0;
}
.roast-details-field input[type="date"]::-webkit-datetime-edit { padding:0; }

/* The date in Add Dated Note uses the same left and right inset as the
   neighboring textarea, without changing the size of the form card. */
.tasting-note-form {
  width:100%;
  margin-inline:0;
  padding:14px;
}
.tasting-note-form label,
.tasting-note-form input[type="date"],
.tasting-note-form textarea { min-width:0; width:100%; max-width:100%; }
.tasting-note-form input[type="date"] {
  height:46px;
  min-height:46px;
  padding:0 12px;
  margin-inline:0;
  line-height:normal;
  -webkit-appearance:none;
  appearance:none;
}
.tasting-note-form input[type="date"]::-webkit-date-and-time-value {
  display:flex;
  align-items:center;
  height:100%;
  min-height:0;
  padding:0;
  margin:0;
  text-align:left;
}
.tasting-note-form input[type="date"]::-webkit-datetime-edit { padding:0; }

/* The native date picker used its intrinsic width in the two-column edit
   form, making this cell appear larger than the rest. */
#saved-edit-form > .grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
#saved-edit-form > .grid > *,
#saved-edit-form > .grid label { min-width:0; max-width:100%; }
#saved-edit-form > .grid input { display:block; width:100%; min-width:0; max-width:100%; height:46px; }
#saved-edit-form > .grid input[type="date"] {
  padding:0 12px;
  line-height:normal;
  -webkit-appearance:none;
  appearance:none;
}
#saved-edit-form > .grid input[type="date"]::-webkit-date-and-time-value {
  display:flex;
  align-items:center;
  height:100%;
  min-height:0;
  padding:0;
  margin:0;
  text-align:left;
}
#saved-edit-form > .grid input[type="date"]::-webkit-datetime-edit { padding:0; }

/* Preheat is a single temperature input: its time remains an implicit 0:00
   in the saved data and on the graph. */
.saved-edit-row.is-preheat > label { flex:0 1 180px; }

/* Deliberately separate destructive deletion from the dated-note controls. */
.saved-delete-area {
  margin:40px 0 12px;
  padding-top:22px;
  border-top:1px solid var(--line);
}
.saved-delete-button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-height:46px;
  margin:0;
  padding:12px 16px;
  border:1px solid #d7aa9c;
  border-radius:10px;
  background:#fff1ed;
  color:#8e382b;
  font-size:12px;
  font-weight:700;
  line-height:1.25;
  text-decoration:none;
  touch-action:manipulation;
}
.saved-delete-button svg { display:block; flex:0 0 17px; width:17px; height:17px; }
.saved-delete-button:active { background:#f5dacf; }
html[data-theme="dark"] .saved-delete-button {
  background:#3b2726;
  border-color:#80564e;
  color:#f2b9ab;
}
html[data-theme="dark"] .saved-delete-button:active { background:#53312d; }
@media(max-width:650px){
  #saved-edit-form > .grid input[type="date"] { font-size:16px; }
}


/* Make deletion its own deliberately separated area, well below dated notes. */
.saved-delete-area {
  margin:76px 0 24px;
  padding:28px 0 4px;
}
.saved-delete-description {
  margin:0 0 14px;
  color:var(--muted,#68756a);
  font-size:12px;
  line-height:1.5;
}
html[data-theme="dark"] .saved-delete-description { color:#b4bfb3; }

/* v47 — Total duration is read-only context for the editable time entries below. */
.saved-readings-duration { margin:-5px 0 12px; font-size:12px; line-height:1.5; color:#566c5b; }
.saved-readings-duration strong { font-variant-numeric:tabular-nums; font-weight:750; color:var(--ink); }
html[data-theme="dark"] .saved-readings-duration { color:#b4c1b5; }
html[data-theme="dark"] .saved-readings-duration strong { color:#ecf2e9; }


/* v49 — Swipe left to reveal the confirmed Delete action on the right. */
.roast-swipe-item{position:relative;overflow:hidden;border-radius:12px;margin-bottom:9px;isolation:isolate}
.roast-swipe-content{position:relative;z-index:1;min-width:0;transform:translate3d(var(--roast-swipe-offset,0px),0,0);transition:transform .22s ease;will-change:transform;touch-action:pan-y}
.roast-swipe-item.is-revealed .roast-swipe-content{transform:translate3d(-88px,0,0)}
.roast-swipe-item.is-dragging .roast-swipe-content{transition:none}
.roast-swipe-delete{position:absolute;z-index:0;right:0;top:0;bottom:0;width:88px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border:0;border-radius:0 10px 10px 0;background:#9d463e;color:#fff;font-size:12px;font-weight:700;opacity:1;touch-action:manipulation}
.roast-swipe-delete svg{width:18px;height:18px}
.roast-swipe-delete:active{background:#80382e}
.roast-swipe-item .home-recent-item,.roast-swipe-item .library-roast-row{margin-bottom:0}
.roast-swipe-item .library-roast-row{background:var(--paper);padding:0 1px 0 0}
.roast-swipe-item .home-recent-item{width:100%}
.roast-swipe-item:focus-within .roast-swipe-delete:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
html[data-theme="dark"] .roast-swipe-delete{background:#a24b42;color:#fff3ef}
html[data-theme="dark"] .roast-swipe-item .library-roast-row{background:#171d18}
@media(prefers-reduced-motion:reduce){.roast-swipe-content{transition:none}}

/* v48 — Compact saved-roast fields use a full-size wheel picker when tapped. */
.saved-time-field{display:flex;flex-direction:column;gap:5px;min-width:0;font-size:11px;color:#60705f}
.saved-time-field>span{font-size:11px;color:inherit}
.saved-time-select{width:100%;min-height:42px;display:flex;align-items:center;justify-content:space-between;gap:9px;padding:9px 10px;border:1px solid var(--line);border-radius:9px;background:#fffefa;color:var(--ink);text-align:left;font-size:14px;font-weight:650;font-variant-numeric:tabular-nums}
/* The previous font chevron sat low on iOS because its glyph is not centered
   inside its line box. Draw a centered chevron in a fixed-size square instead. */
.saved-time-select span[aria-hidden="true"]{
  width:18px;height:18px;flex:0 0 18px;
  display:grid;place-items:center;
  font-size:0;line-height:0;color:var(--muted);
}
.saved-time-select span[aria-hidden="true"]::before{
  content:"";display:block;width:8px;height:8px;
  border-right:2px solid currentColor;border-bottom:2px solid currentColor;
  transform:translateY(-2px) rotate(45deg);
}
.saved-edit-row>.saved-time-field{flex:1;min-width:82px;max-width:180px}
.saved-edit-row label input[type=number]{font-size:16px;min-height:42px}
#saved-edit-form>.grid>.saved-time-field{width:100%;min-width:0}
.saved-time-dialog{width:min(370px,calc(100vw - 28px));max-width:370px;padding:24px 20px;border-radius:16px;box-shadow:0 14px 42px #162f2428}
.saved-time-dialog h2{font-size:20px;margin:0 0 8px}
.saved-time-dialog .hint{margin:0 0 12px}
.saved-time-dialog .adjustment-time-wheels{padding:4px 0 12px}
.saved-time-actions{display:flex;gap:10px;margin-top:22px}
.saved-time-actions button{flex:1;min-height:44px}
.saved-time-dialog #saved-time-clear{display:block;margin:12px auto 0;text-decoration:underline}
.saved-time-dialog #saved-time-clear[hidden]{display:none}
html[data-theme="dark"] .saved-time-field{color:#b4c1b5}
html[data-theme="dark"] .saved-time-select{background:#181d19;border-color:#48544a;color:#e4f1e3}
@media(max-width:350px){.saved-edit-row>.saved-time-field{min-width:74px}.saved-time-select{padding:8px}}
/* While dragging an already revealed row closed, follow the finger instead of
   the resting -88px offset. */
.roast-swipe-item.is-dragging .roast-swipe-content{transform:translate3d(var(--roast-swipe-offset,0px),0,0)}
/* Keep the time picker opaque above the saved-roast editor. */
.saved-time-dialog{background:var(--paper);color:var(--ink)}
html[data-theme="dark"] .saved-time-dialog{background:#191f1a;color:#e6f0e6}

/* v51 — Classify only the two known starting-weight ranges. */
.batch-size-tag{display:inline-flex;vertical-align:middle;align-items:center;white-space:nowrap;padding:3px 7px;margin-left:5px;border:1px solid #c9d8bf;border-radius:999px;background:#edf3e6;color:#405b43;font-size:10px;font-weight:700;line-height:1.35;letter-spacing:0}
.batch-size-preview{grid-column:1/-1;color:var(--muted);font-size:11px;line-height:1.3;margin:-3px 0 3px}
.coffee-prep-title #setup-batch-size:empty{display:none}
.coffee-prep-title .batch-size-tag{margin:3px 0 0}
.home-recent-title .batch-size-tag{margin-left:7px}
.compare-roast-date .batch-size-tag{font-size:9px}
html[data-theme="dark"] .batch-size-tag{background:#283b2d;color:#c8e1cb;border-color:#56725b}

/* v51 — Comparison settings are a read-only reference, not logged actions. */
.reference-adjustment-mirror{margin:13px 0 4px;padding:11px 12px;border:1px dashed #9ebba0;border-radius:11px;background:#edf3e9}
.reference-adjustment-heading{display:flex;flex-direction:column;gap:3px;margin-bottom:6px}
.reference-adjustment-heading strong{font-size:12px;color:#355c3f}
.reference-adjustment-heading small{font-size:11px;color:#627766}
.reference-adjustment-mirror p{font-size:11px;color:#627766;line-height:1.45;margin:3px 0 9px}
.reference-adjustment-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:6px 0;font-size:12px;color:#415b45}
.reference-adjustment-row+.reference-adjustment-row{border-top:1px solid #dce6d7}
.reference-adjustment-row span:last-child{text-align:right;white-space:nowrap}
.reference-adjustment-row small{display:block;color:#6b7f6e;font-size:10px;white-space:normal}
.compare-preview-adjustments{display:flex;flex-direction:column;gap:5px;margin:10px 0;padding:10px;border-radius:9px;background:#eaf0e7;font-size:11px;color:#405a43}
.compare-preview-adjustments>strong{font-size:11px}
html[data-theme="dark"] .reference-adjustment-mirror{background:#223027;border-color:#5d8269}
html[data-theme="dark"] .reference-adjustment-heading strong,html[data-theme="dark"] .reference-adjustment-row{color:#d6e9d8}
html[data-theme="dark"] .reference-adjustment-heading small,html[data-theme="dark"] .reference-adjustment-mirror p,html[data-theme="dark"] .reference-adjustment-row small{color:#b4caba}
html[data-theme="dark"] .reference-adjustment-row+.reference-adjustment-row{border-color:#405747}
html[data-theme="dark"] .compare-preview-adjustments{background:#2b3d30;color:#d7e7d8}

/* v51 — Direct graph editing for recorded readings. */
.saved-graph-instruction{font-size:12px;color:var(--muted);line-height:1.5;margin:-3px 0 9px}
#saved-readings-graph{height:auto;min-height:0;max-height:none;aspect-ratio:340/210;padding:8px 4px;margin:0 0 12px;overflow:hidden}
#saved-readings-graph svg{width:100%;height:100%;display:block;touch-action:manipulation}
.saved-graph-point{outline:none;touch-action:manipulation}
.saved-graph-point.is-selected circle:not(.saved-graph-touch){stroke:var(--accent,#405e45);stroke-width:4;paint-order:stroke}
.saved-graph-point:focus-visible circle:not(.saved-graph-touch){stroke:#255b3a;stroke-width:5}
.saved-graph-point .saved-graph-touch{pointer-events:all}
.saved-graph-editors{margin-bottom:15px}
.saved-graph-reading-editor{padding:13px;background:#f1f4ec;border:1px solid #cad9c5;border-radius:11px}
.saved-graph-reading-editor[hidden]{display:none}
.saved-graph-reading-editor>strong{display:block;font-size:13px;margin-bottom:11px;color:var(--ink)}
.saved-graph-reading-controls{display:flex;align-items:flex-end;gap:11px;min-width:0}
.saved-graph-reading-controls>.saved-time-field,.saved-graph-reading-controls>label{flex:1;min-width:0}
.saved-graph-reading-controls>label{font-size:11px;color:var(--muted)}
.saved-graph-reading-controls>label input{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;height:42px;margin-top:5px;font-size:16px}
html[data-theme="dark"] .saved-graph-reading-editor{background:#202b23;border-color:#4b6751}
@media(max-width:350px){.saved-graph-reading-controls{gap:6px}.saved-graph-reading-editor{padding:10px}}

/* v52 — Make alignment state unmistakable, especially in dark mode. */
.compare-mode button{transition:background-color .16s ease,color .16s ease,box-shadow .16s ease}
.compare-mode button[aria-pressed="true"]{background:#fffefb;color:#294c34;box-shadow:0 1px 4px #31462b28}
.compare-mode button[aria-pressed="false"]{background:transparent;color:#647665}
html[data-theme="dark"] .compare-mode{background:#111913;border:1px solid #3e5143}
html[data-theme="dark"] .compare-mode button[aria-pressed="true"]{background:#3c6246;color:#f2fff3;box-shadow:inset 0 0 0 1px #86b694,0 1px 4px #0004}
html[data-theme="dark"] .compare-mode button[aria-pressed="false"]{background:transparent;color:#a9c2b0;box-shadow:none}
.reference-key .reference-visibility{margin-left:auto;border:1px solid #a8bdac;border-radius:8px;background:#edf4e9;color:#365a41;padding:7px 10px;min-height:34px;text-decoration:none;font-size:11px;font-weight:650}
html[data-theme="dark"] .reference-key .reference-visibility{background:#273c2c;border-color:#64886b;color:#e2f4e5;text-decoration:none}
.reference-phase-legend{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:9px}
.reference-phase-legend span{border-radius:7px;padding:4px 7px;font-size:10px;font-weight:650;color:#3a4034}
.reference-phase-legend .drying{background:#f2d461}
.reference-phase-legend .maillard{background:#d9a674}
.reference-phase-legend .development{background:#ce977c}
.reference-stage-band{fill-opacity:.28}
.reference-stage-name{font-size:9px;fill:#514331;font-weight:650;pointer-events:none}
html[data-theme="dark"] .reference-stage-band{fill-opacity:.24}
html[data-theme="dark"] .reference-stage-name{fill:#ece3d3}
@media(prefers-reduced-motion:reduce){.compare-mode button{transition:none}}

.prestart-adjustments{margin-top:15px}
.prestart-adjustments-note{color:var(--muted);font-size:11px;line-height:1.5;margin:0 0 9px}


/* v55 — Distinct roast-start moment. The page remains intact behind the modal. */
.ready-start-dialog{
  width:min(100% - 32px,430px);max-width:430px;
  max-height:calc(100dvh - 40px);overflow:auto;
  border:0;border-radius:23px;
  margin:auto;padding:clamp(23px,5vh,44px) 19px 27px;
  background:#1f2821;color:#eff5ec;
  box-shadow:0 28px 80px #0008;
  text-align:center;
}
.ready-start-dialog::backdrop{background:rgba(7,12,9,.89)}
.ready-start-content{display:flex;flex-direction:column;align-items:center;gap:14px}
.ready-start-heading{margin:0 0 11px;font-size:13px;font-weight:650;letter-spacing:.015em;color:#d8e7d0}
.ready-start-circle{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:11px;
  width:clamp(185px,57vw,237px);height:clamp(185px,57vw,237px);
  border-radius:50%;border:3px solid #d8e9c6;
  background:#b9d3a6;color:#213726;
  box-shadow:0 7px 0 #67845c,0 16px 36px #0005;
  font-weight:750;font-size:clamp(19px,5vw,23px);
  line-height:1.15;cursor:pointer;touch-action:manipulation;
  transition:transform .15s ease,box-shadow .15s ease,background .15s ease;
}
.ready-start-circle:active{transform:translateY(4px);box-shadow:0 3px 0 #67845c,0 9px 22px #0005}
.ready-start-circle:focus-visible,.ready-start-back:focus-visible{outline:3px solid #fff;outline-offset:4px}
.ready-start-icon{font-size:29px;line-height:1;margin-left:5px}
.ready-start-hint{color:#c1d0be;font-size:11px;line-height:1.4;margin:5px 0 13px}
.ready-start-back{width:min(100%,280px);min-height:47px;background:transparent;color:#ecf3eb;border:1px solid #7d9680;border-radius:11px;font-size:13px;font-weight:650;cursor:pointer;padding:12px 18px}
.ready-open-button{display:flex;align-items:center;justify-content:center;gap:9px;min-height:45px;margin:13px 0 5px;background:var(--olive);border:1px solid var(--line);color:var(--ink);font-size:12px;font-weight:750}
.ready-open-button span{font-size:17px;line-height:1}
html[data-theme="dark"] .ready-open-button{background:#293b2c;border-color:#58715a;color:#e3efe1}
@media(max-height:600px){.ready-start-dialog{padding:17px 16px}.ready-start-circle{width:150px;height:150px;font-size:18px}.ready-start-content{gap:9px}.ready-start-heading{margin-bottom:3px}.ready-start-hint{margin-bottom:3px}}
@media(prefers-reduced-motion:reduce){.ready-start-circle{transition:none}}

/* v55 — Reference is a guide, not a competing current-roast curve. */
.reference-curve{opacity:.34}
.reference-reading{opacity:.36}
html[data-theme="dark"] .reference-curve{opacity:.40}
html[data-theme="dark"] .reference-reading{opacity:.42}
.reference-stage-name{dominant-baseline:middle}


/* v57 — Collapsed reference controls show only the Show curve action. */
.reference-controls{display:block;min-height:119px}
.reference-controls .compare-mode{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:100%}
.reference-controls.is-reference-hidden{display:flex;align-items:center;justify-content:flex-end;min-height:0;padding:6px 9px}
.reference-controls.is-reference-hidden .reference-visibility{display:inline-flex;align-items:center;justify-content:center;min-height:34px;padding:7px 12px;background:#edf4e9;border:1px solid #a8bdac;border-radius:8px;color:#365a41;font-size:11px;font-weight:650;text-decoration:none}
html[data-theme="dark"] .reference-controls.is-reference-hidden .reference-visibility{background:#273c2c;border-color:#64886b;color:#e2f4e5}


/* v59 — Keep batch labels visible even for long bean names. */
.coffee-prep-name-row{display:flex;align-items:center;gap:7px;max-width:100%;min-width:0;flex-wrap:wrap}
.coffee-prep-name-row strong{min-width:0;max-width:100%;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.coffee-prep-name-row #setup-batch-size{display:inline-flex;flex:0 0 auto;min-width:0}
.coffee-prep-name-row .batch-size-tag{margin:0;font-size:10px}
.home-recent-title{display:flex;align-items:center;gap:6px;min-width:0;white-space:normal;overflow:visible}
.home-recent-name{display:block;flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-recent-title .batch-size-tag{flex:0 0 auto;margin:0;font-size:9px;padding:3px 5px}
.home-roast-copy small .batch-size-tag{display:inline-flex;margin-left:6px;font-size:9px;padding:2px 5px;vertical-align:middle}
/* Let the button size to the selected roast up to a safe limit, then ellipsize. */
.reference-toolbar .reference-toolbar-label{flex:0 0 auto}
.reference-toolbar .compare-open{min-width:0;max-width:min(70%,290px);width:auto;flex:0 1 auto;overflow:hidden;text-overflow:clip}
.compare-open .compare-button-label{display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Foreground cue: visible while Roastline itself is open, without blocking logging. */
.reading-cue-banner{
  position:fixed;z-index:95;left:50%;top:calc(env(safe-area-inset-top,0px) + 10px);
  width:max-content;max-width:calc(100vw - 28px);display:flex;align-items:center;gap:10px;
  padding:12px 16px;border-radius:14px;background:#223e2a;color:#fff;
  box-shadow:0 8px 26px rgba(0,0,0,.24);border:1px solid #678267;
  font-size:13px;line-height:1.3;pointer-events:none;
  opacity:0;transform:translate(-50%,-120%);
  transition:opacity .2s ease,transform .22s ease;
}
.reading-cue-banner.is-visible{opacity:1;transform:translate(-50%,0)}
.reading-cue-banner strong{display:block;font-size:13px;font-weight:750}
.reading-cue-banner small{display:block;margin-top:3px;font-size:11px;color:#d7e6d3}
.reading-cue-bell{font-size:19px;line-height:1;color:#bedcaa}
html[data-theme="dark"] .reading-cue-banner{background:#365641;border-color:#739b78;color:#fff}
/* Allow iOS to position the ordinary reading input above its keyboard. */
.live-view #live-reading-form{margin:0;scroll-margin-bottom:14px}
.live-view #measurement{font-size:16px}
@media(prefers-reduced-motion:reduce){.reading-cue-banner{transition:none}}


/* v60 — Live reference button: preserve side padding and keep icon separate
   so a long bean name can truncate instead of crowding the controls. */
.reference-toolbar .compare-open{
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  flex:0 1 auto;
  width:max-content;
  max-width:min(72%,310px);
  min-width:0;
  gap:7px;
  padding:9px 13px;
  overflow:hidden;
}
.compare-open .compare-open-icon{flex:0 0 auto;line-height:1;white-space:nowrap}
.compare-open .compare-button-label{
  display:block;
  flex:0 1 auto;
  width:auto;
  min-width:0;
  max-width:100%;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  text-align:left;
}
/* The primary Log action stays readable even when its text changes to
   'Log extra' between scheduled readings. */
.roast-unified-workspace .reading label{min-width:0;flex:1 1 auto}
.roast-unified-workspace .reading #log{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  flex:0 0 auto;
  min-width:100px;
  padding:9px 10px;
  line-height:1.2;
  white-space:nowrap;
}