/* Phone overrides. Loaded with media="(max-width: 767.98px)" in index.html,
   so nothing here can affect tablet or desktop layouts. */

/* iOS Safari zooms the page when focusing a field under 16px. */
.form-control,
.form-select,
textarea,
.compact-task-form .form-control,
.compact-task-form .form-select,
.compact-task-form textarea,
#descriptionEditor .ql-container,
#resolutionEditor .ql-container,
.ql-editor {
  font-size: 16px;
}

/* KPI cards: two-up grid instead of five full-width stacked cards.
   Project Time (3rd in the DOM) moves last and spans the full row. */
#section-overview .row > .col-md {
  flex: 0 0 50%;
  max-width: 50%;
  margin-bottom: 0;
}
#section-overview .row > .col-md:nth-child(3) {
  order: 1;
  flex-basis: 100%;
  max-width: 100%;
}
.kpi-card {
  padding: 10px 12px;
}
.kpi-icon {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  margin-right: 0.6rem !important;
}
.kpi-card .text-uppercase {
  font-size: 0.68rem;
  line-height: 1.2;
}

/* Full-screen modals: keep the footer clear of the home indicator. */
.modal-fullscreen-sm-down .modal-content {
  padding-bottom: env(safe-area-inset-bottom);
}

.main-content {
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
}

/* ---------- Header + bottom tab bar ---------- */
:root {
  --topbar-height: 48px;
  --tabbar-height: 56px;
}
.navbar .navbar-brand {
  font-size: 1rem;
}
.horizontal-nav {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 0.25rem env(safe-area-inset-bottom);
  padding-left: max(0.25rem, env(safe-area-inset-left));
  padding-right: max(0.25rem, env(safe-area-inset-right));
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
}
.horizontal-nav .nav {
  gap: 0;
}
.horizontal-nav .nav-link {
  flex-direction: column;
  gap: 0.15rem;
  height: var(--tabbar-height);
  padding: 0.35rem 0.1rem;
  font-size: 0.65rem;
  border-radius: 0;
  border-bottom: none;
  border-top: 3px solid transparent;
}
.horizontal-nav .nav-link i {
  font-size: 1.15rem;
}
.horizontal-nav .nav-link.active {
  background: none;
  border-top-color: #2563eb;
}
body {
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
}

/* ---------- List controls ---------- */
/* Not sticky: with the tabs at the bottom there is nothing to stack under,
   and a sticky search bar costs a third of the screen. */
.list-controls {
  position: static;
  box-shadow: none !important;
}
.list-controls > .d-flex {
  width: 100%;
}
/* Sort button and the deletion switch share one line. */
.list-controls .list-controls-actions {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.5rem !important;
}
.list-controls .list-controls-actions .form-check-label {
  white-space: nowrap;
}
.list-controls .input-group {
  width: 100% !important;
}
/* Undo the tablet rule that forces the input to 100% and breaks the group. */
.list-controls #taskSearchInput {
  width: 1% !important;
  flex: 1 1 auto;
}

/* ---------- Compact task cards ---------- */
/* Layout per row: checkbox on the left, title + note on top, then a single
   wrapping line of chips (priority, category, times, due, owner, tags). */
.card.p-4 {
  padding: 0.75rem !important;
}
.card.p-4 .title-row-offset .btn {
  position: static;
  transform: none;
  margin-left: auto;
}
.task-list-table tbody tr {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.35rem;
  padding: 0.6rem 0.6rem 0.6rem 2.6rem;
}
/* :nth-child(n) matches every cell; it is only there to outrank the
   desktop column-width rules (e.g. .task-list-table td:nth-child(4)). */
.task-list-table tbody tr td:nth-child(n) {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
}
.task-list-table tbody tr td {
  display: block;
  background: transparent;
  box-shadow: none;
  border: none;
  overflow: visible;
  font-size: 0.78rem;
  color: #475569;
}
.task-list-table tbody tr td::before {
  content: none;
}
.task-list-table tbody tr td:empty,
.task-list-table tbody tr td[data-label="Campus"],
.task-list-table .drag-handle,
.task-list-table tbody tr.end-drop-zone {
  display: none;
}
/* Empty-state rows ("No active tasks.") stay a plain centered line. */
.task-list-table tbody tr:not(.end-drop-zone):has(> td[colspan]) {
  display: block;
  padding: 0.5rem;
}
.task-list-table tbody tr td[colspan] {
  display: block;
  width: 100% !important;
  text-align: center;
}
.task-list-table tbody tr td[data-label="Done"],
.task-list-table tbody tr td[data-label="Restore"] {
  position: absolute;
  left: 0.6rem;
  top: 0.65rem;
}
.task-list-table tbody tr td[data-label="Task"] {
  flex: 1 1 100%;
  font-size: 0.95rem;
  color: inherit;
}
.task-list-table .task-title-link {
  padding: 0;
  line-height: 1.3;
}
.task-list-table tbody tr td[data-label="Task"] small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
}
.task-list-table tbody tr td[data-label="Est Time"]::before {
  content: "Est ";
}
.task-list-table tbody tr td[data-label="Time Worked"]::before {
  content: "Worked ";
}
.task-list-table tbody tr td[data-label="Due Date"]::before {
  content: "Due ";
}
.task-list-table tbody tr td[data-label="Est Time"]::before,
.task-list-table tbody tr td[data-label="Time Worked"]::before,
.task-list-table tbody tr td[data-label="Due Date"]::before,
.task-list-table tbody tr td[data-label="Owner"]::before {
  min-width: 0;
  margin: 0;
  font-size: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #94a3b8;
}
.task-list-table tbody tr td[data-label="Owner"]::before {
  content: "\f007";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.25rem;
  font-size: 0.65rem;
}
.task-list-table tbody tr td[data-label="Est Time"],
.task-list-table tbody tr td[data-label="Time Worked"],
.task-list-table tbody tr td[data-label="Due Date"],
.task-list-table tbody tr td[data-label="Owner"] {
  white-space: nowrap;
}
.task-list-table .due-date-status {
  display: inline;
  margin-left: 0.25rem;
}
.task-list-table tbody tr td[data-label="Tags"] .badge {
  margin-right: 0.15rem !important;
}

/* Reorder buttons replace the drag handle (they share its cell); flex
   order puts them at the end of the chip line, right-aligned. Completed
   rows' handle cell is empty and stays hidden. */
.task-list-table tbody tr td.drag-handle-cell:not(:empty) {
  display: block;
  order: 1;
  margin-left: auto;
}
.task-move-btns {
  display: inline-flex;
  gap: 0.25rem;
}
.task-move-btns .btn {
  padding: 0.15rem 0.45rem;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

/* ---------- Calendar ---------- */
/* Toolbar: two short rows instead of four.
   Row 1: [3 Day | Monthly] ........ [G ▾] [⟳ Sync]
   Row 2: ‹ Oct 28 – 30, 2026 ›                     */
#section-calendar > .overview-calendar-card {
  padding: 0.5rem !important;
}
.overview-calendar-toolbar {
  margin-bottom: 0.5rem !important;
  row-gap: 0.25rem !important;
}
/* The bottom tab bar already says "Calendar". */
.overview-calendar-toolbar h5 {
  display: none;
}
.overview-calendar-toolbar-actions {
  margin-left: auto !important;
  flex-wrap: nowrap !important;
  gap: 0.35rem !important;
}
/* Shorten the Google buttons; the full text stays as the accessible name. */
#gcalBtn,
#syncCalendarBtn {
  font-size: 0;
}
#gcalBtn i,
#syncCalendarBtn i {
  font-size: 0.875rem;
  margin-right: 0 !important;
}
/* Bootstrap sizes the caret in em, so give it a font size back. */
#gcalBtn::after {
  font-size: 0.875rem;
  margin-left: 0.3rem;
}
#syncCalendarBtn i::before {
  content: "\f021";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}
/* On the icon, not the button: the button's ::after is the touch hit area. */
#syncCalendarBtn i::after {
  content: "Sync";
  margin-left: 0.3rem;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 400;
}
.overview-calendar-nav-center {
  margin-top: 0 !important;
}
.calendar-schedule-btn {
  display: inline-block;
  margin-top: 0.4rem;
}
.calendar-waiting-item .calendar-schedule-btn {
  margin-top: 0.3rem;
}
/* Drag hints don't apply on phones; the Schedule buttons replace dragging. */
.overview-task-pool .d-flex > .small.text-muted {
  display: none;
}

/* ---------- Notes ---------- */
/* Header row (timestamp, badges, Edit/Delete) wraps instead of pushing the
   actions off-screen; long emails break inside their badge. */
.note-card > .d-flex:first-child {
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}
.note-card > .d-flex:first-child .badge {
  margin-left: 0 !important;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.note-card > .d-flex:first-child > div:last-child {
  order: 2;
  flex: none;
  margin-left: auto;
  white-space: nowrap;
}
/* Row 1: timestamp and Question badge. Row 2: email and actions.
   The zero-height ::after takes a whole line, forcing the break. */
.note-card > .d-flex:first-child {
  row-gap: 0.125rem;
}
.note-card > .d-flex:first-child::after {
  content: "";
  order: 1;
  flex-basis: 100%;
}
/* The email shares row 2 with the actions, clipping its end when it doesn't
   fit. A zero basis keeps flexbox from wrapping it onto its own line; it
   then grows back to its natural width when there is room. */
.note-card > .d-flex:first-child .note-user-badge {
  order: 2;
  flex: 1 1 0;
  min-width: 0;
  max-width: max-content;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.note-user-badge > i {
  flex: none;
}
.note-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Fade the clipped end instead of an ellipsis. A scroll timeline is only
   active when the name actually overflows, so names that fit stay crisp. */
@supports (animation-timeline: scroll()) {
  .note-user-name {
    text-overflow: clip;
    animation: note-user-fade linear both;
    animation-timeline: scroll(self inline);
  }
  @keyframes note-user-fade {
    from,
    to {
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent);
      mask-image: linear-gradient(to right, #000 calc(100% - 1.75rem), transparent);
    }
  }
}
.note-card {
  padding: 8px 10px;
}
.note-content {
  overflow-wrap: anywhere;
}
/* Quill indents lists 3em per level; 1em per level fits a phone. */
.note-content .ql-reader {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}
.note-content .ql-editor ol,
.note-content .ql-editor ul {
  padding-left: 0.25em;
}
.note-content .ql-editor li:not(.ql-direction-rtl) {
  padding-left: 1.25em;
}
.note-content .ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
  padding-left: 2.25em;
}
.note-content .ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
  padding-left: 3.25em;
}
.note-content .ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
  padding-left: 4.25em;
}
.note-content .ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
  padding-left: 5.25em;
}
/* Replies are indented 1.5rem plus padding; halve that on phones. */
#notesContainer > .ms-4 {
  margin-left: 0.5rem !important;
  padding-left: 0.5rem !important;
}
/* Header: the task title gets the whole first line; Actions and the close
   button sit right-aligned on a second line. */
#notesModal .modal-header {
  flex-wrap: wrap;
  row-gap: 0.4rem;
  padding: 0.6rem 0.75rem;
}
#notesModalTitle {
  flex: 1 1 100%;
  font-size: 1.05rem;
  line-height: 1.3;
}
/* Section headers (Summary of Work, Description, Details): the buttons drop
   below the title instead of squeezing it onto two lines. */
#notesModal .modal-body > .card > .d-flex:first-child {
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
#notesModal .modal-body > .card > .d-flex:first-child > .d-flex {
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- Questions ---------- */
/* Expanded cards: actions move to their own line so the question text keeps
   the width. The zero basis stops the text from wrapping under the checkbox. */
.question-card:not(.question-collapsed) > .question-row {
  flex-wrap: wrap;
}
.question-card:not(.question-collapsed) > .question-row > .question-main {
  flex: 1 1 0;
}
.question-card:not(.question-collapsed) > .question-row > .question-actions {
  flex-basis: 100%;
  justify-content: flex-end;
}
/* "2 open below" -> "2 open" to leave room for the summary line. */
.question-open-below-word {
  display: none;
}
.question-children {
  margin-left: 0.75rem;
}
/* A collapsed question's due chip wraps under its text rather than
   squeezing the text to a few letters. */
.question-summary-line {
  flex-wrap: wrap;
}
.question-summary-line .question-summary {
  max-width: 100%;
}
.question-summary-line .todo-due-chip {
  margin-left: 0;
}
/* No physical keyboard to Shift+Enter with; the buttons say enough. */
.question-reply-draft-hint {
  display: none;
}
.question-reply-draft .d-flex {
  justify-content: flex-end;
}

/* Upload files / Upload folder: "Files" / "Folder" so the pair fits on
   one line without the labels wrapping. */
.drive-label-long {
  display: none;
}
.drive-label-short {
  display: inline;
}

/* Time by Campus and the Time by Category cards: too narrow for the bars
   to read; Time and Share carry it. */
.campus-time-bar-cell {
  display: none;
}
