/* ─────────────────────────────────────────────────────────────────────────────
   installer.css — Phase 2: Рабочий стол монтажника
   Переиспользует токены portal.css; паттерны из my_surveys.css / foreman.css.
───────────────────────────────────────────────────────────────────────────── */

/* ── Full-height layout ─────────────────────────────────────────────────────── */

.content-area.content-area--installer {
  position: relative;
  padding: 0 !important;
  overflow: visible !important;
  display: block !important;
}

.content-area.content-area--installer #installer-view.view-section.active {
  position: relative;
  display: flex !important;
  flex-direction: column;
  overflow: visible;
  min-height: auto;
  flex: none;
}

/* ── Root ───────────────────────────────────────────────────────────────────── */

.inst-root {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

/* ── Toolbar (segment + search) ─────────────────────────────────────────────── */

.inst-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card-bg, var(--bg));
  border-bottom: 1px solid var(--border);
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Segment control */
.inst-seg {
  display: flex;
  gap: 4px;
  background: var(--input-bg, var(--bg-secondary, #f0f0f0));
  border-radius: 8px;
  padding: 3px;
}

.inst-seg-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  min-height: 36px;
}

.inst-seg-btn--active {
  background: var(--accent);
  color: #fff;
}

/* Search */
.inst-search {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inst-search-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 14px;
}
.inst-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* ── Table layout ───────────────────────────────────────────────────────────── */

.inst-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 80px;
}

.inst-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.inst-table thead th {
  position: sticky;
  top: 0;
  background: var(--card-bg, #fff);
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  z-index: 5;
}

.inst-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}

.inst-table tbody tr:hover {
  background: var(--card-hover-bg, var(--bg-secondary, #fafafa));
}

.inst-table td {
  padding: 12px 12px;
  vertical-align: middle;
  color: var(--text);
}

/* Column widths */
.inst-col-date    { width: 110px; white-space: nowrap; }
.inst-col-client  { min-width: 160px; }
.inst-col-address { min-width: 180px; color: var(--muted); font-size: 13px; }
.inst-col-salary  { width: 130px; text-align: right; white-space: nowrap; }
.inst-col-phone   { width: 140px; white-space: nowrap; }
.inst-col-status  { width: 120px; }

/* Date badge */
.inst-date-badge {
  display: inline-block;
  background: var(--accent-light, rgba(1,105,111,.1));
  color: var(--accent);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
}

/* Client cell */
.inst-client-id {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  display: block;
}
.inst-client-name {
  font-weight: 600;
  display: block;
}
.inst-client-company {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

/* Salary badge */
.inst-salary {
  font-weight: 700;
  color: var(--success, #437a22);
  font-size: 14px;
}

/* Empty / loading states */
.inst-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.inst-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.inst-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: inst-spin .7s linear infinite;
}

@keyframes inst-spin { to { transform: rotate(360deg); } }

/* ── Request detail modal ───────────────────────────────────────────────────── */

.inst-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 600px) {
  .inst-modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.inst-modal {
  background: var(--card-bg, #fff);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 32px rgba(0,0,0,.15);
}

@media (min-width: 600px) {
  .inst-modal {
    border-radius: 16px;
    max-height: 88vh;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
  }
}

.inst-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.inst-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.inst-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .12s;
}
.inst-modal-close:hover { background: var(--bg-secondary, #f5f5f5); }

.inst-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Detail section */
.inst-detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inst-detail-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.inst-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.inst-detail-label {
  flex-shrink: 0;
  width: 130px;
  color: var(--muted);
  font-size: 13px;
}

.inst-detail-value {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}

/* Media / estimate buttons */
.inst-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  text-decoration: none;
}
.inst-media-btn:hover {
  background: var(--bg-secondary, #f5f5f5);
  border-color: var(--accent);
  color: var(--accent);
}

.inst-media-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Comment textarea */
.inst-comment-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inst-comment-input {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.inst-comment-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* Action footer */
.inst-modal-footer {
  flex-shrink: 0;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inst-footer-actions {
  display: flex;
  gap: 10px;
}

.inst-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  min-height: 48px;
}
.inst-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.inst-btn--accept {
  background: var(--accent);
  color: #fff;
}
.inst-btn--accept:hover:not(:disabled) {
  background: var(--accent-dark, #015a5f);
}

.inst-btn--decline {
  background: transparent;
  border: 2px solid var(--error, #c0392b);
  color: var(--error, #c0392b);
}
.inst-btn--decline:hover:not(:disabled) {
  background: rgba(192,57,43,.07);
}

.inst-footer-comment {
  display: flex;
  gap: 8px;
}

.inst-footer-comment .inst-comment-input {
  min-height: 44px;
  height: 44px;
  resize: none;
  padding: 10px 12px;
}

.inst-btn--comment {
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--bg-secondary, #f0f0f0);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
}
.inst-btn--comment:hover:not(:disabled) {
  background: var(--border);
}

/* Status badge */
.inst-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.inst-status-badge--sent     { background: rgba(100,100,200,.1); color: #4444bb; }
.inst-status-badge--accepted { background: rgba(67,122,34,.12);  color: #437a22; }
.inst-status-badge--declined { background: rgba(192,57,43,.1);   color: #c0392b; }

/* ── los_estimate hidePrices mode ─────────────────────────────────────────── */

.le-hide-prices .le-col-price,
.le-hide-prices .le-col-disc,
.le-hide-prices .le-col-disc-pct,
.le-hide-prices .le-col-total,
.le-hide-prices .le-summary-cards,
.le-hide-prices .le-col-actions,
.le-hide-prices .le-actions-bar,
.le-hide-prices .le-snap-bar,
.le-hide-prices .le-edit-fab {
  display: none !important;
}

/* Hide save/snapshot controls in hidePrices mode */
.le-hide-prices .le-autosave-indicator,
.le-hide-prices .le-top-actions,
.le-hide-prices .le-header-actions {
  visibility: hidden;
  pointer-events: none;
}

/* ── Completion form modal (Phase 3) ───────────────────────────────────────── */

.inst-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1100; /* above detail modal */
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 600px) {
  .inst-form-overlay {
    align-items: center;
    padding: 20px;
  }
}

.inst-form-modal {
  background: var(--card-bg, #fff);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 32px rgba(0,0,0,.18);
}

@media (min-width: 600px) {
  .inst-form-modal {
    border-radius: 16px;
    max-height: 90vh;
  }
}

.inst-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.inst-form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.inst-form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
}
.inst-form-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.inst-form-textarea {
  min-height: 80px;
  resize: vertical;
}

.inst-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-secondary, #f7f7f7);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  align-self: flex-start;
  min-height: 44px;
}
.inst-file-btn:hover {
  background: var(--accent-light, rgba(1,105,111,.08));
  border-color: var(--accent);
}

.inst-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.inst-preview-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 84px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary, #fafafa);
}

.inst-preview-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
}

.inst-preview-video-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #eee);
  border-radius: 6px;
  color: var(--accent);
}
.inst-preview-video-icon i { width: 28px; height: 28px; }

.inst-preview-name {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

.inst-form-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.inst-form-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s ease;
}

.inst-form-status {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */

.inst-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}
.inst-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.inst-toast--error {
  background: var(--error, #c0392b);
  color: #fff;
}
