:root {
    /* ===== Colors ===== */
    --bg: #121212;
    --surface: #1e1e1e;
    --primary: #bb86fc;
    --secondary: #8e3edc;
    --accent: #c792ff;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --input-bg: #2a2a2a;
    --input-border: #333;
    --button-gradient: linear-gradient(135deg, var(--accent), var(--secondary));
    --button-hover-gradient: linear-gradient(135deg, #b678ff, #7a2ec7);
    --shadow-light: rgba(187, 134, 252, 0.35);
    --shadow-strong: rgba(187, 134, 252, 0.55);
    --border: #2a2a2a;
    --text: #e0e0e0;
    --muted: #9e9e9e;
    --danger: #b00020;
    --radius: 8px;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 16px;
    background-color: var(--bg);
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 72px auto 0;
}

h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 24px;
    margin-top: auto;
}

h2 {
    color: var(--accent);
    text-align: center;
    margin-bottom: 10px;
    margin-top: 10px;
}

h3 {
    color: var(--text-secondary); 

    margin-bottom: 5px;
    margin-top: 10px;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background-color: #121212;
    padding: 16px 0;
}

table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-collapse: collapse;
}

table::-webkit-scrollbar {
    height: 8px;
}

/* Paragraphs */
p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Optional emphasis inside paragraphs */
p strong {
    color: var(--text-primary);
    font-weight: 600;
}

p.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Lists */
ul,
ol {
    margin: 8px 0 16px 40px;
    padding: 0;
    color: var(--text-secondary);
}

li {
    margin-bottom: 8px;
    line-height: 1.5;
    position: relative;
}

/* Custom bullet for unordered lists */
ul li::marker {
    color: var(--primary);
}

/* Nested lists */
li ul,
li ol {
    margin-top: 6px;
    margin-bottom: 6px;
}

/* List text emphasis */
li strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Overlay ===== */
#page-overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
    transition: opacity 0.25s ease;
    background: rgba(255, 255, 255, 0.65);
}

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1100; /* Below sidebar (1200) but above content */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
    transition: opacity 0.25s ease;
    background: rgba(0, 0, 0, 0.3);
}

.overlay.show,
#page-overlay.show {
    display: block; 
    opacity: 1;
    pointer-events: auto;
}


#page-overlay p {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;

    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}


/* ===== Form Styles ===== */
.form-container {
    background: var(--surface);
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right:20px;

    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 24px;

}

.form-container label {
    font-weight: 500;
    color: var(--text-primary);
}

.form-container form{
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
}

.form-container .row {
    display: flex;
    margin-top: 10px;
    margin-bottom: 10px;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
}


input {
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 16px;
    flex: 1;
    min-width: 50px;
    width: auto;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.form-container label {
    display: block;
    margin-top: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-container input[type="text"],
.form-container input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

.form-container input[type="checkbox"] {
    margin-top: 4px;
}

/* Autofill / browser styles */
.form-container input:-webkit-autofill,
.form-container input:-webkit-autofill:hover,
.form-container input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
    box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

 /* ===== Buttons ===== */
button {
    display: inline-flex; 
    width: 100%;
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    margin: 10px 0;
    background: var(--button-gradient);
    color: var(--text-primary);
    box-shadow: 0 0 8px var(--shadow-light);
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

button:hover {
    background: var(--button-hover-gradient);
    box-shadow: 0 0 12px var(--shadow-strong);
}

button:active {
    transform: scale(0.98);
}

/* Ghost variant */
.button--ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(187, 134, 252, 0.25);
}

.button--soft {
    background: rgba(187, 134, 252, 0.15);
    color: var(--accent);
    border: 1px solid rgba(187, 134, 252, 0.25);
    box-shadow: 0 0 6px rgba(187, 134, 252, 0.15);
}

.mdc-button {
    box-shadow: none !important; /* Remove ripple's shadow effect */
}

 /* ===== Smaller Buttons ===== */
.abtn {
    display: inline-flex;           /* flex for icon + optional text */
    align-items: center;            /* vertically center */
    justify-content: center;        /* horizontally center */
    gap: 6px;                       /* spacing between icon and text */

    padding: 8px 14px;              /* size for icon buttons */
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    margin: 10px 0 10px 0;

    background: linear-gradient(135deg, #c792ff, #8e3edc);
    color: #fff;

    border: none;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;

    line-height: 1; /* prevents shrinking inside flex */
    vertical-align: middle;

    box-shadow: 0 0 8px rgba(187, 134, 252, 0.35);
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.abtn:hover {
    background: linear-gradient(135deg, #b678ff, #7a2ec7);
    box-shadow: 0 0 12px rgba(187, 134, 252, 0.55);
}

.abtn:active {
    transform: scale(0.98);
}

.abtn--soft {
    background: rgba(187, 134, 252, 0.15);
    color: var(--accent);
    border: 1px solid rgba(187, 134, 252, 0.25);
    box-shadow: 0 0 6px rgba(187, 134, 252, 0.15);
}

.abtn--soft:hover {
    background: rgba(187, 134, 252, 0.25);
    box-shadow: 0 0 10px rgba(187, 134, 252, 0.3);
}

.abtn--ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(187, 134, 252, 0.25);
}

.abtn--ghost:hover {
    background: rgba(187, 134, 252, 0.1);
}

/* Danger variant */
.abtn--danger {
    background: var(--danger);
    color: #fff;
}

.abtn--danger:hover {
    background: #d32f2f;
}

/* Material icon inside button */
.abtn .material-icons {
    font-size: 1.2em;   /* adjust icon size */
    vertical-align: middle;
}
/* ===== Meal Sections ===== */
.meal-section {
    margin-bottom: 16px;
}

.meal-disclosure > summary {
    background: var(--surface);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    list-style: none;
}

.meal-disclosure > summary::-webkit-details-marker {
    display: none;
}

.meal-disclosure > summary::after {
    content: 'expand_more';
    font-family: 'Material Icons';
    position: absolute;
    right: 16px;
    color: var(--primary);
    transition: transform 0.3s;
}

.meal-disclosure[open] > summary::after {
    transform: rotate(180deg);
}

.meal-entries {
    padding: 16px;
    background: var(--surface);
    border-radius: 8px 8px 8px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

.meal-entries--collapsable {
    padding: 16px;
    background: var(--surface);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-top: 5px;
}

/* ===== Entry Cards ===== */
.entry-card {
    margin-bottom: 10px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--input-bg);
}

.mdc-card {
    background-color: var(--surface);
    border-radius: 8px;
}

.mdc-card.entry-card{
    background: var(--input-bg);
}

.mdc-card__content {
    padding: 16px;
}

.entry-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    border-radius: 4px;
    overflow: hidden;
    transition: background-color 0.2s;
}

.entry-card h3:hover {
    background-color: #3a3a3a;
}

.entry-card li,
.mdc-card li {
    color: var(--text-secondary);
}

.copy-icon {
    font-size: 18px;
    color: var(--primary);
    opacity: 0.7;
}

.entry-card h3:hover .copy-icon {
    opacity: 1;
}

.entry-card p {
    margin: 0 0 12px 3px;
    color: var(--text-secondary);
}

.nutrients {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nutrients span {
    background: #333;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-primary);
}

.calories {
    font-weight: bold;
    background: #4a148c;
    color: var(--text-primary);
    cursor: pointer;
}

.calories:hover {
    background: #6a1b9a;
}

.no-entries {
    text-align: center;
    padding: 32px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    color: var(--text-secondary);
}

/* ===== Modals ===== */
.modal-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    max-width: 300px;
    width: 90%;
    display: flex;
    flex-direction: column;
    text-align: center;
    color: var(--text-primary);
}
.modal-buttons {
    margin-top: 16px;
    display: flex;
    width: 100%;
    justify-content: space-evenly;
}

.modal-content h3 {
    color: var(--text-secondary); 
}

.nutrient-item {
    margin: 8px 0;
    padding: 4px 0;
    border-bottom: 1px solid #444;
}


/* ===== App Bar ===== */
.app-bar {
    height: 56px;
    background: var(--surface);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,.6);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.menu-btn {
    margin-left: auto;
    font-size: 28px;
    cursor: pointer;
    color: var(--primary);
    border: none;
    background: none;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    background: var(--surface);
    padding: 72px 16px 16px;
    box-shadow: 2px 0 12px rgba(0,0,0,.7);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1200;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 16px;
    background: #1e1e1e;
    box-shadow: 0 2px 4px rgba(0,0,0,.4);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--primary);
}

.sidebar-close {
    font-size: 26px;
    color: var(--primary);
    width:30%;
    background: none;
    border: none;
    cursor: pointer;
}

.sidebar a {
    display: flex;
    padding: 12px 10px;
    margin-bottom: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 16px;
    border-radius: 8px;
    align-items: center;
    gap: 12px;
}

.sidebar a .material-icons {
    font-size: 20px;
    color: var(--primary);
}

.sidebar a:hover {
    background: rgba(187,134,252,.14);
}

.sidebar-status {
    padding: 12px 8px;
    margin-bottom: 8px;
    text-align: center;
    display: flex;
    flex-direction: column; /* or row */
    gap: 15px; /* space between children */

}

.fs-connected {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(139,195,74,0.15);
    padding: 6px 12px;
    border-radius: 10px;
    color: #8BC34A;
    font-weight: 600;
    font-size: 13px;
    justify-content: center;
    
}


.fs-connect:hover {
    background: #a96df0;
}


.fs-connected .material-icons {
    font-size: 16px;
}


.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: 8px 0 12px;
}

/* ---------- TABLE ---------- */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-weight: 500;
}

td {
    vertical-align: middle;
    text-align: center;
}

td.username {
    word-break: break-word;
}

.login-name {
    color: var(--muted);
    font-size: 0.82rem;
}

.shared-badge {
    display: inline-flex;
    margin-left: 7px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--primary);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.optional-label {
    margin-left: 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
}

.form-container .field-row {
    margin-bottom: 4px;
}

.form-help {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.shared-text {
    color: #c9a8ff;
    font-weight: 600;
}


.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
}


 /* ---------- ACTIONS ---------- */

.actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 16px;
}

.actions form {
    display: inline-flex;
}
.actions form .btn {
    padding: 8px 14px;        /* same as other buttons */
    font-size: 0.9rem;
    display: inline-flex;      /* ensure icon is centered */
    align-items: center;
    justify-content: center;
    gap: 6px;
}


.flash {
    background: #4a148c;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.md-content {
    max-width: 100%;
}

.md-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-collapse: collapse;
}

/* Optional: make scrolling smoother on mobile */
.md-content table::-webkit-scrollbar {
    height: 8px;
}

/* ===== Mobile-first journal workflow ===== */
:root {
    --theme-color: #8de0ad;
    --theme-rgb: 141, 224, 173;
    --bg: #0d1512;
    --bg-rgb: 13, 21, 18;
    --surface: #15211c;
    --surface-rgb: 21, 33, 28;
    --surface-raised: #1b2a24;
    --input-bg: #101b17;
    --input-border: #31483e;
    --primary: var(--theme-color);
    --primary-strong: #58c987;
    --secondary: #ffb86b;
    --accent: var(--theme-color);
    --on-primary: #07120c;
    --text-primary: #f5faf7;
    --text-secondary: #b9c9c1;
    --muted: #8fa49a;
    --border: #273b32;
    --card: var(--surface);
    --danger: #ff7e79;
    --radius: 18px;
    --button-gradient: linear-gradient(135deg, #75d99c, #4fbd7d);
    --button-hover-gradient: linear-gradient(135deg, #8de0ad, #58c987);
    --shadow-light: rgba(56, 154, 100, 0.18);
    --shadow-strong: rgba(56, 154, 100, 0.3);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0 14px calc(92px + env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 10% -10%, rgba(var(--theme-rgb), 0.14), transparent 34%),
        var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

body.modal-open,
body.menu-open {
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 18px 0 28px;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: calc(64px + env(safe-area-inset-top));
    margin: 0 -14px;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 8px;
    background: rgba(var(--bg-rgb), 0.9);
    border-bottom: 1px solid rgba(var(--theme-rgb), 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.page-title-wrap {
    min-width: 0;
    text-align: center;
}

.page-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.app-name {
    display: block;
    margin-bottom: 1px;
    color: var(--primary);
    font-size: 0.66rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.header-spacer {
    width: 48px;
}

.icon-button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: none;
}

.icon-button:hover {
    background: var(--surface-raised);
    box-shadow: none;
}

.icon-button .material-icons {
    font-size: 22px;
}

.source-card,
.copy-panel,
.notice-card,
.empty-state {
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(var(--surface-rgb), 0.94);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.source-context,
.copy-panel-heading,
.modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.source-context h2,
.copy-panel-heading h2,
.modal-heading h2,
.empty-state h2 {
    margin: 2px 0 0;
    color: var(--text-primary);
    text-align: left;
    font-size: 1.35rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.source-badge,
.entry-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 7px 9px;
    border-radius: 999px;
    background: rgba(255, 184, 107, 0.12);
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.source-badge .material-icons {
    font-size: 16px;
}

.date-picker-form {
    margin-top: 18px;
}

.date-picker-form label,
.copy-panel > label {
    display: block;
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.date-stepper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
}

.date-stepper .date-input-shell {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: 100%;
}

.date-stepper .icon-button {
    width: 100%;
    min-width: 0;
}

.date-input-shell {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
}

.date-input-shell:focus-within {
    outline: 3px solid rgba(var(--theme-rgb), 0.45);
    outline-offset: 2px;
}

.date-input-shell input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 9px 10px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 650;
    text-align: center;
}

.date-actions {
    display: grid;
    grid-template-columns: 0.8fr 1.6fr;
    gap: 8px;
    margin-top: 10px;
}

button,
.abtn {
    min-height: 48px;
    border-radius: 15px;
    box-shadow: none;
}

button:not(.button--soft):not(.button--ghost):not(.icon-button):not(.palette-option):not(.nutrition-chip):not(.entry-name-button):not(.bottom-nav-more),
.abtn:not(.abtn--soft):not(.abtn--ghost):not(.abtn--danger):not(.disconnect-button) {
    color: var(--on-primary);
}

.abtn:not(.abtn--soft):not(.abtn--ghost):not(.abtn--danger):not(.disconnect-button) {
    background: var(--button-gradient);
}

.button--soft,
.button--ghost,
.abtn--soft,
.abtn--ghost {
    border-color: rgba(var(--theme-rgb), 0.28);
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--primary);
    box-shadow: none;
}

.button--soft:hover,
.button--ghost:hover,
.abtn--soft:hover,
.abtn--ghost:hover {
    background: rgba(var(--theme-rgb), 0.2);
    box-shadow: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(var(--theme-rgb), 0.45);
    outline-offset: 2px;
}

button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.compact-button {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 9px 10px;
    font-size: 0.78rem;
    line-height: 1.15;
}

.compact-button .material-icons {
    font-size: 18px;
}

.copy-panel {
    position: relative;
    overflow: hidden;
    border-color: rgba(var(--theme-rgb), 0.28);
    background:
        linear-gradient(140deg, rgba(var(--theme-rgb), 0.16), rgba(var(--surface-rgb), 0.96) 56%),
        var(--surface);
}

.copy-route {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 16px;
    color: var(--primary);
}

.route-dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
}

.source-dot {
    background: var(--secondary);
}

.destination-dot {
    background: var(--primary);
}

.route-line {
    height: 1px;
    flex: 1;
    background: var(--border);
}

.copy-route .material-icons {
    font-size: 18px;
}

.copy-panel > label {
    margin-top: 16px;
}

.field-help {
    margin: -3px 0 10px;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.destination-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.destination-date-row .date-input-shell {
    grid-column: 1 / -1;
}

.day-copy-button,
.meal-copy-button {
    position: relative;
    margin: 14px 0 0;
    color: var(--on-primary);
}

.button-count {
    position: absolute;
    right: 12px;
    min-width: 26px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(8, 32, 20, 0.18);
    font-size: 0.72rem;
}

.meal-list {
    display: grid;
    gap: 10px;
}

.meal-section {
    position: relative;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: visible;
    background: var(--surface);
}

.meal-disclosure {
    margin: 0;
}

.meal-disclosure > summary {
    min-height: 56px;
    padding: 12px 46px 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
    font-size: 1rem;
}

.meal-disclosure[open] > summary {
    position: sticky;
    top: calc(64px + env(safe-area-inset-top));
    z-index: 20;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.meal-disclosure > summary::after {
    right: 14px;
    color: var(--primary);
}

.meal-summary-main {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.meal-name {
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-meta {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.meal-calories {
    flex-shrink: 0;
    color: var(--secondary);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.meal-entries--collapsable {
    margin: 0;
    padding: 10px;
    border-radius: 0 0 var(--radius) var(--radius);
    background: rgba(11, 19, 16, 0.5);
    box-shadow: none;
}

.meal-copy-row {
    padding: 10px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--surface-raised);
}

.meal-copy-button {
    position: static;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 7px 12px;
    gap: 6px;
    border-radius: 12px;
    font-size: 0.78rem;
}

.meal-copy-button .material-icons {
    font-size: 17px;
}

.entry-card {
    margin: 0 0 9px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
    overflow: hidden;
}

.entry-card:last-child {
    margin-bottom: 0;
}

.entry-card__content {
    padding: 10px;
}

.entry-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.entry-name {
    min-width: 0;
    margin: 0;
}

.entry-name-button {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 5px 6px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
}

.entry-name-button > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.entry-name-button:hover {
    background: rgba(var(--theme-rgb), 0.08);
    box-shadow: none;
}

.entry-name-button .material-icons {
    flex: none;
    color: var(--muted);
    font-size: 15px;
}

.entry-details {
    margin-top: 3px;
}

.entry-details > summary {
    width: fit-content;
    min-height: 34px;
    padding: 5px 7px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
    border-radius: 9px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 650;
    list-style: none;
}

.entry-details > summary::-webkit-details-marker {
    display: none;
}

.entry-details > summary:hover {
    background: rgba(var(--theme-rgb), 0.08);
    color: var(--text-secondary);
}

.entry-details > summary .material-icons {
    font-size: 16px;
}

.entry-details-chevron {
    transition: transform 0.2s ease;
}

.entry-details[open] .entry-details-chevron {
    transform: rotate(180deg);
}

.entry-details-content {
    margin-top: 5px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
}

.entry-description {
    margin: 0 0 9px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.nutrition-chip {
    width: 100%;
    min-height: 42px;
    margin: 0 0 9px;
    padding: 7px 10px;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 5px;
    justify-content: initial;
    border: 1px solid rgba(255, 184, 107, 0.2);
    border-radius: 12px;
    background: rgba(255, 184, 107, 0.08);
    color: var(--secondary);
    box-shadow: none;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: left;
}

.nutrition-chip:hover {
    background: rgba(255, 184, 107, 0.13);
    box-shadow: none;
}

.nutrition-chip span:nth-of-type(1) {
    margin-left: 5px;
    color: var(--muted);
}

.nutrition-chip .material-icons {
    color: var(--secondary);
    font-size: 18px;
}

.entry-details-content .nutrition-chip {
    margin-bottom: 0;
}

.clone-form {
    margin: 0;
}

.entry-copy-button {
    margin: 0;
    min-height: 40px;
    padding: 6px 10px;
    gap: 4px;
    border-radius: 11px;
    color: var(--primary);
    font-size: 0.74rem;
}

.entry-copy-button .material-icons {
    font-size: 17px;
}

.notice-card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.notice-card > .material-icons {
    color: var(--secondary);
}

.notice-card strong {
    line-height: 1.35;
}

.notice-card p {
    margin: 5px 0 0;
    font-size: 0.8rem;
}

.notice-card .abtn {
    grid-column: 1 / -1;
    margin: 4px 0 0;
}

.empty-state {
    padding: 36px 24px;
    text-align: center;
}

.empty-state > .material-icons {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 40px;
}

.empty-state h2 {
    text-align: center;
}

.empty-state p {
    margin-bottom: 0;
}

/* ===== Cached entry search ===== */
.search-panel {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.search-panel-heading,
.search-results-heading {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.search-panel-heading h2,
.search-results-heading h2 {
    margin: 3px 0 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-panel-heading > .material-icons {
    color: var(--primary);
    font-size: 28px;
}

.cached-entry-search {
    margin-top: 15px;
}

.cached-entry-search label,
.search-copy-fields > label {
    display: block;
    margin: 0 0 7px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 650;
}

.cached-entry-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.cached-entry-search input[type="search"] {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.search-submit {
    width: auto;
    min-width: 92px;
    min-height: 46px;
    margin: 0;
    padding: 8px 12px;
}

.search-panel .field-help {
    margin: 9px 1px 0;
}

.search-results-heading {
    margin: 18px 2px 10px;
}

.clear-search-link {
    min-height: 38px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
}

.cached-entry-results {
    display: grid;
    gap: 8px;
}

.cached-entry-card {
    padding: 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
}

.cached-entry-main {
    min-width: 0;
}

.cached-entry-main h3 {
    margin: 0 0 4px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cached-entry-main p {
    margin: 0 0 7px;
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cached-entry-meta {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.cached-entry-meta span {
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(var(--theme-rgb), 0.08);
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 650;
}

.search-copy-form {
    margin: 0;
}

.search-entry-copy-button {
    width: auto;
    min-width: 70px;
    min-height: 42px;
    margin: 0;
    padding: 7px 9px;
    gap: 4px;
    border-radius: 12px;
    font-size: 0.74rem;
}

.search-entry-copy-button .material-icons {
    font-size: 17px;
}

.search-limit-note {
    margin: 12px 4px 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.4;
    text-align: center;
}

.search-copy-sheet {
    width: 100%;
    max-width: 520px;
    margin: auto 0 0;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    background: var(--surface-raised);
    text-align: left;
}

.search-copy-entry-name {
    margin: 8px 0 14px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.35;
}

.search-copy-fields {
    display: grid;
    gap: 7px;
}

.search-copy-fields > label:not(:first-child) {
    margin-top: 5px;
}

.search-copy-fields select {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 650;
}

.search-copy-footer {
    margin-top: 16px;
    padding-top: 10px;
    display: grid;
    grid-template-columns: 0.8fr 1.4fr;
    gap: 8px;
    border-top: 1px solid var(--border);
}

.search-copy-footer button {
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 9px 10px;
    font-size: 0.78rem;
}

.modal-overlay {
    z-index: 1500;
    padding: 18px;
    background: rgba(3, 9, 6, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.progress-overlay {
    display: none;
}

.progress-overlay.show {
    display: flex;
}

.progress-card {
    width: min(88vw, 330px);
    padding: 26px 22px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-raised);
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

.progress-card .muted {
    max-width: 100%;
    color: var(--muted);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

.progress-spinner {
    width: 30px;
    height: 30px;
    margin-bottom: 5px;
    border: 3px solid rgba(var(--theme-rgb), 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.nutrition-sheet {
    width: 100%;
    max-width: 520px;
    margin: auto 0 0;
    padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    background: var(--surface-raised);
    text-align: left;
}

.batch-selection-sheet {
    width: 100%;
    max-width: 560px;
    max-height: min(84vh, 720px);
    margin: auto 0 0;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    background: var(--surface-raised);
    text-align: left;
    overflow: hidden;
}

.batch-selection-summary {
    margin: 9px 0 11px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.batch-selection-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 9px;
}

.batch-select-toggle {
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 7px 9px;
    font-size: 0.73rem;
}

.batch-selection-list {
    min-height: 100px;
    padding: 2px;
    display: grid;
    gap: 7px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.batch-selection-item {
    min-width: 0;
    min-height: 60px;
    padding: 10px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 22px;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
    cursor: pointer;
}

.batch-selection-item:has(input:checked) {
    border-color: rgba(var(--theme-rgb), 0.3);
    background: rgba(var(--theme-rgb), 0.08);
}

.batch-selection-item input[type="checkbox"] {
    width: 22px;
    min-width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    flex: none;
    border: 0;
    accent-color: var(--primary);
    box-shadow: none;
}

.batch-selection-item-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.batch-selection-item-details strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-selection-item-details span {
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: capitalize;
}

.batch-selection-check {
    color: transparent;
    font-size: 20px;
}

.batch-selection-item input:checked ~ .batch-selection-check {
    color: var(--primary);
}

.batch-selection-footer {
    padding-top: 10px;
    display: grid;
    grid-template-columns: 0.8fr 1.4fr;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
    background: var(--surface-raised);
}

.batch-selection-footer button {
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 9px 10px;
    font-size: 0.78rem;
}

.sheet-handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 4px;
    background: #53675d;
}

.nutrient-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}

.nutrient-item {
    min-width: 0;
    margin: 0;
    padding: 13px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--input-bg);
    text-align: center;
}

.nutrient-item strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.nutrient-item span {
    color: var(--muted);
    font-size: 0.7rem;
}

.nutrient-item--featured strong {
    color: var(--secondary);
}

.theme-picker {
    margin: 4px 0 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.theme-picker-heading strong {
    display: block;
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.theme-picker-help {
    margin: 5px 0 12px;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.palette-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.palette-option {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 7px 8px;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) 16px;
    gap: 7px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-secondary);
    box-shadow: none;
    font-size: 0.72rem;
    font-weight: 650;
    text-align: left;
}

.palette-option:hover {
    border-color: rgba(var(--theme-rgb), 0.35);
    background: var(--surface-raised);
    box-shadow: none;
}

.palette-option.selected {
    border-color: var(--primary);
    background: rgba(var(--theme-rgb), 0.1);
    color: var(--text-primary);
}

.palette-preview {
    width: 25px;
    height: 25px;
    border: 7px solid var(--palette-bg);
    border-radius: 50%;
    background: var(--palette-accent);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.palette-check {
    color: transparent;
    font-size: 16px;
}

.palette-option.selected .palette-check {
    color: var(--primary);
}

.custom-palette-option {
    position: relative;
    cursor: pointer;
}

.custom-palette-option:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.custom-palette-option input[type="color"] {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
}

.sidebar {
    width: min(86vw, 310px);
    padding: calc(72px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    border-right: 1px solid var(--border);
    background: var(--bg);
    box-shadow: 16px 0 60px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
}

.sidebar-header {
    height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: var(--bg);
}

.sidebar-title,
.sidebar a,
.sidebar a .material-icons,
.sidebar-close {
    color: var(--primary);
}

.sidebar a {
    min-height: 48px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 13px;
}

.sidebar a.active {
    border-color: rgba(var(--theme-rgb), 0.18);
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--text-primary);
}

.sidebar a.active .material-icons {
    color: var(--primary);
}

.sidebar-section-label {
    display: block;
    margin: 0 10px 7px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.sidebar a.sidebar-logout,
.sidebar a.sidebar-logout .material-icons {
    color: var(--text-secondary);
}

.sidebar a.sidebar-logout:hover {
    color: var(--text-primary);
}

.sidebar-close {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    margin: 0;
    box-shadow: none;
}

.sidebar-status {
    margin: 0;
    padding: 2px 0 18px;
    display: block;
    text-align: left;
}

.account-state {
    min-height: 58px;
    padding: 11px 12px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.account-state > .material-icons {
    font-size: 22px;
}

.account-state div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-state strong {
    color: var(--text-primary);
    font-size: 0.84rem;
}

.account-state span:not(.material-icons) {
    color: var(--muted);
    font-size: 0.7rem;
}

.account-state--online {
    border-color: rgba(112, 207, 145, 0.22);
    background: rgba(112, 207, 145, 0.08);
}

.account-state--online > .material-icons {
    color: #7edb9e;
}

.account-state--offline > .material-icons {
    color: var(--muted);
}

.sidebar-status .account-connect,
.sidebar-status .disconnect-button {
    width: 100%;
    min-height: 44px;
    margin: 8px 0 0;
    justify-content: center;
    font-size: 0.78rem;
}

.sidebar-status .account-connect {
    border-color: transparent;
    background: var(--button-gradient);
    color: var(--on-primary);
}

.sidebar-status .account-connect .material-icons {
    color: currentColor;
}

.sidebar-status .disconnect-button,
.sidebar-status .disconnect-button:hover {
    border: 1px solid rgba(255, 126, 121, 0.3);
    background: rgba(255, 126, 121, 0.1);
    color: #ffaaa6;
    box-shadow: none;
}

.sidebar-status .disconnect-button .material-icons {
    color: #ffaaa6;
}

.overlay {
    z-index: 1100;
    background: rgba(3, 9, 6, 0.66);
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--border);
    background: rgba(var(--surface-rgb), 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.bottom-nav a,
.bottom-nav button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    margin: 0;
    padding: 5px 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
    font-size: 0.66rem;
    font-weight: 600;
    text-decoration: none;
}

.bottom-nav .material-icons {
    font-size: 22px;
}

.bottom-nav a.active {
    background: rgba(var(--theme-rgb), 0.1);
    color: var(--primary);
}

.mdc-snackbar {
    bottom: calc(76px + env(safe-area-inset-bottom));
}

.mdc-snackbar__surface {
    border: 1px solid rgba(var(--theme-rgb), 0.28);
    border-left: 4px solid var(--primary);
    border-radius: 14px !important;
    background: var(--surface-raised) !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36) !important;
}

.mdc-snackbar__label {
    color: var(--text-primary) !important;
    font-size: 0.84rem !important;
}

.mdc-snackbar .mdc-snackbar__action {
    width: auto;
    min-width: auto;
    min-height: 38px;
    margin: 0 5px 0 0;
    padding: 0 10px;
    background: rgba(var(--theme-rgb), 0.1) !important;
    color: var(--primary) !important;
    box-shadow: none !important;
}

.mdc-snackbar .mdc-button__label {
    color: var(--primary) !important;
}

@media (min-width: 520px) {
    .date-stepper {
        grid-template-columns: 46px minmax(0, 1fr) 46px;
    }

    .date-stepper .date-input-shell {
        grid-column: auto;
        grid-row: auto;
    }

    .date-stepper .icon-button {
        width: 46px;
        min-width: 46px;
    }

    .destination-date-row {
        grid-template-columns: minmax(0, 1.5fr) minmax(76px, 0.7fr) minmax(68px, 0.55fr);
    }

    .destination-date-row .date-input-shell {
        grid-column: auto;
    }
}

@media (min-width: 720px) {
    body {
        padding-right: 24px;
        padding-bottom: 36px;
        padding-left: 24px;
    }

    .page-header {
        margin-right: -24px;
        margin-left: -24px;
        padding-right: 24px;
        padding-left: 24px;
    }

    .container {
        padding-top: 26px;
    }

    .bottom-nav {
        display: none;
    }

    .nutrition-sheet,
    .search-copy-sheet {
        margin: auto;
        border-radius: 24px;
        padding: 18px 22px 24px;
    }

    .batch-selection-sheet {
        margin: auto;
        padding: 18px 20px 20px;
        border-radius: 24px;
    }

    .mdc-snackbar {
        bottom: 24px;
    }
}

@media (max-width: 380px) {
    .date-actions {
        grid-template-columns: 1fr;
    }
}

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

/* ===== Responsive user administration ===== */
.admin-hero {
    margin-bottom: 14px;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(var(--theme-rgb), 0.14), transparent 60%),
        var(--surface);
}

.admin-hero h2 {
    margin: 3px 0 5px;
    color: var(--text-primary);
    text-align: left;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.admin-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.admin-hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 8px;
}

.admin-logs-link {
    min-height: 48px;
    padding: 10px 13px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--theme-rgb), 0.25);
    border-radius: 14px;
    background: rgba(var(--theme-rgb), 0.1);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-logs-link .material-icons {
    font-size: 19px;
}

.admin-cache-settings {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.admin-cache-heading {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.admin-cache-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--primary);
}

.admin-cache-icon .material-icons {
    font-size: 21px;
}

.admin-cache-heading h2 {
    margin: 3px 0 0;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
}

.cache-refresh-state {
    grid-column: 2;
    width: fit-content;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 126, 121, 0.1);
    color: #ffaaa6;
    font-size: 0.68rem;
    font-weight: 750;
}

.cache-refresh-state--enabled {
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--primary);
}

.admin-cache-help {
    margin: 12px 0;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.cache-refresh-form {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
}

.cache-refresh-form > label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 650;
}

.cache-refresh-control {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.cache-refresh-control input[type="number"] {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 16px;
}

.cache-refresh-control > span {
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 650;
}

.cache-refresh-control button {
    width: auto;
    min-width: 72px;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    font-size: 0.76rem;
}

.cache-refresh-form > p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.4;
}

.cache-refresh-status {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.cache-refresh-status > div {
    min-width: 0;
    padding: 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-radius: 12px;
    background: rgba(var(--theme-rgb), 0.06);
}

.cache-refresh-status span {
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 650;
}

.cache-refresh-status strong {
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1.35;
}

.cache-refresh-result {
    grid-column: 1 / -1;
}

.admin-log-hero {
    margin-bottom: 14px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.admin-log-hero h2,
.admin-log-toolbar h2 {
    margin: 3px 0 5px;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: left;
}

.admin-log-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.admin-log-back {
    min-height: 42px;
    padding: 8px 10px;
    display: inline-flex;
    gap: 5px;
    align-items: center;
    border: 1px solid rgba(var(--theme-rgb), 0.24);
    border-radius: 12px;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-log-back .material-icons {
    font-size: 17px;
}

.admin-log-panel {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.admin-log-toolbar {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    justify-content: space-between;
}

.admin-log-toolbar form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.admin-log-toolbar label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 650;
}

.admin-log-toolbar select {
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
}

.admin-log-output {
    width: 100%;
    height: min(62vh, 620px);
    margin: 0;
    padding: 11px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #090c0e;
    color: #c6d5cd;
    font: 0.68rem/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    -webkit-overflow-scrolling: touch;
}

.admin-create {
    width: 100%;
    min-height: 48px;
    padding: 10px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 14px;
    background: var(--button-gradient);
    color: var(--on-primary);
    font-size: 0.84rem;
    font-weight: 750;
    text-decoration: none;
}

.admin-create .material-icons {
    font-size: 20px;
}

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

.user-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.user-card--source {
    border-color: rgba(var(--theme-rgb), 0.38);
    box-shadow: inset 3px 0 0 var(--primary), 0 12px 28px rgba(0, 0, 0, 0.12);
}

.user-card-header {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.user-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--theme-rgb), 0.25);
    border-radius: 15px;
    background: rgba(var(--theme-rgb), 0.12);
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 800;
}

.user-identity {
    min-width: 0;
}

.user-identity h3 {
    margin: 0 0 3px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-login {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-badge,
.user-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 700;
}

.user-badge .material-icons {
    font-size: 13px;
}

.user-badge--source {
    border-color: rgba(var(--theme-rgb), 0.26);
    background: rgba(var(--theme-rgb), 0.1);
    color: var(--primary);
}

.user-status-row {
    margin: 13px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.user-connection {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
}

.user-connection .material-icons {
    font-size: 15px;
}

.user-connection--online {
    color: #7edb9e;
}

.user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.admin-action {
    min-width: 0;
    min-height: 46px;
    padding: 8px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 0.73rem;
    font-weight: 650;
    text-decoration: none;
}

.admin-action:hover {
    border-color: rgba(var(--theme-rgb), 0.3);
    background: var(--surface-raised);
    color: var(--text-primary);
}

.admin-action .material-icons {
    flex: none;
    color: var(--primary);
    font-size: 18px;
}

.admin-action--source {
    border-color: rgba(var(--theme-rgb), 0.25);
    background: rgba(var(--theme-rgb), 0.1);
    color: var(--primary);
}

.admin-action--current {
    cursor: default;
    color: var(--muted);
}

.user-delete-form {
    margin-top: 9px;
}

.user-delete-form .admin-delete,
.user-delete-form .admin-delete:hover {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid rgba(255, 126, 121, 0.24);
    border-radius: 13px;
    background: rgba(255, 126, 121, 0.08);
    color: #ffaaa6;
    box-shadow: none;
    font-size: 0.72rem;
}

@media (min-width: 620px) {
    .admin-hero {
        align-items: center;
        justify-content: space-between;
        flex-direction: row;
    }

    .admin-create {
        width: auto;
        min-width: 130px;
    }

    .admin-hero-actions {
        width: auto;
        grid-template-columns: auto auto;
    }

    .admin-cache-heading {
        grid-template-columns: 40px minmax(0, 1fr) auto;
    }

    .cache-refresh-state {
        grid-column: auto;
    }

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

/* Compact source/destination rows; dates stay available when controls are closed. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.journal-control-card {
    padding: 8px 10px;
    margin-bottom: 8px;
    box-shadow: none;
}

.journal-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 148px);
    align-items: center;
    gap: 8px;
}

.journal-control-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 0 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
    font-size: 0.84rem;
    text-align: left;
}

.journal-control-toggle:hover {
    background: rgba(var(--theme-rgb), 0.06);
    box-shadow: none;
}

.journal-control-label {
    flex: none;
    color: var(--muted);
    font-weight: 500;
}

.journal-control-toggle strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.journal-control-toggle .material-icons {
    flex: none;
    font-size: 18px;
    color: var(--muted);
}

.journal-control-toggle[aria-expanded="true"] .material-icons {
    transform: rotate(180deg);
}

.journal-date-form {
    min-width: 0;
    margin: 0;
}

.journal-control-row .date-input-shell input[type="date"] {
    min-height: 44px;
    padding: 7px 6px;
    font-size: 16px;
}

.journal-control-options {
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.journal-control-options[hidden] {
    display: none;
}

.journal-date-shortcuts,
.journal-destination-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.journal-destination-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.journal-control-options .compact-button {
    min-width: 0;
    padding: 7px 4px;
    font-size: 0.75rem;
}

.journal-control-card > .day-copy-button {
    margin-top: 8px;
}

.journal-refresh[aria-busy="true"] .material-icons {
    animation: journal-refresh-spin 0.9s linear infinite;
}

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

.meal-list {
    margin-top: 14px;
}

.meal-section--copyable .meal-disclosure > summary {
    border-radius: var(--radius) var(--radius) 0 0;
}

.meal-section--copyable .meal-entries--collapsable {
    border-radius: 0;
}

.journal-cache-status {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin: 3px 2px 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.4;
    font-weight: 400;
}
