:root{
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#20242a;background:#f4f6f8;color-scheme:light;
}
*{box-sizing:border-box} body{margin:0;min-height:100vh;background:#f4f6f8} button,input,select,textarea{font:inherit} a{color:inherit}
.topbar{min-height:58px;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 18px;background:#20242a;color:#fff}.brand{font-weight:750;white-space:nowrap}.account-nav{display:flex;align-items:center;justify-content:flex-end;gap:14px;flex-wrap:wrap}.account-nav a{color:#fff;text-decoration:none;opacity:.94}.current-user{opacity:.7}
.tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:1px;background:#d9dde2;position:sticky;top:0;z-index:10;border-bottom:1px solid #cfd5dc}.tab{border:0;border-radius:0;background:#fff;color:#20242a;padding:13px 8px;cursor:pointer;font-weight:650}.tab:hover{background:#f5f6f7}.tab.active{background:#eef1f4;color:#111;border-bottom:3px solid #20242a}
.app-shell{max-width:1440px;margin:0 auto;padding:18px}.narrow-shell{max-width:720px}.view{display:none}.view.active{display:block}.global-message{max-width:900px}
h1,h2,h3{line-height:1.2}h1{font-size:26px}h2{font-size:20px}h3{font-size:16px}.page-head,.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.page-head{margin-bottom:14px}.page-head h1,.section-head h1,.section-head h2{margin:0}
.panel{background:#fff;border:1px solid #dce1e6;border-radius:10px;padding:16px;margin-bottom:16px}.muted{color:#6c7580;font-size:13px}.message{padding:10px 12px;border-radius:8px;margin-bottom:14px}.message.error{background:#ffe8e8;color:#7b2020}.message.success{background:#e7f5ea;color:#205f2e}
button,.button-link,.mini-button{border:0;border-radius:7px;padding:9px 13px;background:#20242a;color:#fff;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;font-weight:650;white-space:nowrap}.secondary,.secondary-link{background:#eef1f4!important;color:#20242a!important;border:1px solid #cfd5dc!important}.ghost,.ghost-link{background:transparent!important;color:#4c5560!important}.danger{background:#9b3030!important;color:#fff!important}.mini-button{padding:6px 9px;font-size:12px;min-height:30px}.button-row,.actions-cell{display:flex;gap:7px;align-items:center;flex-wrap:wrap}.actions-cell{justify-content:flex-end;flex-wrap:nowrap;white-space:nowrap}.actions-cell .inline-form,.actions-cell>a,.actions-cell>button{flex:0 0 auto}.inline-form{display:inline-flex;margin:0}
input,select,textarea{width:100%;padding:9px 10px;border:1px solid #cbd2da;border-radius:7px;background:#fff;color:#20242a}textarea{resize:vertical}label{display:grid;gap:5px;font-weight:650;font-size:13px}.form-grid,.ingredient-form,.profile-form,.prep-form{display:grid;gap:11px}.form-grid{grid-template-columns:repeat(3,minmax(160px,1fr))}.compact-form{grid-template-columns:minmax(180px,1fr) 2fr auto;align-items:end}.ingredient-form{grid-template-columns:repeat(5,minmax(130px,1fr))}.profile-form{grid-template-columns:repeat(5,minmax(135px,1fr))}.prep-form{grid-template-columns:160px 160px 1fr 1fr;align-items:start}.wide-field,.span-all{grid-column:1/-1}.span-2{grid-column:span 2}.editor-panel{display:none;margin-top:12px}.editor-panel.open{display:block}.editor-block{border-top:1px solid #e3e6ea;margin-top:16px;padding-top:16px}
.table-wrap{overflow:auto;border:1px solid #dde2e7;border-radius:9px;background:#fff}.data-table{width:100%;border-collapse:collapse;font-size:13px;min-width:850px}.data-table th,.data-table td{padding:8px 9px;border-bottom:1px solid #e8ebee;text-align:right;vertical-align:middle}.data-table thead th{position:sticky;top:0;background:#f6f8fa;color:#4b545e;font-size:12px;z-index:1}.data-table th:first-child,.data-table td:first-child,.data-table .comment-cell{text-align:left}.data-table tbody tr:last-child td{border-bottom:0}.data-table tbody tr:hover td{background:#fafbfc}.name-cell{font-weight:700;white-space:nowrap}.comment-cell{max-width:280px;min-width:160px}.group-row th{background:#e9edf1!important;color:#30363d;text-align:left!important;padding:7px 10px;letter-spacing:.02em}.ingredient-table{min-width:1320px}.ingredient-table td{white-space:nowrap}.ingredient-table .comment-cell{white-space:normal}.row-warning td{background:#fff8e7}.status{display:inline-block;border-radius:999px;padding:3px 7px;font-size:11px;font-weight:750}.status.ok{background:#e4f4e7;color:#216330}.status.warn{background:#fff0cc;color:#7b5412}
.dish-yield{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;margin:12px 0 6px;padding:8px 10px;border:1px solid #dfe4e8;border-radius:8px;background:#f8f9fa;font-size:13px}.dish-yield span{color:#68717a}.nutrition-summary{display:grid;grid-template-columns:repeat(8,minmax(90px,1fr));gap:1px;background:#dfe4e8;border:1px solid #dfe4e8;border-radius:8px;overflow:hidden;margin:14px 0}.nutrition-summary div{background:#f8f9fa;padding:9px}.nutrition-summary span,.nutrition-summary strong{display:block}.nutrition-summary span{font-size:11px;color:#68717a}.nutrition-summary strong{font-size:13px;margin-top:2px}.inline-add-form,.inline-edit-grid{display:grid;grid-template-columns:minmax(220px,2fr) minmax(100px,.8fr) minmax(150px,1fr) auto;gap:10px;align-items:end;margin-top:12px}.selector-row{display:grid;grid-template-columns:minmax(220px,1fr);gap:10px;align-items:end;max-width:560px;margin:0 0 14px}.note-clear-form,.danger-zone,.save-day-form{margin-top:10px}.editor-row td{background:#f7f9fb!important}
fieldset{border:1px solid #d7dde3;border-radius:8px;padding:10px;display:grid;gap:6px;max-height:190px;overflow:auto}legend{font-size:12px;font-weight:750;padding:0 5px}.check{display:flex;align-items:center;gap:7px;font-weight:500}.check input{width:auto;margin:0}.timeline-panel{overflow:hidden}.prep-timeline{min-height:180px}.timeline-layout{display:grid;grid-template-columns:180px minmax(0,1fr);border:1px solid #dfe4e8;border-radius:9px;overflow:hidden}.timeline-labels{background:#fff;border-right:1px solid #dfe4e8}.timeline-label{height:36px;padding:4px 8px;border-bottom:1px solid rgba(0,0,0,.05);display:flex;align-items:center;font-size:11px;font-weight:700;line-height:1.1}.timeline-scroll{overflow-x:auto;background:#fff}.timeline-svg{display:block;min-width:760px}.timeline-empty{padding:20px;color:#6b737c}
.goal-grid{display:grid;grid-template-columns:repeat(4,minmax(180px,1fr));gap:10px;margin-top:15px}.goal-card{border:1px solid #dde2e7;border-radius:8px;padding:10px;background:#fafbfc}.goal-head{display:flex;justify-content:space-between;gap:8px;font-size:12px}.goal-head strong{text-align:right}.goal-bar{height:7px;background:#e0e4e8;border-radius:999px;overflow:hidden;margin:8px 0}.goal-bar span{display:block;height:100%;background:#7f8a95}.goal-card.low .goal-bar span{background:#c88422}.goal-card.ok .goal-bar span{background:#3d8f4b}.goal-card.high .goal-bar span{background:#bd4545}.goal-state{font-size:11px;color:#666}.chart-controls{display:flex;gap:10px 16px;flex-wrap:wrap;margin-bottom:12px}.profile-chart{border:1px solid #dde2e7;border-radius:9px;overflow:auto;background:#fff;min-height:300px}.profile-chart svg{display:block;min-width:800px}.chart-empty{padding:30px;color:#6b737c}
.auth-page{display:grid;place-items:center;padding:20px}.auth-card{width:min(100%,420px);background:#fff;border-radius:12px;padding:24px;box-shadow:0 10px 30px rgba(0,0,0,.08)}.auth-card h1{margin-top:0}.auth-card form{display:grid;gap:13px}.user-list{display:grid;gap:12px}.user-card{border:1px solid #dde2e7;border-radius:9px;padding:14px;display:grid;grid-template-columns:1fr auto;gap:12px;align-items:end}.user-edit-form{display:grid;grid-template-columns:minmax(160px,1.2fr) minmax(160px,1fr) minmax(160px,1fr) auto;gap:10px;align-items:end}.user-card-head{display:flex;align-items:center;gap:8px;grid-column:1/-1}.badge{font-size:11px;border:1px solid #cbd2da;border-radius:999px;padding:2px 7px}
@media(max-width:1100px){.ingredient-form{grid-template-columns:repeat(3,1fr)}.profile-form{grid-template-columns:repeat(3,1fr)}.nutrition-summary{grid-template-columns:repeat(4,1fr)}.goal-grid{grid-template-columns:repeat(2,1fr)}.prep-form{grid-template-columns:1fr 1fr}.prep-form fieldset{grid-column:span 1}}
@media(max-width:760px){.app-shell{padding:12px}.topbar{align-items:flex-start}.current-user{width:100%;text-align:right}.account-nav{font-size:13px;gap:9px}.tab{font-size:13px;padding:11px 4px}.page-head h1{font-size:23px}.panel{padding:12px}.ingredient-form,.profile-form,.form-grid,.compact-form,.prep-form{grid-template-columns:1fr}.span-2,.prep-form fieldset{grid-column:auto}.inline-add-form,.inline-edit-grid,.selector-row{grid-template-columns:1fr}.goal-grid{grid-template-columns:1fr}.nutrition-summary{grid-template-columns:repeat(2,1fr)}.timeline-layout{grid-template-columns:105px minmax(0,1fr)}.timeline-label{height:30px;padding:3px 6px;font-size:10px}.timeline-svg{min-width:520px}.user-card{grid-template-columns:1fr}.user-edit-form{grid-template-columns:1fr}.actions-cell{justify-content:flex-start}}
.editor-row.editor-panel{display:none}.editor-row.editor-panel.open{display:table-row}

.prep-multiplier-control{display:grid;grid-template-columns:auto 110px;align-items:center;gap:8px;font-size:13px}.prep-multiplier-control input{min-width:90px}.prep-ingredient-table{min-width:0}.prep-ingredient-table th,.prep-ingredient-table td{text-align:left}.prep-ingredient-table th:nth-child(2),.prep-ingredient-table td:nth-child(2){text-align:right}.prep-ingredient-table th:nth-child(3),.prep-ingredient-table td:nth-child(3){text-align:center;width:90px}.timeline-svg [data-layer="labels"]{pointer-events:none}


/* --- UI refinement update --- */
:root{
  --topbar-height:58px;
  --tabs-height:45px;
  --sticky-nav-height:103px;
}
.topbar{
  position:sticky;
  top:0;
  z-index:80;
  box-shadow:0 1px 0 rgba(255,255,255,.06);
}
.tabs{
  top:var(--topbar-height);
  z-index:75;
}
.data-table thead th{
  position:static;
}
.data-table tbody tr:hover td{
  box-shadow:inset 0 0 0 9999px rgba(20,28,36,.025);
}
.data-table .col-typical{
  background:#eef4f8;
}
.data-table .nutrient-kcal{background:#fff6d8}
.data-table .nutrient-kj{background:#fff9e7}
.data-table .nutrient-fat{background:#f5e1cf}
.data-table .nutrient-saturated-fat{background:#faeee3}
.data-table .nutrient-carbs{background:#f2d6d8}
.data-table .nutrient-sugar{background:#f9e5e6}
.data-table .nutrient-protein{background:#dff0e3}
.data-table .nutrient-salt{background:#e4e8f4}
.data-table thead .col-typical{background:#dfeaf1}
.data-table thead .nutrient-kcal{background:#f8e8aa}
.data-table thead .nutrient-kj{background:#f8efc8}
.data-table thead .nutrient-fat{background:#eac8aa}
.data-table thead .nutrient-saturated-fat{background:#f1dcc9}
.data-table thead .nutrient-carbs{background:#e7bfc2}
.data-table thead .nutrient-sugar{background:#f0d0d2}
.data-table thead .nutrient-protein{background:#c8e4cf}
.data-table thead .nutrient-salt{background:#cfd6ea}
.group-row th{
  box-shadow:none!important;
}

/* A clone of the current table head follows the page under the sticky navigation. */
.floating-table-head{
  position:fixed;
  display:none;
  overflow:hidden;
  z-index:68;
  pointer-events:none;
  border-left:1px solid #dde2e7;
  border-right:1px solid #dde2e7;
  box-shadow:0 3px 8px rgba(24,31,38,.14);
  background:#fff;
}
.floating-table-head table{
  border-collapse:collapse;
  margin:0;
  table-layout:fixed;
}
.floating-table-head th{
  padding:8px 9px;
  text-align:right;
  vertical-align:middle;
  color:#4b545e;
  font-size:12px;
  border-bottom:1px solid #d8dde2;
  white-space:nowrap;
}
.floating-table-head th:first-child{text-align:left}
.floating-table-head .col-typical{background:#dfeaf1}
.floating-table-head .nutrient-kcal{background:#f8e8aa}
.floating-table-head .nutrient-kj{background:#f8efc8}
.floating-table-head .nutrient-fat{background:#eac8aa}
.floating-table-head .nutrient-saturated-fat{background:#f1dcc9}
.floating-table-head .nutrient-carbs{background:#e7bfc2}
.floating-table-head .nutrient-sugar{background:#f0d0d2}
.floating-table-head .nutrient-protein{background:#c8e4cf}
.floating-table-head .nutrient-salt{background:#cfd6ea}

.floating-hscroll{
  position:fixed;
  left:0;
  bottom:0;
  display:none;
  height:18px;
  overflow-x:auto;
  overflow-y:hidden;
  z-index:90;
  background:#eef1f4;
  border:1px solid #c8ced5;
  border-bottom:0;
}
.floating-hscroll-inner{height:1px}
body.has-floating-scrollbar{padding-bottom:18px}

/* Compact profile log with target percentages. */
.profile-log-table td,
.profile-log-table th{
  padding:4px 7px;
  line-height:1.15;
  white-space:nowrap;
}
.profile-log-table .mini-button{
  min-height:24px;
  padding:3px 6px;
  font-size:11px;
}
.log-nutrient-cell{
  min-width:112px;
}
.log-value{
  display:block;
  font-size:11px;
}
.log-pct{
  display:inline-block;
  margin-top:2px;
  padding:1px 5px;
  border-radius:999px;
  font-size:10px;
  font-weight:750;
}
.log-pct.low{background:#ffe9a6;color:#6e5200}
.log-pct.ok{background:#d8efdc;color:#205f2e}
.log-pct.high{background:#f7d4d4;color:#842e2e}
.log-pct.neutral{background:#e9edf1;color:#5f6872}

/* Preparation ingredient list has no status column anymore. */
.prep-ingredient-table th:nth-child(2),
.prep-ingredient-table td:nth-child(2){
  text-align:right;
}
.prep-ingredient-table th:nth-child(3),
.prep-ingredient-table td:nth-child(3){
  width:auto;
}

/* Keep content clear of sticky navigation when navigating to anchors. */
.view{scroll-margin-top:calc(var(--sticky-nav-height) + 12px)}

@media(max-width:760px){
  .topbar{align-items:flex-start}
  .floating-table-head th{padding:7px 8px;font-size:11px}
  .profile-log-table td,.profile-log-table th{padding:3px 6px}
}

/* Login background image. Background.jpg must be located next to this stylesheet in /assets. */
.auth-login-page{
  min-height:100vh;
  min-height:100dvh;
  background-image:url("Background.jpg");
  background-position:center center;
  background-size:cover;
  background-repeat:no-repeat;
  background-color:#20242a;
}
.auth-login-page .auth-card{
  position:relative;
  z-index:1;
}

/* --- Admin tools & bug reports --- */
.nav-badge-link{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:5px;
}
.notification-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#d92f3a;
  color:#fff;
  font-size:10px;
  line-height:1;
  font-weight:800;
  box-shadow:0 0 0 2px #20242a;
}
.active-nav-link{font-weight:800;text-decoration:underline!important;text-underline-offset:4px}
.session-settings-form{grid-template-columns:minmax(260px,420px) minmax(180px,1fr) auto;align-items:end}
.session-setting-hint{padding-bottom:10px;font-size:12px}
.narrow-wide-shell{max-width:980px;margin:0 auto}
.bugreport-create-form{display:grid;gap:12px}
.bugreport-list{display:grid;gap:12px}
.bugreport-card{margin:0}
.bugreport-card.is-unread{box-shadow:inset 4px 0 0 #d92f3a}
.bugreport-meta{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:10px}
.bugreport-text{white-space:normal;line-height:1.5;overflow-wrap:anywhere}
.bugreport-admin-form{display:grid;gap:10px;margin-top:16px;padding-top:14px;border-top:1px solid #e0e4e8}
.bugreport-response{margin-top:14px;padding:12px;border-radius:8px;background:#f2f5f7;border-left:4px solid #67727c;line-height:1.45}
.bugreport-response-head{font-weight:800;margin-bottom:5px}
.bugreport-response-date{margin-top:7px;font-size:11px}
.status.muted-status{background:#e7e9ec;color:#59616a}
@media(max-width:760px){
  .session-settings-form{grid-template-columns:1fr}
  .session-setting-hint{padding-bottom:0}
  .notification-badge{min-width:16px;height:16px;font-size:9px;padding:0 4px}
  .bugreport-meta{align-items:center}
}

/* --- Maintenance update: tracking, fiber, targets, dark mode --- */
.comment-header,.floating-table-head .comment-header{text-align:left!important}
.data-table .nutrient-fiber{background:#ece3f5}
.data-table thead .nutrient-fiber,.floating-table-head .nutrient-fiber{background:#d9c8ea}
.goal-bar{position:relative;overflow:hidden}
.goal-target-marker{position:absolute;top:-2px;bottom:-2px;width:2px;background:#1f252b;transform:translateX(-1px);z-index:3;pointer-events:none}
.daily-edit-form{grid-template-columns:minmax(120px,.8fr) minmax(170px,1fr) auto;max-width:620px;margin-top:0}
.tracking-settings-form{display:grid;gap:14px}
.tracking-fieldset{max-height:none;overflow:visible}
.tracking-options{display:grid;grid-template-columns:repeat(3,minmax(150px,1fr));gap:8px 14px}
.spline-toggle{padding-right:12px;border-right:1px solid #d7dde3;margin-right:2px;font-weight:750}
.bugreport-delete-form{margin-top:9px;display:flex;justify-content:flex-end}

@media(max-width:760px){
  .tracking-options{grid-template-columns:1fr 1fr}
  .daily-edit-form{grid-template-columns:1fr}
}
@media(max-width:480px){.tracking-options{grid-template-columns:1fr}}

@media (prefers-color-scheme: dark){
  :root{color:#e8edf2;background:#11151a;color-scheme:dark}
  body{background:#11151a;color:#e8edf2}
  .topbar{background:#090c10;color:#fff;box-shadow:0 1px 0 #303842}
  .tabs{background:#303842;border-bottom-color:#3a434d}
  .tab{background:#171c22;color:#e8edf2}
  .tab:hover{background:#20262d}
  .tab.active{background:#252c34;color:#fff;border-bottom-color:#d3dae1}
  .panel,.table-wrap,.timeline-scroll,.timeline-labels,.profile-chart,.auth-card{background:#1a2026;border-color:#37414b;color:#e8edf2}
  .muted,.goal-state,.nutrition-summary span,.dish-yield span{color:#aab4be}
  .message.error{background:#4b2024;color:#ffd8dc}
  .message.success{background:#183b26;color:#d8f4df}
  input,select,textarea{background:#12171c;color:#edf2f6;border-color:#46515d}
  input:disabled{color:#aab4be;background:#20262d}
  button,.button-link,.mini-button{background:#e6ebef;color:#11161b}
  .secondary,.secondary-link{background:#273039!important;color:#edf2f6!important;border-color:#4a5662!important}
  .ghost,.ghost-link{color:#bdc6cf!important}
  .danger{background:#a93d45!important;color:#fff!important}
  fieldset{border-color:#414c57}
  .data-table th,.data-table td{border-bottom-color:#303943;color:#e5ebf0}
  .data-table thead th{background:#242b32;color:#d3dbe3}
  .data-table tbody tr:hover td{box-shadow:inset 0 0 0 9999px rgba(255,255,255,.025)}
  .group-row th{background:#3a4753!important;color:#ffffff;border-top:2px solid #72879a;border-bottom:1px solid #596a79;box-shadow:inset 5px 0 0 #8da5ba}
  .row-warning td{background:#3b321d}
  .status.ok{background:#1d4a2b;color:#c9f1d2}
  .status.warn{background:#4a3816;color:#ffe1a3}
  .status.muted-status{background:#333a42;color:#c2c9d0}
  .dish-yield,.goal-card,.nutrition-summary div,.editor-row td{background:#20262d!important;border-color:#3c4650}
  .nutrition-summary{background:#3c4650;border-color:#3c4650}
  .goal-bar{background:#3b444d}
  .goal-target-marker{background:#f0f4f7}
  .profile-chart{background:#171c22}
  .timeline-layout{border-color:#3a444e}
  .timeline-labels{border-right-color:#3a444e}
  .timeline-label{border-bottom-color:rgba(255,255,255,.07);color:#edf2f6}
  .timeline-empty,.chart-empty{color:#aab4be}
  .floating-table-head{background:#1a2026;border-color:#3c4650;box-shadow:0 3px 8px rgba(0,0,0,.45)}
  .floating-table-head th{color:#d5dde5;border-bottom-color:#414b55}
  .floating-hscroll{background:#252d35;border-color:#4a5560}
  .data-table .col-typical{background:#22313a}
  .data-table .nutrient-kcal{background:#3a341b}
  .data-table .nutrient-kj{background:#312f20}
  .data-table .nutrient-fat{background:#38281f}
  .data-table .nutrient-saturated-fat{background:#30251f}
  .data-table .nutrient-carbs{background:#3b2226}
  .data-table .nutrient-sugar{background:#47262b}
  .data-table .nutrient-fiber{background:#30263c}
  .data-table .nutrient-protein{background:#20372a}
  .data-table .nutrient-salt{background:#222c42}
  .data-table thead .col-typical,.floating-table-head .col-typical{background:#2c414d}
  .data-table thead .nutrient-kcal,.floating-table-head .nutrient-kcal{background:#514824}
  .data-table thead .nutrient-kj,.floating-table-head .nutrient-kj{background:#48442c}
  .data-table thead .nutrient-fat,.floating-table-head .nutrient-fat{background:#4c3528}
  .data-table thead .nutrient-saturated-fat,.floating-table-head .nutrient-saturated-fat{background:#43332a}
  .data-table thead .nutrient-carbs,.floating-table-head .nutrient-carbs{background:#552e34}
  .data-table thead .nutrient-sugar,.floating-table-head .nutrient-sugar{background:#65343b}
  .data-table thead .nutrient-fiber,.floating-table-head .nutrient-fiber{background:#48365c}
  .data-table thead .nutrient-protein,.floating-table-head .nutrient-protein{background:#2d4d39}
  .data-table thead .nutrient-salt,.floating-table-head .nutrient-salt{background:#303e5d}
  .log-pct.low{background:#5a4517;color:#ffe49a}
  .log-pct.ok{background:#234c2d;color:#cef1d5}
  .log-pct.high{background:#5b292e;color:#ffd0d4}
  .log-pct.neutral{background:#353e47;color:#c8d0d8}
  .bugreport-admin-form{border-top-color:#3b4650}
  .bugreport-response{background:#252d35;border-left-color:#929da8}
  .user-card{border-color:#3a444e}
  .badge{border-color:#4d5965}
  .spline-toggle{border-right-color:#46515d}
  .auth-login-page .auth-card{background:rgba(24,30,36,.94)}
}


/* --- Compact actions, searchable selectors and activity display --- */
.actions-cell form{margin:0}
.user-last-activity{
  margin-left:auto;
  font-size:11px;
  font-weight:500;
  color:#6c7580;
  white-space:nowrap;
}
.searchable-select-wrap{
  position:relative;
  width:100%;
}
.searchable-select-input{width:100%}
.searchable-native{
  position:absolute!important;
  left:0!important;
  bottom:0!important;
  width:1px!important;
  height:1px!important;
  opacity:0!important;
  pointer-events:none!important;
  padding:0!important;
  border:0!important;
}
.searchable-select-menu{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 4px);
  display:none;
  max-height:280px;
  overflow:auto;
  background:#fff;
  border:1px solid #cbd2da;
  border-radius:8px;
  box-shadow:0 10px 28px rgba(25,32,39,.18);
  z-index:140;
}
.searchable-select-menu.open{display:block}
.searchable-select-option{
  width:100%;
  display:block;
  padding:8px 10px;
  border:0;
  border-radius:0;
  background:#fff;
  color:#20242a;
  text-align:left;
  font-weight:500;
  white-space:normal;
}
.searchable-select-option:hover,
.searchable-select-option.active{
  background:#eef2f5;
}
.searchable-select-empty{
  padding:9px 10px;
  color:#6c7580;
  font-size:12px;
}
@media(max-width:760px){
  .user-last-activity{width:100%;margin-left:0}
  .timeline-layout{grid-template-columns:105px minmax(0,1fr)}
  .timeline-label{height:30px;padding:3px 6px;font-size:10px}
  .timeline-svg{min-width:520px}
}
@media (prefers-color-scheme: dark){
  .user-last-activity{color:#aab4be}
  .searchable-select-menu{background:#171c22;border-color:#46515d;box-shadow:0 10px 28px rgba(0,0,0,.42)}
  .searchable-select-option{background:#171c22;color:#edf2f6}
  .searchable-select-option:hover,.searchable-select-option.active{background:#273039}
  .searchable-select-empty{color:#aab4be}
}
.page-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.off-import-form{display:grid;grid-template-columns:minmax(260px,1fr) auto;gap:10px;align-items:end}.off-import-form button{white-space:nowrap}@media(max-width:760px){.page-head{align-items:flex-start}.page-actions{justify-content:flex-end}.off-import-form{grid-template-columns:1fr}}

/* --- Overlay-Autocomplete, Log-Durchschnitt und eigene Trackingwerte --- */
.searchable-select-menu{
  position:fixed;
  right:auto;
  z-index:10000;
}
.log-average-block{
  margin-top:14px;
  padding:12px;
  border:1px solid #d6dce3;
  border-radius:10px;
  background:#f8fafb;
}
.log-average-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
  font-size:13px;
}
.log-average-head span{color:#6c7580;font-size:11px;white-space:nowrap}
.log-average-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:8px;
}
.nutrient-average-grid{margin-bottom:8px}
.average-card{
  min-width:0;
  padding:8px 9px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:8px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.average-card span{font-size:11px;color:#6c7580}
.average-card strong{font-size:13px;font-weight:700}
.average-card .log-pct{align-self:flex-start}
.compact-account-form{grid-template-columns:minmax(120px,180px) auto}
.custom-tracking-add{grid-template-columns:minmax(180px,1fr) minmax(100px,180px) auto}
.custom-tracking-list{margin-top:10px;display:grid;gap:6px}
.custom-tracking-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 8px;
  border:1px solid #dfe4e9;
  border-radius:8px;
  background:#fafbfc;
}
@media(max-width:760px){
  .log-average-head{align-items:flex-start;flex-direction:column;gap:2px}
  .log-average-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .compact-account-form,.custom-tracking-add{grid-template-columns:1fr}
}
@media (prefers-color-scheme: dark){
  .log-average-block{background:#14191e;border-color:#3b4651}
  .log-average-head span,.average-card span{color:#aab4be}
  .average-card{background:#1b2127;border-color:#3b4651}
  .custom-tracking-row{background:#171c22;border-color:#3b4651}
}


/* --- Log-Durchschnitt als Tabellenzeile, Tracking-Ziele, Zutaten-Suche --- */
.profile-log-average-row td{
  border-top:3px solid #66798a!important;
  border-bottom:2px solid #66798a!important;
  font-weight:650;
  background-clip:padding-box;
}
.profile-log-average-row td:first-child{white-space:nowrap}
.profile-log-average-row td:first-child small{display:block;font-size:10px;font-weight:500;color:#6c7580;margin-top:2px}
.tracking-targets-form{display:grid;gap:12px}
.tracking-target-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.tracking-target-grid label{display:grid;gap:5px;font-size:12px;font-weight:650}
.ingredient-list-search-wrap{position:relative;max-width:520px;margin:0 0 10px}
.ingredient-list-search-wrap label{display:grid;gap:5px;font-size:12px;font-weight:650}
.ingredient-list-search-menu{position:absolute;z-index:1200;left:0;right:0;top:100%;margin-top:4px;display:none;max-height:300px;overflow:auto;background:#fff;border:1px solid #cfd6dd;border-radius:8px;box-shadow:0 12px 28px rgba(0,0,0,.18)}
.ingredient-list-search-menu.open{display:block}
.ingredient-search-hit td{outline:2px solid #2f81f7;outline-offset:-2px;background:#eef6ff!important}
.ingredient-autofill-form{display:flex;gap:10px;align-items:end;padding-bottom:13px;margin-bottom:13px;border-bottom:1px solid #e1e6eb}
.ingredient-autofill-form label{flex:1}
@media (max-width:650px){.ingredient-autofill-form{align-items:stretch;flex-direction:column}}
@media (prefers-color-scheme:dark){
  .profile-log-average-row td{border-color:#7d93a6!important}
  .profile-log-average-row td:first-child small{color:#b4bec8}
  .ingredient-list-search-menu{background:#20262c;border-color:#4c5965;box-shadow:0 12px 30px rgba(0,0,0,.48)}
  .ingredient-search-hit td{outline-color:#77b7ff;background:#24384a!important}
  .ingredient-autofill-form{border-color:#3b4651}
}

/* --- Fix: Durchschnitt oben/abgetrennt, Zutaten-Suche als Viewport-Overlay --- */
.profile-log-average-row td{
  border-top:4px solid #52697c!important;
  border-bottom:4px solid #52697c!important;
}
.profile-log-average-spacer td{
  height:12px!important;
  min-height:12px!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}
.ingredient-list-search-menu-overlay{
  z-index:5000!important;
  right:auto!important;
  margin:0!important;
  overflow:auto;
}
@media (prefers-color-scheme:dark){
  .profile-log-average-row td{border-color:#91a9bb!important}
}

/* Regression-Fix: Zutatensuche nutzt die gleiche Autocomplete-Komponente wie Gerichte. */
.ingredient-list-search-wrap .searchable-select-wrap{width:100%;max-width:520px}
.ingredient-list-search-wrap{overflow:visible}

/* --- Mehrgeräte/Profil-Farben/Responsive Verlauf --- */
.profile-chart{overflow:hidden!important;width:100%;min-width:0}
.profile-chart svg{display:block;width:100%!important;max-width:100%;min-width:0!important}
.goal-card.negative .goal-bar span{background:hsl(var(--negative-hue,210) 68% 48%)}
.log-pct.negative{background:hsl(var(--negative-hue,210) 80% 90%);color:hsl(var(--negative-hue,210) 70% 28%)}
.value-negative{color:hsl(var(--negative-hue,210) 72% 42%);font-weight:750}
@media (prefers-color-scheme:dark){
  .log-pct.negative{background:hsl(var(--negative-hue,210) 45% 28%);color:hsl(var(--negative-hue,210) 85% 86%)}
  .value-negative{color:hsl(var(--negative-hue,210) 80% 72%)}
}


/* --- Globale Zielbereich-Farben (Admin konfigurierbar) --- */
.goal-card.negative .goal-bar span{background:hsl(var(--negative-hue,210),68%,48%)}
.goal-card.low .goal-bar span{background:hsl(var(--low-hue,45),68%,48%)}
.goal-card.ok .goal-bar span{background:hsl(var(--ok-hue,125),55%,42%)}
.goal-card.high .goal-bar span{background:hsl(var(--high-hue,0),58%,50%)}
.log-pct.negative{background:hsl(var(--negative-hue,210),80%,90%);color:hsl(var(--negative-hue,210),70%,28%)}
.log-pct.low{background:hsl(var(--low-hue,45),85%,82%);color:hsl(var(--low-hue,45),75%,24%)}
.log-pct.ok{background:hsl(var(--ok-hue,125),55%,86%);color:hsl(var(--ok-hue,125),65%,24%)}
.log-pct.high{background:hsl(var(--high-hue,0),68%,88%);color:hsl(var(--high-hue,0),68%,30%)}
.value-negative{color:hsl(var(--negative-hue,210),72%,42%);font-weight:750}
@media (prefers-color-scheme:dark){
  .log-pct.negative{background:hsl(var(--negative-hue,210),45%,28%);color:hsl(var(--negative-hue,210),85%,86%)}
  .log-pct.low{background:hsl(var(--low-hue,45),48%,27%);color:hsl(var(--low-hue,45),88%,82%)}
  .log-pct.ok{background:hsl(var(--ok-hue,125),40%,25%);color:hsl(var(--ok-hue,125),80%,84%)}
  .log-pct.high{background:hsl(var(--high-hue,0),42%,27%);color:hsl(var(--high-hue,0),82%,86%)}
  .value-negative{color:hsl(var(--negative-hue,210),80%,72%)}
}
