:root {
  --navy: #102238;
  --navy-2: #173552;
  --blue: #2875d2;
  --blue-soft: #eaf3ff;
  --green: #28a56a;
  --green-dark: #16774a;
  --green-soft: #e8f7ef;
  --yellow: #f3bd3d;
  --yellow-dark: #9c6d00;
  --yellow-soft: #fff6da;
  --red: #d95555;
  --ink: #17212f;
  --muted: #6c7887;
  --line: #e2e8ef;
  --surface: #fff;
  --background: #f4f7fa;
  --shadow: 0 16px 45px rgba(19, 42, 68, .12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--background); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 500px); align-items: center; gap: 8vw; padding: 7vw; background: radial-gradient(circle at 12% 14%, #28567d 0, transparent 33%), linear-gradient(145deg, #0c1c2d, #173c5a 62%, #1d4c70); color: #fff; }
.login-brand { display: flex; align-items: center; gap: 24px; font-size: 28px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand span { color: #b8c9d8; margin-top: 6px; font-size: 17px; }
.brand-mark { width: 78px; height: 78px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.5); border-radius: 24px; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 5px rgba(255,255,255,.05); font-weight: 800; font-size: 38px; }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; border-color: rgba(255,255,255,.35); color: #fff; font-size: 21px; }
.login-card { padding: 42px; border-radius: 28px; color: var(--ink); background: rgba(255,255,255,.97); box-shadow: 0 34px 100px rgba(0,0,0,.28); }
.login-card h1 { margin: 7px 0 12px; font-size: 36px; letter-spacing: -.03em; }
.login-card p { color: var(--muted); line-height: 1.55; margin: 0 0 26px; }
.login-card small { display: block; color: var(--muted); text-align: center; margin-top: 18px; }
.login-kicker, .eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 800; }

label { display: grid; gap: 7px; color: #425064; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #ccd6e2; border-radius: 11px; padding: 10px 13px; outline: none; color: var(--ink); background: #fff; transition: border .15s, box-shadow .15s; }
textarea { min-height: 94px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,117,210,.13); }
.login-card label + label { margin-top: 15px; }
.form-error { min-height: 20px; color: var(--red); text-align: center; font-size: 13px; margin-top: 12px; }

.button { min-height: 42px; padding: 10px 17px; border: 0; border-radius: 11px; font-weight: 750; transition: transform .12s, filter .12s, background .12s; }
.button:hover { filter: brightness(.97); }
.button:active { transform: translateY(1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(40,117,210,.22); }
.button.success { color: #fff; background: var(--green); }
.button.warning { color: var(--yellow-dark); background: var(--yellow-soft); border: 1px solid #eed487; }
.button.secondary { color: #214a75; background: var(--blue-soft); }
.button.ghost { color: #506075; background: transparent; border: 1px solid var(--line); }
.button.danger { color: #a23131; background: #fff0f0; }
.button.wide { width: 100%; margin-top: 24px; }
.button.small { min-height: 36px; padding: 8px 12px; font-size: 12px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; display: grid; place-items: center; background: #fff; color: #54657a; font-size: 20px; }

.app { min-height: 100vh; }
.topbar { height: 74px; display: flex; align-items: center; padding: 0 22px; background: var(--navy); color: #fff; gap: 28px; position: relative; z-index: 1200; box-shadow: 0 6px 22px rgba(14,34,55,.18); }
.brand { min-width: 184px; display: flex; align-items: center; gap: 11px; }
.brand strong, .brand span { display: block; }
.brand span { margin-top: 2px; color: #a9bacb; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.nav { display: flex; align-self: stretch; }
.nav-button { padding: 0 18px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #aebdcb; font-weight: 700; }
.nav-button:hover { color: #fff; }
.nav-button.active { color: #fff; border-bottom-color: #55a1f2; background: rgba(255,255,255,.035); }
.nav-with-badge { display: flex; align-items: center; gap: 7px; }
.nav-badge { min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 12px; color: #fff; background: var(--red); font-size: 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.period-control { height: 42px; display: flex; align-items: stretch; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; background: rgba(255,255,255,.07); }
.period-control button { border: 0; color: #fff; background: transparent; }
.period-arrow { width: 34px; font-size: 22px; color: #a9bfd2 !important; }
.period-arrow:hover { background: rgba(255,255,255,.08); }
.period-value { min-width: 126px; padding: 5px 9px; border-left: 1px solid rgba(255,255,255,.1) !important; border-right: 1px solid rgba(255,255,255,.1) !important; }
.period-value span, .period-value strong { display: block; }
.period-value span { color: #91a9bd; text-transform: uppercase; letter-spacing: .1em; font-size: 8px; }
.period-value strong { margin-top: 2px; font-size: 11px; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-left: 1px solid rgba(255,255,255,.14); }
.user-chip strong, .user-chip span { display: block; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip strong { font-size: 13px; }
.user-chip span { color: #9fb1c2; font-size: 11px; margin-top: 2px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #2f79bf; font-size: 12px; font-weight: 800; }
.topbar .icon-button { border-color: rgba(255,255,255,.15); color: #d6e2ec; background: rgba(255,255,255,.06); }

.view { display: none; }
.view.active { display: block; }
.map-layout { height: calc(100vh - 74px); min-height: 0; display: grid; grid-template-columns: 370px 1fr; overflow: hidden; }
.object-panel { position: relative; z-index: 700; height: 100%; min-height: 0; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: #fff; border-right: 1px solid var(--line); box-shadow: 9px 0 30px rgba(30,58,86,.08); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 22px 12px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 22px; }
.compact-stats { margin: 0 18px 15px; display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.compact-stats > div, .compact-stats > button { padding: 11px 10px; text-align: center; border-right: 1px solid var(--line); background: #fafcfe; }
.compact-stats > :last-child { border-right: 0; }
.compact-stats strong { font-size: 17px; }
.compact-stats small { display: block; color: var(--muted); margin-top: 2px; font-size: 10px; }
.status-dot { width: 9px; height: 9px; display: inline-block; margin-right: 5px; border-radius: 50%; }
.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.search-wrap { margin: 0 18px 11px; position: relative; }
.search-wrap span { position: absolute; left: 12px; top: 9px; color: #7a8998; font-size: 20px; z-index: 1; }
.search-wrap input { padding-left: 38px; background: #f7f9fb; }
.filter-row { display: flex; gap: 7px; padding: 0 18px 14px; border-bottom: 1px solid var(--line); }
.filter-chip { min-height: 34px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: #566579; font-size: 12px; font-weight: 700; }
.filter-chip.active { border-color: #b7d3f1; background: var(--blue-soft); color: #225f9e; }
.object-list { flex: 1; min-height: 0; overflow-y: auto; }
.object-row { padding: 15px 18px; display: grid; grid-template-columns: 15px 1fr auto; gap: 11px; border-bottom: 1px solid #edf1f5; cursor: pointer; transition: background .12s; }
.object-row:hover, .object-row.active { background: #f2f7fc; }
.object-row .object-pin { width: 12px; height: 12px; margin-top: 5px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(0,0,0,.08); }
.object-row .object-pin.pending { background: var(--yellow); }
.object-row .object-pin.completed { background: var(--green); }
.object-row strong { display: block; font-size: 13px; line-height: 1.35; }
.object-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.object-row small { color: #91a0ae; white-space: nowrap; }
.empty-state { padding: 38px 24px; text-align: center; color: var(--muted); line-height: 1.5; }
.map-stage { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; }
#map { width: 100%; height: 100%; background: #dfe8ef; }
.map-legend { position: absolute; right: 18px; bottom: 22px; z-index: 600; display: flex; gap: 14px; padding: 10px 13px; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(25,50,75,.16); color: #57677a; font-size: 11px; font-weight: 650; }
.legend-pin { width: 10px; height: 10px; display: inline-block; margin-right: 6px; border-radius: 50%; }
.legend-pin.pending { background: var(--yellow); }
.legend-pin.completed { background: var(--green); }
.map-marker { width: 28px; height: 28px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 4px 11px rgba(22,41,63,.35); }
.map-marker::after { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.82); top: 7px; left: 7px; }
.map-marker.pending { background: var(--yellow); }
.map-marker.completed { background: var(--green); }
.leaflet-tooltip { border: 0; border-radius: 9px; box-shadow: 0 7px 22px rgba(20,42,64,.2); font-family: inherit; }

.page-shell { max-width: 1500px; margin: 0 auto; padding: 34px 34px 60px; }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title h1 { margin: 6px 0 0; font-size: 30px; letter-spacing: -.025em; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 15px; }
.metric-card { min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 5px 18px rgba(28,51,75,.045); }
.metric-card .metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin: 11px 0 5px; font-size: 32px; letter-spacing: -.04em; }
.metric-card small { color: #8b98a6; }
.metric-card.accent { background: linear-gradient(140deg, var(--navy), #1d4b70); color: #fff; border-color: transparent; }
.metric-card.accent .metric-label, .metric-card.accent small { color: #b8c8d6; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 5px 18px rgba(28,51,75,.045); }
.card.span-2 { grid-column: span 2; }
.card.span-3 { grid-column: span 3; }
.card-title { min-height: 42px; display: flex; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.card-title h3 { margin: 5px 0 0; font-size: 18px; }
.card-note { color: var(--muted); font-size: 11px; }
.daily-chart, .trend-chart { height: 190px; display: flex; align-items: stretch; gap: 5px; border-bottom: 1px solid var(--line); padding-top: 16px; overflow-x: auto; }
.day-column, .trend-column { min-width: 12px; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; color: #8492a2; font-size: 9px; }
.day-bar, .trend-bar { width: min(100%, 19px); min-height: 2px; border-radius: 5px 5px 0 0; background: linear-gradient(#53aeef, var(--blue)); transition: height .2s; }
.day-column.zero .day-bar { background: #dfe6ed; }
.day-value { min-height: 12px; color: #516174; font-weight: 750; font-size: 9px; }
.trend-chart { gap: 13px; }
.trend-column { min-width: 46px; }
.trend-bar { width: 32px; background: linear-gradient(#51c18b, var(--green)); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #7b8998; background: #f7f9fb; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.activity-table th:not(:first-child), .activity-table td:not(:first-child) { text-align: center; padding: 8px; min-width: 34px; }
.activity-table th:first-child, .activity-table td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 170px; }
.activity-table th:first-child { background: #f7f9fb; z-index: 2; }
.activity-cell { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; color: #1e6a48; background: var(--green-soft); font-weight: 800; }
.activity-cell.empty { color: #b5bec7; background: #f4f6f8; }
.progress-list { display: grid; gap: 14px; }
.progress-item { display: grid; gap: 6px; }
.progress-meta { display: flex; justify-content: space-between; color: #4f5e70; font-size: 12px; }
.progress-track { height: 8px; border-radius: 8px; overflow: hidden; background: #edf1f4; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--green); }
.mini-progress { display: inline-block; width: 90px; height: 6px; margin-right: 8px; vertical-align: middle; overflow: hidden; border-radius: 6px; background: #e7ecf1; }
.mini-progress i { display: block; height: 100%; background: var(--green); }

.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.create-user-card { display: grid; gap: 14px; position: sticky; top: 18px; }
.users-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; }
.user-row.inactive { opacity: .58; }
.user-row .avatar { color: #fff; }
.user-row strong, .user-row small { display: block; }
.user-row small { color: var(--muted); margin-top: 4px; }
.user-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.requests-layout { display: grid; grid-template-columns: 370px 1fr; gap: 16px; align-items: start; }
.request-create-card { display: grid; gap: 14px; position: sticky; top: 18px; }
.request-create-card .card-note { margin: 0; line-height: 1.45; }
.requests-list { display: grid; gap: 10px; }
.request-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; }
.request-row.pending { border-color: #e8cd81; background: #fffdf5; }
.request-row.accepted { border-color: #b8dfca; background: #f7fcf9; }
.request-main strong, .request-main small { display: block; }
.request-main strong { font-size: 14px; line-height: 1.4; }
.request-main p { margin: 7px 0; color: #445469; white-space: pre-wrap; line-height: 1.45; font-size: 12px; }
.request-main small { color: var(--muted); line-height: 1.5; }
.request-side { min-width: 145px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.request-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.request-status { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 9px; font-size: 11px; font-weight: 800; }
.request-status.pending { color: var(--yellow-dark); background: var(--yellow-soft); }
.request-status.accepted { color: var(--green-dark); background: var(--green-soft); }
.request-status.declined { color: #9d3535; background: #fff0f0; }
.request-status.completed { color: #145c32; background: #d5f4df; }
.request-row.completed { border-color: #83cfa0; }
.notifications-list { display: grid; gap: 8px; margin-bottom: 18px; }
.notifications-list[hidden] { display: none; }
.notification-row { display: grid; gap: 4px; text-align: left; white-space: normal; }
.notification-row span, .notification-row small { font-weight: 400; }
.request-seen { color: var(--muted); font-size: 10px; }

.drawer-backdrop { position: fixed; inset: 74px 0 0; z-index: 1250; background: rgba(13,29,46,.28); backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 74px; right: 0; z-index: 1300; width: min(470px, 100vw); height: calc(100vh - 74px); display: flex; flex-direction: column; background: #fff; box-shadow: -20px 0 60px rgba(20,42,64,.22); transform: translateX(102%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-handle { display: none; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 22px 18px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 5px 0 0; font-size: 20px; }
.drawer-content { padding: 20px 22px 45px; overflow-y: auto; }
.detail-status { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px; margin-bottom: 18px; border-radius: 13px; }
.detail-status.pending { background: var(--yellow-soft); color: var(--yellow-dark); }
.detail-status.completed { background: var(--green-soft); color: var(--green-dark); }
.detail-status strong { display: block; }
.detail-status small { display: block; margin-top: 3px; opacity: .8; }
.detail-address { font-size: 16px; line-height: 1.55; font-weight: 720; }
.detail-meta { display: flex; gap: 16px; margin: 10px 0 20px; color: var(--muted); font-size: 12px; }
.systems { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 20px; }
.system-tag { padding: 5px 8px; border-radius: 8px; color: #435771; background: #eef3f7; font-size: 10px; font-weight: 750; }
.detail-section { padding-top: 19px; margin-top: 19px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 12px; font-size: 15px; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.detail-tabs { display: grid; grid-template-columns: 1fr 1.45fr; gap: 6px; margin-top: 20px; padding: 5px; border-radius: 12px; background: #eef3f7; }
.detail-tabs button { min-height: 42px; padding: 8px 10px; border: 0; border-radius: 9px; color: #52657a; background: transparent; font-size: 12px; font-weight: 800; }
.detail-tabs button[aria-selected="true"] { color: #143f69; background: #fff; box-shadow: 0 2px 8px #1022381a; }
.detail-tabs span { display: inline-grid; min-width: 20px; height: 20px; margin-left: 4px; place-items: center; border-radius: 10px; color: #174f87; background: #e5f2ff; font-size: 10px; }
.detail-tab-panel[hidden] { display: none; }
.note-form { display: grid; gap: 9px; }
.notes-list { display: grid; gap: 9px; margin-top: 11px; }
.note { padding: 12px; border-radius: 11px; background: #f6f8fa; }
.note p { margin: 0 0 8px; white-space: pre-wrap; line-height: 1.45; font-size: 13px; }
.note footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.text-button { padding: 0; border: 0; color: var(--red); background: none; font-size: 10px; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.photo-upload { position: relative; display: block; padding: 16px 12px; border: 1.5px solid #8eb9e6; border-radius: 12px; text-align: center; color: #174f87; background: #edf6ff; cursor: pointer; font-weight: 750; }
.photo-upload.secondary { border-style: dashed; border-color: #b8c8d7; color: #4a6077; background: #f8fafc; }
.photo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.photo { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: #e8edf2; }
.photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo button { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border: 0; border-radius: 50%; color: #fff; background: rgba(133,30,30,.82); }
.unresolved-warning { padding: 10px 12px; border-radius: 10px; color: #8a6100; background: var(--yellow-soft); font-size: 12px; line-height: 1.4; }
.external-document-section { margin-top: 0; border-top: 0; }
.external-document-form { display: grid; gap: 10px; margin-top: 13px; padding: 14px; border: 1px solid #d9e5f1; border-radius: 13px; background: #f7fbff; }
.project-upload { position: relative; display: block; padding: 13px 12px; overflow: hidden; border: 1.5px dashed #8eb9e6; border-radius: 11px; text-align: center; color: #174f87; background: #edf6ff; cursor: pointer; font-weight: 750; }
.project-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.project-file-name { color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.external-document-form .button.wide { margin-top: 2px; }
.document-section { margin-top: 0; border-top: 0; }
.documents-list { display: grid; gap: 9px; }
.document-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.document-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; color: #fff; background: #2164a4; font-weight: 900; }
.document-main { min-width: 0; }
.document-main strong, .document-main small { display: block; overflow-wrap: anywhere; }
.document-main strong { color: #25384c; font-size: 12px; line-height: 1.35; }
.document-main small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.document-actions { display: flex; align-items: center; gap: 5px; }
.document-empty { display: grid; gap: 5px; padding: 24px 12px; text-align: center; }
.document-empty span { color: var(--muted); font-size: 12px; line-height: 1.45; }

.modal { width: min(900px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.modal::backdrop, .image-modal::backdrop { background: rgba(12,28,44,.64); backdrop-filter: blur(3px); }
.modal-shell { min-height: min(760px, calc(100vh - 28px)); display: flex; flex-direction: column; }
.modal-header, .modal-footer { padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 4px 0 0; font-size: 20px; }
.modal-footer { border-top: 1px solid var(--line); border-bottom: 0; }
.modal-footer > div { display: flex; gap: 8px; }
.work-act-modal { width: min(720px, calc(100vw - 24px)); }
.work-act-modal .modal-shell { min-height: min(690px, calc(100vh - 28px)); }
.act-progress { display: grid; grid-template-columns: 30px 1fr 30px 1fr 30px 1fr 30px 1fr 30px; align-items: center; gap: 8px; padding: 17px 24px 0; }
.act-progress span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #7d8996; background: #edf1f5; font-size: 12px; font-weight: 850; }
.act-progress span.active { color: #fff; background: var(--blue); }
.act-progress span.done { color: #fff; background: var(--green); }
.act-progress i { height: 3px; border-radius: 3px; background: #e2e8ef; }
.act-progress i.done { background: #86d1ad; }
.act-body { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 28px; }
.act-step > h3, .defect-step > h3, .maintenance-step > h3 { margin: 7px 0 6px; font-size: 23px; }
.act-step > .card-note, .defect-step > .card-note, .maintenance-step > .card-note { display: block; margin: 0 0 22px; font-size: 12px; line-height: 1.5; }
.act-type-grid { display: grid; gap: 11px; }
.act-type-grid label { position: relative; display: block; padding: 18px 18px 18px 53px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.act-type-grid label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px #2875d218; }
.act-type-grid input { position: absolute; top: 18px; left: 17px; width: 20px; min-height: 20px; }
.act-type-grid strong, .act-type-grid small { display: block; }
.act-type-grid strong { color: #293a4d; font-size: 15px; }
.act-type-grid small { margin-top: 5px; color: var(--muted); font-weight: 500; }
.act-period-grid, .act-quantity-grid, .act-contract-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.act-quantity-grid { grid-template-columns: 1fr 1fr 1.35fr; }
.act-period-grid { margin-top: 28px; }
.act-system-suggestions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.act-system-suggestions > span { width: 100%; color: var(--muted); font-size: 12px; }
.act-system-suggestions .system-tag { border: 0; cursor: pointer; }
.dictation-actions { display: flex; gap: 9px; margin-top: 11px; }
.dictation-actions .button { flex: 1; }
.dictation-actions .recording { color: #fff; background: #d34848; animation: recording-pulse 1.1s infinite; }
@keyframes recording-pulse { 50% { box-shadow: 0 0 0 6px #d3484824; } }
.dictation-status { min-height: 18px; margin: 8px 0 14px; line-height: 1.4; }
.defect-step > label { margin-top: 14px; }
.defect-step > label:first-of-type { margin-top: 20px; }
.dictation-single { width: 100%; margin-top: 9px; }
.defect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.defect-cost-grid { margin-top: 16px; }
.maintenance-object-systems { display: grid; gap: 9px; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; color: var(--muted); background: #f4f7fa; font-size: 12px; }
.maintenance-object-systems .systems { margin: 0; }
.maintenance-sections { display: grid; gap: 8px; }
.maintenance-section-option { display: grid; grid-template-columns: 22px 38px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.maintenance-section-option:has(input:checked) { border-color: #8db9e7; background: #f2f8ff; }
.maintenance-section-option input { width: 18px; min-height: 18px; margin-top: 2px; }
.maintenance-section-option input:disabled { opacity: 1; cursor: not-allowed; }
.maintenance-section-number { display: grid; min-height: 25px; place-items: center; border-radius: 7px; color: #245c91; background: #e8f2fc; font-weight: 850; }
.maintenance-section-option strong, .maintenance-section-option small { display: block; }
.maintenance-section-option strong { color: #293a4d; font-size: 13px; line-height: 1.35; }
.maintenance-section-option small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.maintenance-step > label { margin-top: 14px; }
.extinguisher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.extinguisher-history-field { display: flex; width: 100%; min-width: 0; border: 1px solid #ccd6e2; border-radius: 11px; background: #fff; }
.extinguisher-history-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,117,210,.13); }
.extinguisher-history-field > input { flex: 1; min-width: 0; width: 0; border: 0; background: transparent; box-shadow: none; }
.extinguisher-history-field > .extinguisher-history-arrow { flex: 0 0 44px; width: 44px; padding: 0; border: 0; border-radius: 0 11px 11px 0; appearance: none; color: transparent; box-shadow: none; cursor: pointer; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235d6d80' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center; }
.extinguisher-history-arrow option { color: var(--ink); background: #fff; }
.extinguisher-history-arrow[hidden] { display: none; }
.act-items { display: grid; gap: 9px; margin: 16px 0; }
.act-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfe; }
.act-item-number { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: #245c91; background: #e8f2fc; font-weight: 850; }
.act-item strong, .act-item small { display: block; }
.act-item strong { font-size: 13px; line-height: 1.45; }
.act-item small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.act-item button { min-height: 32px; padding: 5px 9px; }
.defect-item-actions { display: grid; gap: 6px; }
.act-items-summary { display: grid; gap: 7px; margin: -3px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #f1f7fd; }
.act-items-summary:empty { display: none; }
.act-items-summary div { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; line-height: 1.4; }
.act-items-summary strong { text-align: right; }
.act-optional-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 18px; }
.act-contract { margin-top: 17px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.act-contract summary { cursor: pointer; color: #38546f; font-size: 12px; font-weight: 800; }
.act-contract-grid { margin-top: 14px; }
.act-contract-grid label:last-child { grid-column: 1 / -1; }
.act-footer { flex-wrap: wrap; }
.act-footer > span { color: var(--muted); font-size: 12px; }
.assignment-toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.assignment-toolbar .search-wrap { flex: 1; margin: 0; }
.assignment-list { flex: 1; overflow-y: auto; padding: 7px 20px; }
.assignment-row { display: grid; grid-template-columns: 24px 78px 1fr; align-items: center; gap: 9px; padding: 10px 4px; border-bottom: 1px solid #edf1f4; font-size: 12px; }
.assignment-row input { min-height: 0; width: 17px; height: 17px; }
.assignment-row small { color: var(--muted); }
.period-dialog { width: min(450px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.period-dialog::backdrop { background: rgba(12,28,44,.64); backdrop-filter: blur(3px); }
.period-shell { padding: 22px; }
.period-header, .period-year-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.period-header h2 { margin: 5px 0 0; font-size: 23px; }
.period-year-nav { margin: 22px 0 14px; color: #506075; font-size: 13px; }
.period-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.period-month { min-height: 50px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; color: #42556a; background: #fff; font-size: 12px; font-weight: 720; }
.period-month:hover { border-color: #9dbfe4; background: #f5f9fe; }
.period-month.selected { border-color: var(--blue); color: #fff; background: var(--blue); }
.period-month.current:not(.selected) { color: var(--blue); border-color: #a9c9ec; background: var(--blue-soft); }
.period-shell > .button.wide { margin-top: 16px; }
.image-modal { width: min(1100px, 96vw); height: min(850px, 92vh); padding: 0; border: 0; background: transparent; overflow: visible; }
.image-modal img { width: 100%; height: 100%; object-fit: contain; }
.image-modal .icon-button { position: absolute; top: 6px; right: 6px; z-index: 2; color: #fff; background: rgba(0,0,0,.55); border: 0; }

.toast { position: fixed; left: 50%; bottom: 26px; z-index: 2500; max-width: min(440px, calc(100vw - 30px)); padding: 12px 17px; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: opacity .2s, transform .2s; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a43e3e; }

@media (max-width: 1050px) {
  .topbar { gap: 12px; }
  .brand { min-width: auto; }
  .brand > div:last-child { display: none; }
  .user-chip > div:last-child { display: none; }
  .map-layout { grid-template-columns: 330px 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .card.span-3 { grid-column: span 2; }
  .admin-grid, .requests-layout { grid-template-columns: 310px 1fr; }
}

@media (max-width: 760px) {
  .topbar { height: 126px; padding: 9px 10px; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 52px 48px; }
  .brand { grid-column: 1; grid-row: 1; }
  .top-actions { grid-column: 2 / 4; grid-row: 1; gap: 6px; }
  .user-chip { display: none; }
  .period-value { min-width: 106px; }
  .period-arrow { width: 29px; }
  .nav { grid-column: 1 / 4; grid-row: 2; overflow-x: auto; }
  .nav-button { flex: 1; padding: 0 12px; }
  .map-layout { height: calc(100vh - 126px); display: block; }
  .object-panel { display: none; }
  .map-stage { height: 100%; }
  .map-legend { display: none; }
  .drawer-backdrop { inset: 126px 0 0; }
  .drawer { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: min(78vh, 760px); height: min(78dvh, 760px); max-height: calc(100vh - 126px); max-height: calc(100dvh - 126px); padding-bottom: env(safe-area-inset-bottom); border-radius: 22px 22px 0 0; box-shadow: 0 -18px 55px rgba(20,42,64,.24); transform: translateY(105%); transition: transform .25s cubic-bezier(.22,.75,.22,1); will-change: transform; }
  .drawer.open { transform: translateY(0); }
  .drawer.dragging { transition: none; }
  .drawer-handle { position: absolute; top: 9px; left: 50%; display: block; width: 44px; height: 5px; margin: 0; border-radius: 999px; background: #c8d2dc; transform: translateX(-50%); pointer-events: none; }
  .drawer-header { padding: 22px 18px 14px; touch-action: none; user-select: none; }
  .drawer-header h2 { font-size: 19px; }
  .drawer-content { padding: 17px 18px 40px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .login-screen { display: flex; flex-direction: column; justify-content: center; padding: 22px; }
  .login-brand { display: none; }
  .login-card { width: 100%; padding: 30px 24px; }
  .page-shell { padding: 24px 14px 45px; }
  .page-title h1 { font-size: 24px; }
  .metric-grid, .dashboard-grid, .admin-grid, .requests-layout { grid-template-columns: 1fr; }
  .card.span-2, .card.span-3 { grid-column: span 1; }
  .create-user-card { position: static; }
  .request-create-card { position: static; }
  .request-row { grid-template-columns: 1fr; }
  .request-side { align-items: flex-start; }
  .request-actions { justify-content: flex-start; }
  .user-row { grid-template-columns: 40px 1fr; }
  .user-actions { grid-column: 1 / 3; justify-content: flex-start; }
  .assignment-toolbar { flex-wrap: wrap; }
  .assignment-toolbar .search-wrap { flex-basis: 100%; }
  .photo-actions { grid-template-columns: 1fr; }
}

/* Audit: reachable mobile controls, keyboard focus and constrained layouts. */
.connection-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.connection-screen .card { max-width: 440px; }
.mobile-map-tools, .mobile-only { display: none; }
.object-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; color: inherit; }
.compact-stats > button { border: 0; border-right: 1px solid var(--line); color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #2678c5; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
.drawer:not(.open) { visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer-content { min-height: 0; overflow-wrap: anywhere; }
.object-row > div, .user-row > div, .request-main { min-width: 0; overflow-wrap: anywhere; }
.map-load-error { position: absolute; z-index: 850; top: 10px; left: 60px; right: 12px; padding: 10px; background: #fff5d8; border-radius: 12px; }
.map-layout { height: calc(100dvh - 74px); }
.requests-layout:has(.request-create-card.hidden) { grid-template-columns: 1fr; }
@media (max-width:760px) {
  .map-layout { position: relative; height: calc(100dvh - 126px); }
  .mobile-map-tools { position: absolute; bottom: 24px; left: 14px; right: 14px; z-index: 750; display: flex; justify-content: space-between; gap: 10px; }
  .mobile-map-tools .button { box-shadow: 0 4px 18px #10223833; }
  .mobile-only { display: block; }
  .map-layout.list-open .object-panel { display: flex; position: absolute; inset: 0; width: 100%; z-index: 800; }
  .map-load-error { top: 12px; }
  .detail-actions { grid-template-columns: 1fr; }
  .photo button { width: 36px; height: 36px; }
  .document-row { grid-template-columns: 38px minmax(0, 1fr); }
  .document-actions { grid-column: 1 / -1; }
  .document-actions .button { flex: 1; }
  .modal-shell { height: calc(100dvh - 48px); min-height: 0; }
  .modal { max-height: calc(100dvh - 28px); }
  .assignment-list { min-height: 0; }
  .work-act-modal { position: fixed; inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; overflow: hidden; border-radius: 0; }
  .work-act-modal .modal-shell { height: 100dvh; min-height: 0; }
  .act-body { padding: 22px 18px; }
  .act-progress { padding: 14px 18px 0; }
  .act-period-grid, .act-quantity-grid, .act-optional-fields, .act-contract-grid, .defect-grid, .extinguisher-grid { grid-template-columns: 1fr; }
  .act-contract-grid label:last-child { grid-column: auto; }
  .dictation-actions { flex-direction: column; }
  .act-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .act-footer > span { display: none; }
  .act-footer > div { width: 100%; }
  .act-footer .button { flex: 1; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.map-stage { isolation: isolate; }
@media(max-width:760px) { .nav-button { font-size: 13px; padding: 0 9px; min-width: 0; } }

.tile-error { position:absolute; top:12px; right:12px; z-index:750; max-width:260px; padding:10px; border-radius:10px; color:#5e4811; background:#fff5d8; font-size:12px; }

button.metric-card { text-align:left; color:inherit; }
button.metric-card.accent { color:white; }

.audit-launch-section > .button { width: 100%; }
.user-location-marker { background: transparent; }
.user-location-dot { display: block; width: 20px; height: 20px; margin: 2px; border: 3px solid white; border-radius: 50%; background: #2875e8; box-shadow: 0 1px 7px #10223888; }
#mobile-fit-map[aria-busy="true"] { opacity: .65; }
