/* Semantic Rails adapters; visual tokens/components remain the original CSS. */
.mm-diary .date-nav .day-step { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: 1.2rem; color: var(--ink); }
.mm-diary .slot-header { list-style: none; }
.mm-diary .slot-header::-webkit-details-marker { display: none; }
.mm-diary .slot-header h2 { margin: 0; font-size: .95rem; font-weight: 700; }
.mm-diary .slot:not([open]) .slot-header { border-bottom: none; }
.mm-diary .slot .chevron::after { content: "▼"; }
.mm-diary .slot[open] .chevron::after { content: "▲"; }
.mm-diary .entry-name { margin: 0; font-size: inherit; }
.mm-diary .entry-actions form { margin: 0; }
.mm-diary .entry-actions a { border: none; background: transparent; cursor: pointer; font-size: .9rem; color: var(--muted); padding: .25rem .4rem; border-radius: 6px; }
.mm-diary .entry-actions a:hover { background: var(--accent-soft); color: var(--accent); }
.mm-diary .macro-total { font: inherit; }
.mm-diary .quick-entry-link { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .9rem; background: var(--panel); color: var(--accent); white-space: nowrap; font-size: .9rem; font-weight: 550; }
.mm-diary .search-box .ghost { margin-top: .25rem; }
.mm-diary-dialog { border: 0; padding: 0; color: var(--ink); background: transparent; max-width: none; max-height: none; overflow: visible; }
.mm-diary-dialog::backdrop { background: rgba(20, 30, 25, .45); }
.mm-diary-dialog h2:focus { outline: none; }

.mm-diary .date-nav { flex-wrap: wrap; }
.mm-diary .date-nav noscript { flex-basis: 100%; text-align: center; }
.mm-diary .macro-total:disabled { cursor: default; }
.mm-diary .slot-add-entry { padding: 0 .9rem .5rem; }
.mm-diary .entry-meta { overflow-wrap: anywhere; }
.mm-diary .macro-total, .mm-diary .macro-value, .mm-diary .calorie-hero { min-width: 0; max-width: 100%; }
.mm-diary .macro-value, .mm-diary .calorie-value { overflow-wrap: anywhere; }
.mm-diary .target-note { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.mm-history .section-head h1 { margin: .25rem 0 .75rem; font-size: 1.1rem; }
.mm-history .section-head noscript { flex-basis: 100%; }
.mm-history .section-head { flex-wrap: wrap; }
.mm-history .history-day { display: block; }
.mm-diary .quick-entry-link { font-family: Arial, sans-serif; line-height: normal; }
.mm-diary .search-result { text-decoration: none; color: var(--ink); }
.mm-diary .search-result > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.mm-diary .search-result .meta { max-width: 45%; white-space: normal; overflow-wrap: anywhere; text-align: right; }
/* Match the original 143px date field after min/max constrain the year editor. */
.mm-diary #day-input { width: 8.9375rem; }
.mm-diary .calorie-value.number-long { font-size: 1.3rem !important; line-height: 1.1; }
.mm-diary .entry-kcal { white-space: normal; overflow-wrap: anywhere; max-width: 35%; }
.mm-diary .auth-message { overflow-wrap: anywhere; }
.mm-diary-dialog .nb-value { white-space: normal; overflow-wrap: anywhere; max-width: 55%; }
.mm-diary-dialog .detail-sub { overflow-wrap: anywhere; }
.mm-history .card-title { margin: 0; font-size: inherit; }
.mm-history .custom-range-note { font-size: .8rem; color: var(--muted); }
/* Reuse the original inline form geometry for native/Turbo Rails forms. */
.mm-entry-form { min-width: 0; }
.mm-entry-form .entry-page-title { margin: .25rem 0 .75rem; font-size: 1.1rem; }
.mm-entry-form .entry-chooser { margin-bottom: .75rem; }
.mm-entry-form .entry-chooser > summary, .mm-entry-form .entry-advanced > summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.mm-entry-form .entry-advanced { margin: .2rem 0 .75rem; overflow-wrap: anywhere; }
.mm-entry-form .entry-advanced p, .mm-entry-form .entry-help { font-size: .8rem; color: var(--muted); }
.mm-entry-form label.grow, .mm-entry-form .row label { min-width: 0; }
.mm-entry-form label.grow input, .mm-entry-form label.grow textarea { width: 100%; }
.mm-entry-form textarea { padding: .45rem .55rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.mm-entry-form .form-cancel { display: inline-flex; align-items: center; justify-content: center; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); font: 550 .9rem Arial, sans-serif; background: var(--panel); text-decoration: none; }
.mm-entry-form .entry-error { margin-bottom: .75rem; overflow-wrap: anywhere; }
@media (max-width: 640px) { .mm-entry-form .log-action-row .form-cancel { min-height: 3.6rem; font-size: 1.05rem; } }

.mm-entry-form #quick-form .row label.grow { min-width: min(100%, 12rem); }
.mm-entry-form :focus-visible { outline: revert; outline-offset: revert; }

.mm-entry-form output.live-total { display: block; }

.mm-entry-form .row select, .mm-entry-form .row input { max-width: 100%; }
.mm-entry-form .inline-form-title, .mm-entry-form .comp-name { min-width: 0; overflow-wrap: anywhere; }
/* Restore the native control metrics that Tailwind preflight resets. */
.mm-entry-form input, .mm-entry-form select, .mm-entry-form button { font-family: Arial, sans-serif; line-height: normal; }

/* A square inside r=84/220 keeps every text-box corner clear of the ring. */
.mm-diary .calorie-ring-wrap { container-type: inline-size; }
.mm-diary .calorie-ring-wrap .ring-center { inset: 23.5%; padding: 0; }
.mm-diary .calorie-ring-wrap .ringed-value { white-space: nowrap; overflow-wrap: normal; font-size: min(3.3rem, calc(85cqi / var(--ring-value-chars))) !important; line-height: 1.05; }
.mm-diary .calorie-ring-wrap .target-note { white-space: nowrap; overflow-wrap: normal; font-size: min(.78rem, calc(105cqi / (var(--ring-note-chars) + 2))); line-height: 1.1; margin-top: .2rem; gap: .2em; }
.mm-diary .calorie-ring-wrap .over-dot { width: .55em; height: .55em; flex-shrink: 0; }
