/* ═══════════════════════════════════════════════════════
   Staff Management — Frontend Styles  v1.1
   Layout: Full-width fluid + 4-breakpoint responsive
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --hrtt-bg:          #f4f6fa;
  --hrtt-surface:     #ffffff;
  --hrtt-surface2:    #f0f2f7;
  --hrtt-border:      #dde1ea;
  --hrtt-primary:     #4361ee;
  --hrtt-primary-dim: #3451d1;
  --hrtt-amber:       #f59e0b;
  --hrtt-amber-dim:   #d97706;
  --hrtt-blue:        #3b82f6;
  --hrtt-purple:      #8b5cf6;
  --hrtt-red:         #ef4444;
  --hrtt-green:       #10b981;
  --hrtt-text:        #1e2433;
  --hrtt-text-muted:  #6b7a99;
  --hrtt-radius:      10px;
  --hrtt-shadow:      0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
  --hrtt-shadow-md:   0 4px 24px rgba(67,97,238,.12);
  --hrtt-font:        'DM Sans', system-ui, sans-serif;
  --hrtt-mono:        'DM Mono', monospace;
  /* Layout tokens — overridden by Settings page */
  --hrtt-max-width:   1600px;
  --hrtt-gutter:      32px;
}

/* ── Reset / Base ───────────────────────────────────── */
.hrtt-app *, .hrtt-app *::before, .hrtt-app *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ── Full-width override ─────────────────────────────
   Multi-strategy escape from WordPress theme containers.
   Works with Twenty* themes, Astra, GeneratePress, Divi,
   Elementor, etc. regardless of overflow/position on parents. */
.hrtt-app {
  font-family: var(--hrtt-font);
  background: var(--hrtt-bg);
  color: var(--hrtt-text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;

  /* Strategy 1: negative margins + 100vw */
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);

  /* Strategy 2: break out of any max-width on ancestors */
  left: 0;
  right: 0;
}

/* Force all direct ancestor containers to not clip us.
   Targets the most common WP theme wrapper selectors.   */
.site-content .hrtt-app,
.entry-content .hrtt-app,
.post-content .hrtt-app,
.page-content .hrtt-app,
.content-area .hrtt-app,
.site-main .hrtt-app,
article .hrtt-app,
.wp-block-post-content .hrtt-app {
  /* Re-apply in case inheritance removed it */
  width: 100vw !important;
  margin-left: calc(-50vw + 50%) !important;
  margin-right: calc(-50vw + 50%) !important;
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

/* ── Header ─────────────────────────────────────────── */
.hrtt-header {
  background: var(--hrtt-surface);
  border-bottom: 1px solid var(--hrtt-border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 0 var(--hrtt-border), 0 2px 12px rgba(0,0,0,.07);
  width: 100%;
}
.hrtt-header-inner {
  max-width: var(--hrtt-max-width);
  margin: 0 auto;
  padding: 0 var(--hrtt-gutter);
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.hrtt-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; letter-spacing: -0.3px; color: var(--hrtt-text);
  flex-shrink: 0;
}
.hrtt-logo-icon { font-size: 20px; }
.hrtt-logo-text strong { color: var(--hrtt-primary); }
.hrtt-logo-text em {
  font-style: normal; color: var(--hrtt-amber);
  font-size: 12px; margin-left: 6px; font-weight: 600;
}
.hrtt-user-info { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hrtt-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--hrtt-primary); color: #fff;
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hrtt-user-avatar.admin { background: var(--hrtt-amber); }
.hrtt-user-name { font-size: 14px; color: var(--hrtt-text-muted); font-weight: 500; }

/* ── Nav ────────────────────────────────────────────── */
.hrtt-nav-wrapper {
  background: var(--hrtt-surface);
  border-bottom: 1px solid var(--hrtt-border);
  position: sticky; top: 60px; z-index: 190;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.hrtt-nav {
  max-width: var(--hrtt-max-width);
  margin: 0 auto;
  padding: 0 var(--hrtt-gutter);
  display: flex; gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hrtt-nav::-webkit-scrollbar { display: none; }
.hrtt-nav-btn {
  background: none; border: none; cursor: pointer;
  padding: 15px 22px;
  font-family: var(--hrtt-font); font-size: 14px; font-weight: 500;
  color: var(--hrtt-text-muted);
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
  white-space: nowrap;
  flex-shrink: 0;
}
.hrtt-nav-btn:hover { color: var(--hrtt-text); }
.hrtt-nav-btn.active {
  color: var(--hrtt-primary);
  border-bottom-color: var(--hrtt-primary);
  font-weight: 600;
}

/* ── Main content ────────────────────────────────────── */
.hrtt-main {
  max-width: var(--hrtt-max-width);
  margin: 0 auto;
  padding: 28px var(--hrtt-gutter) 48px;
}
.hrtt-tab { display: none; }
.hrtt-tab.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }

/* ── Welcome ────────────────────────────────────────── */
.hrtt-welcome { margin-bottom: 24px; }
.hrtt-welcome h2 {
  font-size: 24px; font-weight: 700; letter-spacing: -.5px; color: var(--hrtt-text);
}
.hrtt-welcome p { color: var(--hrtt-text-muted); margin-top: 4px; font-size: 14px; }

/* ── Stats Grid ─────────────────────────────────────── */
.hrtt-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.hrtt-stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
.hrtt-stat-card {
  background: var(--hrtt-surface);
  border: 1px solid var(--hrtt-border);
  border-radius: var(--hrtt-radius);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
  box-shadow: var(--hrtt-shadow);
}
.hrtt-stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.hrtt-stat-card:hover { transform: translateY(-2px); box-shadow: var(--hrtt-shadow-md); }
.hrtt-stat-blue::before   { background: var(--hrtt-blue); }
.hrtt-stat-amber::before  { background: var(--hrtt-amber); }
.hrtt-stat-green::before  { background: var(--hrtt-green); }
.hrtt-stat-purple::before { background: var(--hrtt-purple); }
.hrtt-stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--hrtt-text-muted);
}
.hrtt-stat-value {
  font-size: 30px; font-weight: 700; margin-top: 8px;
  font-family: var(--hrtt-mono); color: var(--hrtt-text);
}

/* ── Card ───────────────────────────────────────────── */
.hrtt-card {
  background: var(--hrtt-surface);
  border: 1px solid var(--hrtt-border);
  border-radius: var(--hrtt-radius);
  padding: 24px;
  box-shadow: var(--hrtt-shadow);
}
.hrtt-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.hrtt-card-title { font-size: 16px; font-weight: 700; color: var(--hrtt-text); }
.hrtt-mt { margin-top: 20px; }

/* ── Two-column dashboard layout ────────────────────── */
.hrtt-dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.hrtt-dash-cols .hrtt-card-full { grid-column: 1 / -1; }

/* ── Buttons ────────────────────────────────────────── */
.hrtt-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 7px; cursor: pointer;
  font-family: var(--hrtt-font); font-weight: 600; font-size: 14px;
  padding: 9px 16px;
  transition: all .16s; text-decoration: none; white-space: nowrap;
}
.hrtt-btn-primary {
  background: var(--hrtt-primary); color: #fff;
  box-shadow: 0 2px 8px rgba(67,97,238,.25);
}
.hrtt-btn-primary:hover { background: var(--hrtt-primary-dim); box-shadow: 0 4px 12px rgba(67,97,238,.35); }
.hrtt-btn-secondary {
  background: var(--hrtt-surface2); color: var(--hrtt-text);
  border: 1px solid var(--hrtt-border);
}
.hrtt-btn-secondary:hover { border-color: var(--hrtt-primary); color: var(--hrtt-primary); background: #eef1ff; }
.hrtt-btn-ghost {
  background: transparent; color: var(--hrtt-text-muted);
  border: 1px solid var(--hrtt-border);
}
.hrtt-btn-ghost:hover { color: var(--hrtt-text); background: var(--hrtt-surface2); }
.hrtt-btn-danger { background: var(--hrtt-red); color: #fff; }
.hrtt-btn-danger:hover { background: #dc2626; }
.hrtt-btn-sm { padding: 5px 11px; font-size: 12px; }
.hrtt-btn-pdf {
  background: #dc2626; color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.2);
}
.hrtt-btn-pdf:hover { background: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,.3); color: #fff; }
.hrtt-btn-pdf svg { vertical-align: middle; flex-shrink: 0; }

.hrtt-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.hrtt-action-wrap { display: inline-flex; }

/* ── Inputs ─────────────────────────────────────────── */
.hrtt-input {
  width: 100%; background: #fff; border: 1px solid var(--hrtt-border);
  border-radius: 7px; padding: 9px 13px;
  color: var(--hrtt-text); font-family: var(--hrtt-font); font-size: 14px;
  transition: border-color .16s, box-shadow .16s;
  appearance: none;
}
.hrtt-input:focus { outline: none; border-color: var(--hrtt-primary); box-shadow: 0 0 0 3px rgba(67,97,238,.12); }
.hrtt-input::placeholder { color: var(--hrtt-text-muted); }
.hrtt-input-sm { width: auto; min-width: 140px; padding: 5px 11px; font-size: 13px; }
.hrtt-textarea { resize: vertical; min-height: 80px; }
select.hrtt-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7a99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
input[type="date"].hrtt-input,
input[type="month"].hrtt-input { color-scheme: light; }

/* ── Form layout ────────────────────────────────────── */
.hrtt-form { display: flex; flex-direction: column; gap: 16px; }
.hrtt-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hrtt-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.hrtt-form-group { display: flex; flex-direction: column; gap: 6px; }
.hrtt-form-group label {
  font-size: 11px; font-weight: 700; color: var(--hrtt-text-muted);
  text-transform: uppercase; letter-spacing: .6px;
}
.hrtt-form-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Filters bar ────────────────────────────────────── */
.hrtt-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hrtt-filters-bar { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--hrtt-border); }

/* ── Table ──────────────────────────────────────────── */
.hrtt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hrtt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hrtt-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--hrtt-text-muted); border-bottom: 2px solid var(--hrtt-border);
  background: var(--hrtt-surface2); white-space: nowrap;
}
.hrtt-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--hrtt-border);
  vertical-align: middle; color: var(--hrtt-text);
}
.hrtt-table tr:last-child td { border-bottom: none; }
.hrtt-table tbody tr:hover td { background: #f7f8ff; }
.hrtt-table .hrtt-actions { display: flex; gap: 8px; flex-wrap: nowrap; }

/* ── Badges ─────────────────────────────────────────── */
.hrtt-badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.hrtt-badge-ordinary { background: #eff6ff; color: #2563eb; }
.hrtt-badge-overtime  { background: #fffbeb; color: #b45309; }
.hrtt-badge-active    { background: #ecfdf5; color: #059669; }
.hrtt-badge-inactive  { background: #fef2f2; color: #dc2626; }
.hrtt-badge-pending   { background: #fef3c7; background: color-mix(in srgb, var(--hrtt-amber) 15%, white); color: var(--hrtt-amber); }
.hrtt-badge-approved  { background: #ecfdf5; background: color-mix(in srgb, var(--hrtt-green) 15%, white); color: var(--hrtt-green); }
.hrtt-badge-rejected  { background: #fef2f2; background: color-mix(in srgb, var(--hrtt-red)   15%, white); color: var(--hrtt-red); }

/* ── Recent logs ────────────────────────────────────── */
.hrtt-recent-logs h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--hrtt-text); }
.hrtt-log-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--hrtt-surface);
  border: 1px solid var(--hrtt-border); border-radius: 8px;
  margin-bottom: 8px; transition: border-color .16s, box-shadow .16s;
  gap: 12px;
}
.hrtt-log-item:hover { border-color: var(--hrtt-primary); box-shadow: 0 0 0 3px rgba(67,97,238,.08); }
.hrtt-log-left  { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hrtt-log-date  { font-size: 12px; color: var(--hrtt-text-muted); font-family: var(--hrtt-mono); }
.hrtt-log-place { font-weight: 600; font-size: 14px; color: var(--hrtt-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrtt-log-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hrtt-log-hours { font-size: 18px; font-weight: 700; font-family: var(--hrtt-mono); color: var(--hrtt-primary); }
.hrtt-log-actions { display: flex; gap: 6px; }

/* ── Report summary ─────────────────────────────────── */
.hrtt-rep-summary {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.hrtt-rep-box {
  background: var(--hrtt-surface2); border: 1px solid var(--hrtt-border);
  border-radius: 8px; padding: 16px; text-align: center;
}
.hrtt-rep-box-label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--hrtt-text-muted); font-weight: 700; }
.hrtt-rep-box-value { font-size: 24px; font-weight: 700; font-family: var(--hrtt-mono); color: var(--hrtt-primary); margin-top: 4px; }

/* ── Loading / Empty / Msg ──────────────────────────── */
.hrtt-loading, .hrtt-empty {
  text-align: center; color: var(--hrtt-text-muted); padding: 48px 24px; font-size: 14px;
}
.hrtt-loading::before { content: '⟳ '; display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hrtt-msg { font-size: 13px; padding: 6px 0; min-height: 20px; }
.hrtt-msg.ok  { color: var(--hrtt-green); font-weight: 600; }
.hrtt-msg.err { color: var(--hrtt-red);   font-weight: 600; }

.hrtt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hrtt-surface);
  border: 1px solid var(--hrtt-border);
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: var(--hrtt-shadow-md);
  z-index: 10000;
  font-weight: 600;
  min-height: 0;
}

/* ── Modal ──────────────────────────────────────────── */
.hrtt-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(30,36,51,.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
.hrtt-modal {
  background: var(--hrtt-surface); border: 1px solid var(--hrtt-border);
  border-radius: 14px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
.hrtt-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--hrtt-border);
  position: sticky; top: 0; background: var(--hrtt-surface); z-index: 1;
}
.hrtt-modal-header h3 { font-size: 16px; font-weight: 700; color: var(--hrtt-text); }
.hrtt-modal-close {
  background: none; border: none; cursor: pointer; color: var(--hrtt-text-muted);
  font-size: 22px; line-height: 1; transition: color .15s; padding: 0; flex-shrink: 0;
}
.hrtt-modal-close:hover { color: var(--hrtt-text); }
.hrtt-modal-body  { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.hrtt-modal-footer {
  padding: 14px 24px 20px; border-top: 1px solid var(--hrtt-border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0; background: var(--hrtt-surface);
}

/* ── Deep-link banner (Blocco E2) ────────────────────── */
.hrtt-deeplink-banner {
  position: relative;
  background: var(--hrtt-surface); border: 1px solid var(--hrtt-border);
  border-left: 4px solid var(--hrtt-amber); border-radius: var(--hrtt-radius);
  padding: 14px 40px 14px 18px; margin-bottom: 20px; font-size: 14px;
  color: var(--hrtt-text); box-shadow: var(--hrtt-shadow);
}
.hrtt-deeplink-banner-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer; color: var(--hrtt-text-muted);
  font-size: 20px; line-height: 1; padding: 0;
}
.hrtt-deeplink-banner-close:hover { color: var(--hrtt-text); }

/* ── Login notice ───────────────────────────────────── */
.hrtt-login-notice {
  background: var(--hrtt-surface); border: 1px solid var(--hrtt-border);
  border-radius: var(--hrtt-radius); padding: 48px 32px; text-align: center;
  color: var(--hrtt-text-muted); box-shadow: var(--hrtt-shadow);
  max-width: 480px; margin: 40px auto;
}
.hrtt-login-notice a { color: var(--hrtt-primary); font-weight: 600; }

/* ── Bar chart ──────────────────────────────────────── */
.hrtt-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.hrtt-bar-name { font-size: 13px; font-weight: 600; width: 160px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--hrtt-text); }
.hrtt-bar-track { flex: 1; background: var(--hrtt-surface2); border-radius: 20px; height: 8px; overflow: hidden; border: 1px solid var(--hrtt-border); }
.hrtt-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--hrtt-primary), var(--hrtt-blue)); border-radius: 20px; transition: width .6s ease; }
.hrtt-bar-val   { font-family: var(--hrtt-mono); font-size: 13px; color: var(--hrtt-text-muted); width: 56px; text-align: right; flex-shrink: 0; }

/* ── CF validation hint ─────────────────────────────── */
.hrtt-cf-hint { font-size: 11px; color: var(--hrtt-text-muted); margin-top: 3px; }
.hrtt-cf-hint.valid   { color: var(--hrtt-green); }
.hrtt-cf-hint.invalid { color: var(--hrtt-red); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   XL  ≥ 1280px  — full layout (default above)
   LG  1024–1279 — slightly reduced gutters
   MD   768–1023 — tablet: 2-col stats, stacked nav
   SM   480– 767 — mobile landscape
   XS       <480 — mobile portrait
══════════════════════════════════════════════════════ */

/* ── LG: 1024–1279px ────────────────────────────────── */
@media (max-width: 1279px) {
  :root { --hrtt-gutter: 24px; }
  .hrtt-stats-grid { grid-template-columns: repeat(4,1fr); gap: 12px; }
  .hrtt-stats-grid-5 { grid-template-columns: repeat(5,1fr); }
  .hrtt-stat-value { font-size: 26px; }
}

/* ── MD: 768–1023px ─────────────────────────────────── */
@media (max-width: 1023px) {
  :root { --hrtt-gutter: 20px; }

  /* Header: hide username label */
  .hrtt-user-name { display: none; }

  /* Nav: smaller padding */
  .hrtt-nav-btn { padding: 13px 16px; font-size: 13px; }

  /* Stats: 2×2 grid */
  .hrtt-stats-grid { grid-template-columns: repeat(2,1fr); }
  .hrtt-stats-grid-5 { grid-template-columns: repeat(2,1fr); }

  /* Dashboard: single column */
  .hrtt-dash-cols { grid-template-columns: 1fr; }

  /* Form: single column */
  .hrtt-form-row,
  .hrtt-form-row-3 { grid-template-columns: 1fr; }

  /* Report summary: 2×2 */
  .hrtt-rep-summary { grid-template-columns: repeat(2,1fr); }

  /* Table: slightly smaller text */
  .hrtt-table { font-size: 13px; }
  .hrtt-table th, .hrtt-table td { padding: 9px 12px; }

  /* Card header: stack vertically when needed */
  .hrtt-card-header { gap: 8px; }
  .hrtt-filters { gap: 8px; }
}

/* ── SM: 480–767px ──────────────────────────────────── */
@media (max-width: 767px) {
  :root { --hrtt-gutter: 14px; }

  /* Header: compact */
  .hrtt-header-inner { height: 52px; }
  .hrtt-logo-text em { display: none; }

  /* Nav: icon-like, scrollable */
  .hrtt-nav-wrapper { top: 52px; }
  .hrtt-nav { padding: 0 14px; }
  .hrtt-nav-btn { padding: 12px 14px; font-size: 12px; }

  /* Stats: 2 col */
  .hrtt-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hrtt-stats-grid-5 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hrtt-stat-card { padding: 16px; }
  .hrtt-stat-value { font-size: 22px; }

  /* Main */
  .hrtt-main { padding: 16px var(--hrtt-gutter) 40px; }
  .hrtt-welcome h2 { font-size: 20px; }

  /* Cards */
  .hrtt-card { padding: 16px; }
  .hrtt-card-header { flex-direction: column; align-items: flex-start; }
  .hrtt-card-header .hrtt-filters { width: 100%; }

  /* Report summary: 2 col */
  .hrtt-rep-summary { grid-template-columns: 1fr 1fr; }
  .hrtt-rep-box-value { font-size: 20px; }

  /* Table: card-style rows on mobile */
  .hrtt-table-wrap { border: 1px solid var(--hrtt-border); border-radius: var(--hrtt-radius); overflow: hidden; }
  .hrtt-table thead { display: none; }
  .hrtt-table, .hrtt-table tbody, .hrtt-table tfoot, .hrtt-table tr, .hrtt-table td { display: block; width: 100%; }
  .hrtt-table tr { padding: 12px 14px; border-bottom: 1px solid var(--hrtt-border); position: relative; }
  .hrtt-table tr:last-child { border-bottom: none; }
  .hrtt-table tbody tr:hover { background: #f7f8ff; }
  .hrtt-table td {
    padding: 3px 0 3px 44%;
    border: none; font-size: 13px; min-height: 24px;
    position: relative;
  }
  .hrtt-table td::before {
    content: attr(data-label);
    position: absolute; left: 0; width: 42%;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--hrtt-text-muted);
    padding-top: 2px;
  }
  /* Actions column: full width, no pseudo */
  .hrtt-table td.hrtt-actions { padding-left: 0; margin-top: 8px; }
  .hrtt-table td.hrtt-actions::before { display: none; }

  /* Filters: stack */
  .hrtt-filters { flex-direction: column; align-items: stretch; }
  .hrtt-filters .hrtt-input-sm,
  .hrtt-filters .hrtt-btn { width: 100%; min-width: 0; justify-content: center; }

  /* Bulk bar (Blocco C2): stack */
  .hrtt-bulk-bar { flex-direction: column; align-items: stretch; }
  .hrtt-bulk-reason { width: 100%; min-width: 0; }
  .hrtt-bulk-bar .hrtt-btn { width: 100%; justify-content: center; }
  .hrtt-bulk-bar .hrtt-action-wrap { width: 100%; }

  /* Log items: stack */
  .hrtt-log-item { flex-direction: column; align-items: flex-start; }
  .hrtt-log-right { width: 100%; justify-content: space-between; }

  /* Modal: full screen */
  .hrtt-modal-overlay { padding: 0; align-items: flex-end; }
  .hrtt-modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
}

/* ── XS: < 480px ────────────────────────────────────── */
@media (max-width: 479px) {
  :root { --hrtt-gutter: 12px; }

  .hrtt-stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hrtt-stats-grid-5 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hrtt-stat-card { padding: 14px; }
  .hrtt-stat-label { font-size: 10px; }
  .hrtt-stat-value { font-size: 20px; }

  .hrtt-rep-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hrtt-rep-box { padding: 12px; }
  .hrtt-rep-box-value { font-size: 18px; }

  .hrtt-nav-btn { padding: 11px 12px; font-size: 11px; }
  .hrtt-btn { font-size: 13px; padding: 8px 14px; }
  .hrtt-btn-sm { font-size: 12px; padding: 5px 10px; }

  /* Bar chart: shorter name column */
  .hrtt-bar-name { width: 100px; }
}

/* ── Barra azioni bulk (Blocco C2) ──────────────────────
   Nessun colore esadecimale fisso: var(--hrtt-*) con fallback
   (regola 5 del brief). ─────────────────────────────── */
.hrtt-bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 12px 14px;
  background: var(--hrtt-surface2, #f0f2f7);
  border: 1px solid var(--hrtt-border, #dde1ea);
  border-radius: 8px;
}
.hrtt-bulk-count {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  color: var(--hrtt-text-muted, #6b7a99);
}
.hrtt-bulk-reason { flex: 1; min-width: 200px; }

/* ── Riquadro/icona del motivo del rifiuto (Blocco C2) ── */
.hrtt-reason-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--hrtt-red, #ef4444); color: var(--hrtt-surface, #fff);
  font-size: 10px; font-style: normal; font-weight: 700; cursor: help;
  margin-left: 4px; vertical-align: middle;
}

/* ── Piè di tabella "TOTALE" (Blocco E) ─────────────────
   Primo uso di <tfoot> nell'app: nessuna regola esistente lo copriva.
   var(--hrtt-*) con fallback, nessun hex fisso (regola 5). ───────── */
.hrtt-table tfoot td {
  border-top: 2px solid var(--hrtt-border, #dde1ea);
  background: var(--hrtt-surface2, #f0f2f7);
}
.hrtt-table-foot td { color: var(--hrtt-text, #1e2433); }

/* ── Excel Export Button ─────────────────────────────── */
.hrtt-btn-xlsx {
  background: #217346;
  color: #fff;
  box-shadow: 0 2px 8px rgba(33,115,70,.2);
}
.hrtt-btn-xlsx:hover {
  background: #1a5c38;
  box-shadow: 0 4px 12px rgba(33,115,70,.3);
  color: #fff;
}
.hrtt-btn-xlsx svg {
  vertical-align: middle;
  flex-shrink: 0;
}
