/* Mobile-first additions to Pico. Theme "Alpin klar": ice-blue background, white cards,
   mountain-blue accent. The app always uses the light theme (data-theme="light"). */
:root[data-theme="light"] {
  --pico-font-size: 100%;
  --pico-border-radius: .6rem;
  --pico-background-color: #f3f7fb;
  --pico-card-background-color: #fff;
  --pico-card-sectioning-background-color: #f8fafc;
  --pico-card-box-shadow: 0 1px 2px rgba(16, 42, 67, .06), 0 4px 16px rgba(16, 42, 67, .06);
  --pico-muted-border-color: #e1e8f0;
  --pico-color: #243b53;
  --pico-h1-color: #102a43;
  --pico-h2-color: #102a43;
  --pico-h3-color: #1d3a5c;
  --pico-muted-color: #627d98;
  --pico-primary: #1d4e89;
  --pico-primary-background: #1d4e89;
  --pico-primary-border: #1d4e89;
  --pico-primary-underline: rgba(29, 78, 137, .4);
  --pico-primary-hover: #163d6b;
  --pico-primary-hover-background: #163d6b;
  --pico-primary-hover-border: #163d6b;
  --pico-primary-focus: rgba(29, 78, 137, .25);
  --pico-primary-inverse: #fff;
  --accent-soft: #e6eef7;
}
body { background: var(--pico-background-color); }
main.container { padding-top: 2rem; padding-bottom: 3rem; }
h1 { letter-spacing: -.01em; }
article { border: 1px solid var(--pico-muted-border-color); }
button, [role="button"] { font-weight: 500; }

/* Header bar spans the full width, its content is centred */
.site-header {
  background: var(--pico-card-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 1px 8px rgba(16, 42, 67, .04);
}
nav { flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--pico-h1-color); }
.brand .icon { color: var(--pico-primary); }
.nav-links a { color: var(--pico-color); font-size: .95rem; border-radius: .4rem; }
.nav-links a:hover { color: var(--pico-primary); background: var(--accent-soft); }
.nav-links a[aria-current="page"] { color: var(--pico-primary); background: var(--accent-soft); font-weight: 600; }
.nav-toggle { display: none; width: auto; height: auto; align-self: center; padding: .25rem .75rem; margin: 0; }

@media (max-width: 1024px) {
  .nav-toggle { display: inline-block; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .nav-links.is-open { display: flex; }
  .nav-links li { padding: .1rem 0; }
}

.flash { padding: .75rem 1rem; margin-bottom: 1.5rem; }
.flash-error { border-left: 4px solid var(--pico-del-color); }
.flash-success { border-left: 4px solid var(--pico-ins-color); }

/* Tables sit on white cards; wide tables scroll horizontally on mobile */
table {
  --pico-background-color: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius); overflow: hidden; box-shadow: var(--pico-card-box-shadow);
}
th { font-size: .85rem; color: var(--pico-muted-color); }
.table-scroll { overflow-x: auto; }

.logout-form { display: flex; align-items: center; gap: .5rem; margin: 0; }
.logout-form button { width: auto; padding: .25rem .75rem; margin: 0; font-size: .9rem; }
.login-card { max-width: 24rem; margin: 3rem auto; padding: 2rem; }

/* Home page */
.hero { margin-bottom: 2.5rem; }
.hero h1 { font-size: 2.25rem; margin: 0 0 .75rem; }
.hero .lead { font-size: 1.1rem; max-width: 42rem; color: var(--pico-color); }
.hero [role="button"] { width: auto; }
.eyebrow { color: var(--pico-primary); font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem; }
.module-card {
  display: flex; flex-direction: column; gap: .4rem; padding: 1.25rem;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius); box-shadow: var(--pico-card-box-shadow);
  color: var(--pico-color); text-decoration: none; transition: border-color .15s, transform .15s;
}
.module-card:hover { border-color: var(--pico-primary); transform: translateY(-2px); }
.module-card strong { color: var(--pico-h1-color); font-size: 1.1rem; }
.module-text { font-size: .9rem; flex: 1; }
.module-stat { color: var(--pico-primary); font-weight: 600; }
.module-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
  border-radius: .6rem; background: var(--accent-soft); color: var(--pico-primary); margin-bottom: .25rem;
}

.form-error { color: var(--pico-del-color); display: block; margin-bottom: var(--pico-spacing); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; margin: 0; }
.row-actions a { margin-right: .75rem; }
.link-button {
  background: none; border: none; padding: 0; margin: 0; width: auto;
  color: var(--pico-del-color); text-decoration: underline; cursor: pointer;
}

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { margin-bottom: 0; }
.page-header a[role="button"] { width: auto; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 .75rem; }
.result-count { color: var(--pico-muted-color); margin-bottom: .5rem; }
.participant-table th a { text-decoration: none; white-space: nowrap; }
.participant-table td, .participant-table th { padding: .4rem .5rem; }

.header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.header-actions a[role="button"] { width: auto; }
.change-list { padding-left: 1.25rem; }
.change-fields { margin: .25rem 0 .75rem; font-size: .9em; }
.change-fields del { color: var(--pico-del-color); }
.change-fields ins { color: var(--pico-ins-color); text-decoration: none; }

/* Assignment boards */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; align-items: start; }
.board-column {
  border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: .9rem;
  background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow);
}
.board-column header { display: flex; flex-direction: column; margin-bottom: .5rem; }
.board-column.unassigned { border-style: dashed; background: transparent; box-shadow: none; border-color: #b6c6d8; }
.board-column.over-capacity { border-color: var(--pico-del-color); }
.board-column.over-capacity .occupancy { color: var(--pico-del-color); font-weight: bold; }
.column-actions { display: flex; gap: .75rem; font-size: .85em; }
.column-actions form { margin: 0; }
.board-list { list-style: none; padding: 0; margin: 0; min-height: 2.5rem; }
.board-list .card {
  list-style: none; padding: .4rem .6rem; margin-bottom: .4rem; border-radius: var(--pico-border-radius);
  background: var(--accent-soft); border: 1px solid transparent;
  display: flex; flex-direction: column;
}
.unassigned .board-list .card { background: var(--pico-card-background-color); border-color: var(--pico-muted-border-color); }
.board-list[data-sortable] .card { cursor: grab; }
.mismatch { color: var(--pico-del-color); font-weight: bold; }

/* Weekly schedule: blocks are positioned in minutes since the start of the visible range */
.calendar { --scale: 1.1px; }
.calendar-grid {
  display: grid; grid-template-columns: 3rem repeat(var(--days), minmax(8rem, 1fr)); overflow-x: auto;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius); box-shadow: var(--pico-card-box-shadow); padding: .5rem .5rem .75rem 0;
}
.cal-header { height: 2.5rem; display: flex; justify-content: center; align-items: center; gap: .5rem; font-weight: bold; }
.cal-header a { text-decoration: none; }
.cal-body {
  position: relative; height: calc(var(--range) * var(--scale));
  border-left: 1px solid var(--pico-muted-border-color);
  background: repeating-linear-gradient(to bottom, var(--pico-muted-border-color) 0 1px, transparent 1px calc(60 * var(--scale)));
}
.time-axis .cal-body { border-left: none; background: none; }
.time-axis span { position: absolute; top: calc(var(--top) * var(--scale)); right: .25rem; font-size: .7rem; color: var(--pico-muted-color); }
.block {
  position: absolute; left: 2px; right: 2px;
  top: calc(var(--top) * var(--scale)); height: calc(var(--height) * var(--scale));
  overflow: hidden; padding: 2px 6px; border-radius: 6px; font-size: .78rem; line-height: 1.2;
  display: flex; flex-direction: column; text-decoration: none; hyphens: auto;
  background: var(--pico-primary-background); color: var(--pico-primary-inverse);
}
.block small { font-size: .7rem; }
.block-internal {
  background: var(--pico-card-background-color); color: var(--pico-color);
  border: 2px dashed var(--pico-secondary-border);
}
.day-nav { display: none; justify-content: space-between; margin-bottom: .5rem; }
.day-nav button { width: auto; padding: .25rem 1rem; }
@media (max-width: 768px) {
  .day-nav { display: flex; }
  .calendar-grid { grid-template-columns: 3rem 1fr; }
  .day-column { display: none; }
  .day-column.is-active { display: block; }
}

/* Task areas */
.area-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.notes-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.notes-footer button { width: auto; margin: 0; }

/* Kitchen */
.subnav { display: flex; justify-content: flex-start; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.subnav a {
  text-decoration: none; padding: .35rem .9rem; border-radius: 999px; font-size: .95rem;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color); color: var(--pico-color);
}
.subnav a[aria-current="page"] { background: var(--pico-primary); border-color: var(--pico-primary); color: #fff; }
.muted { color: var(--pico-muted-color); }
.dinner-list {
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius); box-shadow: var(--pico-card-box-shadow); padding: .25rem 1rem;
}
.dinner-list .dinner-row:last-child { border-bottom: none; }
.dinner-row { display: grid; grid-template-columns: 6rem 1fr auto; gap: .75rem; align-items: center; padding: .25rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.dinner-row form, .dinner-row select { margin: 0; }
.saved { color: var(--pico-ins-color); }
.qty { white-space: nowrap; text-align: right; width: 1%; }
.item-row { display: grid; grid-template-columns: 2fr 1fr 1fr 2.75rem; gap: .5rem; align-items: start; }
.item-row[hidden] { display: none; }
.remove-row { width: 2.75rem; padding: .5rem 0; margin: 0; }
.item-row.is-deleted input { text-decoration: line-through; opacity: .45; }
#add-row { width: auto; }
.items-heading { font-size: 1.25rem; margin-top: 1.5rem; }
.items-heading small { font-size: .85rem; font-weight: normal; color: var(--pico-muted-color); }
.item-row input { margin-bottom: .25rem; }
.item-row-head { font-size: .8rem; color: var(--pico-muted-color); }
@media print {
  header, .subnav, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  table { box-shadow: none; }
  .shopping-list td { padding: .15rem .5rem; }
}
