.app { display: block; }
@media (max-width: 1000px) { .app { display: block; } }
.brand-mark {
  overflow: hidden;
  background: #fff;
}

.sync-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #bfd5f5;
  border-radius: 10px;
  background: #f3f8ff;
  color: #294567;
}
.sync-progress progress { width: 100%; height: 12px; accent-color: #1769e0; }
.sync-progress span { color: #6f7b91; font-size: 13px; }
button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
}
.brand-mark img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  display: block;
}
.brand-mark.small img {
  width: 86%;
  height: 86%;
}
.face-image-field input[type=file] {
  padding: 9px;
  background: #f8fafc;
}
.face-image-box {
  min-height: 150px;
  border: 1px dashed #b9c6d8;
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #6f7b91;
  font-weight: 500;
}
.face-image-box img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}
.face-image-status {
  color: #6f7b91;
  font-weight: 500;
}
.form-grid .check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 28px;
  color: #344158;
}
.form-grid .check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  flex: 0 0 16px;
  box-shadow: none;
}
.face-probe-all {
  padding: 2px 0 0;
}
.face-probe-list {
  display: grid;
  gap: 10px;
  padding: 4px 0 0;
}
.face-probe-device {
  padding: 10px 12px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}
.face-probe-device span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  width: 100%;
  grid-column: 1 / -1;
}
.record-create-grid label {
  min-width: 0;
}
.record-create-grid input,
.record-create-grid select,
.record-create-grid textarea {
  width: 100%;
}
.record-create-grid > .wide,
.record-create-grid > .textarea-field,
.record-device-panel {
  grid-column: 1 / -1;
}
.record-device-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}
.record-device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.record-device-head strong {
  color: #344158;
}
.record-device-head .check-row {
  min-height: 0;
}
.record-device-list {
  max-height: 220px;
  overflow: auto;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.record-device-list .face-probe-device {
  background: #fff;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  width: 100%;
}
.record-device-list .face-probe-device span {
  white-space: normal;
  word-break: break-all;
}
.empty.compact {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
button.danger {
  background: #e24b4b;
  border-color: #e24b4b;
  color: #fff;
}
button.danger:hover {
  background: #cf3f3f;
  border-color: #cf3f3f;
}
.confirm-box {
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  padding: 16px;
  background: #f8fafc;
}
.confirm-box strong {
  display: block;
  margin-bottom: 6px;
  color: #172033;
}
.confirm-box p {
  margin: 0 0 12px;
  color: #6f7b91;
}
.danger-box {
  border-color: #ffd4d4;
  background: #fff7f7;
}
.danger-box strong {
  color: #e24b4b;
}
.confirm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.confirm-list span {
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  color: #52617a;
  padding: 4px 10px;
}
.qr-card {
  display: inline-grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
}
.qr-image {
  display: grid;
  place-items: center;
}
.visitor-qr {
  width: 180px;
  height: 180px;
  shape-rendering: crispEdges;
  border: 1px solid #e5eaf2;
}
.qr-token {
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2f6fc;
  color: #344158;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  word-break: break-all;
  text-align: center;
}
.bars {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, minmax(52px, 1fr));
  align-items: stretch;
  gap: 14px;
  padding: 34px 8px 28px;
  overflow: hidden;
  border-bottom: 1px solid #e5eaf2;
  background:
    linear-gradient(to top, #e5eaf2 1px, transparent 1px),
    linear-gradient(to top, #f3f6fb 1px, transparent 1px);
  background-size: 100% 100%, 100% 52px;
}
.bars .bar-group {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  justify-items: center;
  gap: 8px;
  position: relative;
}
.bars .bar-pair {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
}
.bars .bar {
  width: 12px;
  max-height: 100%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: #1769e0;
  box-shadow: 0 8px 16px rgba(23, 105, 224, 0.16);
  transition: height 0.2s ease;
}
.bars .bar.alarm {
  background: #e8b15d;
  box-shadow: 0 8px 16px rgba(232, 177, 93, 0.18);
}
.bars .bar-group label {
  position: static;
  max-width: 100%;
  overflow: hidden;
  color: #667288;
  font-size: 11px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-reports {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.ring-report {
  min-height: 180px;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding-top: 14px;
}
.ring-chart {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px #e5eaf2;
}
.ring-chart > div {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.08);
}
.ring-chart strong {
  font-size: 24px;
  line-height: 1;
  color: #172033;
}
.ring-chart small {
  color: #6f7b91;
}
.chart-legend {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.chart-legend span {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: #52617a;
}
.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.chart-legend b {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-legend em {
  font-style: normal;
  color: #172033;
  font-weight: 700;
}
.chart-legend p {
  margin: 0;
  color: #6f7b91;
}
.rank-bars {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}
.rank-row {
  display: grid;
  grid-template-columns: 24px minmax(76px, 1fr) minmax(90px, 1.6fr) 34px;
  align-items: center;
  gap: 10px;
}
.rank-row span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #eef3fa;
  color: #52617a;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.rank-row b {
  overflow: hidden;
  color: #344158;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-row i {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef3fa;
}
.rank-row i em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1769e0, #18a874);
}
.rank-row strong {
  text-align: right;
  color: #172033;
}
.access-toolbar {
  align-items: flex-start;
}
.access-toolbar .left {
  flex: 1;
  min-width: 0;
}
.access-filter {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(170px, 1fr)) repeat(4, minmax(120px, 0.8fr)) auto auto;
  gap: 9px;
  align-items: center;
}
.access-filter input,
.access-filter select {
  width: 100%;
  min-width: 0;
}
.access-filter button {
  white-space: nowrap;
}
.permission-form {
  display: grid;
  gap: 18px;
  grid-column: 1 / -1;
}
.permission-form .permission-basic {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 15px;
}
.permission-form .permission-basic label:first-child {
  grid-column: 1 / -1;
}
.permission-devices,
.permission-sections {
  display: grid;
  gap: 12px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#permissionAreaList {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
#permissionAreaList .face-probe-all {
  grid-column: 1 / -1;
}
.permission-section {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #f8fafc;
}
.permission-section label {
  min-width: 0;
}
.permission-section input {
  width: 100%;
}
@media (min-width: 900px) {
  dialog:has(.permission-form) {
    width: min(860px, 92vw);
  }
  dialog:has(.record-create-grid) {
    width: min(980px, 94vw);
  }
  dialog:has(.record-create-grid) .form-grid {
    max-height: 70vh;
  }
}
@media (max-width: 900px) {
  .record-create-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .bars {
    grid-template-columns: repeat(7, 48px);
    overflow-x: auto;
  }
  .dashboard-reports,
  .ring-report {
    grid-template-columns: 1fr;
  }
  .ring-chart {
    justify-self: center;
  }
  .rank-row {
    grid-template-columns: 24px minmax(70px, 1fr) minmax(80px, 1.4fr) 34px;
  }
  .access-filter {
    grid-template-columns: 1fr;
  }
  .record-create-grid,
  .record-device-list {
    grid-template-columns: 1fr;
  }
  .record-device-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .permission-form .permission-basic,
  #permissionAreaList,
  .permission-section {
    grid-template-columns: 1fr;
  }
}
