* {
  box-sizing: border-box;
}
:root {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #182d24;
  background: #f2f4f1;
  --line: #d8e0d9;
  --muted: #59685f;
  --green: #236343;
  --red: #ac292c;
  --yellow: #90621a;
  --space: 12px;
}
body {
  margin: 0;
}
button,
input,
a {
  font: inherit;
}
button,
a,
input {
  touch-action: manipulation;
}
button {
  height: 38px;
  padding: 0 12px;
  border: 1px solid #bdcbbf;
  border-radius: 6px;
  background: #fff;
  color: #20382e;
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  background: #edf3ed;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #558ec6;
  outline-offset: 2px;
}
input {
  height: 40px;
  border: 1px solid #a5b6a8;
  border-radius: 5px;
  padding: 8px 12px;
  min-width: 0;
  background: white;
  color: #172d24;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 18px;
}
h2 {
  font-size: 17px;
}
h3 {
  font-size: 15px;
  margin: 16px 0 8px;
}
p {
  line-height: 1.5;
}
label {
  display: grid;
  gap: 8px;
}
label input {
  width: 100%;
}
[hidden] {
  display: none !important;
}
.header {
  min-height: 64px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #20382e;
  color: #fff;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.brand span {
  font-size: 13px;
  font-weight: 400;
  display: block;
  opacity: 0.85;
}
.branch-identity {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header button {
  height: 36px;
  background: #2b473b;
  border-color: #577165;
  color: #fff;
}
.header button:hover {
  background: #3c5b4c;
}
.header a:not(.brand) {
  padding: 8px;
}
.connection {
  font-size: 12px;
  white-space: nowrap;
  color: #bedac6;
}
.connection.offline {
  color: #ffd3ac;
}
.connection::before {
  content: '●';
  margin-right: 6px;
}
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 20px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-heading p,
#updatedAt,
.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.floors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
  align-items: start;
}
.floor {
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 8px;
  background: white;
  padding: 16px;
  min-width: 0;
}
.floor.warning {
  border-top-color: var(--yellow);
}
.floor.critical {
  border-top-color: var(--red);
  background: #fffafa;
}
.floor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.floor-head h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--green);
  background: #e5f2e9;
}
.warning .badge {
  background: #fff0ce;
  color: #72500b;
}
.critical .badge {
  background: #fde5e5;
  color: var(--red);
}
.counter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}
.counter-label {
  font-size: 13px;
  color: var(--muted);
}
.stepper {
  display: flex;
  gap: 6px;
  align-items: center;
}
.step {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
}
.counter-value {
  min-width: 58px;
  font-size: 28px;
  font-weight: 700;
  height: 40px;
  border-color: transparent;
  background: transparent;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}
.metrics {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
}
.metric-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.deficit {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 12px;
}
.critical .deficit {
  color: var(--red);
}
.floor .request {
  width: 100%;
}
.floor-footer {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}
.notice {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 0 0 12px;
  border: 1px solid;
}
.notice.critical {
  background: #ffeded;
  border-color: #e9b5b5;
  color: #8c2424;
}
.notice.error {
  background: #fff1e2;
  border-color: #d7a666;
  color: #763f12;
}
.transfers {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.transfer {
  border: 1px solid #d6c69d;
  border-left: 4px solid #a47c28;
  background: #fffdf8;
  border-radius: 6px;
  padding: 12px 16px;
}
.transfer.accepted {
  border-left-color: #377b50;
}
.transfer h3 {
  margin: 0 0 8px;
}
.toolbar,
.transfer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.response-group {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
  background: #f4f3ed;
  border-radius: 5px;
}
.response-group span {
  margin-right: 4px;
}
.response-group button {
  font-size: 12px;
  height: 36px;
}
.primary {
  background: #285d42;
  color: #fff;
  border-color: #285d42;
}
.primary:hover {
  background: #204c35;
}
.hint {
  margin-top: 12px;
}
.switcher {
  position: relative;
  width: 240px;
  flex-shrink: 0;
}
.switcher > button {
  width: 100%;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.branch-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  padding: 8px;
  background: white;
  color: #182d24;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px #0002;
  z-index: 20;
}
.branch-popup input {
  width: 100%;
  height: 36px;
}
.branch-options {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
}
.branch-options button {
  display: block;
  width: 100%;
  height: 36px;
  text-align: left;
  background: white;
  color: #20382e;
  border: 0;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.branch-options button:hover,
.branch-options button:focus {
  background: #e5eee6;
}
.branch-options button[aria-current='true'] {
  background: #dcecdf;
}
.reports {
  margin-top: 24px;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e4e9e4;
  white-space: nowrap;
}
th {
  font-size: 12px;
  color: var(--muted);
}
.report-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.report-summary strong {
  font-size: 24px;
  display: block;
}
.hours {
  display: flex;
  gap: 4px;
  align-items: end;
  height: 130px;
  overflow-x: auto;
  margin: 12px 0;
}
.hour {
  min-width: 28px;
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
}
.bar {
  background: #507b60;
  width: 100%;
  min-height: 2px;
  margin-bottom: 5px;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-card {
  background: white;
  padding: 32px;
  width: min(400px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
}
.login-card .brand {
  display: block;
  margin-bottom: 24px;
}
.login-card h1 {
  margin-bottom: 8px;
}
.login-card form,
.login-card form label {
  margin-top: 16px;
}
.login-card button {
  width: 100%;
  margin-top: 16px;
}
.login-card > label {
  margin-top: 16px;
}
dialog {
  max-width: 400px;
  width: calc(100% - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
dialog::backdrop {
  background: #14251db3;
}
dialog label,
dialog p,
dialog .toolbar {
  margin-top: 16px;
}
dialog p {
  font-size: 12px;
  color: var(--muted);
}
.tv .floor {
  min-height: 310px;
}
.tv .counter-value {
  font-size: 38px;
}
.tv .floor h2 {
  font-size: 22px;
}
.tv .login-card {
  margin: 40px auto;
}
.empty {
  padding: 24px;
  border: 1px dashed #a9b8ac;
  color: var(--muted);
}
@media (min-width: 1500px) {
  .floors {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}
@media (max-width: 1100px) {
  .header {
    gap: 12px;
    padding: 12px 16px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions button {
    font-size: 12px;
    padding: 0 8px;
  }
  .connection {
    font-size: 11px;
  }
  .branch-identity {
    max-width: 140px;
  }
  .switcher {
    width: 220px;
  }
  .floors {
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  }
  main {
    padding: 16px;
  }
  .floor {
    padding: 12px;
  }
}
@media (max-width: 760px) {
  .header {
    flex-wrap: wrap;
  }
  .header-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .connection {
    margin-left: auto;
  }
  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .floors {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .login-card {
    padding: 24px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .floor.critical .badge {
    animation: attention 3s 2;
  }
  @keyframes attention {
    50% {
      box-shadow: 0 0 0 3px #ac292c22;
    }
  }
}

.floors[data-count='1'] {
  grid-template-columns: minmax(0, 520px);
}
.floors.many-floors {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.floor {
  container-type: inline-size;
}
@container (max-width:235px) {
  .counter {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 0;
  }
  .stepper {
    justify-content: space-between;
  }
  .counter-value {
    flex: 1;
  }
  .floor-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
  }
  .metrics {
    padding-top: 12px;
  }
}
