/* ==========================================================================
   P. ZAFIROPOULOS WORKSPACE — UI v2 Δόση 5: Αρχική & Εργασίες
   - Αρχική (#h7Home / #homeRoot): εναρμόνιση καρτών KPI, «Σήμερα για εσένα»,
     «Έργα ανά φάση» (με το Operations · Συνεργασία καθαρά ενεργό, όχι κλειστό),
     πωλητών και πρόσφατων αλλαγών με τα UI v2 tokens.
   - Εργασίες (#teamRoot / .rc5-*): διόρθωση στριμωγμένης κάρτας .rc5-task-line
     σε iPad όρθιο (1024×1366), διόρθωση φόντου εκπρόθεσμων (.rc5-late),
     καθαρά φίλτρα/γρήγορη προσθήκη 34px, Kanban & Εβδομάδα, ιεραρχία κουμπιών.
   - Διατηρείται άθικτο το #51 (Συμμετέχοντες φόρμας στο rc7.css).
   - Καμία αλλαγή σε JS, labels, id, name, data-*, δικαιώματα ή Forecast.
   ========================================================================== */

/* ==========================================================================
   1. ΑΡΧΙΚΗ (#homeRoot / #h7Home)
   ========================================================================== */
#homeRoot .h7-head {
  align-items: center;
  margin: 0 0 12px;
}

#homeRoot .h7-head h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ui-text);
}

#homeRoot .h7-date {
  font-size: var(--ui-text-sm);
  color: var(--ui-text-muted);
}

#homeRoot .h7-head button {
  min-height: var(--ui-control-h);
  padding: 6px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: var(--ui-text-sm);
  font-weight: 600;
}

@media (hover: hover) {
  #homeRoot .h7-head button:hover {
    background: var(--ui-surface-hover);
    border-color: #9db0c7;
    color: var(--ui-text);
  }
}

#homeRoot .h7-cards {
  gap: 12px;
  margin-bottom: 12px;
}

#homeRoot .h7-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  padding: 13px 15px;
  box-shadow: var(--ui-shadow-xs);
}

@media (hover: hover) {
  #homeRoot .h7-card.h7-click:hover,
  #homeRoot .h7-panel.h7-click:hover {
    border-color: var(--ui-primary-border);
    box-shadow: var(--ui-shadow-sm);
  }
}

#homeRoot .h7-label {
  font-size: var(--ui-text-xs);
  color: var(--ui-text-muted);
}

#homeRoot .h7-big {
  font-size: clamp(19px, 2vw, 26px);
  color: var(--ui-text);
  font-variant-numeric: tabular-nums;
}

#homeRoot .h7-sub {
  font-size: var(--ui-text-sm);
  color: var(--ui-text-secondary);
}

#homeRoot .h7-red {
  color: var(--ui-danger-text);
  font-weight: 600;
}

#homeRoot .h7-ring {
  background: conic-gradient(var(--ui-primary) calc(var(--p) * 1%), var(--ui-border) 0);
}

#homeRoot .h7-ring span {
  color: var(--ui-text);
  font-variant-numeric: tabular-nums;
}

#homeRoot .h7-bar {
  background: var(--ui-surface-hover);
}

#homeRoot .h7-bar span {
  background: linear-gradient(90deg, #2c6eb5, var(--ui-primary));
}

#homeRoot .h7-bar.ok span {
  background: var(--ui-success-text);
}

#homeRoot .h7-bar.warn span {
  background: var(--ui-accent);
}

#homeRoot .h7-grid {
  gap: 12px;
}

#homeRoot .h7-panel {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  padding: 13px 15px;
  box-shadow: var(--ui-shadow-xs);
}

#homeRoot .h7-panel-head h3 {
  font-size: var(--ui-text-lg);
  font-weight: 700;
  color: var(--ui-text);
}

#homeRoot .h7-panel-head small {
  font-size: var(--ui-text-xs);
  color: var(--ui-text-muted);
}

#homeRoot .h7-item {
  min-height: 44px;
  padding: 8px 6px;
  border-radius: var(--ui-radius-md);
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text);
}

@media (hover: hover) {
  #homeRoot button.h7-item:hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
  }
}

#homeRoot .h7-approval {
  padding: 6px 10px;
  min-height: 34px;
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  margin: 4px 0;
}

#homeRoot .h7-approval b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: var(--ui-radius-pill);
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
  font-size: var(--ui-text-xs);
  font-variant-numeric: tabular-nums;
}

#homeRoot .h7-icon {
  background: var(--ui-info-bg);
}

#homeRoot .h7-icon.red {
  background: var(--ui-danger-bg);
}

#homeRoot .h7-icon.amber {
  background: var(--ui-warning-bg);
}

#homeRoot .h7-icon.green {
  background: var(--ui-success-bg);
}

#homeRoot .h7-tag {
  background: var(--ui-info-bg);
  color: var(--ui-info-text);
  border: 1px solid var(--ui-info-border);
  font-size: var(--ui-text-xs);
  font-weight: 700;
}

#homeRoot .h7-tag.red {
  background: var(--ui-danger-bg);
  color: var(--ui-danger-text);
  border-color: var(--ui-danger-border);
}

#homeRoot .h7-tag.amber {
  background: var(--ui-warning-bg);
  color: var(--ui-warning-text);
  border-color: var(--ui-warning-border);
}

#homeRoot .h7-tag.green {
  background: var(--ui-success-bg);
  color: var(--ui-success-text);
  border-color: var(--ui-success-border);
}

/* Έργα ανά φάση: Operations · Συνεργασία καθαρά ενεργό (ζωηρό πρασινομπλέ, όχι κλειστό/γκρι) */
#homeRoot .h7-phase-track .ph0 {
  background: #2b6cb0;
}

#homeRoot .h7-phase-track .ph1 {
  background: var(--ui-primary);
}

#homeRoot .h7-phase-track .ph2 {
  background: #0f766e;
}

#homeRoot .h7-tiles div {
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
}

#homeRoot .h7-tiles b {
  font-size: 21px;
  color: var(--ui-text);
  font-variant-numeric: tabular-nums;
}

#homeRoot .h7-seller-track {
  background: var(--ui-surface-hover);
}

#homeRoot .h7-seller-track span {
  background: var(--ui-primary);
}

#homeRoot .h7-seller-track span.ok {
  background: var(--ui-success-text);
}

#homeRoot .h7-seller-track span.warn {
  background: var(--ui-accent);
}

#homeRoot .h7-seller-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#homeRoot .h7-change {
  min-height: 36px;
  padding: 6px;
  border-radius: var(--ui-radius-sm);
}

@media (hover: hover) {
  #homeRoot .h7-change:hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
  }
}

#homeRoot .h7-legacy {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-xs);
}

#homeRoot .h7-legacy > summary {
  min-height: 38px;
  font-size: var(--ui-text-base);
  color: var(--ui-text-secondary);
}

#homeRoot #nextPendingCommunications {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-xs);
}

#homeRoot #nextPendingCommunications h3 {
  margin: 0 0 8px;
  font-size: var(--ui-text-md);
  color: var(--ui-text);
}

#homeRoot #nextPendingCommunications .pending-link {
  padding: 8px 12px;
  min-height: var(--ui-control-h);
  font-size: var(--ui-text-base);
  background: var(--ui-surface-subtle);
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-md);
}

/* ==========================================================================
   2. ΕΡΓΑΣΙΕΣ & ΠΑΡΑΔΟΤΕΑ (#teamRoot / .rc5-*)
   ========================================================================== */
#teamRoot {
  color: var(--ui-text);
}

#teamRoot .team-page-heading {
  padding: 8px 12px;
  margin: 0 0 8px !important; /* υπερισχύει workspace-compact.css #app .team-page-heading */
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-xs);
}

#teamRoot button {
  min-height: var(--ui-control-h);
  padding: 6px 12px;
  border-radius: var(--ui-radius-md);
  font-size: var(--ui-text-sm);
  font-weight: 600;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}

#teamRoot .team-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}

#teamRoot .team-filter-bar button,
#teamRoot .team-tabs button {
  min-height: var(--ui-control-h-sm);
  padding: 5px 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-pill);
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
  font-size: var(--ui-text-sm);
}

#teamRoot .team-filter-bar .selected,
#teamRoot .team-tabs .selected {
  background: var(--ui-primary) !important; /* υπερισχύει team-work.css .team-filter-bar .selected */
  border-color: var(--ui-primary) !important; /* υπερισχύει team-work.css .team-filter-bar .selected */
  color: #ffffff !important; /* υπερισχύει team-work.css .team-filter-bar .selected */
}

#teamRoot .team-toolbar input,
#teamRoot .team-toolbar select,
#teamRoot .team-occurrence-picker select,
#teamRoot .rc5-quick-add input,
#teamRoot #teamComment {
  min-height: var(--ui-control-h);
  padding: 6px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-family: var(--ui-font-sans);
  font-size: var(--ui-text-base);
  line-height: 1.35;
  box-sizing: border-box;
}

#teamRoot #teamComment {
  min-height: 80px;
}

#teamRoot .team-toolbar input:focus,
#teamRoot .team-toolbar select:focus,
#teamRoot .rc5-quick-add input:focus,
#teamRoot #teamComment:focus {
  outline: none;
  border-color: var(--ui-primary);
  box-shadow: var(--ui-focus-ring);
}

/* Μπάρα προβολής (Λίστα / Πίνακας / Η εβδομάδα μου) & Γρήγορη προσθήκη */
#teamRoot .rc5-task-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin: 6px 0 8px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-xs);
}

#teamRoot .rc5-views {
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
}

#teamRoot .rc5-views button {
  min-height: var(--ui-control-h);
  padding: 5px 11px;
  border: 0;
  border-radius: 0;
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
}

#teamRoot .rc5-views button.selected {
  background: var(--ui-primary);
  color: #ffffff;
}

#teamRoot .rc5-quick-add {
  align-items: center;
}

#teamRoot .rc5-quick-add input[type="date"] {
  width: 145px;
  flex: 0 0 auto;
}

#teamRoot .rc5-quick-add button[type="submit"] {
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  color: #ffffff;
  white-space: nowrap;
}

@media (hover: hover) {
  #teamRoot .rc5-quick-add button[type="submit"]:hover {
    background: var(--ui-primary-hover);
    border-color: var(--ui-primary-hover);
    color: #ffffff;
  }
}

/* ---------- ΚΡΙΣΙΜΗ ΔΙΟΡΘΩΣΗ: Master-Detail & γραμμή εργασίας (.rc5-task-line) ---------- */
#teamRoot .team-work-layout {
  grid-template-columns: minmax(310px, 0.95fr) minmax(350px, 1.35fr);
  gap: 14px;
}

#teamRoot .rc5-task-line {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 4px;
  align-items: start;
  padding: 3px 0 3px 6px;
  margin: 5px 0;
  border-left: 4px solid var(--ui-primary);
  border-radius: var(--ui-radius-sm);
}

#teamRoot .rc5-task-line.prio-urgent {
  border-left-color: var(--ui-danger);
}

#teamRoot .rc5-task-line.prio-high {
  border-left-color: var(--ui-accent);
}

#teamRoot .rc5-task-line.prio-low {
  border-left-color: var(--ui-text-muted);
}

#teamRoot .rc5-done,
#teamRoot .rc5-done-placeholder {
  grid-column: 1;
  grid-row: 1;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  margin-top: 8px;
  align-self: start;
}

#teamRoot .rc5-task-line .team-task-row {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px 12px !important; /* υπερισχύει team-work.css .team-task-row padding:17px!important */
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md) !important; /* υπερισχύει workspace.css .team-task-row border-radius:12px!important */
  gap: 4px 8px;
  font-weight: 400;
}

#teamRoot .rc5-task-line .team-task-row .team-row-title {
  font-size: var(--ui-text-base);
  font-weight: 700;
  color: var(--ui-text);
  line-height: 1.35;
}

/* Ετικέτα έργου (.rc5-chip) κάτω από την κάρτα ώστε να μην στριμώχνει ποτέ τον τίτλο */
#teamRoot .rc5-task-line > .rc5-chip {
  grid-column: 2;
  justify-self: start;
  min-height: 24px;
  padding: 2px 9px;
  max-width: 100%;
  font-size: var(--ui-text-xs);
  background: var(--ui-surface-subtle);
  border-color: var(--ui-border);
  color: var(--ui-text-secondary);
}

/* Διόρθωση σύγκρουσης workspace.css .team-task-row background:white!important vs .rc5-late */
#teamRoot .rc5-task-line.rc5-late .team-task-row:not(.selected) {
  background: #fff5f5 !important; /* υπερισχύει workspace.css .team-task-row background:white!important */
  border-color: var(--ui-danger-border);
}

#teamRoot .rc5-task-line .team-task-row.selected {
  background: var(--ui-primary-soft) !important; /* υπερισχύει workspace.css .team-task-row.selected */
  border-color: var(--ui-primary) !important; /* υπερισχύει workspace.css .team-task-row.selected */
  box-shadow: inset 3px 0 0 var(--ui-primary);
}

#teamRoot .team-chip {
  padding: 2px 8px;
  border-radius: var(--ui-radius-pill);
  font-size: var(--ui-text-xs);
  font-weight: 700;
}

#teamRoot .status-in_progress {
  background: var(--ui-info-bg);
  color: var(--ui-info-text);
}

#teamRoot .status-pending_approval {
  background: var(--ui-warning-bg);
  color: var(--ui-warning-text);
}

#teamRoot .status-closed {
  background: var(--ui-success-bg);
  color: var(--ui-success-text);
}

#teamRoot .status-blocked {
  background: var(--ui-danger-bg);
  color: var(--ui-danger-text);
}

/* Καρτέλα λεπτομέρειας εργασίας (.team-detail) */
#teamRoot .team-detail {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-xs);
  padding: 16px 18px !important; /* υπερισχύει workspace-compact.css #app .team-detail padding:14px!important */
}

#teamRoot .team-detail .rc5-task-info {
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  padding: 10px 12px;
}

#teamRoot .team-detail .rc5-task-info .rc5-chip {
  min-height: 28px;
  padding: 3px 10px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border-strong);
  color: var(--ui-primary);
}

#teamRoot .team-primary-actions button[data-team="submit"],
#teamRoot .team-primary-actions button[data-team="close-task"],
#teamRoot .team-primary-actions button[data-team="start"],
#teamRoot #teamCommentForm button[type="submit"] {
  background: var(--ui-primary) !important; /* υπερισχύει workspace.css .success / .primary */
  border-color: var(--ui-primary) !important; /* υπερισχύει workspace.css .success / .primary */
  color: #ffffff !important; /* υπερισχύει workspace.css .success / .primary */
}

#teamRoot .team-primary-actions button[data-team="delete"] {
  background: var(--ui-surface) !important; /* υπερισχύει workspace-next.css .danger */
  border-color: var(--ui-danger-border) !important; /* υπερισχύει workspace-next.css .danger */
  color: var(--ui-danger-text) !important; /* υπερισχύει workspace-next.css .danger */
}

@media (hover: hover) {
  #teamRoot .team-primary-actions button[data-team="delete"]:hover {
    background: var(--ui-danger-bg) !important; /* υπερισχύει workspace-next.css .danger */
    border-color: var(--ui-danger) !important; /* υπερισχύει workspace-next.css .danger */
    color: var(--ui-danger-text) !important; /* υπερισχύει workspace-next.css .danger */
  }
}

/* Kanban (.rc5-board) & Εβδομάδα (.rc5-week) */
#teamRoot .rc5-col {
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  padding: 10px;
}

#teamRoot .rc5-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-left: 4px solid var(--ui-primary);
  border-radius: var(--ui-radius-md);
  box-shadow: var(--ui-shadow-xs);
}

#teamRoot .rc5-week-head span {
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  color: var(--ui-text-secondary);
}

#teamRoot .rc5-week-head span.today {
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  color: #ffffff;
}

#teamRoot .rc5-bar {
  background: var(--ui-surface);
  border-color: var(--ui-border-strong);
  border-left: 4px solid var(--ui-primary);
}

/* ---------- 3. iPad Pro (pointer: coarse + ≥761px): 34px αντί για 44px ---------- */
@media (pointer: coarse) and (min-width: 761px) {
  #homeRoot .h7-head button,
  #teamRoot button,
  #teamRoot .team-filter-bar button,
  #teamRoot .rc5-views button {
    min-height: var(--ui-control-h) !important; /* υπερισχύει workspace-compact.css @media(pointer:coarse) #app button 44px */
  }

  #teamRoot .rc5-done {
    min-height: 30px !important; /* υπερισχύει workspace-compact.css @media(pointer:coarse) #app button 44px */
  }

  #teamRoot .rc5-task-line > .rc5-chip {
    min-height: 24px !important; /* υπερισχύει workspace-compact.css @media(pointer:coarse) #app button 44px */
  }

  #teamRoot .team-toolbar input,
  #teamRoot .team-toolbar select,
  #teamRoot .rc5-quick-add input,
  #teamRoot #teamComment {
    font-size: var(--ui-text-md) !important; /* υπερισχύει workspace-compact.css @media(pointer:coarse) 16px σε iPad Pro */
  }
}

/* ---------- 4. Responsive ---------- */
@media (max-width: 1000px) {
  #teamRoot .team-work-layout {
    grid-template-columns: minmax(270px, 0.9fr) minmax(300px, 1.2fr);
  }
}

@media (max-width: 760px) {
  #teamRoot .team-work-layout {
    grid-template-columns: 1fr;
  }
}
