/* Tablet-Layout (Familienbildschirm, ≥ 900 px quer). Bewusste Abweichung von Basis §10:
   eigenes Layout statt Hochskalieren. Greift nur unter body.layout-tablet. */

body.layout-tablet { font-size: 18px; }

body.layout-tablet .shell {
  max-width: none;
  display: grid;
  grid-template-columns: 96px 1fr;
  height: 100dvh;
  overflow: hidden;
}

body.layout-tablet .main { display: flex; flex-direction: column; min-width: 0; height: 100dvh; }

body.layout-tablet .view {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px calc(env(safe-area-inset-right) + 20px) calc(env(safe-area-inset-bottom) + 16px) 20px;
}

/* Linke Icon-Leiste */
.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: calc(env(safe-area-inset-top) + 14px) 8px 14px calc(env(safe-area-inset-left) + 8px);
  background: #fff;
  border-right: 1px solid var(--line);
}
.sidebar-logo { font-size: 2rem; margin-bottom: 10px; }
.side-item {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  border-radius: 16px;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 0.75rem;
}
.side-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.side-icon { font-size: 1.8rem; }

/* Kopfzeile: Uhr, Haushalt, Datum, Personenfilter */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: calc(env(safe-area-inset-top) + 12px) 20px 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-time { font-size: 1.6rem; font-weight: 700; white-space: nowrap; }
.topbar-clock { font-variant-numeric: tabular-nums; }
.topbar-sep { color: var(--line); margin: 0 8px; }
.topbar-household { font-weight: 600; color: var(--muted); }
.topbar-date { color: var(--muted); white-space: nowrap; }
.topbar-filter { margin-left: auto; overflow-x: auto; }
body.layout-tablet .pf { font-size: 0.95rem; padding: 4px 14px 4px 4px; }
body.layout-tablet .pf .avatar-sm { width: 34px; height: 34px; font-size: 1.2rem; }

/* Kopfleiste des Kalenders */
body.layout-tablet .cal-toolbar { flex-wrap: nowrap; }
body.layout-tablet .cal-title { text-align: left; font-size: 1.35rem; order: -1; flex: 1; }
body.layout-tablet .seg { flex-basis: auto; }
body.layout-tablet .seg button { padding: 8px 16px; font-size: 0.95rem; }

/* Zeitraster */
.tgrid { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: calc(100dvh - 190px); }
.tg-head, .tg-allday, .tg-body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.tg-head { border-bottom: 1px solid var(--line); }
.tg-corner { font-size: 0.7rem; color: var(--muted); padding: 6px 4px; text-align: right; }
.tg-colhead { padding: 6px; text-align: center; border-left: 1px solid var(--line); min-width: 0; }
.dayhead { border: 0; background: none; display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; }
.dayhead.today { background: var(--brand); color: #fff; }
.dh-wd { font-size: 0.85rem; text-transform: uppercase; }
.dh-num { font-size: 1.3rem; font-weight: 700; }
.phead { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--pfg, var(--ink)); }
.tg-allday { border-bottom: 1px solid var(--line); background: #fdfbf9; }
.ad-cell { border-left: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; min-width: 0; }
.tgrid-scroll { flex: 1 1 auto; overflow-y: auto; }
.tg-body { padding: 8px 0 4px; }
.tg-hours { position: relative; }
.hour { position: absolute; right: 6px; transform: translateY(-50%); font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hour:first-child { transform: none; }
.grid-col {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 51px, var(--line) 51px, var(--line) 52px);
  cursor: copy;
}
.grid-col.is-today { background-color: #fffaf5; }
.block-wrap { position: absolute; padding: 1px 2px; }
.block-wrap .occ { height: 100%; align-items: flex-start; flex-wrap: wrap; align-content: flex-start; white-space: normal; font-size: 0.85rem; padding: 4px 6px; }
.block-wrap .occ-title { white-space: normal; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }

/* Monatsraster */
.month { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.month .wd-row { font-size: 0.85rem; text-transform: uppercase; padding: 4px 0; }
.month .mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(110px, 1fr); gap: 4px; }
.mcell { border-radius: 10px; background: #fdfbf9; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; overflow: hidden; }
.mcell.other { opacity: 0.45; }
.mcell.today { background: var(--brand-light); box-shadow: inset 0 0 0 2px var(--brand); }
.mnum { font-weight: 700; font-size: 0.95rem; padding: 0 2px; }
.mcell .occ { font-size: 0.75rem; min-height: 20px; padding: 2px 5px; }
.more { font-size: 0.75rem; color: var(--muted); padding-left: 4px; }

/* Dialoge mittig statt als Blatt von unten */
body.layout-tablet .dialog-backdrop { align-items: center; }
body.layout-tablet .dialog { border-radius: 22px; max-width: 640px; padding: 22px; }
body.layout-tablet .toast { bottom: 24px; }
body.layout-tablet .card { max-width: 860px; }

/* Aufgaben: eine Spalte je Person */
body.layout-tablet .task-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; align-items: start; }
body.layout-tablet .task-card { min-height: 64px; font-size: 1.05rem; }
body.layout-tablet .task-emoji { font-size: 1.9rem; }
