:root {
  --ink: #173143;
  --muted: #647787;
  --navy: #1d4962;
  --blue: #147bb0;
  --line: #dce4e9;
  --bg: #f3f6f8;
  --white: #fff;
  --green: #1d7c5c;
  --amber: #966215;
  --red: #b33535;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", Meiryo,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  line-height: 1.4;
  font-weight: 600;
}
button:hover,
.button:hover {
  background: #edf3f6;
  text-decoration: none;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}
.primary:hover {
  background: #163b51;
}
.danger {
  color: var(--red);
}
.small {
  padding: 5px 9px;
  font-size: 12px;
}
input,
select,
textarea {
  border: 1px solid #bacad4;
  border-radius: 5px;
  padding: 9px 11px;
  background: #fff;
  max-width: 100%;
  color: var(--ink);
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #90cbea;
  outline-offset: 2px;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--navy);
}
textarea {
  resize: vertical;
  min-height: 90px;
}
[hidden] {
  display: none !important;
}
.brand {
  font-size: 22px;
  letter-spacing: 0.07em;
  font-weight: 800;
  color: var(--navy);
}
#header {
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 8px;
}
.app-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 40px;
  flex: 0 0 36px;
  border-radius: 5px;
}
.app-brand:hover {
  background: #edf3f6;
}
.app-brand img {
  display: block;
  object-fit: contain;
}
.nav {
  display: flex;
  align-self: stretch;
  flex: 1;
  min-width: 0;
  gap: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}
.nav a {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 12px;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}
.nav a:hover {
  background: #f4f7f9;
}
.nav a.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  background: #f5f9fb;
}
.org-context {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 240px;
  border: 1px solid #d1e3ed;
  background: #eaf3f7;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--navy);
  line-height: 1.6;
}
.org-context span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-context.impersonating {
  background: #fff4dc;
  border-color: #f0d494;
  color: #795724;
}
.account-control {
  position: relative;
  flex: 0 0 36px;
  margin-left: auto;
}
.account-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
}
.account-toggle[aria-expanded="true"] {
  background: #eaf2f7;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 7px 22px #17314325;
  z-index: 30;
}
.account-menu button {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 3px;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}
main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 10px 16px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin: 0 0 8px;
  flex-wrap: nowrap;
}
.page-heading h1 {
  font-size: 18px;
  line-height: 1.4;
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.page-actions > button {
  padding: 6px 12px;
}
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.13em;
  font-weight: 700;
  margin: 0 0 7px;
}
h1 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.5;
  font-weight: 700;
}
h2 {
  font-size: 16px;
  margin: 0 0 14px;
}
h3 {
  font-size: 13px;
  margin: 0 0 14px;
}
p {
  line-height: 1.8;
  margin: 8px 0;
}
.muted {
  color: var(--muted);
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-header h2 {
  margin: 0;
}
.links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 900px;
}
.link-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  min-height: 95px;
}
.link-panel:hover {
  border-color: #7a9fb4;
  background: #fafdff;
  text-decoration: none;
}
.link-panel span {
  color: var(--blue);
}
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  background: #edf2f5;
  color: #527084;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.tag.active {
  background: #e7f4ed;
  color: var(--green);
}
.tag.inactive {
  background: #f0f1f3;
  color: #7a818a;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  padding: 17px 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-value {
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 12px;
  color: var(--muted);
  margin-left: 5px;
}
.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
}
.sidebar {
  align-self: start;
}
.sidebar .panel {
  padding: 17px;
}
.group-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.group-button {
  justify-content: space-between;
  width: 100%;
  border-color: transparent;
  text-align: left;
  background: transparent;
  font-weight: 500;
  font-size: 13px;
  padding: 10px;
}
.group-button.selected {
  background: #e8f1f6;
  color: var(--navy);
  font-weight: 700;
}
.group-row {
  display: flex;
}
.group-row .group-button {
  flex: 1;
}
.group-row .edit-group {
  border: 0;
  background: transparent;
  padding: 5px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .spacer {
  flex: 1;
}
.table-wrap {
  overflow: auto;
}
.dataTable {
  font-size: 12px;
}
.dataTable th {
  white-space: nowrap;
  font-size: 11px;
  color: #617789;
  font-weight: 700;
  background: #f8fafb;
}
.dataTable td {
  vertical-align: middle;
}
.device-name {
  font-weight: 600;
  display: block;
  white-space: nowrap;
}
.subtext {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
  max-width: 260px;
  white-space: normal;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
  font-size: 12px;
}
.number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.actions {
  white-space: nowrap;
}
.actions button {
  margin: 2px;
}
.dt-container .dt-search input,
.dt-container .dt-length select {
  padding: 6px 9px !important;
}
.dt-container .dt-layout-row {
  font-size: 12px;
}
.dt-container .dt-paging .dt-paging-button {
  padding: 5px 9px !important;
  border-radius: 4px !important;
}
.selection-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 70px;
}
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 115px;
  border-bottom: 1px solid var(--line);
  padding-top: 20px;
}
.chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.chart-bar {
  width: 65%;
  min-height: 1px;
  background: #6ba1bd;
  border-radius: 3px 3px 0 0;
}
.chart-col span {
  font-size: 9px;
  color: var(--muted);
  margin-top: 5px;
}
.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.chart-title strong {
  font-size: 14px;
}
.dealer-picker {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr);
  gap: 22px;
}
.own-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 250px;
  background: var(--navy);
  color: white;
  padding: 32px;
  border-radius: 8px;
}
.own-login p {
  color: #c8dce7;
  font-size: 13px;
}
.own-login h2 {
  font-size: 24px;
  margin: 12px 0;
}
.own-login button {
  margin-top: 22px;
  background: white;
  color: var(--navy);
  border: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.field label,
.field legend {
  font-size: 12px;
  font-weight: 600;
}
.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.field input,
.field textarea,
.field select {
  width: 100%;
}
.radio-row {
  display: flex;
  gap: 22px;
  align-items: center;
}
.radio-row label {
  font-weight: 400;
  display: flex;
  gap: 7px;
  align-items: center;
}
.radio-row input {
  width: auto;
}
.section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.section:first-child {
  padding-top: 0;
}
.section:last-child {
  border: 0;
}
.section h2 {
  margin-bottom: 6px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.settings {
  max-width: 900px;
}
.settings .section > .field {
  max-width: 520px;
}
.alert {
  padding: 13px 16px;
  background: #fff6e2;
  border: 1px solid #ecd8a6;
  border-radius: 6px;
  color: #795724;
  font-size: 12px;
  line-height: 1.8;
}
.blank {
  min-height: 220px;
}
.loading {
  padding: 80px;
  text-align: center;
  color: var(--muted);
}
#notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 14px 20px;
  background: #e7f4ed;
  color: var(--green);
  border: 1px solid #a4cfb7;
  border-radius: 7px;
  max-width: 650px;
  box-shadow: 0 4px 20px #17314312;
  font-size: 13px;
  line-height: 1.7;
}
#notice.error {
  background: #fff0ed;
  color: var(--red);
  border-color: #e3aca0;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 20px 80px #152c4155;
  max-width: 620px;
  width: calc(100% - 40px);
  padding: 0;
  color: var(--ink);
}
dialog::backdrop {
  background: #142d4266;
}
dialog .dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
}
dialog .dialog-head h2 {
  margin: 0;
  font-size: 18px;
}
dialog form,
.dialog-body {
  padding: 22px 26px;
}
dialog .context-note {
  padding: 11px 26px;
  background: #eaf3f7;
  font-size: 12px;
  font-weight: 600;
}
dialog .form-actions {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #edf3f6, #f8fafb);
}
.login-box {
  width: 410px;
  max-width: calc(100vw - 40px);
  padding: 38px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 45px #18344908;
}
.login-box .brand {
  font-size: 29px;
  margin-bottom: 8px;
}
.login-box h1 {
  font-size: 17px;
  margin: 25px 0 23px;
}
.login-box .primary {
  width: 100%;
  padding: 12px;
}
.login-error {
  color: var(--red);
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 14px;
}
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  font-size: 13px;
}
.detail-grid dt {
  color: var(--muted);
}
.detail-grid dd {
  margin: 0;
}
.log-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 55vh;
  overflow: auto;
  background: #f3f6f8;
  border: 1px solid var(--line);
  padding: 15px;
  border-radius: 5px;
  font-size: 12px;
}
.read-only {
  background: #edf2f5;
  padding: 8px 12px;
  color: var(--muted);
  border-radius: 5px;
  font-size: 12px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
@media (max-width: 900px) {
  main {
    padding: 10px 12px;
  }
  .header-main {
    padding: 13px 18px 0;
    gap: 15px;
  }
  .brand small {
    display: none;
  }
  .nav {
    padding: 0;
  }
  .context {
    padding: 12px 18px;
    gap: 9px;
    flex-wrap: wrap;
  }
  .context strong {
    font-size: 15px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: flex;
    gap: 12px;
  }
  .sidebar .panel {
    margin-bottom: 0;
  }
  .sidebar .panel:last-child {
    flex: 1;
  }
  .group-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .group-button {
    width: auto;
  }
  .dealer-picker {
    grid-template-columns: 1fr;
  }
  .own-login {
    min-height: 180px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .account {
    font-size: 11px;
  }
  .account .organization-text {
    display: none;
  }
  .page-heading {
    flex-wrap: nowrap;
  }
}
@media (max-width: 550px) {
  .links {
    grid-template-columns: 1fr;
  }
  .header-main {
    gap: 10px;
  }
  .account button {
    padding: 5px 8px;
    margin-left: 4px;
  }
  .brand {
    font-size: 19px;
  }
  .context-label {
    width: 100%;
  }
  .sidebar {
    display: block;
  }
  .sidebar .panel {
    margin-bottom: 12px;
  }
  .page-heading h1 {
    font-size: 18px;
  }
  .stats {
    gap: 9px;
  }
  .stat {
    padding: 14px;
  }
  .stat-value {
    font-size: 22px;
  }
}
.workspace > * {
  min-width: 0;
}
.plain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.plain-table th,
.plain-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.dealer-picker .panel {
  min-width: 0;
  overflow: auto;
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 550px) {
  .toolbar {
    gap: 6px;
  }
  .chart {
    gap: 2px;
  }
  .chart-col span {
    font-size: 8px;
  }
  #notice {
    left: 18px;
    right: 18px;
    bottom: 18px;
  }
  .account strong {
    display: block;
  }
  .detail-grid {
    grid-template-columns: 90px minmax(0, 1fr);
  }
}

.kitting-panel {
  max-width: 850px;
}
.kitting-panel .context-note {
  padding: 15px;
  background: #eaf3f7;
  margin-bottom: 25px;
  border-radius: 5px;
}
.code-entry {
  display: flex;
  gap: 12px;
}
.code-entry input {
  font-family: ui-monospace, monospace;
  font-size: 21px;
  letter-spacing: 0.06em;
  flex: 1;
  min-width: 0;
}
.code-entry button {
  flex-shrink: 0;
}
#qr-video {
  display: block;
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  background: #132735;
  border-radius: 6px;
}
#kitting-result {
  font-weight: 600;
  color: #1d7c5c;
}
@media (max-width: 650px) {
  .code-entry {
    flex-direction: column;
  }
  .code-entry input {
    width: 100%;
  }
}

.login-page main {
  width: auto;
  max-width: 100%;
  padding: 20px;
}
@media (max-width: 700px) {
  .header-bar {
    gap: 4px;
    padding: 0 4px;
  }
  .nav a {
    padding: 0 10px;
  }
  .org-context {
    max-width: 130px;
    font-size: 11px;
    padding: 3px 6px;
  }
  .page-heading {
    gap: 8px;
  }
  .page-actions > button {
    padding: 6px 9px;
  }
  main {
    padding: 8px;
  }
  .panel {
    padding: 10px;
  }
}

/* Management lists fill the viewport; dealer screens keep their own layout. */
body.table-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.table-page #header {
  flex: 0 0 auto;
}
.table-page main {
  flex: 1;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.table-page .page-heading {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 12px;
}
.table-page main > .panel {
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.table-page .panel > p {
  flex: 0 0 auto;
  margin: 0 0 8px;
}
.table-page .table-wrap,
.table-page .dt-container {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}
.table-page .dt-container > .dt-layout-row {
  flex: 0 0 auto;
  margin: 0;
}
.table-page .dt-container > .dt-layout-row:first-child {
  padding-bottom: 8px;
}
.table-page .dt-container > .dt-layout-row:last-child {
  padding-top: 8px;
}
.table-page .dt-container > .dt-layout-table {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  padding: 0;
}
.table-page .dt-container .dt-layout-table .dt-layout-cell {
  flex: 1;
  display: flex !important;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
}
.table-page .dt-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
}
.table-page .dt-scroll-head,
.table-page .dt-scroll-foot {
  flex: 0 0 auto;
}
.table-page .dt-scroll-body {
  flex: 1;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overscroll-behavior: contain;
}

#header.dealer-header {
  background: var(--navy);
  border-bottom-color: var(--navy);
  color: white;
}
.dealer-header .app-brand img {
  filter: brightness(0) invert(1);
}
.dealer-header .app-brand:hover,
.dealer-header .account-toggle:hover,
.dealer-header .account-toggle[aria-expanded="true"] {
  background: #ffffff20;
}
.dealer-header .nav a {
  color: #e0edf5;
}
.dealer-header .nav a:hover {
  background: #ffffff15;
}
.dealer-header .nav a.active {
  background: white;
  color: var(--navy);
  border-bottom-color: white;
}
.dealer-header .account-toggle {
  color: white;
}
.dealer-header .org-context:not(.impersonating) {
  background: #ffffff15;
  border-color: #ffffff60;
  color: white;
}

/* Keep identifier columns readable; horizontal scrolling stays inside DataTables. */
.all-devices-table {
  min-width: 1800px;
}
.all-devices-table th,
.all-devices-table td {
  white-space: nowrap;
}
.all-device-filters {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 400px minmax(140px, 1fr);
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
}
.all-device-filters .filter-block {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.all-device-filters .org-filter-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 0 0 400px;
  width: 400px;
  border-left: 1px solid #cbd5df;
  padding-left: 12px;
}
.all-device-filters .keyword-filter-block {
  width: 100%;
  max-width: 480px;
}
.all-device-filters input,
.all-device-filters select {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 5px 7px;
  font-size: 12px;
}
.all-device-filters select[hidden] {
  display: none;
}
.all-device-filters #all-search-keyword {
  flex-grow: 1.45;
}
.all-device-filters button {
  flex: 0 0 auto;
  margin: 0;
}
.dt-layout-start:has(> .all-device-filters) {
  width: 100%;
  min-width: 0;
}

.all-device-filters .keyword-input-group {
  display: flex;
  flex: 1.45 1 0;
  min-width: 0;
}
.all-device-filters #all-search-keyword {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
#all-search-keyword::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.all-device-filters #all-keyword-clear {
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding: 3px 9px;
  background: white;
  font-size: 18px;
  line-height: 1;
}
#all-device-exports {
  justify-self: end;
}
#all-device-exports .dt-buttons {
  display: flex;
  gap: 6px;
  margin: 0;
  float: none;
}
#all-device-exports .dt-button {
  margin: 0;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.all-device-filters .keyword-input-group {
  border-radius: 5px;
}
.all-device-filters .keyword-input-group:focus-within {
  outline: 3px solid #90cbea;
  outline-offset: 2px;
}
.all-device-filters .keyword-input-group input:focus,
.all-device-filters .keyword-input-group button:focus-visible {
  outline: none;
}
.all-device-filters #all-keyword-clear {
  border-color: #bacad4;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

.provisioning-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 16px;
}
.provisioning-layout .subtext {
  max-width: none;
}
.provisioning-check {
  display: flex;
  align-items: center;
  gap: 6px;
}
.provisioning-check input {
  width: auto;
}
.provisioning-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.provisioning-preview img {
  width: 100%;
  max-width: 480px;
  height: auto;
  background: white;
}
@media (max-width: 760px) {
  .provisioning-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

#provisioning-error {
  color: var(--red);
  font-weight: 600;
}

/* Dealer workspace: a single divider, compact controls and a viewport-height list. */
.dealer-page .dealer-workspace {
  background: var(--white);
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 0;
}
.dealer-page .dealer-sidebar {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 5px 6px;
}
.dealer-sidebar section {
  margin: 0 0 8px;
}
.dealer-sidebar h3 {
  margin: 0;
}
.dealer-period input {
  width: 100%;
  margin-top: 5px;
  padding: 4px 6px;
}
.dealer-sidebar .panel-header {
  gap: 4px;
  margin-bottom: 4px;
}
.dealer-sidebar .group-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dealer-sidebar .group-row {
  display: flex;
  align-items: center;
  min-width: 0;
}
.dealer-sidebar .group-button {
  min-width: 0;
  padding: 4px;
  gap: 4px;
  width: auto;
  font-size: 13px;
}
.dealer-sidebar .group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dealer-sidebar .group-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.dealer-sidebar .edit-group,
.dealer-sidebar .group-edit-placeholder {
  flex: 0 0 24px;
  width: 24px;
}
.dealer-sidebar .edit-group {
  padding: 3px;
  color: var(--ink);
}
.dealer-chart {
  flex: 0 0 auto;
  margin: 0 0 6px;
}
.dealer-page .dealer-table-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 4px 5px;
}
.dealer-table-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
}
.dealer-table-tools > button,
.dealer-table-tools .selection-label {
  flex: 0 0 auto;
}
.dealer-table-tools .selection-label {
  min-width: 0;
  white-space: nowrap;
}
.dealer-table-search {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}
.dealer-table-search input {
  width: 150px;
  padding: 4px 6px;
}
.dealer-devices-table {
  width: 100%;
}
.dealer-devices-table td,
.dealer-devices-table th {
  white-space: nowrap;
}
.dealer-page .dt-layout-full:has(.dealer-table-tools) {
  min-width: 0;
  width: 100%;
}
@media (max-width: 700px) {
  .dealer-page .dealer-workspace {
    grid-template-columns: 150px minmax(0, 1fr);
  }
  .dealer-page .dealer-sidebar {
    padding: 4px;
  }
}
@media (max-width: 700px) {
  .dealer-chart .chart-col:not(:nth-child(5n + 1)):not(:last-child) span {
    visibility: hidden;
  }
}

/* Axis and bars share the same plotting height; day labels sit below zero. */
.usage-chart {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 16px;
  align-items: stretch;
  column-gap: 0;
  row-gap: 0;
  padding: 8px 0 0;
  border: 0;
}
.usage-chart-axis {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  line-height: 1.1;
}
.usage-chart-axis .axis-width-sample {
  display: block;
  visibility: hidden;
  padding-right: 6px;
}
.usage-chart-tick {
  position: absolute;
  right: 6px;
  transform: translateY(50%);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.usage-chart-plot {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.usage-chart-grid {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--line);
  opacity: 0.5;
}
.usage-chart-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.usage-chart-column {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.usage-chart .chart-bar {
  min-height: 0;
}
.usage-chart-days {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  gap: 4px;
  padding-top: 3px;
  font-size: 10px;
  color: var(--muted);
}
.usage-chart-days span {
  flex: 1;
  min-width: 0;
  text-align: center;
}
@media (max-width: 700px) {
  .usage-chart-days span:not(:nth-child(5n + 1)):not(:last-child) {
    visibility: hidden;
  }
}

.kitting-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 8px 12px;
}
.kitting-settings > fieldset {
  grid-column: 1 / -1;
}
.kitting-panel .context-note {
  margin-bottom: 8px;
}
@media (max-width: 700px) {
  .kitting-settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .kitting-panel .form-actions > button {
    width: 100%;
  }
}

/* Shared kitting page: registration stays first in DOM and on narrow screens. */
.kitting-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "qr registration";
  gap: 10px;
  align-items: start;
}
.kitting-workspace > .kitting-panel {
  grid-area: registration;
  min-width: 0;
}
.kitting-workspace > .kitting-qr {
  grid-area: qr;
  min-width: 0;
}
.kitting-qr .provisioning-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.kitting-workspace h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .kitting-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "registration" "qr";
    gap: 4px;
  }
}
.kitting-panel .subtext {
  max-width: none;
}

.provisioning-ssid-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.provisioning-ssid-label .provisioning-check {
  margin: 0;
}

.provisioning-preview .provisioning-instruction {
  align-self: stretch;
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}

.provisioning-preview .provisioning-version {
  margin: 0;
}
.provisioning-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 8px 0 12px;
}
.provisioning-editor-title {
  font-size: 18px;
  margin: 0 0 10px;
}

.kitting-panel .kitting-instruction {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}

/* Only this screen uses the instruction size as the minimum text size. */
body.kitting-screen,
body.kitting-screen
  :is(
    p,
    a,
    button,
    input,
    select,
    option,
    textarea,
    label,
    legend,
    small,
    .context-note,
    .org-context,
    .org-context span,
    .subtext
  ) {
  font-size: max(16px, 1em);
}
.kitting-screen #provisioning-form .toolbar,
.kitting-screen #kitting-form .form-actions {
  justify-content: center;
}

.kitting-panel .device-code-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.kitting-panel #device-code-example {
  white-space: nowrap;
}

/* Dedicated device details: compact sidebar and scrollable logs. */
.device-detail-page #content {
  padding: 0;
}
.device-detail-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: calc(100dvh - 46px);
  overflow: hidden;
}
.device-detail-sidebar {
  padding: 10px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.device-detail-sidebar h1 {
  font-size: 20px;
  margin: 0 0 10px;
}
.device-detail-sidebar h2,
.device-detail-section h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
.device-info {
  margin: 0 0 12px;
}
.device-info dt {
  font-weight: 600;
  margin-top: 8px;
  font-size: 13px;
}
.device-info dd {
  margin: 2px 0 0;
  padding-inline-start: 16px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.device-detail-sidebar > .button {
  width: 100%;
}
.device-detail-content {
  overflow: auto;
  min-width: 0;
  padding: 0 10px;
}
.device-detail-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.device-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.device-section-heading h2 {
  margin: 0;
}
.device-usage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 12px;
}
.device-detail-section .dt-container {
  min-width: 0;
}
.device-detail-section table.dataTable th,
.device-detail-section table.dataTable td {
  white-space: nowrap;
}
.device-detail-section [role="status"]:empty {
  display: none;
}
.device-detail-page .log-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .device-detail-layout {
    display: block;
    height: auto;
    overflow: visible;
  }
  .device-detail-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .device-detail-content {
    overflow: visible;
  }
}
.device-detail-sidebar {
  display: flex;
  flex-direction: column;
}
.device-detail-sidebar > h1,
.device-detail-sidebar > h2,
.device-detail-sidebar > .field,
.device-detail-sidebar > .button {
  flex-shrink: 0;
}
.device-detail-sidebar > .device-info {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
@media (max-width: 700px) {
  .device-detail-sidebar > .device-info {
    overflow: visible;
  }
}

.billing-report {
  max-width: 1200px;
  margin: 0 auto;
}
.billing-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
}
.billing-heading h1 {
  font-size: 20px;
  margin: 0;
}
.billing-month {
  display: flex;
  align-items: center;
  gap: 8px;
}
.billing-month input {
  width: 170px;
}
.billing-description {
  margin: 0 0 12px;
}
.billing-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.billing-table th,
.billing-table td {
  padding: 9px 12px;
  border: 1px solid var(--line);
}
.billing-table thead {
  background: #e8f1f6;
}
.billing-table th {
  text-align: left;
}
.billing-table .amount {
  text-align: right;
  white-space: nowrap;
}
.billing-table .billing-group {
  vertical-align: top;
  min-width: 130px;
}
.billing-table .billing-subtotal {
  background: #f5f8fa;
  font-weight: 600;
}
.billing-table tfoot {
  background: var(--navy);
  color: white;
  font-size: 17px;
  font-weight: 700;
}
.billing-table .billing-empty {
  text-align: center;
  padding: 24px;
}
@media (max-width: 700px) {
  .billing-table th,
  .billing-table td {
    padding: 7px 9px;
  }
  .billing-table .billing-group {
    min-width: 100px;
  }
}

.invoice-issuer-form {
  max-width: 760px;
  margin: 0 auto;
}
.invoice-issuer-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.invoice-issuer-form .issuer-contacts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.invoice-issuer-form textarea {
  resize: vertical;
}
.billing-month {
  flex-wrap: wrap;
}
.billing-config-note {
  color: var(--muted);
}
@media (max-width: 700px) {
  .invoice-issuer-form .issuer-contacts {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.invoice-stamp-preview {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background-color: white;
  background-image:
    linear-gradient(45deg, #e8edf1 25%, transparent 25%),
    linear-gradient(-45deg, #e8edf1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8edf1 75%),
    linear-gradient(-45deg, transparent 75%, #e8edf1 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}
.invoice-stamp-preview img {
  max-width: 134px;
  max-height: 134px;
  object-fit: contain;
}
.invoice-stamp-preview span {
  background: white;
  padding: 3px 6px;
}
.invoice-stamp-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.invoice-stamp-controls input[type="file"] {
  width: auto;
  max-width: 100%;
}
#invoice-stamp-status:empty {
  display: none;
}
