/* ── Time Clock ── */
.tc { display: grid; gap: 20px; min-width: 0; max-width: 100%; }

/* Empty state (not logged in) */
.tc-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px; text-align: center; color: var(--text-muted);
}
.tc-empty__icon { width: 48px; height: 48px; }

/* Header */
.tc-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tc-header__left { display: flex; flex-direction: column; gap: 4px; }
.tc-header__title {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary);
}
.tc-header__title-icon { width: 24px; height: 24px; color: #10b981; }
[data-theme="dark"] .tc-header__title-icon { color: #34d399; }
.tc-header__sub { margin: 0; font-size: 13px; color: var(--text-muted); }
.tc-header__right { text-align: right; }
.tc-header__time {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.tc-header__date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Two-column grid */
.tc-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .tc-grid { grid-template-columns: 1fr; } }

/* Main column */
.tc-main { display: grid; gap: 20px; align-content: start; }

/* Sidebar */
.tc-sidebar { display: grid; gap: 20px; align-content: start; }

/* Card */
.tc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.tc-card--flush { padding: 0; }
.tc-card__title { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.tc-card__head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.tc-card__head--amber { background: #fffbeb; }
[data-theme="dark"] .tc-card__head--amber { background: rgba(217,119,6,0.08); }
.tc-card__head-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tc-card__head-title--amber { color: #b45309; }
[data-theme="dark"] .tc-card__head-title--amber { color: #fbbf24; }

/* ── Punch Clock Form (clock-in state) ── */
.tc-punch-form { display: flex; flex-direction: column; gap: 16px; }
.tc-punch-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; max-width: 100%; }
@media (max-width: 600px) {
  .tc-punch-row { grid-template-columns: 1fr; }
}

.tc-punch-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tc-punch__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.tc-punch__label-icon { width: 15px; height: 15px; color: var(--text-secondary); flex-shrink: 0; }
.tc-punch__optional {
  font-size: 10px; font-weight: 500; color: var(--text-muted);
  padding: 1px 6px; background: var(--bg-hover); border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.tc-punch__required {
  font-size: 10px; font-weight: 600; color: #dc2626;
  padding: 1px 6px; background: rgba(220,38,38,0.08); border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
[data-theme="dark"] .tc-punch__required { color: #f87171; background: rgba(248,113,113,0.1); }

.tc-punch__search {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg-base); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; box-sizing: border-box; min-width: 0;
}
.tc-punch__search::placeholder { color: var(--text-muted); }
.tc-punch__search:focus {
  outline: none; border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}
.tc-punch__textarea {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg-base); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; box-sizing: border-box;
  resize: vertical; min-height: 70px;
}
.tc-punch__textarea::placeholder { color: var(--text-muted); }
.tc-punch__textarea:focus {
  outline: none; border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}
.tc-punch__textarea--error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1) !important;
}
.tc-punch__error {
  font-size: 12px; color: #ef4444; margin-top: -2px;
}
[data-theme="dark"] .tc-punch__error { color: #f87171; }

/* ── Vehicle Picker (searchable dropdown) ── */
.tc-veh-picker { position: relative; }
.tc-veh-picker__input {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg-base); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; box-sizing: border-box; min-width: 0;
}
.tc-veh-picker__input::placeholder { color: var(--text-muted); }
.tc-veh-picker__input:focus {
  outline: none; border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}
.tc-veh-picker__dropdown {
  display: none; position: absolute; left: 0; right: 0; top: 100%;
  margin-top: 4px; max-height: 220px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 50; padding: 4px 0;
}
.tc-veh-picker--open .tc-veh-picker__dropdown { display: block; }
.tc-veh-picker__item {
  padding: 9px 14px; font-size: 13px; color: var(--text-primary);
  cursor: pointer; transition: background .1s;
}
.tc-veh-picker__item:hover { background: var(--bg-hover); }
.tc-veh-picker__item--active { font-weight: 600; color: #059669; }
[data-theme="dark"] .tc-veh-picker__item--active { color: #34d399; }
.tc-veh-picker__item--hidden { display: none; }
.tc-veh-picker__stock { font-weight: 600; color: var(--text-muted); margin-right: 2px; }
.tc-veh-picker__empty { padding: 12px 14px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* Clock In/Out buttons */
.tc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
  font-family: inherit;
}
.tc-btn:active { transform: scale(0.97); }
.tc-btn__icon { width: 16px; height: 16px; }
.tc-btn--full { width: 100%; }

.tc-btn--in {
  background: #10b981; color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.tc-btn--in:hover { background: #059669; box-shadow: 0 4px 12px rgba(16,185,129,0.35); }

.tc-btn--out {
  background: #ef4444; color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.tc-btn--out:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.35); }

/* ── Status bar (clocked-in state) ── */
.tc-status {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: #ecfdf5; border: 1px solid rgba(16,185,129,0.2); border-radius: 12px;
}
[data-theme="dark"] .tc-status {
  background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.15);
}
.tc-status__icon-wrap {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(16,185,129,0.15); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tc-status__icon { width: 22px; height: 22px; color: #059669; }
[data-theme="dark"] .tc-status__icon { color: #34d399; }
.tc-status__icon--pulse { animation: tc-pulse 2s ease-in-out infinite; }
@keyframes tc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.tc-status__info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tc-status__title { margin: 0; font-size: 14px; font-weight: 600; color: #059669; }
[data-theme="dark"] .tc-status__title { color: #34d399; }
.tc-status__since { margin: 0; font-size: 12px; color: var(--text-secondary); }
.tc-status__elapsed { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: #059669; }
[data-theme="dark"] .tc-status__elapsed { color: #34d399; }
.tc-status__vehicle {
  display: inline-block; margin-top: 4px; padding: 2px 8px;
  font-size: 11px; font-weight: 500; color: #059669;
  background: rgba(16,185,129,0.1); border-radius: 6px;
}
[data-theme="dark"] .tc-status__vehicle { color: #34d399; background: rgba(16,185,129,0.12); }
.tc-status__desc {
  display: block; margin-top: 4px; font-size: 12px; color: var(--text-secondary);
  font-style: italic;
}
.tc-status__action { flex-shrink: 0; margin-left: auto; }

/* Recent Punches table */
.tc-table-wrap { overflow-x: auto; }
.tc-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.tc-table th {
  text-align: left; padding: 10px 18px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.tc-table td {
  padding: 10px 18px; color: var(--text-secondary); border-bottom: 1px solid var(--border);
}
.tc-table tbody tr:last-child td { border-bottom: none; }
.tc-table tbody tr:hover { background: var(--bg-hover); }
.tc-table__right { text-align: right; }
.tc-table__mono { font-variant-numeric: tabular-nums; font-family: inherit; }
.tc-table__primary { color: var(--text-primary); font-weight: 500; }
.tc-table__empty { text-align: center; padding: 32px 18px; color: var(--text-muted); }

/* Active row highlight */
.tc-table__row--active { background: rgba(16,185,129,0.04); }
[data-theme="dark"] .tc-table__row--active { background: rgba(16,185,129,0.06); }
.tc-table__row--active:hover { background: rgba(16,185,129,0.08); }

/* Active badge */
.tc-active-badge {
  display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 600;
  color: #059669; background: #ecfdf5; border-radius: 6px;
}
[data-theme="dark"] .tc-active-badge { color: #34d399; background: rgba(16,185,129,0.12); }

/* Flag sidebar */
.tc-flag-icon { width: 18px; height: 18px; color: #d97706; flex-shrink: 0; }
[data-theme="dark"] .tc-flag-icon { color: #fbbf24; }

.tc-flags { padding: 0; }

.tc-flags__empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px;
}
.tc-flags__check { width: 40px; height: 40px; color: #10b981; }
[data-theme="dark"] .tc-flags__check { color: #34d399; }

/* Individual flag entry */
.tc-flag-entry {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.tc-flag-entry:last-child { border-bottom: none; }
.tc-flag-entry__date { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.tc-flag-entry__reason { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.tc-flag-entry__resolve {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border: 1px solid #d97706; border-radius: 7px;
  background: transparent; color: #d97706;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.tc-flag-entry__resolve:hover { background: #d97706; color: #fff; }
[data-theme="dark"] .tc-flag-entry__resolve { border-color: #fbbf24; color: #fbbf24; }
[data-theme="dark"] .tc-flag-entry__resolve:hover { background: #fbbf24; color: #1c1917; }

/* ── Tablet ── */
@media (max-width: 768px) {
  .tc-grid { grid-template-columns: 1fr; }
}

/* ── Mobile polish ── */
@media (max-width: 640px) {
  .tc-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .tc-header__right { text-align: left; display: flex; gap: 12px; align-items: baseline; }
  .tc-header__title { font-size: 18px; }
  .tc-header__time { font-size: 16px; }
  .tc-card { padding: 14px; }
  .tc-card__title { font-size: 14px; margin-bottom: 12px; }
  .tc-btn { padding: 10px 16px; font-size: 14px; }
  .tc-status { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .tc-status__icon-wrap { width: 36px; height: 36px; }
  .tc-status__action { width: 100%; }
  .tc-status__action .tc-btn { width: 100%; }
  .tc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tc-table th, .tc-table td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .tc-table td:nth-child(4), .tc-table th:nth-child(4),
  .tc-table td:nth-child(5), .tc-table th:nth-child(5) { display: none; }
  .tc-flag-entry { padding: 12px 14px; }
}
@media (max-width: 400px) {
  .tc-card { padding: 10px; }
  .tc-btn { padding: 8px 12px; font-size: 13px; }
  .tc-punch__search, .tc-punch__textarea, .tc-veh-picker__input { padding: 8px 10px; font-size: 13px; }
}
