/* =========================================================
   ROZ workdesk — roz.css
   Follows the same design language as logistics.css
   ========================================================= */

/* ── Root layout ────────────────────────────────────────── */
.roz-root {
  display: flex;
  flex-direction: column;
  min-height: auto;
  flex: none;
  overflow: visible;
}

/* ── Segmented control (sub-tabs) — reuse lg-seg styles ── */
.roz-seg {
  display: flex;
  gap: 4px;
  background: var(--input-bg, var(--bg-secondary, #ebebeb));
  border-radius: 8px;
  padding: 3px;
}

.roz-seg button {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  min-height: 34px;
}

.roz-seg button:hover:not(.active) {
  background: rgba(0,0,0,.06);
  color: var(--text);
}

.roz-seg button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.roz-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Body ────────────────────────────────────────────────── */
.roz-body {
  flex: none;
  overflow: visible;
  padding: 16px 20px;
}

/* ── Placeholder ─────────────────────────────────────────── */
.roz-placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 60px 0;
  text-align: center;
}

/* ── Toast ───────────────────────────────────────────────── */
.roz-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
  padding: 8px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 9999;
}

.roz-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Table ───────────────────────────────────────────────── */
.roz-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.roz-table {
  border-collapse: collapse;
  font-size: 12.5px;
  width: 100%;
}

/* Allow header text to wrap in fixed-layout tables (surveys, analytics) */
#roz-surveys-table th,
#roz-analytics-table th {
  white-space: normal;
  word-break: keep-all;
}

.roz-table th {
  background: var(--surface, #f6f6f6);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.roz-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.roz-table tr:last-child td {
  border-bottom: none;
}

.roz-table tr:hover td {
  background: var(--hover-bg, rgba(0,0,0,.025));
}

/* ── Section headers ─────────────────────────────────────── */
.roz-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface, #f6f6f6);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  border-top: 2px solid var(--border);
}

.roz-section-header:first-child {
  border-top: none;
}

/* ── Inline inputs ───────────────────────────────────────── */
.roz-input {
  width: 80px;
  padding: 3px 5px;
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: right;
  transition: border-color .1s, background .1s;
}

.roz-input:hover,
.roz-input:focus {
  border-color: var(--accent);
  background: var(--bg);
  outline: none;
}

.roz-input--wide {
  width: 120px;
  text-align: left;
}

/* ── Calculated (read-only) cells ────────────────────────── */
.roz-calc {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  min-width: 70px;
  display: inline-block;
}

.roz-calc--total {
  font-weight: 700;
  color: var(--accent);
}

/* ── Mismatch warning ────────────────────────────────────── */
.roz-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Add-row form ────────────────────────────────────────── */
.roz-add-form {
  background: var(--surface, #f9f9f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.roz-add-form label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roz-add-form .roz-field-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Surveyor filter select ──────────────────────────────── */
.roz-filter-select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
}

/* ── Address link ────────────────────────────────────────── */
.roz-addr-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.roz-addr-link:hover {
  text-decoration: underline;
}

/* ── Phone text ──────────────────────────────────────────── */
.roz-muted {
  color: var(--muted);
  font-size: 11.5px;
}

/* ── Role badge ──────────────────────────────────────────── */
.roz-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface, #eee);
  color: var(--muted);
  white-space: nowrap;
}

.roz-badge--manager {
  background: #fff3cd;
  color: #7a5c00;
}

/* ── Refresh button ──────────────────────────────────────── */
.roz-btn-refresh {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.roz-btn-refresh:hover {
  background: var(--hover-bg, rgba(0,0,0,.05));
}

/* ── Add row button ──────────────────────────────────────── */
.roz-btn-add {
  margin-top: 8px;
  padding: 7px 14px;
  font-size: 13px;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  width: 100%;
  text-align: center;
  transition: border-color .15s, color .15s;
}

.roz-btn-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Inline checkbox (force_contract_pct) ────────────────── */
.roz-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Send to accountant button ───────────────────────────── */
.roz-btn-send {
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}

.roz-btn-send:hover:not(:disabled) {
  opacity: .85;
}

.roz-btn-send:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Delete row button (red ✕) ───────────────────────────── */
.roz-btn-del {
  padding: 2px 7px;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #e53e3e;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.roz-btn-del:hover:not(:disabled) {
  background: #e53e3e;
  color: #fff;
}

.roz-btn-del:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Recall from archive button ──────────────────────────── */
.roz-btn-recall {
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.roz-btn-recall:hover:not(:disabled) {
  background: var(--hover-bg, rgba(0,0,0,.05));
}

.roz-btn-recall:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Archive summary panel ───────────────────────────────── */.roz-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.roz-summary-card {
  background: var(--surface, #f6f6f6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 150px;
  flex: 1 1 150px;
}

.roz-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}

.roz-summary-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

/* ── Conditions: вложенный seg-control ───────────────────── */
.roz-seg--inner {
  margin-bottom: 12px;
}

/* ── Conditions: таблица ставок ──────────────────────────── */
.roz-rates-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.roz-rates-table th {
  background: var(--surface, #f6f6f6);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.roz-rates-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.roz-rates-table tr:last-child td {
  border-bottom: none;
}

.roz-rates-label {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.roz-rates-value {
  text-align: right;
  width: 120px;
}

.roz-rates-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

/* ── Conditions: блок менеджеров-замерщиков ──────────────── */
.roz-flags-block {
  margin-top: 8px;
  max-width: 480px;
}

.roz-flags-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roz-flag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .1s;
}

.roz-flag-row:hover {
  background: var(--hover-bg, rgba(0,0,0,.03));
}

.roz-flag-name {
  flex: 1;
  color: var(--text);
}

.roz-flag-id {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Analytics: totals row ───────────────────────────────── */
.roz-row-total td {
  border-top: 2px solid var(--border);
  background: var(--surface, #f6f6f6);
}

/* ── StickyThead: hide original thead when pin-clone is active ───────────── */
.roz-table thead.fm-thead-offscreen {
  visibility: collapse;
}

/* ── Calendar: survey chip (bigger than foreman chip to show address) ─────── */
.roz-cal-chip {
  min-height: 48px;
}

.roz-cal-addr {
  display: block;
  font-size: 10px;
  color: var(--muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  margin-top: 2px;
}
