:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657086;
  --line: #dfe5ef;
  --primary: #2457d6;
  --primary-dark: #1740a8;
  --danger: #bd2e37;
  --success: #1c8b5a;
  --warning: #a66300;
  --soft: #eef3ff;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: #e8edf7;
  color: var(--text);
}

button.secondary:hover {
  background: #dbe4f3;
}

button.danger {
  background: #f4dee0;
  color: var(--danger);
}

button.danger:hover {
  background: #edcace;
}

button.small {
  padding: 7px 10px;
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 44px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(460px, calc(100vw - 32px));
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.login-brand,
.role-brand,
.role-header,
.user-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand {
  margin-bottom: 20px;
}

.brand-logo {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  padding: 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f8fafc;
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 900;
}

.org-title {
  max-width: 620px;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.role-header {
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 44px);
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1001;
}

.role-header h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.management-header,
.eip-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
}

.management-header .role-brand,
.eip-header .role-brand {
  justify-self: start;
}

.management-header .user-box,
.eip-header .user-box {
  justify-self: end;
}

.management-header-title,
.eip-header-title {
  justify-self: center;
  margin: 0;
  color: #111827;
  font-size: clamp(1.8rem, 2.4vw, 2.45rem);
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}

.user-box span {
  color: var(--text);
  font-weight: 800;
}

.placeholder-main {
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cpo-layout .setup-panel {
  grid-column: span 2;
}

.commander-main {
  display: grid;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.commander-dashboard {
  min-height: 320px;
  border-top: 4px solid #172033;
}

.dashboard-date-picker {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.dashboard-date-picker input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-weight: 800;
}

.commander-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.commander-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
  position: relative;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.commander-metric:hover,
.commander-metric:focus {
  border-color: rgba(36, 87, 214, 0.36);
  box-shadow: 0 14px 28px rgba(23, 32, 51, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.metric-prepos:hover,
.metric-prepos:focus {
  border-color: rgba(124, 58, 237, 0.38);
}

.metric-eip:hover,
.metric-eip:focus {
  border-color: rgba(28, 139, 90, 0.38);
}

.metric-ecin:hover,
.metric-ecin:focus {
  border-color: rgba(189, 46, 55, 0.38);
}

.metric-gruata:hover,
.metric-gruata:focus {
  border-color: rgba(124, 58, 237, 0.38);
}

.commander-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: #2457d6;
}

.commander-metric::after {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef3ff;
  color: #1740a8;
  font-size: 0.86rem;
  font-weight: 900;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.metric-cpo::after {
  content: "CPO";
}

.metric-eip::before {
  background: #1c8b5a;
}

.metric-eip::after {
  content: "EIP";
  background: #e8f7ef;
  color: #12633f;
}

.metric-ecin::before {
  background: #bd2e37;
}

.metric-ecin::after {
  content: "EC";
  background: #fff1f2;
  color: #991b1b;
}

.metric-gruata::before {
  background: #7c3aed;
}

.metric-gruata::after {
  content: "GR";
  background: #f3e8ff;
  color: #6d28d9;
}

.metric-gruata small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-prepos::before {
  background: #7c3aed;
}

.metric-prepos::after {
  content: "PP";
  background: #f3e8ff;
  color: #6d28d9;
}

.commander-metric span,
.commander-metric small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.commander-metric strong {
  color: var(--text);
  font-size: 2.35rem;
  line-height: 1;
}

.commander-device-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.device-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.05);
  border-top: 4px solid #2457d6;
  scroll-margin-top: 18px;
}

.device-card-eip {
  border-top-color: #1c8b5a;
}

.device-card-ecin {
  border-top-color: #bd2e37;
}

.device-card-prepos {
  border-top-color: #7c3aed;
}

.device-card .inline-title {
  margin-bottom: 0;
  align-items: flex-start;
}

.device-card.device-collapsed .device-list {
  display: none;
}

.device-card .inline-title h2 {
  font-size: 1.15rem;
  margin-bottom: 2px;
}

.device-card .inline-title span {
  display: block;
  max-width: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.device-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #f8fafc;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.device-link:hover,
.device-link:focus {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.device-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.device-row,
.device-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 12px;
}

.device-row {
  display: grid;
  gap: 8px;
}

.device-row-top,
.device-row-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.device-row strong {
  color: var(--text);
}

.device-row span,
.device-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.device-row-detail {
  display: grid;
  gap: 4px;
}

.device-row-detail em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.device-row-detail b {
  color: var(--text);
}

.cpo-dashboard-shift {
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9ff 100%);
}

.cpo-dashboard-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.cpo-dashboard-member {
  display: grid;
  gap: 8px;
  border: 1px solid #d8e2f5;
  border-left: 4px solid #2457d6;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.cpo-member-main {
  display: grid;
  gap: 3px;
}

.cpo-member-unit {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
}

.cpo-dashboard-member strong {
  line-height: 1.25;
}

.cpo-member-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cpo-member-meta span,
.cpo-member-meta em,
.cpo-member-meta b {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef3ff;
  color: #1740a8;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
}

.cpo-member-meta em {
  background: #f1f5f9;
  color: var(--muted);
}

.cpo-member-meta .cpo-member-function {
  background: #e2e8f0;
  color: #334155;
}

.cpo-member-meta .function-copar {
  background: #b7d7f0;
  color: #123b63;
}

.cpo-member-meta .function-sala-1 {
  background: #c6e0b4;
  color: #28551f;
}

.cpo-member-meta .function-sala-2 {
  background: #f4b6c2;
  color: #7f1d36;
}

.cpo-member-meta .function-zona-1 {
  background: #ffe699;
  color: #674d00;
}

.cpo-member-meta .function-zona-2 {
  background: #f8cbad;
  color: #743b17;
}

.cpo-member-meta .function-zona-3 {
  background: #d5c4e8;
  color: #4c2a72;
}

.cpo-member-meta .function-zona-4 {
  background: #b7dee8;
  color: #164e63;
}

.cpo-dashboard-empty {
  padding: 10px 12px;
}

.device-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.time-pill,
.team-pill,
.zone-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3ff;
  color: #1740a8;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.device-card-eip .team-pill {
  background: #e8f7ef;
  color: #12633f;
}

.device-card-eip .zone-pill {
  background: #e8f7ef;
  color: #12633f;
}

.device-card-ecin .team-pill,
.zone-pill {
  background: #fff1f2;
  color: #991b1b;
}

.device-card-prepos .team-pill,
.device-card-prepos .zone-pill {
  background: #f3e8ff;
  color: #6d28d9;
}

.prepos-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.prepos-history-title {
  margin-bottom: 10px;
}

.prepos-history-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.prepos-history-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.prepos-history-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.prepos-history-filters input {
  min-height: 40px;
}

.prepos-history-list {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.team-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 1100px) {
  .device-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dashboard-placeholder {
  display: grid;
  align-content: center;
  min-height: 220px;
  border: 1px dashed #b9c4d8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 18px;
}

.eip-main {
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.prepos-main {
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.prepos-panel {
  display: grid;
  gap: 14px;
}

.prepos-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 12px;
}

.prepos-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.prepos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prepos-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.prepos-list {
  display: grid;
  gap: 8px;
}

.prepos-board {
  overflow-x: auto;
}

.prepos-board table {
  width: 100%;
  max-width: 520px;
  border: 3px solid #111;
  border-collapse: collapse;
  background: #fff;
  color: #111827;
}

.prepos-board th,
.prepos-board td {
  border: 2px solid #111;
  padding: 7px 9px;
  vertical-align: middle;
}

.prepos-board thead th {
  background: #f3f4f6;
  font-size: 1rem;
  text-align: center;
}

.prepos-board tbody th {
  width: 84px;
  background: #f8fafc;
  text-align: center;
  font-weight: 900;
}

.prepos-board td {
  font-size: 0.95rem;
}

.prepos-board td div + div {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #111;
}

.prepos-board-cim table {
  border-color: #7c3aed;
  box-shadow: inset 0 0 0 1px #7c3aed;
}

.prepos-board-cim thead th {
  background: #d5c4e8;
  color: #2e1065;
}

.prepos-board-cim tbody th {
  background: #f3e8ff;
  color: #3b0764;
}

.prepos-board-cim tbody tr:last-child td {
  background: #faf5ff;
}

.prepos-cpo-row td {
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr;
  gap: 10px;
  font-weight: 800;
}

.prepos-logistics-fieldset,
.prepos-team-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.prepos-logistics-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.prepos-logistics-fieldset input {
  width: auto;
}

.prepos-logistics-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.prepos-logistics-fields[hidden] {
  display: none;
}

.prepos-team-fieldset {
  display: grid;
  gap: 12px;
}

.prepos-team-fieldset legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  padding: 0 6px;
}

.prepos-selected-teams {
  display: grid;
  gap: 8px;
}

.prepos-selected-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.prepos-selected-team span {
  color: var(--text);
  font-weight: 800;
}

.eip-management-panel {
  display: grid;
  gap: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: 10px 14px;
  text-decoration: none;
}

.button-link:hover {
  background: var(--primary-dark);
}

.button-link.secondary {
  background: #e8edf7;
  color: var(--text);
}

.button-link.secondary:hover {
  background: #dbe4f3;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--success);
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.eip-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.eip-empty {
  grid-column: 1 / -1;
}

.eip-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.eip-card-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.eip-card-title strong {
  color: var(--text);
  font-size: 1.05rem;
}

.eip-card-title span {
  border-radius: 999px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 5px 9px;
}

.eip-card-details {
  display: grid;
  gap: 8px;
}

.eip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.eip-row span {
  color: var(--muted);
}

.modal {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.modal.prepos-modal {
  width: min(1740px, calc(100vw - 20px));
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.modal-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.prepos-modal-card {
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.prepos-modal-content {
  display: grid;
  grid-template-columns: minmax(440px, 0.58fr) minmax(980px, 1.42fr);
  gap: 16px;
  align-items: start;
}

.prepos-form-column {
  display: grid;
  gap: 14px;
}

.prepos-map-panel {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-height: 790px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 12px;
}

.prepos-map-panel .inline-title {
  margin: 0;
}

.prepos-map-panel h3 {
  margin: 0;
  color: var(--text);
}

.prepos-team-map {
  min-height: 710px;
  height: 710px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ff;
}

.prepos-map-device-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1.35fr) minmax(360px, 0.65fr);
  gap: 10px;
  align-items: stretch;
}

.prepos-device-table-wrap {
  height: 710px;
  max-height: 710px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prepos-device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.prepos-device-table th,
.prepos-device-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.prepos-device-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3ff;
  color: #1740a8;
  font-size: 0.76rem;
  font-weight: 950;
}

.prepos-device-table td:first-child {
  color: var(--text);
  font-weight: 900;
  min-width: 96px;
}

.prepos-device-table td span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.prepos-team-map .leaflet-popup-content {
  margin: 10px 12px;
  color: var(--text);
}

.prepos-team-map .prepos-map-marker {
  filter: drop-shadow(0 0 6px rgba(23, 32, 51, 0.28));
}

.modal-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-title h2 {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.compact-grid {
  margin-bottom: 0;
}

.prepos-cpo-select-grid {
  grid-template-columns: minmax(0, 1fr);
}

.prepos-cpo-select-grid select {
  width: 100%;
  min-width: 0;
}

.weekday-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.weekday-fieldset legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 6px;
}

.weekday-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.weekday-fieldset input {
  width: auto;
}

.period-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.period-fieldset legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 6px;
}

.period-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.period-fieldset input {
  width: auto;
}

.update-period-fieldset {
  max-width: 520px;
  margin-top: 14px;
}

.days-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.days-picker[hidden] {
  display: none;
}

.days-picker label {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.days-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.days-picker label:has(input:checked) {
  border-color: var(--primary);
  background: var(--soft);
  color: var(--primary-dark);
}

.commander-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.section-menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 44px);
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: var(--role-header-height, 0px);
  z-index: 1000;
}

.section-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
  padding: 10px 18px;
}

.section-menu-link:hover,
.section-menu-link.active {
  border-color: var(--primary);
  background: var(--soft);
  color: var(--primary-dark);
}

.ecin-main {
  display: grid;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.ecin-dashboard {
  min-height: 320px;
}

.ecin-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 260px));
  gap: 12px;
  max-width: 820px;
}

.inline-check {
  align-content: end;
}

.inline-check input {
  width: auto;
  margin-right: 8px;
}

.ecin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.ecin-summary-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ecin-summary-card:hover,
.ecin-summary-card:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 87, 214, 0.12);
}

.ecin-summary-card.active {
  border-color: var(--primary);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.ecin-table-wrap tbody tr.ecin-type-match td {
  background: #eaf1ff;
  color: var(--text);
  font-weight: 700;
}

.ecin-table-wrap tbody tr.ecin-type-muted td {
  color: var(--muted);
  opacity: 0.72;
}

.ecin-table-wrap tbody td.ecin-active-type-cell {
  background: #dbe7ff;
  color: var(--primary-dark);
  font-weight: 900;
}

.ecin-summary-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.ecin-summary-title span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.ecin-summary-title strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.ecin-map-section {
  display: grid;
  gap: 12px;
}

.ecin-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(440px, 0.95fr);
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}

.ecin-map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.ecin-map {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ff;
}

.ecin-map-empty {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.ecin-map .leaflet-tooltip {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-weight: 800;
}

.ecin-map .ecin-boundary-label {
  border: 1px solid rgba(36, 87, 214, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-dark);
  font-weight: 900;
}

.ecin-map .leaflet-popup-content {
  margin: 10px 12px;
  color: var(--text);
}

.ecin-map-legend {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.12);
}

.ecin-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ecin-map .leaflet-control-layers {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.12);
  font-weight: 800;
}

.ecin-map .leaflet-control-layers-expanded {
  padding: 8px 10px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(23, 32, 51, 0.18);
}

.legend-dot-device {
  background: #dc2626;
}

.legend-dot-prepos {
  background: #7c3aed;
}

.legend-dot-occurrence {
  background: #d54300;
}

.ecin-map .ecin-prepos-marker {
  filter: drop-shadow(0 0 7px rgba(124, 58, 237, 0.55));
}

.ecin-map .ecin-occurrence-marker {
  filter: drop-shadow(0 0 5px rgba(17, 24, 39, 0.35));
}

.fire-risk-main {
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.fire-risk-panel {
  display: grid;
  gap: 14px;
}

.fire-risk-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.fire-risk-summary-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px 16px 14px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.fire-risk-summary-card:hover,
.fire-risk-summary-card:focus {
  border-color: var(--risk-color);
  box-shadow: 0 12px 22px rgba(23, 32, 51, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.fire-risk-summary-card.selected {
  border-color: var(--risk-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--risk-color) 24%, transparent);
}

.fire-risk-summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--risk-color);
}

.fire-risk-summary-card span,
.fire-risk-summary-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.fire-risk-summary-card strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.fire-risk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.fire-risk-map-section,
.fire-risk-table-section {
  display: grid;
  gap: 12px;
}

.fire-risk-map {
  min-height: 760px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ff;
}

.fire-risk-table-wrap {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fire-risk-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.fire-risk-table tbody tr.risk-selected td {
  background: #fff7ed;
  color: var(--text);
  font-weight: 900;
}

.fire-risk-table tbody tr.municipality-selected td {
  background: #e0f2fe;
  color: #082f49;
  font-weight: 900;
}

.fire-risk-table tbody tr.risk-selected td:first-child {
  box-shadow: inset 5px 0 0 var(--risk-row-color, #f97316);
}

.fire-risk-table tbody tr.municipality-selected td:first-child {
  box-shadow: inset 5px 0 0 #0284c7;
}

.fire-risk-level {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--risk-color);
  color: #fff;
  font-weight: 900;
}

.fire-risk-marker {
  background: transparent;
  border: 0;
}

.fire-risk-marker span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.3);
}

.ecin-popup-grid {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  font-size: 0.86rem;
}

.ecin-popup-periods {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.ecin-table-section {
  display: grid;
  gap: 12px;
}

.ecin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ecin-period-notes {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  margin-top: 12px;
  color: var(--text);
  font-size: 0.94rem;
}

.ecin-period-notes strong {
  font-weight: 900;
}

.ecin-period-notes div {
  display: grid;
  gap: 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.data-table td {
  color: var(--text);
  font-size: 0.88rem;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td,
.data-table tbody tr:focus td {
  background: #fff7ed;
}

.data-table tbody tr.selected td {
  background: #fff1f2;
  color: #7f1d1d;
  font-weight: 800;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td:not(:first-child),
.data-table th:not(:first-child) {
  text-align: center;
}

.update-table-wrap {
  margin-top: 14px;
  max-width: 920px;
}

.update-table-block {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.update-table-block .inline-title h2 {
  font-size: 1.05rem;
}

.update-add-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  max-width: 920px;
}

.update-add-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 900;
}

.update-add-row select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.update-days-picker {
  max-width: 920px;
}

.update-data-table input {
  width: 76px;
  padding: 6px 8px;
  text-align: center;
}

.update-data-table tbody tr {
  cursor: default;
}

@media (max-width: 780px) {
  .commander-overview,
  .commander-device-grid {
    grid-template-columns: 1fr;
  }

  .device-list {
    grid-template-columns: 1fr;
  }

  .update-add-row {
    grid-template-columns: 1fr;
  }

  .prepos-history-filters {
    grid-template-columns: 1fr;
  }
}

.menu-button {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
  text-decoration: none;
}

.menu-button:hover {
  border-color: var(--primary);
  background: var(--soft);
  color: var(--primary-dark);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.header-actions,
.schedule-actions,
.title-actions,
.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.title-actions {
  justify-content: flex-end;
}

.operator-month-picker {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-width: 180px;
}

.operator-month-picker input {
  min-height: 38px;
}

.db-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 7px 10px;
}

.db-status.connected {
  border-color: #b9dfcc;
  background: #f4fbf7;
  color: var(--success);
}

.db-status.offline {
  border-color: #f0c987;
  background: #fff7e8;
  color: var(--warning);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.collapsible-panel.collapsed > :not(.section-title) {
  display: none;
}

.panel-toggle {
  min-width: 72px;
}

.availability-panel,
.daily-panel,
.schedule-panel,
.stats-panel {
  grid-column: span 2;
}

.section-title,
.inline-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title span {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid,
.availability-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.import-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbff;
  padding: 12px;
  margin-bottom: 14px;
}

.import-box p {
  margin: 0;
}

.shift-list,
.member-list {
  display: grid;
  gap: 10px;
}

.stats-list {
  display: grid;
  gap: 14px;
}

.stat-zone-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.stat-zone-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.stat-zone-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.stat-zone-title span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

#statsModeToggle.active {
  border-color: var(--primary);
  background: #eef3ff;
  color: var(--primary-dark);
}

.stat-zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.stat-cb-group {
  display: grid;
  gap: 10px;
  border: 1px solid #d8e0ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.stat-cb-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #d8e0ee;
  padding-bottom: 8px;
}

.stat-cb-title h4 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1rem;
}

.stat-cb-title span {
  border-radius: 999px;
  background: #e8f7ef;
  color: #12633f;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.stat-cb-grid {
  display: grid;
  gap: 8px;
}

.stat-category-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.stat-category-row.empty {
  background: #fbfcff;
}

.stat-category-row h5 {
  display: grid;
  align-content: center;
  margin: 0;
  border-radius: 6px;
  background: #eef3ff;
  color: #1740a8;
  padding: 8px;
  font-size: 0.86rem;
  font-weight: 950;
}

.stat-category-members {
  display: grid;
  gap: 8px;
}

.stat-member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 60px;
  border: 1px solid #d8e2f5;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 9px;
}

.stat-member-card .bar-track {
  grid-column: 1 / -1;
}

.stat-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
}

.stat-counts > span {
  display: grid;
  min-width: 0;
  border-radius: 6px;
  background: #eef3ff;
  padding: 5px 8px;
  text-align: center;
}

.stat-counts > span:last-child {
  background: #e8f7ef;
}

.stat-counts b {
  color: #1740a8;
  font-size: 1.25rem;
  line-height: 1;
}

.stat-counts > span:last-child b {
  color: #12633f;
}

.stat-counts small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.stat-function-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.stat-function-counts span {
  display: grid;
  min-width: 0;
  border-radius: 6px;
  background: #b7d7f0;
  padding: 5px 4px;
  text-align: center;
}

.stat-function-counts span:nth-child(2) {
  background: #c6e0b4;
}

.stat-function-counts span:nth-child(3) {
  background: #ffe699;
}

.stat-function-counts b {
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}

.stat-function-counts small {
  margin-top: 3px;
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 900;
}

.stat-member-empty {
  display: grid;
  align-items: center;
  min-height: 60px;
  border: 1px dashed #d8e2f5;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  padding: 9px;
}

.shift-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px 110px 36px;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #eef1f6;
  color: var(--muted);
}

.member-row,
.daily-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 12px;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.06);
}

.stat-person {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stat-person strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.stat-person span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.stat-detail {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.stat-category {
  border-radius: 999px;
  background: #eef3ff;
  color: #1740a8;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.stat-total {
  color: var(--primary-dark);
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1;
}

.stat-row .bar-track,
.stat-row .stat-meta {
  grid-column: 1 / -1;
}

.stat-row .bar-track {
  width: 100%;
  min-width: 0;
  height: 10px;
  background: #e6ecf5;
}

.stat-row .bar {
  background: linear-gradient(90deg, #2457d6, #16a34a);
}

.member-meta,
.daily-meta,
.stat-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.import-issues {
  margin-top: 8px;
  color: var(--text);
}

.import-issues summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
}

.import-issues ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.import-issues li {
  margin: 5px 0;
  line-height: 1.4;
}

.availability-note {
  margin-top: 12px;
  border: 1px solid #f0c987;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: #fffaf0;
  color: var(--text);
  padding: 12px 14px;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-wrap;
}

.availability-note.empty {
  border-color: var(--line);
  border-left-color: #94a3b8;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
}

.automatic-schedule-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.daily-list {
  display: grid;
  gap: 14px;
}

.daily-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.daily-panel-actions > div {
  display: flex;
  gap: 8px;
}

.daily-panel-actions p {
  margin: 0;
}

.daily-zone-group {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px;
}

.daily-zone-group h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
}

.daily-zone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.daily-row {
  align-items: flex-start;
  min-height: 102px;
  flex-wrap: wrap;
}

.assignment-function-field {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: 90px minmax(0, 260px);
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.assignment-function-select {
  min-height: 36px;
  padding: 7px 9px;
}

.assignment-meta .assignment-function {
  background: #e8f7ef;
  color: #12633f;
}

.daily-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-card-cb,
.daily-card-category,
.daily-row strong {
  color: var(--text);
  line-height: 1.15;
}

.daily-card-cb,
.daily-card-category {
  font-size: 1.05rem;
}

.daily-card-cb {
  text-align: center;
  font-weight: 900;
}

.daily-row .status-pill {
  margin-top: 8px;
}

.daily-row.available {
  border-color: #b9dfcc;
  background: #f4fbf7;
}

.daily-row.selectable {
  cursor: pointer;
}

.daily-row.selectable:hover {
  border-color: var(--primary);
  background: var(--soft);
}

.daily-row.selected-assignment {
  border-color: var(--primary);
  background: #eef3ff;
}

.daily-row.unavailable {
  background: #fbfcfe;
}

.status-pill {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.available {
  background: #ddf4e8;
  color: var(--success);
}

.status-pill.selected {
  background: var(--primary);
  color: #fff;
}

.status-pill.unavailable {
  background: #f4dee0;
  color: var(--danger);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day,
.schedule-day {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  min-height: 74px;
  padding: 8px;
}

.schedule-day.weekend-day {
  border-color: #bfd4ff;
  background: #f3f7ff;
}

.schedule-day.holiday-day {
  border-color: #fecaca;
  background: #fff5f5;
}

.schedule-day.weekend-day.holiday-day {
  border-color: #fda4af;
  background: linear-gradient(180deg, #fff1f2 0%, #f3f7ff 100%);
}

.calendar-day {
  cursor: pointer;
}

.calendar-day.readonly {
  cursor: default;
}

.calendar-day.selected {
  background: var(--soft);
  border-color: var(--primary);
}

.calendar-day.readonly.selected {
  color: var(--text);
}

.cpo-layout .availability-toolbar {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-day strong,
.schedule-day strong {
  display: block;
  margin-bottom: 4px;
}

.holiday-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.72rem;
  font-weight: 900;
}

.weekday {
  color: var(--muted);
  font-size: 0.8rem;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-weekday-heading {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef3ff;
  color: #1740a8;
  padding: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.schedule-day-placeholder {
  min-height: 74px;
  border: 1px dashed #d8e2f5;
  border-radius: 6px;
  background: #f8fafc;
}

.shift-assignment {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.shift-assignment:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.assigned {
  color: var(--success);
  font-weight: 700;
}

.assignment-list {
  display: grid;
  gap: 6px;
  line-height: 1.25;
}

.assignment-member {
  display: grid;
  gap: 5px;
  border: 1px solid #d8e2f5;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  padding: 7px;
}

.assignment-cb {
  color: var(--text);
  font-weight: 900;
}

.assignment-main {
  display: grid;
  gap: 2px;
}

.assignment-name {
  color: var(--success);
  font-weight: 900;
}

.assignment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.assignment-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 7px;
  background: #eef3ff;
  color: #1740a8;
  font-size: 0.72rem;
  font-weight: 900;
}

.missing {
  color: var(--danger);
  font-weight: 700;
}

.warnings {
  border: 1px solid #f0c987;
  background: #fff7e8;
  color: var(--warning);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #edf1f7;
  overflow: hidden;
  min-width: 120px;
}

.bar {
  height: 100%;
  background: var(--primary);
}

.gruata-main {
  padding: 18px clamp(16px, 4vw, 44px) 44px;
}

.gruata-panel {
  display: grid;
  gap: 14px;
}

.gruata-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  padding: 14px 0;
}

.gruata-form-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.gruata-form-section legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 900;
}

.gruata-common-grid,
.gruata-composition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.gruata-composition-list {
  display: grid;
  gap: 8px;
}

.gruata-composition-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px 10px;
}

.gruata-composition-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gruata-form[hidden] {
  display: none;
}

.gruata-location-status {
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.gruata-location-status span {
  color: var(--muted);
  font-size: 0.84rem;
}

.gruata-form-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.gruata-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(520px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.gruata-map-section,
.gruata-table-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.gruata-map {
  min-height: 620px;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.gruata-table-wrap {
  min-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gruata-table th,
.gruata-table td {
  padding: 8px;
  vertical-align: middle;
}

.gruata-table tbody tr {
  cursor: pointer;
}

.gruata-table tbody tr.selected {
  background: #f3e8ff;
  box-shadow: inset 4px 0 #7c3aed;
}

.gruata-row-actions {
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.gruata-row-actions button {
  padding: 6px 8px;
}

.gruata-popup-composition {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border-top: 1px solid #dfe5ef;
  padding-top: 7px;
}

@media (max-width: 860px) {
  .app-header,
  .role-header,
  .section-title,
  .inline-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .management-header,
  .eip-header {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .management-header-title,
  .eip-header-title {
    justify-self: start;
    text-align: left;
  }

  .management-header .user-box,
  .eip-header .user-box {
    justify-self: start;
  }

  .layout,
  .form-grid,
  .prepos-modal-content,
  .prepos-map-device-grid,
  .availability-toolbar,
  .prepos-toolbar,
  .ecin-toolbar,
  .prepos-logistics-fields,
  .prepos-grid,
  .eip-list,
  .ecin-summary {
    grid-template-columns: 1fr;
  }

  .prepos-map-panel {
    position: static;
    height: auto;
    min-height: 420px;
  }

  .prepos-team-map {
    min-height: 420px;
    height: 420px;
  }

  .prepos-device-table-wrap {
    height: auto;
    max-height: 320px;
  }

  .button-row,
  .modal-actions {
    justify-content: flex-start;
  }

  .weekday-fieldset {
    grid-template-columns: 1fr;
  }

  .ecin-map-shell {
    grid-template-columns: 1fr;
  }

  .ecin-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .gruata-form,
  .gruata-common-grid,
  .gruata-composition-grid,
  .gruata-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .gruata-map,
  .gruata-table-wrap {
    min-height: 420px;
    height: 420px;
  }

  .fire-risk-grid,
  .fire-risk-summary {
    grid-template-columns: 1fr;
  }

  .fire-risk-map {
    min-height: 420px;
  }

  .fire-risk-table-wrap {
    max-height: none;
  }

  .ecin-map {
    min-height: 420px;
    height: 420px !important;
  }

  .availability-panel,
  .daily-panel,
  .schedule-panel,
  .stats-panel,
  .cpo-layout .setup-panel {
    grid-column: auto;
  }

  .shift-row {
    grid-template-columns: 1fr 1fr;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-zone-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commander-menu {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .daily-zone-grid {
    grid-template-columns: 1fr;
  }
}
[hidden] {
  display: none !important;
}

.cpo-view-month {
  grid-template-columns: minmax(240px, 420px);
}

.cpo-month-toolbar {
  justify-content: space-between;
}

.cpo-month-field {
  width: min(100%, 320px);
}
