:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", Meiryo, sans-serif;
  color: #20374a;
  background: #eef3f7;
  font-size: 15px;
  line-height: 1.6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  background: #173d60;
  color: white;
  border-bottom: 4px solid #78b7bd;
}
.header-inner {
  max-width: 1100px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
}
.brand-mark {
  font-size: 38px;
  line-height: 1;
  background: #ffffff14;
  width: 56px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff30;
  border-radius: 12px;
}
h1 {
  font-size: 23px;
  margin: 0;
  letter-spacing: 0.04em;
}
header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #ccdde8;
}
.version {
  font-size: 11px;
  margin-left: auto;
  white-space: nowrap;
  color: #c7e4e5;
}
main {
  max-width: 1100px;
  margin: auto;
  padding: 24px;
}
.panel {
  background: white;
  border: 1px solid #d9e4eb;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 3px 14px #173d6005;
}
h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 4px 0 15px;
}
h3 {
  font-size: 17px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: #4c7b8c;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.muted {
  color: #617487;
}
.small {
  font-size: 12px;
}
button,
.button-link {
  border: 1px solid #bbcedc;
  background: #f2f7fb;
  color: #1e536f;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4;
  max-width: 100%;
}
button:hover {
  background: #e5f0f5;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary {
  background: #1e6c93;
  color: white;
  border-color: #1e6c93;
}
.primary:hover {
  background: #175678;
}
.quiet {
  background: white;
  font-weight: 500;
}
.danger {
  color: #994755;
  background: #fbf0f1;
  border-color: #dfc1c5;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0;
}
.fields .wide {
  grid-column: 1/-1;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #536d7d;
}
input,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: #20374a;
  background: white;
  border: 1px solid #b6c7d3;
  border-radius: 8px;
  padding: 10px;
  margin: 5px 0;
  min-height: 44px;
}
input:focus {
  outline: 3px solid #bce4f4;
  border-color: #2586b4;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #d68a2e;
  outline-offset: 3px;
}
form {
  margin: 0;
}
details {
  border-top: 1px solid #e1e8ed;
  margin-top: 18px;
  padding-top: 15px;
}
summary {
  cursor: pointer;
  color: #2b5e7c;
  font-weight: 600;
  padding: 4px 0;
  min-height: 38px;
}
.groupbar,
.section-head,
.modebar,
.confirmbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.groupbar h2 {
  margin-bottom: 4px;
}
.groupbar p {
  margin: 0;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sync {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
}
.sync small {
  font-size: 11px;
  color: #68808f;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 21px 0;
}
.stats > div {
  border-radius: 11px;
  padding: 15px 18px;
  background: #f1f5f8;
  border-left: 4px solid #8eacbc;
}
.stats > div:first-child {
  background: #edf7f2;
  border-color: #4d9b78;
}
.stats > div:nth-child(2) {
  background: #faf0f0;
  border-color: #c18c95;
}
.stats small {
  color: #597081;
  font-size: 12px;
}
.stats strong {
  font-size: 30px;
  display: block;
  line-height: 1.4;
}
.segmented {
  display: flex;
  background: #edf2f6;
  padding: 4px;
  border-radius: 11px;
  gap: 4px;
}
.segmented button {
  border: 0;
  background: none;
  min-width: 112px;
}
.segmented .active {
  background: white;
  color: #1c698d;
  box-shadow: 0 1px 5px #264f7322;
}
.cabinet-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 18px 1px 10px;
}
.cabinet-tabs button {
  white-space: nowrap;
}
.cabinet-tabs .active {
  background: #173d60;
  color: white;
  border-color: #173d60;
}
.cabinet-form {
  display: grid;
  grid-template-columns: 100px minmax(100px, 1fr) 100px auto;
  gap: 10px;
  align-items: end;
  background: #f4f7fa;
  border: 1px solid #dce5eb;
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
}
.cabinet-form button {
  margin-bottom: 5px;
}
.legend {
  font-size: 11px;
  color: #607485;
  margin: 20px 0 12px;
}
.available-dot {
  color: #4b9571;
}
.busy-dot {
  color: #c87e8c;
}
.mine-dot {
  color: #437ca6;
}
.selected-dot {
  color: #d28b28;
}
.devices {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.device {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 92px;
  padding: 13px 5px;
  background: #eef8f2;
  border: 1px solid #a4cfb7;
  color: #326a50;
  position: relative;
  word-break: break-word;
}
.device strong {
  font-size: 17px;
}
.device span {
  font-size: 11px;
  line-height: 1.4;
}
.device.busy {
  background: #fcf0f2;
  color: #9a4e61;
  border-color: #e7bdc7;
}
.device.mine {
  background: #ecf4ff;
  color: #35678c;
  border-color: #a0c1dc;
}
.device.selected {
  background: #fff2d8;
  border: 2px solid #ca852a;
  box-shadow: 0 0 0 1px #ca852a;
  color: #794e10;
}
.device:disabled {
  opacity: 0.65;
}
.confirmbar {
  border-top: 1px solid #e1e8ed;
  margin-top: 22px;
  padding-top: 18px;
}
.confirmbar > div:first-child {
  flex: 1;
  min-width: 180px;
}
#chosenLabels {
  max-width: 500px;
  overflow-wrap: anywhere;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e1e8ed;
  text-align: left;
  vertical-align: top;
}
th {
  background: #f4f7fa;
  color: #637a8d;
  white-space: nowrap;
}
.table-scroll {
  overflow-x: auto;
}
.table-scroll table {
  min-width: 570px;
}
.inline-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.inline-form label {
  flex: 1;
  min-width: 120px;
}
.inline-form button {
  margin-bottom: 5px;
}
.tablet-edit {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: end;
  border-bottom: 1px solid #e1e8ed;
  padding: 10px 0;
}
.tablet-edit button {
  margin-bottom: 5px;
}
.filelabel {
  margin: 18px 0;
}
input[type="file"] {
  font-size: 13px;
}
.group-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
#notice,
.alert {
  padding: 15px 18px;
  background: #eed8e0;
  border: 1px solid #d9aebd;
  color: #352a30;
  border-radius: 10px;
  margin-bottom: 17px;
  white-space: pre-line;
}
#notice.success {
  background: #e6f4ec;
  border-color: #bbdac8;
  color: #29553b;
}
.alert p {
  font-size: 12px;
}
.preview-list {
  max-height: 300px;
  overflow: auto;
  background: #f6f8fa;
  padding: 10px;
  border-radius: 8px;
}
.preview-list > div {
  padding: 5px;
  border-bottom: 1px solid #e0e6eb;
  font-size: 12px;
}
dialog {
  border: 1px solid #c8d6df;
  border-radius: 16px;
  padding: 24px;
  max-width: min(660px, calc(100% - 24px));
  max-height: 90dvh;
  color: #20374a;
}
dialog::backdrop {
  background: #132b43aa;
}
dialog > form {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
.modal-content {
  overflow-wrap: anywhere;
}
.qr {
  text-align: center;
}
.qr canvas {
  max-width: 100%;
  height: auto;
}
.urltext {
  font-size: 12px;
  word-break: break-all;
  background: #f1f5f8;
  padding: 10px;
  border-radius: 8px;
}
.code {
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}
.credential {
  padding: 12px;
  border: 1px solid #d8e2e9;
  margin: 10px 0;
  border-radius: 9px;
}
.empty {
  grid-column: 1/-1;
  padding: 30px;
  text-align: center;
  color: #718591;
  background: #f7f9fb;
  border-radius: 10px;
}
footer {
  text-align: center;
  color: #8293a1;
  font-size: 11px;
  padding: 10px 0 25px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 760px) {
  main {
    padding: 14px;
  }
  .header-inner {
    padding: 18px;
  }
  .panel {
    padding: 18px;
  }
  .devices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cabinet-form {
    grid-template-columns: 80px minmax(90px, 1fr) 85px;
  }
  .cabinet-form button {
    grid-column: 1/-1;
  }
  .tablet-edit {
    grid-template-columns: 1fr 1fr;
  }
  .version {
    display: none;
  }
  .groupbar .actions {
    width: 100%;
  }
}
@media (max-width: 420px) {
  main {
    padding: 9px;
  }
  .panel {
    padding: 14px;
    border-radius: 12px;
  }
  h1 {
    font-size: 19px;
  }
  .brand-mark {
    width: 40px;
    height: 46px;
    font-size: 28px;
  }
  .header-inner {
    gap: 10px;
    padding: 16px 12px;
  }
  header p {
    font-size: 10px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .fields .wide {
    grid-column: auto;
  }
  .stats {
    gap: 7px;
  }
  .stats > div {
    padding: 10px;
  }
  .stats strong {
    font-size: 25px;
  }
  .devices {
    gap: 7px;
  }
  .device strong {
    font-size: 15px;
  }
  .device {
    min-height: 85px;
  }
  .sync {
    align-items: flex-start;
  }
  .confirmbar .actions {
    width: 100%;
  }
  .confirmbar .primary {
    flex: 1;
  }
  .cabinet-form {
    gap: 7px;
    padding: 10px;
    grid-template-columns: 64px minmax(70px, 1fr) 70px;
  }
}
