/* Cravex — Today home, trimmed navigation, mobile bottom bar, attendance sheet. */

/* ── Today hero ─────────────────────────────────────────────────────── */
.today-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 4px 0 22px;
}
.today-hero h2 {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.5px;
  margin: 2px 0 6px;
}
.today-hero p { color: #666; font-size: 14px; margin: 0; max-width: 560px; }
.today-date {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #777;
}

/* ── Today grid & cards ─────────────────────────────────────────────── */
.today-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.today-grid > div { min-width: 0; }
.today-card { margin: 0; }
.today-card.wide { grid-column: 1 / -1; }
.today-card .card-hd h3 { display: flex; align-items: center; gap: 8px; }
.today-count {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--accent-soft, var(--surface));
  color: var(--accent-muted, var(--black));
  font-size: 12px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
}
.link-btn {
  background: none;
  border: 0;
  color: #555;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 4px;
}
.link-btn:hover { color: var(--black); text-decoration: underline; }

.today-body { padding: 4px 0; }
.today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.today-row:last-child { border-bottom: 0; }
.today-row-main { min-width: 0; flex: 1; }
.today-row-title { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.today-row-title .muted { color: #888; font-weight: 400; }
.today-row-sub { font-size: 12px; color: #777; margin-top: 3px; }
.today-row-act { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.today-foot { padding: 12px 18px 14px; }
.today-note {
  margin: 4px 18px 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--amberl);
  color: #92400e;
  font-size: 13px;
}

.chip {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.chip-ok { background: var(--greenl); color: #15803d; }
.chip-todo { background: var(--amberl); color: #b45309; }

.btn-big {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 10px;
}

/* inbox */
.inbox-reason {
  margin-top: 10px;
  width: 100%;
  max-width: 360px;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.inbox-row.done { opacity: 0.4; transition: opacity 0.3s; }
.inbox-act { align-self: flex-start; }

/* checklist */
.progress {
  margin: 14px 18px 6px;
  height: 8px;
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}
.progress-bar { height: 100%; background: var(--accent, var(--green)); border-radius: 4px; }
.progress-lbl { margin: 0 18px 8px; font-size: 12px; color: #777; }
.check-row { justify-content: flex-start; }
.check-dot {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}
.check-row.ok .check-dot { background: var(--green); border-color: var(--green); }
.check-row.ok .today-row-title { color: #777; }

/* health tiles */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px 18px 18px;
}
.health-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
}
.health-tile:hover { border-color: var(--border2); }
.health-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: #777; }
.health-val { font-family: 'DM Serif Display', serif; font-size: 30px; line-height: 1.1; }
.health-sub { font-size: 12px; color: #777; }

/* useful empty states */
.empty-next {
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-next-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 4px;
}
.empty-next-title { font-size: 14px; font-weight: 500; }
.empty-next-hint { font-size: 13px; color: #777; max-width: 380px; line-height: 1.5; }
.empty-next .btn-sm { margin-top: 8px; }

/* attendance launcher */
.launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px 18px 18px;
}
.launch-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
}
.launch-tile:hover { border-color: var(--accent, var(--black)); }
.launch-title { font-weight: 500; font-size: 14px; }
.launch-sub { font-size: 12px; color: #777; }

/* ── Navigation: "More" group ───────────────────────────────────────── */
.nav-more-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: #777;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
}
.nav-more-toggle:hover { background: var(--surface); color: var(--black); }
.nav-more-caret { margin-left: auto; transition: transform 0.15s; }
.nav-more { display: none; }
.sb-nav.more-open .nav-more { display: block; }
.sb-nav.more-open .nav-more-caret { transform: rotate(180deg); }

/* ── Mobile bottom tab bar ──────────────────────────────────────────── */
.bottom-bar { display: none; }

@media (max-width: 768px) {
  .bottom-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bb-item {
    flex: 1;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    font: inherit;
    color: #777;
    border-radius: 10px;
    cursor: pointer;
  }
  .bb-icon { font-size: 18px; line-height: 1; }
  .bb-label { font-size: 11px; }
  .bb-item.active { color: var(--black); font-weight: 600; }
  .bb-item.active .bb-icon { color: var(--accent, var(--black)); }

  #app .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .today-grid { grid-template-columns: 1fr; gap: 12px; }
  .today-hero { margin-top: 0; }
  .today-hero h2 { font-size: 26px; }
  .today-hero .role-badge { display: none; }
  .today-row { padding: 14px 16px; }
  .class-row { flex-direction: column; align-items: stretch; }
  .class-row .today-row-act .btn-big { width: 100%; }
  .inbox-row { flex-direction: column; align-items: stretch; }
  .inbox-reason { max-width: none; }
  .inbox-act .btn-sm { flex: 1; min-height: 44px; }
}

/* ── Attendance sheet ───────────────────────────────────────────────── */
body.sheet-open { overflow: hidden; }
.att-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, 0.4);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.att-sheet.open { display: flex; }
.att-panel {
  background: var(--white);
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.att-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.att-close {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.att-title { font-weight: 600; font-size: 16px; }
.att-sub { font-size: 12px; color: #777; margin-top: 2px; }
.att-body { overflow-y: auto; padding: 14px 18px; flex: 1; }
.att-hint { font-size: 13px; color: #666; margin-bottom: 12px; }
.att-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.att-tile {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #bbf7d0;
  background: #f0fdf4;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.att-roll {
  grid-row: 1 / span 2;
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.att-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-state { font-size: 11px; color: #15803d; font-weight: 600; }
.att-tile.absent { border-color: #fecaca; background: #fef2f2; }
.att-tile.absent .att-state { color: #b91c1c; }
.att-tile:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.att-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--white);
}
.att-counts { display: flex; gap: 14px; font-size: 14px; font-weight: 600; }
.att-counts .ok { color: #15803d; }
.att-counts .bad { color: #b91c1c; }
.att-foot-btns { display: flex; gap: 8px; align-items: center; }
.att-reset { min-height: 44px; }

@media (max-width: 768px) {
  .att-sheet { padding: 0; align-items: stretch; }
  .att-panel { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .att-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .att-tile { min-height: 76px; }
  .att-foot { flex-direction: column; align-items: stretch; }
  .att-counts { justify-content: center; }
  .att-foot-btns .btn-big { flex: 1; min-height: 52px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-more-caret, .inbox-row.done { transition: none; }
}

/* Support chat bubble: keep it clear of the bottom bar and the attendance sheet. */
html body.sheet-open #dxBotBubble,
html body.sheet-open #dxBotPanel { display: none; }
@media (max-width: 768px) {
  html body #dxBotBubble { bottom: calc(76px + env(safe-area-inset-bottom)); right: 14px; width: 46px; height: 46px; }
  html body #dxBotPanel { bottom: calc(132px + env(safe-area-inset-bottom)); }
}

/* Buttons/inputs don't inherit the page font by default. */
button, input, select, textarea { font-family: inherit; }
.today-grid .today-card { margin: 0; }

@media (max-width: 768px) {
  /* keep floating elements off the open menu and above the bottom bar */
  #app.sidebar-open ~ #dxBotBubble, #app.sidebar-open ~ #dxBotPanel { display: none; }
  html body .toast { bottom: calc(80px + env(safe-area-inset-bottom)); left: 16px; right: 16px; text-align: center; }
}
