  :root {
    color-scheme: light;
    --rolam:        #623674;
    --rolam-light:  #F2EBF7;
    --rolam-mid:    #C09DC8;
    --rolam-sun:    #fab71d;
    --rolam-shadow: #2d2445;
    --gard:        #2D8C45;
    --gard-light:  #E6F4EA;
    --gard-mid:    #93CCA1;
    --mirano:      #9C5FB5;
    --mirano-light:#F5EEFB;
    --mirano-mid:  #D4AADF;
    --done:        #34C759;
    --done-light:  #E8FAF0;
    --wait:        #FF9500;
    --wait-light:  #FFF3E0;
    --plan:        #007AFF;
    --plan-light:  #E8F3FF;
    --unsched:     #8E8E93;
    --unsched-light: #F2F2F7;
    --invoiced:      #5856D6;
    --invoiced-light: #EFEFF9;
    --invoiced-mid:   #B0AEE8;
    --sys-bg:      #F2F2F7;
    --card-bg:     #FFFFFF;
    --label:       #1C1C1E;
    --label2:      #3C3C43;
    --label3:      #8E8E93;
    --sep:         #E5E5EA;
    --sep2:        #F2F2F7;
    --accent:      #007AFF;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background: var(--sys-bg);
    color: var(--label);
    padding: 20px 16px;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
  }

  /* ── Header ── */
  .header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
  }
  .header-title h1 {
    font-size: 28px; font-weight: 700; letter-spacing: -0.5px; color: var(--label);
  }
  .header-title p { font-size: 13px; color: var(--label3); margin-top: 3px; }
  .refresh-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--r-md);
    border: none; background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--accent); transition: all 0.15s ease;
    white-space: nowrap; flex-shrink: 0;
  }
  .refresh-btn:hover { background: #F0F7FF; }
  .refresh-btn:active { transform: scale(0.97); }

  /* ── Note ── */
  .note-box {
    background: #FFF9E6; border: 1px solid #FFE58A;
    border-radius: var(--r-md); padding: 10px 14px;
    font-size: 12px; color: #7A5C00; margin-bottom: 16px;
    line-height: 1.5;
  }

  /* ── Search ── */
  .search-wrap {
    position: relative; margin-bottom: 14px;
  }
  .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--label3); pointer-events: none; font-size: 15px;
  }
  .search-input {
    width: 100%; padding: 10px 36px 10px 36px;
    border: none; border-radius: var(--r-md);
    background: var(--card-bg); box-shadow: var(--shadow-sm);
    font-size: 14px; color: var(--label);
    font-family: inherit; outline: none;
    transition: box-shadow 0.2s;
  }
  .search-input:focus { box-shadow: 0 0 0 3px rgba(0,122,255,0.15), var(--shadow-sm); }
  .search-input::placeholder { color: var(--label3); }
  .search-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: var(--label3); color: white; border: none; cursor: pointer;
    width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
    display: none; align-items: center; justify-content: center;
    line-height: 1;
  }
  .search-clear.visible { display: flex; }

  /* ── View switcher ── */
  .view-row { display: flex; justify-content: flex-end; margin-bottom: 10px; }
  .view-switcher {
    display: flex; background: var(--card-bg); border-radius: var(--r-md);
    padding: 3px; box-shadow: var(--shadow-sm); gap: 2px;
  }
  .view-btn {
    padding: 5px 13px; border-radius: 9px; border: none;
    background: transparent; cursor: pointer;
    font-size: 12px; font-weight: 500; color: var(--label3);
    font-family: inherit; white-space: nowrap; transition: all 0.15s;
  }
  .view-btn.active {
    background: var(--sys-bg); color: var(--label);
    box-shadow: var(--shadow-sm); font-weight: 600;
  }

  /* ── Calendar nav ── */
  .cal-nav {
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  }
  .cal-nav-btn {
    width: 32px; height: 32px; border-radius: var(--r-sm);
    border: none; background: var(--card-bg); box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 18px; color: var(--label2);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
  }
  .cal-nav-btn:hover { background: var(--sep); }
  .cal-nav-title { font-size: 15px; font-weight: 600; color: var(--label); flex: 1; text-align: center; }
  .cal-today-btn {
    padding: 6px 12px; border-radius: var(--r-sm);
    border: none; background: var(--card-bg); box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 12px; font-weight: 500;
    color: var(--accent); font-family: inherit; transition: all 0.15s;
  }
  .cal-today-btn:hover { background: #F0F7FF; }

  /* ── Week view ── */
  .week-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  }
  @media (max-width: 600px) { .week-grid { grid-template-columns: repeat(3, 1fr); } }
  .week-day-col {
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 8px 6px; box-shadow: var(--shadow-sm); min-height: 100px;
  }
  .wday-today { outline: 2px solid var(--accent); }
  .wday-weekend { background: #FAFAFA; }
  .week-day-header { text-align: center; margin-bottom: 8px; }
  .wday-name { font-size: 10px; font-weight: 700; color: var(--label3); text-transform: uppercase; letter-spacing: 0.4px; }
  .wday-num {
    font-size: 20px; font-weight: 700; color: var(--label);
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 3px auto 0;
  }
  .wday-num.today-circle { background: var(--accent); color: #fff; }
  .week-empty { text-align: center; color: var(--sep); font-size: 22px; padding: 14px 0; }
  .week-pill {
    display: flex; align-items: flex-start; gap: 4px;
    padding: 4px 6px; border-radius: 6px; margin-bottom: 4px;
    font-size: 10px; font-weight: 500; line-height: 1.35;
    cursor: pointer; transition: opacity 0.15s; word-break: break-word;
  }
  .week-pill:hover { opacity: 0.8; }
  .week-pill-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
  .wp-confirmed               { background: var(--done-light); color: #1A7A35; }
  .wp-confirmed .week-pill-dot{ background: var(--done); }
  .wp-awaiting                { background: var(--wait-light); color: #A05000; }
  .wp-awaiting  .week-pill-dot{ background: var(--wait); }
  .wp-planned.rolam           { background: var(--rolam-light); color: var(--rolam); }
  .wp-planned.rolam    .week-pill-dot { background: var(--rolam); }
  .wp-planned.gardenex        { background: var(--gard-light);  color: var(--gard); }
  .wp-planned.gardenex .week-pill-dot { background: var(--gard); }
  .wp-planned.mirano          { background: var(--mirano-light); color: var(--mirano); }
  .wp-planned.mirano   .week-pill-dot { background: var(--mirano); }
  .wp-unscheduled             { background: var(--unsched-light); color: #555; }
  .wp-unscheduled .week-pill-dot { background: var(--unsched); }

  /* ── Month view ── */
  .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .month-head-cell {
    text-align: center; font-size: 11px; font-weight: 700;
    color: var(--label3); padding: 6px 2px; text-transform: uppercase; letter-spacing: 0.3px;
  }
  .month-cell {
    min-height: 72px; background: var(--card-bg); border-radius: var(--r-sm);
    padding: 4px 4px 3px; box-shadow: var(--shadow-sm); overflow: hidden;
  }
  .month-cell.other-month { background: #F9F9FB; }
  .month-cell.other-month .mcell-date { opacity: 0.35; }
  .month-cell.mcell-today { outline: 2px solid var(--accent); }
  .month-cell.mcell-weekend { background: #FAFAFA; }
  .mcell-date {
    font-size: 11px; font-weight: 600; color: var(--label2);
    text-align: right; margin-bottom: 3px; line-height: 1;
  }
  .mcell-date.today-pill {
    background: var(--accent); color: #fff; border-radius: 50%;
    width: 18px; height: 18px; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; margin-bottom: 3px;
  }
  .month-pill {
    font-size: 9px; font-weight: 600; padding: 2px 4px;
    border-radius: 3px; margin-bottom: 2px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.4; display: block; transition: opacity 0.15s;
  }
  .month-pill:hover { opacity: 0.8; }
  .mp-confirmed               { background: var(--done-light);    color: #1A7A35; }
  .mp-awaiting                { background: var(--wait-light);    color: #A05000; }
  .mp-planned.rolam           { background: var(--rolam-light);   color: var(--rolam); }
  .mp-planned.gardenex        { background: var(--gard-light);    color: var(--gard); }
  .mp-planned.mirano          { background: var(--mirano-light);  color: var(--mirano); }
  .mp-unscheduled             { background: var(--unsched-light); color: #555; }

  /* ── Holidays ── */
  .holiday-label {
    font-size: 9px; font-weight: 700; color: #C0392B;
    background: #FDECEA; border-radius: 3px;
    padding: 1px 4px; margin-bottom: 2px; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.5;
  }
  .week-holiday {
    font-size: 9px; font-weight: 700; color: #C0392B;
    background: #FDECEA; border-radius: 3px;
    padding: 2px 5px; margin-bottom: 4px; display: block;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .plan-holiday {
    background: #FDECEA; border-radius: 8px;
    padding: 7px 8px; margin-bottom: 6px;
    font-size: 11px; border-left: 3px solid #C0392B;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    font-weight: 600; color: #C0392B;
    word-break: break-word; line-height: 1.3;
  }
  .wday-holiday { background: #FFF5F5; }
  .mcell-holiday { background: #FFF8F8; }
  .month-more { font-size: 9px; color: var(--label3); font-weight: 600; padding: 1px 3px; }

  /* ── Company selector ── */
  .company-selector {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-bottom: 12px;
  }
  .company-btn {
    padding: 10px 8px; border-radius: var(--r-md);
    border: 2px solid transparent; background: var(--card-bg);
    box-shadow: var(--shadow-sm); cursor: pointer;
    font-family: inherit; font-size: 13px; font-weight: 600;
    color: var(--label2); transition: all 0.18s ease;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    user-select: none;
  }
  .company-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
  .company-btn:active { transform: scale(0.97); }
  .company-btn .cb-label { font-size: 10px; font-weight: 500; color: var(--label3); text-transform: uppercase; letter-spacing: 0.3px; }
  .company-btn.cb-all.active  { border-color: var(--label2); background: var(--sep2); color: var(--label); }
  .company-btn.cb-rolam       { color: var(--rolam); }
  .company-btn.cb-rolam.active{ border-color: var(--rolam); background: var(--rolam-light); }
  .company-btn.cb-gard        { color: var(--gard); }
  .company-btn.cb-gard.active { border-color: var(--gard);  background: var(--gard-light); }
  .company-count { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; line-height: 1; }

  /* ── Stats ── */
  .stats-bar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 8px; margin-bottom: 16px;
  }
  @media (max-width: 520px) { .stats-bar { grid-template-columns: repeat(3, 1fr); } }
  .stat-card {
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 10px 6px; text-align: center;
    box-shadow: var(--shadow-sm); cursor: pointer;
    transition: all 0.18s ease; user-select: none;
    border: 2px solid transparent;
  }
  .stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
  .stat-card:active { transform: scale(0.97); }
  .stat-card.active-filter { border-color: currentColor; background: var(--filter-bg, #F0F7FF); }
  .stat-num { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1; }
  .stat-label { font-size: 9px; color: var(--label3); margin-top: 4px; font-weight: 500; letter-spacing: 0.2px; text-transform: uppercase; }
  .s-total .stat-num      { color: var(--label2); }
  .s-total.active-filter  { --filter-bg: var(--sep2); border-color: var(--label2); }
  .s-confirmed .stat-num  { color: var(--done); }
  .s-confirmed.active-filter { --filter-bg: var(--done-light); border-color: var(--done); }
  .s-awaiting .stat-num   { color: var(--wait); }
  .s-awaiting.active-filter  { --filter-bg: var(--wait-light); border-color: var(--wait); }
  .s-planned .stat-num    { color: var(--plan); }
  .s-planned.active-filter   { --filter-bg: var(--plan-light); border-color: var(--plan); }
  .s-unsched .stat-num     { color: var(--unsched); }
  .s-unsched.active-filter { --filter-bg: var(--unsched-light); border-color: var(--unsched); }
  .s-invoiced .stat-num    { color: var(--invoiced); }
  .s-invoiced.active-filter { --filter-bg: var(--invoiced-light); border-color: var(--invoiced); }

  /* ── Month picker ── */
  .month-tabs { margin-bottom: 12px; }
  .mp-row {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    margin-bottom: 6px;
  }
  .mp-all-btn, .mp-year-btn {
    padding: 6px 14px; border-radius: 20px;
    border: 1.5px solid var(--sep); background: var(--card-bg);
    cursor: pointer; font-size: 12px; font-weight: 500;
    color: var(--label2); font-family: inherit;
    transition: all 0.15s; white-space: nowrap;
  }
  .mp-all-btn:hover, .mp-year-btn:hover { border-color: var(--label3); }
  .mp-all-btn.mp-sel { background: var(--label); color: #fff; border-color: var(--label); }
  .mp-year-btn.mp-yr-open { background: var(--accent); color: #fff; border-color: var(--accent); }
  .mp-year-btn.mp-yr-hassel { border-color: var(--accent); color: var(--accent); font-weight: 700; }
  .mp-months-row {
    display: flex; gap: 5px; flex-wrap: wrap;
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 8px 10px; box-shadow: var(--shadow-sm); margin-bottom: 6px;
  }
  .mp-month-btn {
    padding: 5px 11px; border-radius: 14px;
    border: 1.5px solid var(--sep); background: var(--sys-bg);
    cursor: pointer; font-size: 12px; font-weight: 500;
    color: var(--label2); font-family: inherit;
    transition: all 0.15s; white-space: nowrap; min-width: 46px; text-align: center;
  }
  .mp-month-btn.mp-has:hover { border-color: var(--label3); }
  .mp-month-btn.mp-sel { background: var(--accent); color: #fff; border-color: var(--accent); }
  .mp-month-btn.mp-no { opacity: 0.3; cursor: default; border-style: dashed; }

  /* ── Legend ── */
  .legend { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
  .legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--label2); }
  .legend-dot { width: 9px; height: 9px; border-radius: 50%; }

  /* ── Progress ── */
  .progress-wrap { margin-bottom: 14px; }
  .progress-label { font-size: 12px; color: var(--label3); margin-bottom: 5px; }
  .progress-bar { background: var(--sep); border-radius: 4px; height: 4px; overflow: hidden; }
  .progress-fill { background: var(--accent); height: 100%; border-radius: 4px; transition: width 0.3s ease; }

  /* ── Section headers ── */
  .month-section-header {
    font-size: 13px; font-weight: 600; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin: 24px 0 10px;
  }
  .epoch-header {
    display: flex; align-items: center; gap: 10px;
    margin: 24px 0 14px;
  }
  .epoch-header:first-child { margin-top: 0; }
  .epoch-pill {
    font-size: 12px; font-weight: 700; padding: 4px 12px;
    border-radius: 14px; white-space: nowrap; letter-spacing: 0.2px;
  }
  .epoch-past     .epoch-pill { background: var(--wait-light);    color: #A05000; }
  .epoch-future   .epoch-pill { background: var(--plan-light);    color: #0060CC; }
  .epoch-weekend  .epoch-pill { background: var(--unsched-light); color: #555; }
  .epoch-line { flex: 1; height: 1px; background: var(--sep); }
  .epoch-count { font-size: 11px; color: var(--label3); white-space: nowrap; }

  .status-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
    margin-top: 5px; display: inline-flex; align-items: center; gap: 4px;
  }
  .status-confirmed  { background: var(--done-light);     color: #1A7A35; }
  .status-awaiting   { background: var(--wait-light);     color: #A05000; }
  .status-planned    { background: var(--plan-light);     color: #0060CC; }
  .status-unscheduled{ background: var(--unsched-light);  color: #555; }
  .status-invoiced   { background: var(--invoiced-light); color: var(--invoiced); }

  /* Drive inline panel (inside card, like detail-panel) */
  .drive-panel {
    margin-top: 10px; border-top: 1px solid var(--sep);
    animation: fadeIn 0.18s ease;
  }
  .drive-panel-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0 5px;
  }
  .drive-panel-title {
    flex: 1; font-size: 11px; font-weight: 700; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .drive-panel-ext {
    font-size: 11px; color: #623674; text-decoration: none;
    padding: 2px 7px; border-radius: 5px; border: 1px solid #D4B8E0;
    background: #F2EBF7; white-space: nowrap; flex-shrink: 0;
  }
  .drive-panel-ext:hover { background: #D2E3FC; }
  .drive-panel-close {
    width: 20px; height: 20px; border: none; background: var(--sep2);
    border-radius: 50%; cursor: pointer; font-size: 10px; color: var(--label3);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .drive-panel-close:hover { background: var(--sep); }
  .drive-panel-back {
    display: flex; align-items: center; gap: 6px;
    padding: 0 0 5px; font-size: 11px; color: var(--label3);
  }
  .drive-panel-back button {
    background: none; border: none; cursor: pointer;
    font-size: 11px; color: #623674; padding: 0; text-decoration: underline;
  }
  .drive-panel-body {
    max-height: 220px; overflow-y: auto;
    background: var(--sys-bg); border-radius: var(--r-sm);
    border: 1px solid var(--sep);
  }
  .drive-file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; text-decoration: none; color: var(--label);
    transition: background 0.1s; border-bottom: 1px solid var(--sep);
  }
  .drive-file-item:last-child { border-bottom: none; }
  .drive-file-item:hover { background: var(--card-bg); }
  .drive-file-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
  .drive-file-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drive-file-date { font-size: 10px; color: var(--label3); flex-shrink: 0; }
  .drive-folder-item .drive-file-name { font-weight: 600; color: #623674; cursor: pointer; }
  .drive-loading, .drive-empty, .drive-error {
    padding: 18px; text-align: center; font-size: 12px; color: var(--label3);
  }

  /* Invoice modal */
  .invoice-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1200;
  }
  .invoice-modal {
    background: var(--card-bg); border-radius: var(--r-lg);
    padding: 24px 24px 20px; width: 320px; max-width: 90vw;
    box-shadow: var(--shadow-md);
  }
  .invoice-modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
  .invoice-modal p  { font-size: 12px; color: var(--label3); margin-bottom: 14px; line-height: 1.5; }
  .invoice-input-wrap {
    display: flex; align-items: center;
    border: 1.5px solid var(--sep); border-radius: var(--r-sm);
    overflow: hidden; transition: border-color 0.15s;
    background: var(--card-bg);
  }
  .invoice-input-wrap:focus-within { border-color: var(--invoiced); }
  .invoice-prefix {
    padding: 10px 10px 10px 12px; font-size: 14px; font-weight: 700;
    color: var(--invoiced); background: var(--invoiced-light);
    border-right: 1.5px solid var(--invoiced-mid); white-space: nowrap; user-select: none;
  }
  .invoice-input {
    flex: 1; padding: 10px 12px; border: none;
    font-size: 14px; font-family: inherit; outline: none;
    background: transparent; color: var(--label);
  }
  .invoice-btns { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
  .invoice-cancel { padding: 8px 14px; border-radius: var(--r-sm); border: none;
    background: var(--sep2); color: var(--label2); font-size: 13px; cursor: pointer; }
  .invoice-confirm { padding: 8px 16px; border-radius: var(--r-sm); border: none;
    background: var(--invoiced); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
  .invoice-confirm:hover { opacity: 0.88; }
  .invoice-num-badge {
    font-size: 11px; font-weight: 600; color: var(--invoiced);
    background: var(--invoiced-light); border-radius: 4px;
    padding: 2px 7px; margin-left: 6px;
  }
  .event-card.st-unscheduled { background: #FAFAFA; opacity: 0.9; }
  .event-card.st-unscheduled::before { background: var(--unsched) !important; }

  /* ── mPohoda Pick Modal ── */
  .mph-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1400;
  }
  .mph-modal {
    background: var(--card-bg); border-radius: 14px;
    padding: 22px 22px 18px; width: 480px; max-width: 94vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18); max-height: 80vh;
    display: flex; flex-direction: column;
  }
  .mph-modal-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
  .mph-modal-title { font-size: 15px; font-weight: 700; flex: 1; }
  .mph-modal-close { border: none; background: none; font-size: 20px; color: var(--label3); cursor: pointer; padding: 0 4px; }
  .mph-invoice-row {
    padding: 10px 12px; border-radius: 9px; border: 1px solid var(--sep);
    margin-bottom: 7px; cursor: pointer; background: var(--sys-bg);
    transition: background 0.12s, border-color 0.12s;
  }
  .mph-invoice-row:hover { background: var(--acc-muted, #EDF4FF); border-color: var(--accent); }
  .mph-invoice-num { font-size: 13px; font-weight: 700; color: var(--label1); }
  .mph-invoice-meta { font-size: 11px; color: var(--label2); margin-top: 2px; }
  .mph-list { overflow-y: auto; flex: 1; }

  /* ── Day group ── */
  .day-group { margin-bottom: 6px; }
  .day-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 4px; margin-bottom: 6px;
  }
  .day-name { font-size: 15px; font-weight: 600; color: var(--label); }
  .day-date { font-size: 13px; color: var(--label3); }
  .day-today { font-size: 10px; background: var(--accent); color: white; padding: 2px 7px; border-radius: 10px; font-weight: 600; letter-spacing: 0.3px; }
  .day-badge {
    margin-left: auto; font-size: 11px;
    background: var(--sep2); color: var(--label3);
    padding: 3px 9px; border-radius: 10px; font-weight: 500;
  }
  .day-badge.all-done { background: var(--done-light); color: #1A7A35; }

  /* ── Event card ── */
  .event-card {
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 13px 14px; margin-bottom: 8px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
  }
  .event-card:hover { box-shadow: var(--shadow-md); }
  .event-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
  }
  .event-card.rolam::before    { background: var(--rolam); }
  .event-card.gardenex::before { background: var(--gard); }
  .event-card.mirano::before   { background: var(--mirano); }
  /* Status-based card styles */
  .event-card.st-confirmed { background: #FAFFFE; }
  .event-card.st-confirmed::before { background: var(--done) !important; }
  .event-card.st-awaiting  { background: #FFFCF5; }
  .event-card.st-awaiting::before  { background: var(--wait) !important; }
  .event-card.st-invoiced  { background: var(--invoiced-light); }
  .event-card.st-invoiced::before  { background: var(--invoiced) !important; }
  .event-card.st-planned::before   { /* uses rolam/gardenex color */ }

  .event-icon { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
  .event-body { flex: 1; min-width: 0; }
  .event-title {
    font-weight: 600; font-size: 13px; color: var(--label);
    margin-bottom: 4px; word-break: break-word; line-height: 1.4;
  }
  .st-confirmed .event-title { color: var(--label2); }
  .st-awaiting  .event-title { color: var(--label); }
  .event-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }

  .tag {
    font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 600;
    letter-spacing: 0.2px;
  }
  .tag.rolam    { background: var(--rolam-light);   color: var(--rolam); }
  .tag.gardenex { background: var(--gard-light);    color: var(--gard); }
  .tag.mirano   { background: var(--mirano-light);  color: var(--mirano); }
  .tag.auto     { background: var(--done-light);   color: #1A7A35; }
  .tag.loc      { background: var(--sep2); color: var(--label3); font-weight: 400; }

  .done-info {
    font-size: 11px; font-weight: 500;
    margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  }
  .src-tag {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  }
  .src-cal { background: #F2EBF7; color: #623674; }
  .src-wa  { background: #E6F4EA; color: #1A7A35; }

  /* ── Actions ── */
  .event-actions { flex-shrink: 0; }
  .mark-btn {
    padding: 6px 12px; border-radius: var(--r-sm);
    border: none; cursor: pointer;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    font-family: inherit; transition: all 0.15s;
  }
  .mark-btn:active { transform: scale(0.96); }
  .btn-done   { background: var(--done); color: white; }
  .btn-done:hover { background: #28A845; }
  .btn-undone { background: #FFF3E0; color: #C05000; border: 1px solid #FFD0A0; }
  .btn-undone:hover { background: #FFE0B2; }
  .btn-neutral { background: var(--sep2); color: var(--label2); }
  .btn-neutral:hover { background: var(--sep); }
  .btn-finish { background: #E8E8F0; color: #444; }
  .btn-finish:hover { background: #D8D8E8; }

  /* Drive folder badge */
  .drive-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px; border-radius: 10px;
    background: #F2EBF7; color: #623674;
    text-decoration: none; font-size: 11px; font-weight: 500;
    border: 1px solid #D4B8E0; line-height: 1.6;
    transition: background 0.12s;
  }
  .drive-badge:hover { background: #D2E3FC; }
  .drive-badge-search { background: var(--sep2); color: var(--label3); border-color: var(--sep); opacity: 0.7; }
  .drive-badge-search:hover { background: var(--sep); opacity: 1; }
  #driveStatus {
    cursor: pointer; font-size: 11px; color: var(--label3);
    padding: 4px 8px; border-radius: 8px; border: 1px solid var(--sep);
    background: var(--card-bg); white-space: nowrap;
  }
  #driveStatus:hover { background: var(--sep2); }

  /* Note badge on card */
  .note-badge {
    font-size: 11px; color: var(--label3); margin-top: 5px;
    background: var(--sep2); border-radius: 6px; padding: 4px 8px;
    line-height: 1.4; cursor: pointer; display: block;
    white-space: pre-wrap; word-break: break-word;
  }
  .note-badge:hover { background: var(--sep); }

  /* Note modal */
  .note-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 1200;
  }
  .note-modal {
    background: var(--card-bg); border-radius: var(--r-lg);
    padding: 22px 22px 18px; width: 340px; max-width: 92vw;
    box-shadow: var(--shadow-md);
  }
  .note-modal h3 { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
  .note-modal p  { font-size: 12px; color: var(--label3); margin-bottom: 12px; }
  .note-textarea {
    width: 100%; height: 90px; padding: 10px 12px;
    border: 1.5px solid var(--sep); border-radius: var(--r-sm);
    font-size: 13px; font-family: inherit; resize: vertical;
    outline: none; transition: border-color 0.15s; line-height: 1.5;
  }
  .note-textarea:focus { border-color: var(--accent); }
  .note-btns { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

  /* ── States ── */
  .loading { text-align: center; padding: 50px 20px; color: var(--label3); }
  .spinner {
    width: 28px; height: 28px; border: 2.5px solid var(--sep);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.7s linear infinite; margin: 0 auto 14px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .empty { text-align: center; color: var(--label3); padding: 40px; font-size: 14px; }
  .empty-icon { font-size: 36px; margin-bottom: 10px; }
  .error-box {
    background: #FFF1F1; border: 1px solid #FFC7C7; border-radius: var(--r-md);
    padding: 14px; color: #C0392B; font-size: 13px;
  }

  /* ── Search highlight ── */
  mark { background: #FFF3A3; border-radius: 2px; padding: 0 1px; }

  /* ── Expand / Detail panel ── */
  .event-card { cursor: pointer; }
  .event-card.expanded { box-shadow: var(--shadow-md); }
  .event-card.expanded.rolam    { outline: 2px solid var(--rolam-mid); }
  .event-card.expanded.gardenex { outline: 2px solid var(--gard-mid); }
  .event-card.expanded.mirano   { outline: 2px solid var(--mirano-mid); }

  .expand-arrow {
    font-size: 11px; color: var(--label3); margin-left: 4px;
    transition: transform 0.2s; display: inline-block;
  }
  .expanded .expand-arrow { transform: rotate(180deg); }

  .detail-panel {
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--sep);
    display: none; flex-direction: column; gap: 8px;
    animation: fadeIn 0.18s ease;
  }
  .event-card.expanded .detail-panel { display: flex; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

  .detail-row {
    display: flex; gap: 8px; align-items: flex-start; font-size: 12px;
  }
  .detail-row-icon { font-size: 13px; flex-shrink: 0; margin-top: 1px; width: 18px; text-align: center; }
  .detail-row-content { flex: 1; color: var(--label2); line-height: 1.5; word-break: break-word; }
  .detail-row-label { font-size: 10px; font-weight: 600; color: var(--label3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
  .detail-desc {
    font-size: 12px; color: var(--label2); line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
    background: var(--sys-bg); border-radius: var(--r-sm);
    padding: 10px 12px; max-height: 260px; overflow-y: auto;
  }
  .detail-desc a { color: var(--accent); word-break: break-all; }

  /* Stop buttons from triggering expand */
  .event-actions { position: relative; z-index: 2; }

  /* ── Planning view ── */
  .planning-layout { display: flex; gap: 12px; }
  .plan-sidebar {
    width: 210px; flex-shrink: 0;
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 10px; box-shadow: var(--shadow-sm);
    max-height: 72vh; overflow-y: auto;
  }
  .plan-sidebar-title {
    font-size: 11px; font-weight: 700; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.4px;
    margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--sep);
    cursor: default;
    display: flex; justify-content: space-between; align-items: center;
  }
  .plan-week-area { flex: 1; min-width: 0; }
  .plan-week-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .plan-day-col {
    background: var(--card-bg); border-radius: var(--r-md);
    padding: 8px 6px; box-shadow: var(--shadow-sm);
    min-height: 200px; position: relative;
    transition: outline 0.1s;
  }
  .plan-day-col.drag-over { background: #E8F5E9; outline: 2px dashed #34C759; }
  .plan-day-col.today-col { outline: 2px solid var(--accent); }
  .plan-day-col.holiday-col { background: #FFF5F5; }
  .plan-day-header {
    text-align: center; margin-bottom: 8px; cursor: pointer;
    padding-bottom: 6px; border-bottom: 1px solid var(--sep);
    border-radius: 6px; padding-top: 2px;
  }
  .plan-day-header:hover { background: var(--sep2); }
  .plan-day-name { font-size: 10px; font-weight: 700; color: var(--label3); text-transform: uppercase; }
  .plan-day-num {
    font-size: 20px; font-weight: 700; width: 34px; height: 34px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 3px auto 0;
  }
  .plan-day-num.today-c { background: var(--accent); color: #fff; }
  .delivery-pill {
    font-size: 9px; font-weight: 600; padding: 2px 6px;
    background: #FFF3E0; color: #E65100; border-radius: 4px;
    margin-bottom: 6px; text-align: center; border: 1px solid #FFB74D;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .plan-card {
    background: var(--sys-bg); border-radius: 8px;
    padding: 7px 8px; margin-bottom: 6px;
    font-size: 11px; cursor: grab; border-left: 3px solid var(--label3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06); transition: transform 0.1s;
    user-select: none; position: relative;
  }
  .plan-card:hover { transform: translateY(-1px); }
  .plan-card-unsched-btn {
    position: absolute; top: 4px; right: 4px;
    width: 16px; height: 16px; border-radius: 50%;
    background: transparent; border: none;
    color: var(--label3); font-size: 13px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s;
  }
  .plan-card:hover .plan-card-unsched-btn { opacity: 1; }
  .plan-card-unsched-btn:hover { background: #FF3B30; color: #fff; opacity: 1; }
  .plan-card.rolam-card    { border-color: var(--rolam); }
  .plan-card.gardenex-card { border-color: var(--gard); }
  .plan-card.mirano-card   { border-color: var(--mirano); }
  .plan-card.confirmed-card {
    background: var(--done-light); border-color: var(--done);
  }
  .plan-card.confirmed-card .plan-card-title { color: #1A7A35; }
  .plan-card-title { font-weight: 600; color: var(--label); margin-bottom: 4px; line-height: 1.3; word-break: break-word; }
  .plan-card-delivery { font-size: 9px; color: #E65100; font-weight: 600; margin-bottom: 4px; }
  .plan-card-delivery.late { color: #C62828; }
  .tech-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
  .tech-chip {
    font-size: 9px; padding: 2px 7px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--sep); background: var(--card-bg); color: var(--label2);
    transition: all 0.12s; user-select: none; font-weight: 500; white-space: nowrap;
  }
  .tech-chip.assigned { background: var(--accent); color: #fff; border-color: var(--accent); }
  .tech-chip.busy { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
  .sidebar-card {
    background: var(--sys-bg); border-radius: 8px; padding: 8px 10px;
    margin-bottom: 6px; font-size: 11px; cursor: grab; border-left: 3px solid var(--label3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06); transition: opacity 0.15s; user-select: none;
  }
  .sidebar-card:hover { opacity: 0.8; }
  .sidebar-card.rolam-card    { border-color: var(--rolam); }
  .sidebar-card.gardenex-card { border-color: var(--gard); }
  .sidebar-card.mirano-card   { border-color: var(--mirano); }
  .sidebar-card.confirmed-card { background: var(--done-light); border-color: var(--done); }
  .sidebar-card.confirmed-card .sidebar-card-title { color: #1A7A35; }
  .sidebar-card-title { font-weight: 600; color: var(--label); line-height: 1.3; word-break: break-word; }
  .sidebar-card-delivery { font-size: 9px; color: #E65100; font-weight: 600; margin-top: 3px; }
  .sidebar-search-wrap { position: relative; margin-bottom: 8px; }
  .sidebar-search-input {
    width: 100%; box-sizing: border-box;
    padding: 6px 28px 6px 8px; border-radius: var(--r-sm);
    border: 1px solid var(--sep); background: var(--sys-bg);
    font-size: 12px; font-family: inherit; color: var(--label);
    outline: none; transition: border-color 0.15s;
  }
  .sidebar-search-input:focus { border-color: var(--accent); }
  .sidebar-search-input::placeholder { color: var(--label3); }
  .sidebar-search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: var(--label3); line-height: 1; padding: 0;
  }
  .sidebar-search-clear:hover { color: var(--label); }
  .sidebar-group-header {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 8px 8px 4px 10px; margin-top: 4px;
    border-top: 1px solid var(--sep);
    border-left: 3px solid currentColor;
    border-radius: 0 3px 0 0;
  }
  .sidebar-group-header.first-group { border-top: none; margin-top: 0; padding-top: 4px; }
  .plan-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
  .plan-nav-btn {
    width: 32px; height: 32px; border-radius: var(--r-sm);
    border: none; background: var(--card-bg); box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 18px; color: var(--label2);
    display: flex; align-items: center; justify-content: center; transition: all 0.15s;
    flex-shrink: 0;
  }
  .plan-nav-btn:hover { background: var(--sep); }
  .plan-nav-title { font-size: 14px; font-weight: 600; flex: 1; color: var(--label); }
  .plan-tech-btn {
    padding: 6px 12px; border-radius: var(--r-sm);
    border: none; background: var(--card-bg); box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 12px; font-weight: 500;
    color: var(--label2); font-family: inherit; transition: all 0.15s; flex-shrink: 0;
  }
  .plan-tech-btn:hover { background: var(--sep); }
  .day-popup-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.35);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
  }
  .day-popup {
    background: var(--card-bg); border-radius: var(--r-lg);
    padding: 20px; width: 380px; max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-height: 80vh; overflow-y: auto;
  }
  .day-popup-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
  .day-popup-close {
    float: right; background: none; border: none; font-size: 20px;
    cursor: pointer; color: var(--label3); padding: 0 0 4px 8px; line-height: 1;
  }
  .day-popup-item { padding: 8px 0; border-bottom: 1px solid var(--sep); font-size: 13px; line-height: 1.5; }
  .day-popup-item:last-child { border: none; }
  .plan-empty-col { text-align: center; color: var(--sep); font-size: 22px; padding: 20px 0; }
  .plan-saving { font-size: 10px; color: var(--label3); margin-top: 3px; font-style: italic; }

  /* ── Plan view toggle (week/month) ── */
  .plan-view-toggle {
    display: flex; align-items: center; gap: 2px;
    background: var(--sep2); border-radius: 8px; padding: 2px;
  }
  .plan-view-btn {
    padding: 4px 11px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 12px; font-weight: 500;
    background: transparent; color: var(--label2);
    transition: all 0.15s; font-family: inherit;
  }
  .plan-view-btn.active {
    background: var(--card-bg); color: var(--label);
    box-shadow: var(--shadow-sm); font-weight: 600;
  }

  /* ── Month planning grid ── */
  .plan-month-header {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 6px; margin-bottom: 4px;
  }
  .plan-month-day-name {
    font-size: 10px; font-weight: 700; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.4px; text-align: center;
    padding: 3px 0;
  }
  .plan-month-grid { display: flex; flex-direction: column; gap: 5px; }
  .plan-month-week-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .plan-month-cell {
    background: var(--card-bg); border-radius: var(--r-sm);
    padding: 6px 7px; min-height: 72px; box-shadow: var(--shadow-sm);
    transition: background 0.1s;
  }
  .plan-month-cell.today-col { outline: 2px solid var(--accent); }
  .plan-month-cell.holiday-col { background: #FFF8F8; }
  .plan-month-cell.other-month { opacity: 0.45; }
  .plan-month-cell.drag-over { background: #E8F5E9; outline: 2px dashed #34C759; }
  .plan-month-date {
    font-size: 11px; font-weight: 700; color: var(--label3);
    margin-bottom: 4px; line-height: 1;
  }
  .plan-month-date.today-num { color: var(--accent); }
  .plan-mini-card {
    background: var(--sys-bg); border-radius: 4px;
    border-left: 3px solid var(--sep);
    padding: 3px 5px; margin-bottom: 3px;
    font-size: 10px; font-weight: 600; color: var(--label);
    cursor: pointer; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; transition: background 0.1s;
    display: block;
  }
  .plan-mini-card { position: relative; }
  .plan-mini-card:hover { background: var(--sep); }
  .plan-mini-card.rolam-card    { border-color: var(--rolam); }
  .plan-mini-card.gardenex-card { border-color: var(--gard); }
  .plan-mini-card.mirano-card   { border-color: var(--mirano); }
  .plan-mini-card.confirmed-card { background: var(--done-light); border-color: var(--done); color: #1A7A35; }
  .plan-mini-unsched-btn {
    position: absolute; top: 1px; right: 2px;
    background: transparent; border: none;
    color: var(--label3); font-size: 11px; line-height: 1;
    cursor: pointer; padding: 0 2px; opacity: 0; transition: opacity 0.15s, color 0.15s;
  }
  .plan-mini-card:hover .plan-mini-unsched-btn { opacity: 1; }
  .plan-mini-unsched-btn:hover { color: #FF3B30; opacity: 1; }
  .plan-sidebar.sidebar-drag-over {
    background: var(--plan-light); outline: 2px dashed var(--accent); outline-offset: -2px;
  }

  /* ── Tech panel (inline expandable) ── */
  .plan-week-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
  }
  .plan-week-header .plan-nav { margin-bottom: 0; flex: 1; }
  .plan-tech-row {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
    margin-bottom: 6px; position: relative;
  }
  .plan-tech-col { position: relative; }
  .plan-tech-btn {
    width: 100%; text-align: left;
    padding: 6px 10px; border-radius: var(--r-sm);
    border: none; background: var(--card-bg); box-shadow: var(--shadow-sm);
    cursor: pointer; font-size: 12px; font-weight: 500;
    color: var(--label2); font-family: inherit; transition: all 0.15s;
  }
  .plan-tech-btn:hover { background: var(--sep); }
  .plan-tech-btn.open { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0,122,255,0.25); }
  .plan-tech-panel {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 200;
    background: var(--card-bg); border-radius: var(--r-md);
    box-shadow: var(--shadow-md); border: 1px solid var(--sep);
    padding: 10px; min-width: 200px; max-width: 260px;
    animation: fadeIn 0.15s ease;
  }
  .plan-tech-panel-title {
    font-size: 11px; font-weight: 700; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px;
  }
  .plan-tech-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 0; border-bottom: 1px solid var(--sep2);
    font-size: 13px; color: var(--label);
  }
  .plan-tech-item:last-of-type { border: none; }
  .plan-tech-remove, .plan-tech-edit {
    background: none; border: none; cursor: pointer;
    color: var(--label3); font-size: 14px; line-height: 1; padding: 0 2px;
    border-radius: 3px; transition: all 0.12s; flex-shrink: 0;
  }
  .plan-tech-remove { margin-left: auto; }
  .plan-tech-edit   { margin-left: auto; }
  .plan-tech-remove:hover { color: #C62828; background: #FFEBEB; }
  .plan-tech-edit:hover   { color: var(--accent); background: var(--plan-light); }
  .plan-tech-item-actions { display: flex; gap: 2px; margin-left: auto; }
  .plan-tech-edit-row {
    display: flex; gap: 4px; align-items: center; width: 100%; padding: 3px 0;
    border-bottom: 1px solid var(--sep2);
  }
  .plan-tech-edit-row:last-of-type { border: none; }
  .plan-tech-add-row {
    display: flex; gap: 5px; margin-top: 8px;
  }
  .plan-tech-input {
    flex: 1; border: 1px solid var(--sep); border-radius: var(--r-sm);
    padding: 5px 8px; font-size: 12px; font-family: inherit; outline: none;
    color: var(--label); background: var(--sys-bg);
  }
  .plan-tech-input:focus { border-color: var(--accent); }
  .plan-tech-add-btn {
    padding: 5px 10px; border-radius: var(--r-sm);
    border: none; background: var(--accent); color: #fff;
    cursor: pointer; font-size: 12px; font-weight: 600;
    font-family: inherit; white-space: nowrap; flex-shrink: 0;
  }
  .plan-tech-add-btn:hover { background: #0060CC; }

  /* ── Day tech pool ── */
  .day-tech-pool {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 6px 2px 8px; border-bottom: 2px solid var(--sep);
    margin-bottom: 8px; min-height: 38px;
    border-radius: 6px; transition: background 0.1s;
  }
  .day-tech-pool.pool-drag-over { background: #FFF3E0; outline: 2px dashed var(--wait); }
  .day-tech-chip {
    font-size: 10px; padding: 3px 8px; border-radius: 10px;
    border: 1px solid var(--sep); background: var(--card-bg);
    color: var(--label2); font-weight: 500; white-space: nowrap;
    cursor: grab; user-select: none; transition: all 0.12s;
  }
  .day-tech-chip:hover { background: var(--plan-light); border-color: var(--accent); color: var(--accent); }
  /* Busy = assigned somewhere this day, faded but still draggable */
  .day-tech-chip.busy {
    opacity: 0.4; border-style: dashed;
  }
  .day-tech-chip.busy:hover { opacity: 0.7; background: var(--plan-light); border-color: var(--accent); color: var(--accent); border-style: solid; }
  /* Absent = PN or vacation this day — red */
  .day-tech-chip.absent {
    background: #FFEBEB; border-color: #E53935; color: #C62828; opacity: 1;
  }
  .day-tech-chip.absent:hover { background: #FFCDD2; border-color: #C62828; }
  .day-tech-chip.absent.busy { opacity: 0.5; }
  /* Limited = obmedzený režim this day — orange */
  .day-tech-chip.limited {
    background: #FFF3E0; border-color: #E65100; color: #BF360C; opacity: 1;
  }
  .day-tech-chip.limited:hover { background: #FFE0B2; border-color: #BF360C; }
  .day-tech-chip.limited.busy { opacity: 0.5; }

  /* ── Tech status dot in panel ── */
  .tech-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    display: inline-block;
  }
  .tech-status-dot.available { background: #34C759; }
  .tech-status-dot.absent    { background: #E53935; }
  .tech-status-dot.limited   { background: #FF9500; }

  /* ── Tech profile popup ── */
  .tech-profile-section {
    margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--sep2);
  }
  .tech-profile-section:last-of-type { border: none; margin-bottom: 0; }
  .tech-profile-section-title {
    font-size: 11px; font-weight: 700; color: var(--label3);
    text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px;
  }
  .tech-profile-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
  }
  .tech-profile-row label {
    font-size: 12px; color: var(--label3); width: 96px; flex-shrink: 0; text-align: right;
  }
  .tech-profile-input {
    flex: 1; border: 1px solid var(--sep); border-radius: var(--r-sm);
    padding: 6px 9px; font-size: 13px; font-family: inherit; outline: none;
    color: var(--label); background: var(--sys-bg);
  }
  .tech-profile-input:focus { border-color: var(--accent); }
  .tech-profile-textarea {
    flex: 1; border: 1px solid var(--sep); border-radius: var(--r-sm);
    padding: 6px 9px; font-size: 13px; font-family: inherit; outline: none;
    color: var(--label); background: var(--sys-bg); resize: vertical; min-height: 56px;
  }
  .tech-profile-textarea:focus { border-color: var(--accent); }
  .tech-absence-row {
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap;
  }
  .tech-absence-select {
    border: 1px solid var(--sep); border-radius: var(--r-sm);
    padding: 5px 7px; font-size: 12px; font-family: inherit; outline: none;
    color: var(--label); background: var(--sys-bg); cursor: pointer;
  }
  .tech-absence-date {
    border: 1px solid var(--sep); border-radius: var(--r-sm);
    padding: 5px 7px; font-size: 12px; font-family: inherit; outline: none;
    color: var(--label); background: var(--sys-bg); width: 126px;
  }
  .tech-absence-remove {
    background: none; border: none; cursor: pointer; color: var(--label3);
    font-size: 16px; line-height: 1; padding: 0 3px; border-radius: 3px;
  }
  .tech-absence-remove:hover { color: #C62828; background: #FFEBEB; }
  .tech-profile-actions {
    display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end;
  }
  .tp-btn { padding: 8px 16px; border-radius: var(--r-sm); border: none;
    cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
  .tp-btn-secondary { background: var(--sep); color: var(--label2); }
  .tp-btn-secondary:hover { background: #D1D1D6; }
  .tp-btn-danger { background: #FFEBEB; color: #C62828; }
  .tp-btn-danger:hover { background: #FFCDD2; }
  .tp-btn-primary { background: var(--accent); color: #fff; }
  .tp-btn-primary:hover { background: #0060CC; }
  .tp-add-absence-btn {
    padding: 5px 10px; border-radius: var(--r-sm); border: 1px dashed var(--sep);
    background: none; cursor: pointer; font-size: 12px; color: var(--label3);
    font-family: inherit; margin-top: 2px;
  }
  .tp-add-absence-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--plan-light); }

  /* ── Plan card (assigned techs as draggable chips) ── */
  .plan-card { cursor: pointer; }
  .plan-card:active { transform: none; }
  .plan-card.card-drag-over {
    outline: 2px dashed var(--accent); background: var(--plan-light);
  }
  .plan-card-techs { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
  .plan-card-tech-chip {
    font-size: 9px; padding: 2px 4px 2px 7px; border-radius: 8px;
    background: var(--accent); color: #fff; font-weight: 500;
    display: inline-flex; align-items: center; gap: 2px;
    cursor: grab; user-select: none; transition: opacity 0.12s;
  }
  .plan-card-tech-chip:hover { opacity: 0.85; }
  .plan-card-tech-chip:active { cursor: grabbing; }
  .plan-card-tech-x {
    background: none; border: none; color: rgba(255,255,255,0.7);
    cursor: pointer; font-size: 11px; line-height: 1; padding: 0 1px;
    transition: color 0.1s;
  }
  .plan-card-tech-x:hover { color: #fff; }
  .plan-no-tech { font-size: 9px; color: var(--label3); font-style: italic; margin-top: 4px; }

/* ═══════════════════════════════════════════════════
   CRM Shell — Login · Navigation · Dashboard · Admin
   ═══════════════════════════════════════════════════ */

/* ── Login Screen ── */
#loginScreen {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--sys-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
}
.login-logo {
  font-size: 30px; font-weight: 800; letter-spacing: 2px;
  color: var(--rolam-shadow); text-transform: uppercase;
}
.login-logo em { color: var(--rolam-sun); font-style: normal; letter-spacing: 1px; }
.login-subtitle { font-size: 12px; color: var(--label3); margin-top: -10px; letter-spacing: 0.3px; }
.login-card {
  background: var(--card-bg); border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(45,36,69,0.14); padding: 28px 32px;
  width: 360px; max-width: 94vw;
  border-top: 3px solid var(--rolam);
}
.login-card-title { font-size: 17px; font-weight: 700; color: var(--label); margin-bottom: 16px; }
.login-user-grid { display: flex; flex-direction: column; gap: 8px; }
.login-user-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--sep); background: var(--sys-bg);
  cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--label); text-align: left; transition: all 0.15s; font-family: inherit;
}
.login-user-btn:hover { border-color: var(--rolam); background: var(--rolam-light); }
.login-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--rolam-light); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--rolam); flex-shrink: 0;
}
.login-user-name { font-weight: 600; }
.login-user-role { font-size: 11px; color: var(--label3); margin-top: 1px; }
.login-pwd-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-back-btn {
  background: none; border: none; color: var(--rolam);
  font-size: 13px; cursor: pointer; font-family: inherit; padding: 0;
  display: flex; align-items: center; gap: 4px; margin-bottom: 4px;
}
.login-pwd-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--sep); border-radius: var(--r-md);
  font-size: 14px; font-family: inherit; color: var(--label);
  background: var(--sys-bg); outline: none; transition: border-color 0.15s;
}
.login-pwd-input:focus { border-color: var(--rolam); }
.login-submit-btn {
  padding: 10px; border-radius: var(--r-md); border: none;
  background: var(--rolam-shadow); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.login-submit-btn:hover { background: var(--rolam); }
.login-error { font-size: 12px; color: #C62828; background: #FFEBEE; border-radius: var(--r-sm); padding: 8px; text-align: center; }

/* ── CRM Navigation bar ── */
#crmNav {
  display: flex; align-items: center; gap: 4px;
  background: var(--rolam-shadow); border-radius: var(--r-lg);
  box-shadow: 0 2px 12px rgba(45,36,69,0.25); padding: 0 14px;
  margin-bottom: 16px; height: 52px; flex-shrink: 0;
}
.crm-nav-brand {
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px;
  color: #ffffff; margin-right: 12px; white-space: nowrap;
  text-transform: uppercase;
}
.crm-nav-brand em { color: var(--rolam-sun); font-style: normal; }
.crm-nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.crm-nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm);
  border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.88);
  font-family: inherit; transition: all 0.15s; white-space: nowrap;
  position: relative;
}
.crm-nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.crm-nav-link.active {
  background: rgba(98,54,116,0.5);
  color: #fff; font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--rolam-sun);
}
.crm-nav-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.15); margin: 0 6px; flex-shrink: 0; }
.crm-nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.crm-nav-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(250,183,29,0.2); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--rolam-sun); flex-shrink: 0;
  border: 1.5px solid rgba(250,183,29,0.4);
}
.crm-nav-role-badge { font-size: 10px; padding: 2px 7px; border-radius: 10px; background: rgba(250,183,29,0.25); color: var(--rolam-sun); font-weight: 700; border: 1px solid rgba(250,183,29,0.4); }
.crm-nav-logout {
  padding: 5px 10px; border-radius: var(--r-md); border: 1px solid rgba(255,255,255,0.25); background: none;
  cursor: pointer; font-size: 12px; color: rgba(255,255,255,0.8); font-family: inherit; transition: all 0.15s;
}
.crm-nav-logout:hover { background: rgba(198,40,40,0.2); color: #FF6B6B; border-color: rgba(198,40,40,0.3); }

/* ── Dashboard ── */
.dashboard-greeting { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.dashboard-date { font-size: 13px; color: var(--label3); margin-bottom: 20px; }
.dashboard-section-title { font-size: 11px; font-weight: 700; color: var(--label3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 24px; }
.widget-card {
  background: var(--card-bg); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 16px;
  position: relative; transition: box-shadow 0.15s, transform 0.18s, opacity 0.18s;
  cursor: grab; user-select: none;
}
.widget-card:hover { box-shadow: var(--shadow-md); }
.widget-card.widget-dragging {
  opacity: 0.35; transform: scale(0.96);
  box-shadow: none; cursor: grabbing;
}
.widget-card.widget-drag-over {
  box-shadow: 0 0 0 2px var(--rolam), var(--shadow-md);
  transform: scale(1.02);
}
.widget-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.widget-card-title { font-size: 11px; font-weight: 700; color: var(--label3); text-transform: uppercase; letter-spacing: 0.4px; }
.widget-card-icon { font-size: 20px; }
.widget-unpin-btn {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--label3); padding: 2px 6px;
  border-radius: var(--r-sm); opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.widget-card:hover .widget-unpin-btn { opacity: 1; }
.widget-unpin-btn:hover { background: #FFEBEE; color: #C62828; }
.widget-stat-val { font-size: 36px; font-weight: 800; letter-spacing: -1px; color: var(--label); line-height: 1; }
.widget-stat-label { font-size: 12px; color: var(--label3); margin-top: 4px; }
.widget-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.widget-list-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--sep2); font-size: 12px; }
.widget-list-item:last-child { border-bottom: none; }
.widget-list-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.widget-list-name { flex: 1; font-weight: 500; color: var(--label); }
.widget-list-date { color: var(--label3); font-size: 11px; white-space: nowrap; }
.widget-empty { font-size: 12px; color: var(--label3); text-align: center; padding: 12px 0; }
.widget-cta {
  margin-top: 10px; width: 100%; padding: 8px;
  border: none; border-radius: var(--r-sm);
  background: var(--plan-light); color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.15s;
}
.widget-cta:hover { background: #D0E8FF; }
.add-widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.add-widget-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px dashed var(--sep); background: var(--card-bg);
  cursor: pointer; font-size: 13px; color: var(--label2);
  font-family: inherit; transition: all 0.15s; text-align: left;
}
.add-widget-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--plan-light); }
.add-widget-icon { font-size: 20px; }

/* ── Admin Panel ── */
.admin-wrap { max-width: 860px; }
.admin-section { background: var(--card-bg); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px; }
.admin-section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--sep); }
.admin-user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--sep2); }
.admin-user-row:last-child { border-bottom: none; }
.admin-user-name { font-weight: 600; flex: 1; }
.admin-user-roles { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-role-tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--plan-light); color: var(--accent); font-weight: 600; }
.admin-btn { padding: 5px 12px; border-radius: var(--r-sm); border: 1px solid var(--sep); background: var(--sys-bg); cursor: pointer; font-size: 12px; font-family: inherit; color: var(--label2); transition: all 0.15s; }
.admin-btn:hover { background: var(--sep); }
.admin-btn.danger { border-color: #FFCDD2; color: #C62828; }
.admin-btn.danger:hover { background: #FFEBEE; }
.admin-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-btn.primary:hover { opacity: 0.88; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.admin-form-full { grid-column: 1/-1; }
.admin-label { font-size: 12px; font-weight: 600; color: var(--label2); margin-bottom: 5px; display: block; }
.admin-input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--sep); border-radius: var(--r-sm); font-size: 13px; font-family: inherit; color: var(--label); background: var(--sys-bg); outline: none; transition: border-color 0.15s; }
.admin-input:focus { border-color: var(--accent); }
.admin-roles-check { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-role-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--sep); background: var(--sys-bg); transition: all 0.15s; user-select: none; }
.admin-role-check input { display: none; }
.admin-role-check.checked { border-color: var(--accent); background: var(--plan-light); color: var(--accent); font-weight: 600; }
.admin-avatar-row { display: flex; align-items: center; gap: 16px; }
.admin-avatar-preview {
  width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
  background: var(--rolam-light); display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: var(--rolam);
  overflow: hidden; border: 2px solid var(--sep);
}
.admin-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.admin-avatar-actions { display: flex; flex-direction: column; gap: 6px; }
.admin-avatar-upload-btn {
  padding: 6px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--sep); background: var(--sys-bg);
  cursor: pointer; font-size: 12px; font-family: inherit;
  color: var(--label2); transition: all 0.15s;
}
.admin-avatar-upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--plan-light); }
.admin-avatar-remove-btn {
  padding: 5px 14px; border-radius: var(--r-sm);
  border: 1.5px solid #FFCDD2; background: none;
  cursor: pointer; font-size: 12px; font-family: inherit; color: #C62828;
  transition: all 0.15s;
}
.admin-avatar-remove-btn:hover { background: #FFEBEE; }
.user-avatar {
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
