/* Apartment dossier: marks in the lists and the details window */

.modal.dossier { width: min(640px, calc(100vw - 32px)); }
.ds-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft, #F1F1F1); }
.ds-head .icon-btn { flex: none; }
.dossier .modal-body { display: grid; gap: 12px; padding-top: 16px; }
.ds-sec { border: 1px solid var(--line, #E6E6E6); border-radius: 18px; padding: 14px 16px; display: grid; gap: 10px; }
.ds-sec.ds-green { border-color: #CDEBD8; }
.ds-sec.ds-yellow { border-color: #F3E2A8; }
.ds-sec.ds-blue { border-color: #CADCFB; }
.ds-sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ds-sec-head h4 { flex: 1; margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 6px; }
.ds-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--bg, #F5F5F5); flex: none; }
.ds-ic svg { width: 16px; height: 16px; }
.ds-green .ds-ic { background: #E8F6EE; color: #1E6E40; }
.ds-yellow .ds-ic { background: #FFF5D6; color: #8A6100; }
.ds-blue .ds-ic { background: #E6F0FF; color: #1D4FB8; }
.ds-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--bg, #F5F5F5); font-size: 12px; }
.ds-empty, .ds-meta, .ds-sub, .ds-none { color: var(--muted, #888); font-size: 13px; margin: 0; }
.ds-text { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ds-facts { margin: 0; display: grid; gap: 6px; }
.ds-facts div { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 14px; }
.ds-facts dt { color: var(--muted, #888); }
.ds-facts dd { margin: 0; }
.ds-sec > .btn { justify-self: start; }

/* Toggle */
.ds-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; user-select: none; }
.ds-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ds-track { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #D7DCE3; transition: background .2s; flex: none; }
.ds-track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.ds-switch input:checked + .ds-track { background: var(--st-ready, #2E9E5B); }
.ds-blue .ds-switch input:checked + .ds-track { background: var(--brand, #377EF6); }
.ds-switch input:checked + .ds-track::after { transform: translateX(18px); }
.ds-switch input:focus-visible + .ds-track { outline: 2px solid var(--brand, #377EF6); outline-offset: 2px; }
.ds-state { font-size: 13px; font-weight: 600; color: var(--muted, #888); }
.ds-state.is-on { color: #1E6E40; }

.ds-form { display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg, #F7F8FA); }
.ds-form .field { margin: 0; }
.ds-form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.ds-sec > .field { margin: 0; }

.ds-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ds-list > li { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--line-soft, #F1F1F1); border-radius: 14px; }
.ds-list > li:has(.ds-form) { padding: 0; border: 0; }
.ds-list > li > .ds-form { flex: 1; }
.ds-li-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ds-li-main b { font-size: 14px; }
.ds-tools { display: flex; gap: 2px; flex: none; }
.ds-docs > li { padding: 6px 8px 6px 6px; align-items: center; }
.ds-doc { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 10px; }
.ds-doc:hover { background: var(--bg, #F5F5F5); }
.ds-doc .ds-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-ext { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--sky, #EEF5FF); color: var(--brand, #377EF6); font-size: 11px; font-weight: 700; flex: none; overflow: hidden; }
.ds-ext img { width: 100%; height: 100%; object-fit: cover; }

.ds-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ds-thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-soft, #F1F1F1); background: var(--bg, #F5F5F5); }
.ds-thumb > button:first-child { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ds-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-thumb.is-broken::after { content: 'Açılmadı'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.ds-x { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(20,20,20,.65); color: #fff; cursor: pointer; }
.ds-x svg { width: 12px; height: 12px; }
.ds-ro { display: flex; gap: 8px; align-items: center; margin: 0; font-size: 13px; color: var(--muted, #888); }
.ds-ro svg { width: 16px; height: 16px; flex: none; }
.sa-where .dm-row { white-space: normal; }

/* File picker in the page's own style */
.ds-drop {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed #CBD9EE; border-radius: 14px;
  background: #fff; color: var(--ink-2, #444); cursor: pointer; transition: border-color .15s, background .15s;
}
.ds-drop:hover, .ds-drop.over, .ds-drop:focus-visible { border-color: var(--brand, #377EF6); background: var(--sky, #EEF5FF); outline: none; }
.ds-drop[hidden] { display: none; }
.ds-drop b { font-weight: 600; color: var(--brand, #377EF6); }
.ds-drop small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted, #888); }
.ds-drop-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--sky, #EEF5FF); color: var(--brand, #377EF6); flex: none; }
.ds-drop-ic svg { width: 18px; height: 18px; }
.ds-picked { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ds-picked[hidden] { display: none; }
.ds-picked li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border: 1px solid var(--line, #E6E6E6); border-radius: 12px; background: #fff; }
.ds-ext.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 10px; }
.ds-pname { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-pname small { display: block; font-size: 12px; color: var(--muted, #888); }

/* Sold, reservation (bron), REA */
.ds-sec.ds-sold { border-color: #DCE0E6; }
.ds-sec.ds-orange { border-color: #F5D3BC; }
.ds-sold .ds-ic { background: #EEF0F3; color: #3A4250; }
.ds-orange .ds-ic { background: #FFEEE3; color: #A4470F; }
.ds-sold .ds-switch input:checked + .ds-track { background: #3A4250; }
.ds-orange .ds-switch input:checked + .ds-track { background: #E0711F; }
.ds-orange .ds-state.is-on { color: #A4470F; }
.ds-sold .ds-state.is-on { color: #3A4250; }
@media (max-width: 480px) { .ds-facts div { grid-template-columns: 1fr; gap: 2px; } }

/* Letter marks in the lists: T S B R Q Ə */
.dm-row { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; vertical-align: middle; }
.sa-where .dm-row { margin-top: 4px; margin-left: 6px; }
.dm {
  position: relative; display: inline-grid !important; place-items: center; flex: none;
  width: 22px !important; height: 22px; border-radius: 50%; border: 1.5px solid transparent;
  font-size: 11.5px !important; font-weight: 700; line-height: 1; letter-spacing: 0; cursor: pointer;
  color: #fff !important; background: var(--dm-c); user-select: none; transition: transform .12s, box-shadow .12s;
}
.dm sup { position: absolute; top: -5px; right: -6px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
  background: #fff; color: #4A3500; border: 1px solid #E8C35A; font-size: 9px; line-height: 12px; text-align: center; font-weight: 700; }
.dm:hover { transform: scale(1.08); }
.dm.is-open { box-shadow: 0 0 0 3px color-mix(in srgb, var(--dm-c) 30%, transparent); }
.dm:focus-visible { outline: 2px solid var(--brand, #377EF6); outline-offset: 2px; }
.m-t { --dm-c: #1F8A4C; }
.m-s { --dm-c: #3A4250; }
.m-b { --dm-c: #C25A12; }
.m-r { --dm-c: #6D45D0; }
.m-q { --dm-c: #F2B300; color: #3D2C00 !important; }
.m-e { --dm-c: #2563EB; }
/* Stage notes: problem, gecikmə (delay), digər */
.m-p { --dm-c: #D92D20; }
.m-g { --dm-c: #E8590C; }
.m-d { --dm-c: #667085; }
.dm.m-off { --dm-c: #C9CFD8; background: #fff; border-color: #C9CFD8; color: #8A93A0 !important; font-weight: 600; }
/* Bigger targets for fingers */
@media (pointer: coarse) {
  .dm { width: 26px !important; height: 26px; font-size: 12.5px !important; }
  .dm-row { gap: 6px; }
}

/* The small card a mark opens */
.dpop {
  position: fixed; z-index: 90; width: 300px; max-width: calc(100vw - 24px);
  background: var(--surface, #fff); border: 1px solid var(--line-soft, #EEF0F3); border-radius: 16px;
  box-shadow: var(--shadow-lg, 0 30px 80px -20px rgba(20, 40, 90, .28)); padding: 12px 14px 14px;
  animation: dpop-in .14s ease-out;
}
@keyframes dpop-in { from { opacity: 0; transform: translateY(4px); } }
.dpop-head { display: flex; align-items: center; gap: 8px; }
.dpop-head b { flex: 1; font-size: 14.5px; }
.dpop-head .dm { cursor: default; }
.dpop-head .dm:hover { transform: none; }
.dpop-body { display: grid; gap: 8px; margin-top: 8px; }
.dpop-where { margin: 0; font-size: 12px; color: var(--muted, #888); overflow-wrap: anywhere; }
.dpop-text { margin: 0; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dpop-facts { margin: 0; display: grid; gap: 5px; }
.dpop-facts div { display: grid; grid-template-columns: 104px 1fr; gap: 8px; font-size: 13.5px; }
.dpop-facts dt { color: var(--muted, #888); }
.dpop-facts dd { margin: 0; overflow-wrap: anywhere; }
.dpop-facts small { display: block; color: var(--muted, #888); font-size: 12px; }
.dpop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dpop-list li { display: grid; gap: 2px; font-size: 13px; padding: 6px 8px; border-radius: 10px; background: #FFF8E1; }
.dpop-list li span { overflow-wrap: anywhere; }
.dpop-list .dpop-rest { background: none; color: var(--muted, #888); padding: 0 2px; }
.dpop-list li small { color: var(--muted, #888); font-size: 12px; }
.dpop.is-note .dpop-list li { background: #F4F5F7; }
/* Category label of a stage note */
.nk { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; vertical-align: 1px; color: #fff; background: #667085; }
.nk.nk-problem { background: #D92D20; }
.nk.nk-delay { background: #E8590C; }
.ds-sec.ds-notes .ds-ic { background: #F2F4F7; color: #475467; }
.dpop-more { justify-self: start; }
/* Phone: a sheet along the bottom */
.dpop.is-sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; border-radius: 20px 20px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 70vh; overflow: auto;
  animation: dpop-up .18s ease-out;
}
@keyframes dpop-up { from { transform: translateY(100%); } }
.dpop.is-sheet .dpop-more { justify-self: stretch; }

/* REA section in the dossier */
.ds-sec.ds-violet { border-color: #DED3FA; }
.ds-violet .ds-ic { background: #F1EBFF; color: #5B36B5; }
.ds-violet .ds-switch input:checked + .ds-track { background: #6D45D0; }
.ds-violet .ds-state.is-on { color: #5B36B5; }

/* --- Touch: invisible 40px hit area around each mark, bigger photo/tool buttons, header that wraps --- */
@media (pointer: coarse), (max-width: 760px) {
  .dm { width: 26px !important; height: 26px; font-size: 12.5px !important; }
  .dm::before { content: ''; position: absolute; inset: -7px; }
  .dm-row { gap: 6px; }
  .ds-x { width: 32px; height: 32px; }
  .ds-x svg { width: 14px; height: 14px; }
  .ds-tools .icon-btn { width: 40px; height: 40px; }
  .ds-switch { min-height: 40px; }
}
@media (max-width: 560px) {
  .ds-head h3, .ds-head h2 { overflow-wrap: anywhere; }
  .ds-sec { padding: 12px 14px; }
  .ds-sec-head h4 { min-width: 0; }
  .ds-form-foot { flex-wrap: wrap; }
  .ds-form-foot .btn { flex: 1 1 auto; }
  .dpop-facts div { grid-template-columns: 96px minmax(0, 1fr); }
}
