/* ==========================================================================
   Ticketing Filler - Premium Developer Operations Console Stylesheet
   Zero-build Vanilla CSS with Semantic Tokens & Responsive Layout
   ========================================================================== */

:root {
  /* Common System Metrics & Stacks */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Monaco, monospace;

  /* --- Spacing Scale (Multiples of 4px) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* --- Radii --- */
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  /* --- Dimensions --- */
  --btn-height: 36px;
  --btn-height-sm: 30px;
  --touch-target-min: 44px;

  /* --- Transitions --- */
  --transition-fast: 140ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Z-Index Layering --- */
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-modal-backdrop: 900;
  --z-modal-content: 950;
  --z-toast: 1000;
}

/* ==========================================================================
   THEME: TRUE DARK MODE (Obsidian & Neutral Zinc)
   Default fallback and explicit [data-theme="dark"]
   ========================================================================== */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* --- Surfaces & Canvas (True Neutral Dark, Zero Blue Tint) --- */
  --bg-page: #09090b;             /* Pure deep zinc canvas */
  --bg-topbar: rgba(13, 13, 16, 0.85); /* Frosty dark header */
  --bg-surface: #121215;          /* Card & container background */
  --bg-surface-raised: #18181c;   /* Elevated panels, headers */
  --bg-surface-hover: #222227;    /* Subtle hover surface */
  --bg-input: #0e0e11;            /* Input fields */
  --bg-overlay: rgba(0, 0, 0, 0.72);

  /* Legacy aliases */
  --bg-main: var(--bg-page);
  --bg-card: var(--bg-surface);
  --bg-elevated: var(--bg-surface-raised);

  /* --- Hairline Borders --- */
  --border-subtle: #1c1c21;
  --border-default: #27272b;
  --border-strong: #38383e;
  --border-focus: #6366f1;
  --border-color: var(--border-default);

  /* --- Focus Ring --- */
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.35);

  /* --- Typography & Text Contrast (WCAG AAA compliant) --- */
  --text-primary: #f4f4f5;        /* Crisp white-zinc */
  --text-secondary: #a1a1aa;      /* Medium high-contrast zinc */
  --text-muted: #71717a;          /* Subtle helper text */
  --text-dim: #71717a;
  --text-disabled: #52525b;
  --text-on-accent: #ffffff;
  --text-main: var(--text-primary);

  /* --- Accents & Primary Actions (Electric Indigo - Linear & Raycast style) --- */
  --accent-primary: #6366f1;         /* Indigo 500 */
  --accent-primary-hover: #4f46e5;   /* Indigo 600 */
  --accent-primary-active: #4338ca;  /* Indigo 700 */
  --accent-primary-subtle: rgba(99, 102, 241, 0.14);
  --accent-primary-border: rgba(99, 102, 241, 0.35);
  --accent-blue: var(--accent-primary);
  --accent-blue-hover: var(--accent-primary-hover);

  /* --- Semantics (Balanced, Elegant Statuses) --- */
  /* Optimal (7.45h - 8.00h) */
  --status-optimal-bg: rgba(16, 185, 129, 0.14);
  --status-optimal-border: rgba(16, 185, 129, 0.35);
  --status-optimal-text: #34d399;

  /* Under Threshold (< 7.45h) */
  --status-under-bg: rgba(245, 158, 11, 0.14);
  --status-under-border: rgba(245, 158, 11, 0.35);
  --status-under-text: #fbbf24;

  /* Over Threshold (> 8.00h) */
  --status-over-bg: rgba(239, 68, 68, 0.14);
  --status-over-border: rgba(239, 68, 68, 0.35);
  --status-over-text: #f87171;

  /* Danger Actions */
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-text: #fca5a5;
  --danger-btn-bg: #dc2626;
  --danger-btn-hover: #b91c1c;

  /* Info & Sync */
  --info-bg: rgba(99, 102, 241, 0.14);
  --info-border: rgba(99, 102, 241, 0.35);
  --info-text: #a5b4fc;

  /* --- Shadows & Elevation --- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.65), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   THEME: PURE LIGHT MODE (Crisp White & Minimal Slate)
   ========================================================================== */
:root[data-theme="light"] {
  color-scheme: light;

  /* --- Surfaces & Canvas (Crisp White & Clean Neutral Canvas) --- */
  --bg-page: #f8fafc;
  --bg-topbar: rgba(255, 255, 255, 0.88);
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-input: #ffffff;
  --bg-overlay: rgba(15, 23, 42, 0.4);

  /* Legacy aliases */
  --bg-main: var(--bg-page);
  --bg-card: var(--bg-surface);
  --bg-elevated: var(--bg-surface-raised);

  /* --- Hairline Borders --- */
  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #4f46e5;
  --border-color: var(--border-default);

  /* --- Focus Ring --- */
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.22);

  /* --- Typography & Text Contrast --- */
  --text-primary: #0f172a;        /* Slate 900 */
  --text-secondary: #475569;      /* Slate 600 */
  --text-muted: #64748b;          /* Slate 500 */
  --text-dim: #94a3b8;            /* Slate 400 */
  --text-disabled: #94a3b8;
  --text-on-accent: #ffffff;
  --text-main: var(--text-primary);

  /* --- Accents & Primary Actions (Electric Indigo - WCAG AAA 7.2:1 against white) --- */
  --accent-primary: #4f46e5;         /* Indigo 600 */
  --accent-primary-hover: #4338ca;   /* Indigo 700 */
  --accent-primary-active: #3730a3;  /* Indigo 800 */
  --accent-primary-subtle: rgba(79, 70, 229, 0.08);
  --accent-primary-border: rgba(79, 70, 229, 0.28);
  --accent-blue: var(--accent-primary);
  --accent-blue-hover: var(--accent-primary-hover);

  /* --- Semantics (Calibrated for Pure Light - Zero Washout, High Legibility) --- */
  /* Optimal (7.45h - 8.00h) - Deep Emerald */
  --status-optimal-bg: #ecfdf5;
  --status-optimal-border: #a7f3d0;
  --status-optimal-text: #065f46;     /* High contrast on light green */

  /* Under Threshold (< 7.45h) - Deep Warm Amber */
  --status-under-bg: #fffbeb;
  --status-under-border: #fde68a;
  --status-under-text: #92400e;       /* High contrast on light amber */

  /* Over Threshold (> 8.00h) - Deep Crimson */
  --status-over-bg: #fef2f2;
  --status-over-border: #fecaca;
  --status-over-text: #991b1b;       /* High contrast on light red */

  /* Danger Actions */
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --danger-text: #991b1b;
  --danger-btn-bg: #dc2626;
  --danger-btn-hover: #b91c1c;

  /* Info & Sync - Deep Indigo */
  --info-bg: #eef2ff;
  --info-border: #c7d2fe;
  --info-text: #3730a3;              /* High contrast on light indigo */

  /* --- Shadows & Elevation --- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 13.5px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: inline-block;
  vertical-align: middle;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------- Icons (SVG) ----------------- */
.icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}

.icon-lg {
  width: 18px;
  height: 18px;
}

.day-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-normal);
  color: var(--text-muted);
}

.day-chevron.open {
  transform: rotate(90deg);
}

/* ----------------- Top Navigation Bar ----------------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  padding: 0 var(--space-5);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
  flex-shrink: 0;
  color: var(--text-primary);
}

.nav-brand svg,
.nav-brand-logo {
  flex-shrink: 0;
  display: block;
}

.nav-brand-logo-full {
  height: 22px;
  width: auto;
  display: block;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.nav-brand-logo-full:hover {
  opacity: 0.9;
}

.nav-brand svg {
  color: var(--accent-primary);
}

.nav-brand-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.nav-center {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  max-width: 680px;
  justify-content: center;
}

/* Flexible Batch Selector */
#batch-select {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  font-weight: 500;
  height: var(--btn-height);
  text-overflow: ellipsis;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.user-email-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 0 var(--space-3);
  height: var(--btn-height);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  white-space: nowrap;
}

/* ----------------- Layout Containers ----------------- */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}

/* ----------------- Auth Card (Login) ----------------- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-5);
}

.auth-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.auth-header {
  margin-bottom: var(--space-6);
  text-align: center;
}

.auth-logo-full {
  display: block;
  height: 30px;
  width: auto;
  margin: 0 auto var(--space-5) auto;
}

.auth-header h1,
.auth-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ----------------- Form Elements ----------------- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  height: var(--btn-height);
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 var(--space-3);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.form-control-mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  padding-right: 32px;
}

select.form-control option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

/* Custom Minimal Checkbox */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all var(--transition-fast);
  vertical-align: middle;
  position: relative;
  flex-shrink: 0;
}

input[type="checkbox"]:hover {
  border-color: var(--accent-primary);
}

input[type="checkbox"]:checked {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ----------------- Buttons ----------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--btn-height);
  padding: 0 var(--space-4);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1;
  position: relative;
  user-select: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-primary:active {
  background-color: var(--accent-primary-active);
}

.btn-secondary {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background-color: var(--danger-btn-bg);
  color: #ffffff;
  border-color: var(--danger-btn-bg);
}

.btn-danger:hover {
  background-color: var(--danger-btn-hover);
  border-color: var(--danger-btn-hover);
}

.btn-sm {
  height: var(--btn-height-sm);
  padding: 0 var(--space-3);
  font-size: 12px;
}

.btn-icon-only {
  width: var(--btn-height);
  padding: 0;
  flex-shrink: 0;
}

.btn-icon-only.btn-sm {
  width: var(--btn-height-sm);
  height: var(--btn-height-sm);
}

.btn:disabled, .btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-stepper {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  transition: opacity var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.tickets-table tr:hover .btn-stepper,
.duration-control:hover .btn-stepper,
.duration-control:focus-within .btn-stepper,
.btn-stepper:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.btn-stepper:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

.btn-stepper:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ----------------- Toolbar del Periodo (Action Bar) ----------------- */
.action-bar,
.period-hub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap; /* Rigorosamente a riga singola su desktop */
  gap: var(--space-3);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 8px var(--space-4);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.action-bar:hover,
.period-hub:hover {
  border-color: var(--border-strong);
}

.action-bar-left,
.period-hub-top,
.hub-actions-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.action-bar-right,
.period-hub-bottom,
.hub-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Badge Informativi del Periodo (Pills compatti) */
.batch-meta-tag,
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.batch-meta-tag .icon,
.meta-pill .icon {
  width: 14px;
  height: 14px;
  color: var(--accent-primary);
}

.batch-meta-tag.meta-pill-period {
  background-color: var(--accent-primary-subtle);
  border-color: var(--accent-primary-border);
  font-weight: 600;
  color: var(--text-primary);
}

.batch-meta-tag.meta-pill-period .icon {
  color: var(--accent-primary);
}

/* Status Pill con Live Indicator Dot */
.batch-meta-tag .status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--text-muted);
  flex-shrink: 0;
}

.batch-meta-tag.status-draft {
  background-color: var(--status-under-bg);
  border-color: var(--status-under-border);
  color: var(--status-under-text);
  font-weight: 600;
}

.batch-meta-tag.status-draft .status-indicator-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.batch-meta-tag.status-synced {
  background-color: var(--status-optimal-bg);
  border-color: var(--status-optimal-border);
  color: var(--status-optimal-text);
  font-weight: 600;
}

.batch-meta-tag.status-synced .status-indicator-dot {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.batch-meta-tag.status-partial {
  background-color: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
  font-weight: 600;
}

.batch-meta-tag.status-partial .status-indicator-dot {
  background-color: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary-border);
}

/* Separatore Verticale Discreto */
.action-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-default);
  margin: 0 2px;
}

/* Dimensioni pulsanti nella Action Bar a riga singola */
.action-bar-right .btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-sync-hero {
  height: 32px;
  padding: 0 14px;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--accent-primary-border);
}

.btn-rollback-outline {
  background-color: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-weight: 500;
  height: 32px;
  padding: 0 10px;
}

.btn-rollback-outline:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-btn-bg);
  color: var(--danger-text);
}

.btn-delete-period {
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface-raised);
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-delete-period:hover {
  color: var(--danger-text);
  border-color: var(--danger-border);
  background-color: var(--danger-bg);
}

/* ----------------- Accordion Day Card ----------------- */
.day-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.day-card:hover {
  border-color: var(--border-strong);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background-color: var(--bg-surface-raised);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  flex-wrap: nowrap;
  gap: var(--space-3);
  width: 100%;
  min-height: 48px;
}

.day-header:hover {
  background-color: var(--bg-surface-hover);
}

.day-header-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: opacity var(--transition-fast);
}

.day-header-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.day-date-str {
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.day-hours-breakdown {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.day-hours-breakdown strong {
  color: var(--text-primary);
  font-weight: 600;
}

.day-online-note {
  color: var(--text-muted);
  font-size: 11px;
}

/* Compact Visual Hour Indicator */
.day-hours-indicator-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}

.day-hours-mini-bar {
  width: 52px;
  height: 5px;
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.day-hours-mini-fill {
  height: 100%;
  transition: width var(--transition-normal);
  border-radius: 2px;
}

.day-hours-mini-fill.optimal { background: linear-gradient(90deg, #059669, #10b981); }
.day-hours-mini-fill.under { background: linear-gradient(90deg, #d97706, #f59e0b); }
.day-hours-mini-fill.over { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* --- Toolbar Azioni Header Accordion --- */
.day-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.day-actions-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-default);
  margin: 0 1px;
}

.day-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.btn-day-action {
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.btn-day-action .icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.btn-day-action.btn-secondary {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  opacity: 0.85;
}

.day-header:hover .btn-day-action.btn-secondary,
.btn-day-action.btn-secondary:hover,
.btn-day-action.btn-secondary:focus-visible {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: var(--text-primary);
  opacity: 1;
}

.btn-day-action.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-sync-day {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px var(--accent-primary-border);
  font-weight: 600;
}

.btn-sync-day:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 2px 8px var(--accent-primary-border);
}

.btn-day-action.btn-rollback-outline {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--danger-text);
  font-weight: 500;
  opacity: 0.75;
}

.day-header:hover .btn-day-action.btn-rollback-outline,
.btn-day-action.btn-rollback-outline:hover,
.btn-day-action.btn-rollback-outline:focus-visible {
  border-color: var(--danger-border);
  opacity: 1;
}

.btn-day-action.btn-rollback-outline:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-btn-bg);
  color: var(--danger-text);
}

.day-body {
  border-top: 1px solid var(--border-default);
}

/* SOGLIE ORE (7.45h - 8.00h) STATUS PILLS COMPATTI */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.status-pill .icon {
  width: 13px;
  height: 13px;
}

.status-optimal {
  background-color: var(--status-optimal-bg);
  color: var(--status-optimal-text);
  border: 1px solid var(--status-optimal-border);
}

.status-under {
  background-color: var(--status-under-bg);
  color: var(--status-under-text);
  border: 1px solid var(--status-under-border);
}

.status-over {
  background-color: var(--status-over-bg);
  color: var(--status-over-text);
  border: 1px solid var(--status-over-border);
}

/* ==========================================================================
   Linear-Style Ticket Item Flow (.ticket-item)
   ========================================================================== */
.day-tickets-list {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
}

.ticket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: transparent;
  transition: background-color var(--transition-fast);
  position: relative;
}

.ticket-item:last-child {
  border-bottom: none;
}

.ticket-item:hover {
  background-color: var(--bg-surface-hover);
}

/* --- Lead: Order, Reorder & Status Dot --- */
.ticket-lead {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.ticket-lead .ticket-idx {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 14px;
  text-align: center;
}

.ticket-item:hover .btn-order,
.ticket-lead:focus-within .btn-order {
  opacity: 0.75;
  pointer-events: auto;
}

.ticket-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ticket-status-dot.dot-draft {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.ticket-status-dot.dot-synced {
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* --- Body: Title & Meta --- */
.ticket-body-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.ticket-item:hover .ticket-title-input {
  border-color: var(--border-default);
  background: var(--bg-surface-raised);
}

.ticket-item:hover .btn-edit-ticket,
.ticket-title-wrap:focus-within .btn-edit-ticket {
  opacity: 0.7;
  pointer-events: auto;
}

.ticket-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-surface-raised);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-default);
  white-space: nowrap;
}

.ticket-time-chip .icon {
  width: 11px;
  height: 11px;
  color: var(--text-muted);
}

.chip-commits {
  cursor: pointer;
  border-color: var(--accent-primary-border);
  background: var(--accent-primary-subtle);
  transition: all var(--transition-fast);
}

.chip-commits:hover {
  border-color: var(--accent-primary);
  background: var(--accent-primary-subtle);
  color: var(--accent-primary-hover);
}

/* --- Tail: Duration Stepper + Actions --- */
.ticket-tail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ticket-item:hover .btn-stepper,
.ticket-tail-actions:focus-within .btn-stepper {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.ticket-item:hover .duration-input {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
}

.duration-unit {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-item-sync {
  height: 25px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px var(--accent-primary-border);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-item-sync:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 2px 6px var(--accent-primary-border);
}

.btn-item-sync .icon {
  width: 12px;
  height: 12px;
}

.ticket-synced-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  height: 22px;
}

.btn-action-pill {
  height: 25px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* --- More Actions Contextual Menu (•••) --- */
.ticket-more-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-more-actions {
  width: 25px;
  height: 25px;
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.btn-more-actions .icon {
  width: 14px;
  height: 14px;
}

.ticket-item:hover .btn-more-actions,
.btn-more-actions:focus-visible,
.btn-more-actions:hover {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-more-actions:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-surface-hover);
}

.ticket-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 185px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 100;
  animation: dropdownFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.dropdown-item .icon {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.dropdown-item:hover .icon {
  color: var(--accent-primary);
}

.dropdown-item.item-danger {
  color: var(--danger-text);
}

.dropdown-item.item-danger .icon {
  color: var(--danger-text);
}

.dropdown-item.item-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

/* ----------------- Table Responsive Wrapper (Modals) ----------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ----------------- Tickets Table & Rows (Modals) ----------------- */
.tickets-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-table th {
  text-align: left;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  background-color: var(--bg-surface-raised);
  white-space: nowrap;
}

.tickets-table td {
  text-align: left;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.tickets-table tr:last-child td {
  border-bottom: none;
}

.tickets-table tr:hover {
  background-color: var(--bg-surface-hover);
}

/* Inline Edit: Title Input */
.ticket-title-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  text-align: left;
}

.ticket-title-input {
  flex: 1;
  height: 23px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  padding: 0 5px;
  margin-left: -6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-fast);
}

.tickets-table tr:hover .ticket-title-input,
.ticket-title-input:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-raised);
}

.ticket-title-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input);
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-edit-ticket {
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background-color: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0;
  pointer-events: none;
  flex-shrink: 0;
}

.btn-edit-ticket .icon {
  width: 12px;
  height: 12px;
}

.tickets-table tr:hover .btn-edit-ticket,
.ticket-title-wrap:hover .btn-edit-ticket,
.ticket-title-wrap:focus-within .btn-edit-ticket,
.btn-edit-ticket:focus-visible {
  opacity: 0.7;
  pointer-events: auto;
}

.btn-edit-ticket:hover {
  opacity: 1;
  color: var(--accent-primary);
  background-color: var(--accent-primary-subtle);
  border-color: var(--accent-primary-border);
}

.ticket-meta-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.ticket-desc-snippet {
  font-size: 10.5px;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 520px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0 4px;
  border-radius: var(--radius-xs);
  display: inline-block;
  vertical-align: middle;
}

.ticket-desc-snippet:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.06);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 2px;
}

/* Inline status indicator (saving / saved / error) */
.inline-status-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 11px;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.inline-status-indicator.saving {
  color: var(--accent-primary);
  animation: pulse-spin 1s infinite linear;
}

.inline-status-indicator.saved {
  color: var(--status-optimal-text);
}

.inline-status-indicator.error {
  color: var(--danger-text);
}

@keyframes pulse-spin {
  0% { transform: rotate(0deg); opacity: 0.6; }
  50% { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.6; }
}

/* Chips and Badges */
.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 0 5px;
  height: 18px;
  line-height: 16px;
  border-radius: 3px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip-repo {
  color: var(--accent-primary);
  border-color: var(--accent-primary-border);
  background: var(--accent-primary-subtle);
}

.chip-entity {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.28);
  background: rgba(124, 58, 237, 0.08);
}

.chip-synced {
  color: var(--status-optimal-text);
  border-color: var(--status-optimal-border);
  background: var(--status-optimal-bg);
  font-weight: 600;
}

.chip-partial {
  color: var(--status-under-text);
  border-color: var(--status-under-border);
  background: var(--status-under-bg);
  font-weight: 600;
}

.duration-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
}

.duration-input {
  width: 44px;
  height: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  box-shadow: none;
}

.tickets-table tr:hover .duration-input,
.duration-control:hover .duration-input,
.duration-input:hover {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
}

.duration-input:focus {
  background-color: var(--bg-input);
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}

.timeline-str {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.timeline-slot-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 1px;
  text-align: center;
  white-space: nowrap;
}

/* Ordinamento colonna # */
.ticket-order-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.ticket-idx {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 12px;
  text-align: center;
}

/* Raggruppamento e uniformità pulsanti azione riga */
.ticket-actions-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

/* Pulsanti Tabella Rigorosamente Uniformi & Compatti */
.btn-tbl {
  width: auto;
  min-width: 48px;
  height: 23px;
  padding: 0 7px !important;
  font-size: 10.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 3px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

/* Linear-style quiet secondary actions on table rows */
.tickets-table .btn-secondary.btn-tbl {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  opacity: 0.75;
}

.tickets-table tr:hover .btn-secondary.btn-tbl,
.tickets-table .ticket-actions-row:focus-within .btn-secondary.btn-tbl,
.tickets-table .btn-secondary.btn-tbl:focus-visible {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: var(--text-primary);
  opacity: 1;
}

.tickets-table .btn-secondary.btn-tbl:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.tickets-table .btn-primary.btn-tbl {
  background-color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px var(--accent-primary-border);
}

.tickets-table .btn-primary.btn-tbl:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 2px 6px var(--accent-primary-border);
}

.tickets-table .btn-rollback-outline.btn-tbl {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--danger-text);
  font-weight: 500;
  opacity: 0.75;
}

.tickets-table tr:hover .btn-rollback-outline.btn-tbl,
.tickets-table .ticket-actions-row:focus-within .btn-rollback-outline.btn-tbl,
.tickets-table .btn-rollback-outline.btn-tbl:focus-visible {
  border-color: var(--danger-border);
  opacity: 1;
}

.tickets-table .btn-rollback-outline.btn-tbl:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-btn-bg);
  color: var(--danger-text);
}

.btn-danger-outline {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--danger-text);
  font-weight: 500;
  opacity: 0.55;
  transition: all var(--transition-fast);
}

.tickets-table tr:hover .btn-danger-outline,
.tickets-table .ticket-actions-row:focus-within .btn-danger-outline,
.btn-danger-outline:focus-visible {
  border-color: var(--danger-border);
  opacity: 0.85;
}

.btn-danger-outline:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-btn-bg);
  color: var(--danger-text);
  opacity: 1;
}

/* ----------------- Modals ----------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  padding: var(--space-4);
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-default);
  background-color: var(--bg-surface-raised);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-default);
  background-color: var(--bg-surface-raised);
}

/* Modal Sizes & Controls */
.modal-lg {
  max-width: 680px;
}

textarea.form-control,
.form-control-textarea {
  height: auto;
  min-height: 140px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
}

/* Custom Confirmation Modal */
.modal-confirm-content {
  max-width: 480px;
}

.confirm-details-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: var(--space-3);
}

/* ----------------- Toast Notifications ----------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 400px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
  animation: toastSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

@keyframes toastSlideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast.toast-success { border-left: 4px solid var(--status-optimal-border); }
.toast.toast-error { border-left: 4px solid var(--danger-border); }
.toast.toast-warning { border-left: 4px solid var(--status-under-border); }
.toast.toast-info { border-left: 4px solid var(--info-border); }

.toast-icon {
  margin-top: 1px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--status-optimal-text); }
.toast-error .toast-icon { color: var(--danger-text); }
.toast-warning .toast-icon { color: var(--status-under-text); }
.toast-info .toast-icon { color: var(--info-text); }

.toast-message {
  flex: 1;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-size: 14px;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ----------------- Progress Bar ----------------- */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 12px 0 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--accent-primary);
  width: 0%;
  transition: width 0.3s ease;
}

/* ----------------- Alert Callouts ----------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: var(--space-4);
  line-height: 1.45;
}

.alert-danger {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.alert-success {
  background-color: var(--status-optimal-bg);
  border: 1px solid var(--status-optimal-border);
  color: var(--status-optimal-text);
}

.alert-info {
  background-color: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

/* ASCII Dry-Run Container */
.ascii-container {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  white-space: pre-wrap;
  color: var(--text-primary);
  max-height: 400px;
  overflow-y: auto;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* --- Tablet (641px - 1024px) --- */
@media (max-width: 1024px) {
  .navbar {
    padding: 0 var(--space-4);
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .nav-center {
    order: 3;
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    margin-top: var(--space-1);
  }

  #batch-select {
    max-width: none;
    flex: 1;
  }

  .container {
    padding: var(--space-4);
  }

  /* Tablet action-bar layout */
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .action-bar-left, .action-bar-right {
    width: 100%;
    justify-content: flex-start;
  }
}

/* --- Mobile (<= 640px) --- */
@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .navbar {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .nav-brand-title {
    font-size: 14px;
  }

  .nav-brand-logo-full {
    height: 19px;
  }

  .user-email-chip {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 var(--space-2);
    font-size: 11px;
  }

  .nav-right .btn span {
    display: none;
  }

  .nav-right .btn {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    padding: 0;
  }

  .container {
    padding: var(--space-3);
  }

  /* Mobile action-bar layout */
  .action-bar {
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .action-bar-left {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    width: 100%;
  }

  .action-bar-left .batch-meta-tag {
    font-size: 11.5px;
    padding: 5px 10px;
  }

  .action-bar-right {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    width: 100%;
  }

  .action-bar-right .btn {
    flex: 1;
    min-width: 90px;
    height: var(--touch-target-min);
    font-size: 12px;
    justify-content: center;
  }

  .action-bar-right .btn-delete-period {
    flex: 0 0 var(--touch-target-min);
  }

  .action-bar-right .btn-sync-hero {
    flex: 1 1 100%;
    width: 100%;
    margin-top: 2px;
  }

  .action-divider {
    display: none;
  }

  .day-header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .day-header-toggle {
    width: 100%;
    justify-content: flex-start;
  }

  .day-header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .day-actions-divider {
    display: none;
  }

  .day-actions-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .day-actions-group .btn {
    height: 32px;
    font-size: 11.5px;
    padding: 0 10px;
    justify-content: center;
  }

  .btn-stepper {
    width: 34px;
    height: 34px;
    font-size: 16px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .btn-order {
    opacity: 1;
    pointer-events: auto;
  }

  .btn-edit-ticket {
    opacity: 0.8;
    pointer-events: auto;
  }

  .duration-input {
    background-color: var(--bg-surface-raised);
    border-color: var(--border-default);
  }

  .modal-backdrop {
    padding: var(--space-2);
    align-items: flex-end;
  }

  .modal-content {
    max-height: 94vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }

  /* Mobile Ticket Item Layout */
  .ticket-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .ticket-lead {
    order: 1;
  }

  .ticket-body-content {
    order: 2;
    flex: 1 1 calc(100% - 70px);
  }

  .ticket-tail-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px dashed var(--border-subtle);
  }
}

/* Touch devices fallback (ensures ghost elements are visible on touch) */
@media (hover: none) {
  .btn-stepper {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .btn-order {
    opacity: 1;
    pointer-events: auto;
  }
  .btn-edit-ticket {
    opacity: 0.8;
    pointer-events: auto;
  }
  .duration-input {
    background-color: var(--bg-surface-raised);
    border-color: var(--border-default);
  }
  .tickets-table .btn-secondary.btn-tbl,
  .tickets-table .btn-danger-outline.btn-tbl,
  .tickets-table .btn-rollback-outline.btn-tbl {
    opacity: 1;
    border-color: var(--border-default);
    background-color: var(--bg-surface-raised);
  }
  .tickets-table .btn-danger-outline.btn-tbl {
    border-color: var(--danger-border);
  }
  .ticket-item .btn-stepper,
  .ticket-item .btn-order,
  .ticket-item .btn-edit-ticket,
  .ticket-item .btn-more-actions {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
}

/* ==========================================================================
   Toolbar Filtri Rapidi (Single-Row Modern Filter Bar)
   ========================================================================== */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 7px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-top: 0;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-search-wrap {
  flex: 1 1 260px;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

#filter-search-input {
  padding-left: 32px;
  padding-right: 12px;
  height: 30px;
  font-size: 12px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  width: 100%;
}

#filter-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}

.filter-controls-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.filter-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-default);
  flex-shrink: 0;
}

#filter-repo-select {
  height: 30px;
  font-size: 12px;
  min-width: 160px;
  max-width: 220px;
  padding: 0 8px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.filter-pills-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  height: 30px;
  flex-shrink: 0;
}

.filter-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-pill:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.filter-pill.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
}

/* ==========================================================================
   Timeline Grafica a Blocchi (Mini-Gantt)
   ========================================================================== */
.day-timeline-wrap {
  margin: 10px 14px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: all var(--transition-fast);
}

.day-timeline-wrap.timeline-collapsed {
  padding-bottom: 10px;
}

.timeline-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.day-timeline-wrap:not(.timeline-collapsed) .timeline-header-bar {
  margin-bottom: 8px;
}

.timeline-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timeline-title {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.btn-timeline-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 10.5px;
  font-family: var(--font-sans);
  padding: 2px 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.btn-timeline-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
  background-color: var(--bg-surface-raised);
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot-draft { background-color: var(--accent-primary); }
.legend-dot-synced { background-color: var(--color-success); }
.legend-dot-busy { background-color: var(--color-warning); }

.timeline-track {
  position: relative;
  height: 32px;
  background-color: var(--bg-surface-raised);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.timeline-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.timeline-block:hover {
  filter: brightness(1.2);
  z-index: 5;
  box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  transform: translateY(-1px);
}

.tb-idx {
  font-weight: 700;
  opacity: 0.95;
}

.tb-dur {
  font-size: 9.5px;
  opacity: 0.85;
}

.timeline-block-draft {
  background-color: var(--accent-primary);
  border: 1px solid var(--accent-hover);
}

.timeline-block-synced {
  background-color: var(--color-success);
  border: 1px solid #059669;
}

.timeline-block-busy {
  background: repeating-linear-gradient(
    45deg,
    rgba(245, 158, 11, 0.2),
    rgba(245, 158, 11, 0.2) 6px,
    rgba(245, 158, 11, 0.35) 6px,
    rgba(245, 158, 11, 0.35) 12px
  );
  border: 1px solid var(--status-under-border);
  color: var(--status-under-text);
}

.timeline-lunch-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    var(--border-subtle),
    var(--border-subtle) 4px,
    transparent 4px,
    transparent 8px
  );
  border-left: 1px dashed var(--border-default);
  border-right: 1px dashed var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 1;
}

.lunch-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.65;
  pointer-events: none;
}

.timeline-ruler {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 0 2px;
}

/* ==========================================================================
   Badges Delta & Pulsante Bilanciamento
   ========================================================================== */
.day-balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.badge-delta-zero {
  background-color: var(--status-optimal-bg);
  color: var(--status-optimal-text);
  border: 1px solid var(--status-optimal-border);
}

.badge-delta-under {
  background-color: var(--status-under-bg);
  color: var(--status-under-text);
  border: 1px solid var(--status-under-border);
}

.badge-delta-over {
  background-color: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.btn-balance {
  font-size: 11px;
  padding: 2px 8px;
  height: 24px;
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  opacity: 0.85;
  transition: all var(--transition-fast);
}

.day-header:hover .btn-balance,
.btn-balance:hover,
.btn-balance:focus-visible {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-default);
  color: var(--text-primary);
  opacity: 1;
}

.btn-balance:hover {
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

/* ==========================================================================
   Pulsanti Riordino Ticket (↑ / ↓)
   ========================================================================== */
.order-control-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
}

.btn-order {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 2px;
  color: var(--text-muted);
  width: 15px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.tickets-table tr:hover .btn-order,
.ticket-order-box:focus-within .btn-order,
.btn-order:focus-visible {
  opacity: 0.75;
  pointer-events: auto;
}

.btn-order:hover:not(:disabled) {
  background-color: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--accent-primary);
  opacity: 1;
}

.btn-order:disabled {
  opacity: 0.2;
  cursor: default;
}

/* ==========================================================================
   Modale Archivio Storico
   ========================================================================== */
.archive-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.archive-stat-card {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archive-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.archive-stat-val {
  font-size: 20px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.archive-table-container {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.archive-table {
  margin-bottom: 0;
}

/* ==========================================================================
   Modale Commit Explorer
   ========================================================================== */
.commit-inspector-meta {
  padding: 10px 14px;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
}

.commit-inspector-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.commit-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.commit-msg {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.commit-sha-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-primary);
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.commit-sha-link:hover {
  background-color: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   Modal Tabs Navigation
   ========================================================================== */
.tabs-nav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 16px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

/* ==========================================================================
   Prefers-Reduced-Motion (Accessibility)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .day-chevron {
    transition: none;
  }
}

/* ==========================================================================
   Custom Minimalist Scrollbars (No Browser Default Ugly Scrollbars)
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Button Micro-Interactions & Refinements
   ========================================================================== */
.btn:active {
  transform: scale(0.98);
}

/* ==========================================================================
   Brand Logo Dynamic Text Theme Adaptation
   ========================================================================== */
.brand-logo-text {
  fill: var(--text-primary);
  transition: fill var(--transition-fast);
}

/* ==========================================================================
   Theme Switcher Component (Compact Tri-State Toggle)
   ========================================================================== */
.theme-switch {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
  user-select: none;
}

.theme-switch-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.theme-switch-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.theme-switch-btn:hover {
  color: var(--text-primary);
}

.theme-switch-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Posizionamento selettore tema nella schermata di login (Auth Screen) */
.auth-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 50;
}

/* ==========================================================================
   Modal Merge Ticket (Sostituzione del window.prompt nativo)
   ========================================================================== */
.modal-merge-content {
  max-width: 520px;
}

.merge-desc-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.merge-section-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.merge-source-card {
  background-color: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: var(--space-4);
}

.merge-source-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
  margin-bottom: 3px;
}

.merge-source-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.merge-targets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: var(--space-4);
  padding-right: 2px;
}

.merge-target-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.merge-target-item:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.merge-target-item.selected {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary-subtle);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.merge-target-item-info {
  flex: 1;
  min-width: 0;
}

.merge-target-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-target-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.merge-target-item-hours {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
}

.merge-summary-box {
  background-color: var(--bg-surface-raised);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.merge-summary-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.merge-summary-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
}

