.tdc-muted { color:#5f6b7a; }
.tdc-table-wrap { overflow:auto; border-radius:12px; border:1px solid #e3e7ef; }
.tdc-table { width:100%; border-collapse:collapse; min-width:720px; }
.tdc-table th, .tdc-table td { padding:10px 12px; border-bottom:1px solid #eef1f6; text-align:left; }
.tdc-table thead th { background:#f7f9fc; font-weight:600; }
.tdc-tag { display:inline-block; margin-left:8px; font-size:.75rem; padding:2px 6px; border-radius:8px; background:#eef3ff; color:#2d4cff; border:1px solid #dfe6ff; }
.tdc-link { color:#0b5cff; text-decoration:none; font-weight:600; }
.tdc-link:hover { text-decoration:underline; }

/* Reuse card/grid/button styles if schedule.css exists */
.tdc-card { background:#fff; border-radius:16px; padding:24px; max-width:1100px; margin:28px auto; box-shadow:0 8px 32px rgba(0,0,0,.06); }
.tdc-h2 { margin:0 0 16px; font-size:1.5rem; }
.tdc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
  align-items: flex-end; /* use flexbox-safe keyword */
}
.tdc-field { display:flex; flex-direction:column; gap:8px; }
.tdc-field input, .tdc-field select { border:1px solid #d5d9e2; border-radius:10px; padding:10px 12px; font:inherit; width:100%; }
.tdc-actions { display:flex; justify-content:flex-end; }
.tdc-btn { background:#0b5cff; color:#fff; border:none; border-radius:10px; padding:10px 16px; font-weight:600; cursor:pointer; }
.tdc-btn:hover { filter:brightness(.95); }

@media (max-width: 880px) {
  .tdc-grid { grid-template-columns: 1fr; }
  .tdc-table { min-width: 0; }
}

/* ===== Calendar View – layout tidy ===== */
.tdc-filters.tdc-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0,1fr));
  gap: 14px;
  align-items: flex-end; /* use flexbox-safe keyword */
  margin-bottom: 18px;
}

/* make each field span a sensible width on desktop */
.tdc-filters .tdc-field { grid-column: span 3; }
.tdc-filters .tdc-actions { grid-column: span 2; display: flex; gap: 10px; }
.tdc-quick-range { grid-column: 1 / -1; margin-top: 6px; font-size: 0.9rem; }

/* inputs/buttons visual room */
.tdc-field input,
.tdc-field select {
  padding: 10px 12px;
  min-height: 40px;
}

.tdc-btn { padding: 10px 14px; line-height: 1; }
.tdc-btn + .tdc-btn { margin-left: 6px; }

/* table wrap so it doesn’t feel cramped */
.tdc-table-wrap { margin-top: 12px; }

/* responsive: tablet */
@media (max-width: 1024px) {
  .tdc-filters .tdc-field { grid-column: span 6; }
  .tdc-filters .tdc-actions { grid-column: span 6; justify-content: flex-start; }
}

/* responsive: mobile */
@media (max-width: 640px) {
  .tdc-filters .tdc-field,
  .tdc-filters .tdc-actions { grid-column: 1 / -1; }
  .tdc-actions { gap: 8px; }
  .tdc-quick-range { font-size: 0.85rem; }
}

/* ===== More Filters dropdown ===== */
.tdc-more-filters {
  grid-column: 1 / -1;
  background: #f9fbff;
  border: 1px solid #dfe6ff;
  border-radius: 10px;
  padding: 10px 14px;
}

.tdc-more-filters summary {
  font-weight: 600;
  cursor: pointer;
  color: #0b5cff;
  margin-bottom: 8px;
}

.tdc-more-filters summary::-webkit-details-marker {
  display: none; /* hide default arrow */
}

.tdc-more-filters[open] summary {
  margin-bottom: 14px;
}

.tdc-more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

@media (max-width: 640px) {
  .tdc-more-grid { grid-template-columns: 1fr; }
}

/* 1) Ensure inputs/selects don't overflow their grid cell */
.tdc-field input,
.tdc-field select {
  box-sizing: border-box;   /* <-- prevents width+padding+borders from overflowing */
  width: 100%;
}

/* 2) Widen the first row fields (Start, End, Employee) */
.tdc-filters.tdc-grid .tdc-field:nth-of-type(1),
.tdc-filters.tdc-grid .tdc-field:nth-of-type(2),
.tdc-filters.tdc-grid .tdc-field:nth-of-type(3) {
  grid-column: span 4;      /* 3 fields x 4 columns = 12; perfect fit */
}

/* 3) Slightly larger gap for breathing room on desktop */
.tdc-filters.tdc-grid {
  gap: 18px;
}

/* 4) Responsive fallbacks */
@media (max-width: 1024px) {
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(1),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(2),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(3) {
    grid-column: span 6;    /* 2 per row on tablet */
  }
}

@media (max-width: 640px) {
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(1),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(2),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(3) {
    grid-column: 1 / -1;    /* stack on mobile */
  }
}

/* ===========================
   MOBILE LAYOUT (≤ 640px)
   =========================== */
@media (max-width: 640px) {
  /* Card + spacing */
  .tdc-card { padding: 16px; margin: 16px auto; }

  /* Filters become a single column stack */
  .tdc-filters.tdc-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Make the first three fields (Start/End/Employee) full width */
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(1),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(2),
  .tdc-filters.tdc-grid .tdc-field:nth-of-type(3) {
    grid-column: 1 / -1;
  }

  /* Inputs & selects: bigger tap targets */
  .tdc-field input,
  .tdc-field select {
    min-height: 44px;
    font-size: 16px;   /* avoids iOS zoom-on-focus */
  }

  /* More Filters panel uses 1-col grid on phones */
  .tdc-more-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Actions: buttons side-by-side or full-width if needed */
  .tdc-actions { grid-column: 1 / -1; gap: 10px; }
  .tdc-actions .tdc-btn { flex: 1 1 0; min-height: 44px; }

  /* Quick ranges wraps nicely and is smaller */
  .tdc-quick-range {
    grid-column: 1 / -1;
    margin-top: 4px;
    font-size: 0.85rem;
    line-height: 1.2;
  }

  /* Table: keep it readable on small screens */
  .tdc-table-wrap { margin-top: 8px; }
  .tdc-table { min-width: 0; }        /* allow shrink */
  .tdc-table th, .tdc-table td { padding: 8px 10px; font-size: 14px; }

  /* Optional: hide less-critical columns to reduce width on phones.
     If you want to KEEP them, comment these 2 lines out. */
  .tdc-table th:nth-child(4), .tdc-table td:nth-child(4) { display: none; } /* Location */
  .tdc-table th:nth-child(5), .tdc-table td:nth-child(5) { display: none; } /* Notes */

  /* Actions column stays compact */
  .tdc-table th:last-child, .tdc-table td:last-child { white-space: nowrap; }
}

/* ===========================
   SMALL TABLETS (641–880px)
   =========================== */
@media (min-width: 641px) and (max-width: 880px) {
  .tdc-card { padding: 18px; }
  .tdc-filters.tdc-grid { gap: 14px; }
  .tdc-field input, .tdc-field select { min-height: 42px; }
  .tdc-quick-range { font-size: 0.9rem; }
}
