.operations-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.factory-workspace { display: grid; gap: 18px; }
.factory-workspace-heading h2 { margin: 6px 0; font-size: 27px; }
.factory-workspace-heading p { margin: 0; }
.factory-create-drawer { border: 1px solid #cfe5e8; border-radius: 15px; background: #fff; box-shadow: 0 5px 16px #22334408; }
.factory-create-drawer summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; color: #0d6973; cursor: pointer; font-weight: 800; }
.factory-create-drawer summary small { color: #66758a; font-size: 12px; font-weight: 700; text-align: right; }
.factory-create-drawer[open] summary { border-bottom: 1px solid #dce8ec; }
.factory-create-drawer .factory-create-form { padding: 16px 17px 0; }
.factory-create-drawer .factory-create-note { margin: 14px 17px 17px; }
.factory-create-card { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(460px, 1.5fr); gap: 20px; padding: 24px; border: 1px solid #cfe5e8; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px #2233440b; }
.factory-create-heading h2, .factory-list-heading h2 { margin: 5px 0 7px; font-size: 26px; }
.factory-create-heading p, .factory-list-heading p { margin: 0; }
.factory-create-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; align-items: end; }
.factory-create-form label, .factory-edit-form label { display: grid; gap: 6px; color: #3e5365; font-size: 12px; font-weight: 800; }
.factory-create-form label small, .factory-edit-form label small { color: #788798; font-size: 11px; font-weight: 700; }
.factory-create-form input, .factory-edit-form input { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 10px; background: #fff; font: inherit; }
.factory-create-form button { grid-column: 1 / -1; background: #087f8c; color: #fff; padding: 11px 15px; }
.factory-create-note { grid-column: 1 / -1; display: grid; gap: 5px; padding: 12px 14px; border-radius: 10px; background: #f1f9fa; color: #486273; font-size: 13px; line-height: 1.55; }
.factory-create-note b { color: #0d6973; }
.factory-list-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.factory-device-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 15px; }
.factory-device-card { border: 1px solid #dce5eb; border-radius: 16px; background: #fff; padding: 18px; box-shadow: 0 5px 16px #2233440b; }
.factory-device-card.ready { border-top: 4px solid #087f8c; }
.factory-device-card.claimed { border-top: 4px solid #8a9aaa; }
.factory-device-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.factory-device-id { color: #708096; font-size: 12px; font-weight: 800; }
.factory-device-header h3 { margin: 5px 0 2px; font-size: 21px; overflow-wrap: anywhere; }
.factory-device-header p { margin: 0; color: #66758a; font-size: 13px; }
.factory-state { flex: 0 0 auto; border-radius: 99px; padding: 6px 9px; font-size: 12px; font-weight: 800; }
.factory-state.ready { color: #0b6771; background: #dff4f5; }
.factory-state.claimed { color: #475569; background: #e8eef3; }
.factory-device-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0; }
.factory-device-details div { min-width: 0; padding: 10px; border-radius: 10px; background: #f5f8fa; }
.factory-device-details .factory-code-detail { grid-column: 1 / -1; background: #eef9fa; }
.factory-device-details dt { color: #6b7c8e; font-size: 11px; font-weight: 800; }
.factory-device-details dd { margin: 5px 0 0; color: #223042; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.factory-device-details dd small { display: block; margin-top: 5px; color: #708096; font-weight: 700; line-height: 1.4; }
.factory-primary-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.factory-primary-actions form { margin: 0; }
.factory-primary-actions button { padding: 9px 12px; }
.factory-qr-link { display: inline-block; border-radius: 8px; padding: 9px 12px; color: #fff; background: #087f8c; font-weight: 800; text-decoration: none; }
.factory-action-note { margin: 10px 0 0; color: #66758a; font-size: 12px; line-height: 1.45; }
.factory-card-editor, .factory-archive { margin-top: 14px; border-top: 1px solid #e2e8ee; padding-top: 13px; }
.factory-card-editor summary, .factory-archive summary { color: #0c6872; font-weight: 800; }
.factory-card-editor[open] summary, .factory-archive[open] summary { margin-bottom: 11px; }
.factory-edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid #cfe5e8; border-radius: 11px; background: #f8fcfd; }
.factory-edit-form label:last-of-type, .factory-edit-form button { grid-column: 1 / -1; }
.factory-edit-form button { justify-self: start; background: #087f8c; color: #fff; padding: 9px 13px; }
.factory-archive { color: #8c251c; }
.factory-archive summary { color: #a12a20; }
.factory-archive p { margin: 0 0 10px; color: #73524e; font-size: 12px; line-height: 1.5; }
.factory-archive button { background: #b42318; color: #fff; padding: 9px 12px; }
.factory-claimed-note { margin: 0; padding: 12px; border-radius: 10px; color: #566678; background: #f4f7f9; font-size: 13px; line-height: 1.5; }
.factory-empty { display: grid; gap: 5px; grid-column: 1 / -1; border: 1px dashed #cbd7df; border-radius: 14px; background: #f8fafb; }
.factory-directory-filter { display: grid; grid-template-columns: minmax(280px, 1.5fr) minmax(190px, .75fr) auto auto; align-items: end; gap: 10px; padding: 16px; border: 1px solid #cfe2e7; border-radius: 15px; background: #fff; box-shadow: 0 5px 16px #22334408; }
.factory-directory-filter label { display: grid; gap: 5px; color: #3e5365; font-size: 12px; font-weight: 800; }
.factory-directory-filter input, .factory-directory-filter select { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 10px; background: #fff; font: inherit; }
.factory-directory-filter button { background: #087f8c; color: #fff; padding: 10px 14px; white-space: nowrap; }
.factory-directory-filter a { color: #0c6872; font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.factory-directory-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.factory-directory-heading h3 { margin: 5px 0; font-size: 22px; }
.factory-directory-heading p { margin: 0; }
.factory-device-directory { display: grid; gap: 10px; }
.factory-device-row { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(200px, .85fr) minmax(230px, 1fr) auto; align-items: center; gap: 16px; padding: 17px; border: 1px solid #d7e2e8; border-radius: 15px; background: #fff; box-shadow: 0 4px 13px #22334408; }
.factory-device-row.ready { border-left: 4px solid #087f8c; }
.factory-device-row.claimed { border-left: 4px solid #8a9aaa; }
.factory-device-row.blocked { border-left: 4px solid #d0534b; }
.factory-row-main h3 { margin: 5px 0 2px; font-size: 20px; overflow-wrap: anywhere; }
.factory-row-main p { margin: 0; color: #66758a; font-size: 13px; }
.factory-row-credential, .factory-row-owner { display: grid; gap: 6px; min-width: 0; padding: 10px; border-radius: 10px; background: #f3f7f9; color: #6b7c8e; font-size: 11px; font-weight: 800; }
.factory-row-credential { background: #eef9fa; }
.factory-row-credential code { color: #0f5962; font-size: 16px; line-height: 1.15; overflow-wrap: anywhere; }
.factory-row-credential strong, .factory-row-owner b { color: #233044; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.factory-row-credential .factory-state { justify-self: start; display: inline-block; padding: 4px 7px; }
.factory-device-open { display: inline-block; border-radius: 9px; padding: 10px 13px; color: #fff; background: #087f8c; font-size: 13px; font-weight: 800; text-decoration: none; text-align: center; white-space: nowrap; }
.factory-device-focus { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, .9fr) auto; align-items: center; gap: 18px; padding: 18px; border: 1px solid #cfe2e7; border-radius: 16px; background: #edf7f8; }
.factory-device-focus h3 { margin: 5px 0 2px; font-size: 22px; overflow-wrap: anywhere; }
.factory-device-focus p { margin: 0; color: #66758a; font-size: 13px; }
.factory-device-focus-metrics { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.factory-device-focus-metrics div { min-width: 0; padding: 9px; border-radius: 9px; background: #fff; }
.factory-device-focus-metrics dt { color: #6b7c8e; font-size: 11px; font-weight: 800; }
.factory-device-focus-metrics dd { margin: 4px 0 0; color: #233044; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.factory-device-detail { border: 1px solid #dce5eb; border-radius: 16px; background: #fff; padding: 18px; box-shadow: 0 5px 16px #2233440b; }
.factory-device-detail.ready { border-top: 4px solid #087f8c; }
.factory-device-detail.claimed { border-top: 4px solid #8a9aaa; }

.device-workspace { display: grid; gap: 18px; }
.device-list-heading h2 { margin: 6px 0; font-size: 27px; }
.device-list-heading p { margin: 0; }
.device-directory-filter { display: grid; grid-template-columns: minmax(280px, 1.5fr) minmax(160px, .65fr) auto auto; align-items: end; gap: 10px; padding: 16px; border: 1px solid #cfe2e7; border-radius: 15px; background: #fff; box-shadow: 0 5px 16px #22334408; }
.device-directory-filter label { display: grid; gap: 5px; color: #3e5365; font-size: 12px; font-weight: 800; }
.device-directory-filter input, .device-directory-filter select { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 10px; background: #fff; font: inherit; }
.device-directory-filter button { background: #087f8c; color: #fff; padding: 10px 14px; white-space: nowrap; }
.device-directory-filter a { color: #0c6872; font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.device-directory-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.device-directory-heading h3 { margin: 5px 0; font-size: 22px; }
.device-directory-heading p { margin: 0; }
.device-directory-page { flex: 0 0 auto; border-radius: 999px; padding: 7px 10px; color: #456276; background: #e8f0f4; font-size: 12px; font-weight: 800; }
.device-account-directory { display: grid; gap: 10px; }
.device-account-row { display: grid; grid-template-columns: minmax(230px, 1.3fr) minmax(340px, 1fr) auto; align-items: center; gap: 16px; padding: 17px; border: 1px solid #d7e2e8; border-radius: 15px; background: #fff; box-shadow: 0 4px 13px #22334408; }
.device-account-row-main h3 { margin: 5px 0 2px; font-size: 20px; overflow-wrap: anywhere; }
.device-account-row-main p { margin: 0; color: #66758a; font-size: 13px; overflow-wrap: anywhere; }
.device-account-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.device-account-metrics div { min-width: 0; padding: 9px; border-radius: 9px; background: #f3f7f9; }
.device-account-metrics dt, .device-account-focus-metrics dt { color: #6b7c8e; font-size: 11px; font-weight: 800; }
.device-account-metrics dd, .device-account-focus-metrics dd { margin: 4px 0 0; color: #233044; font-size: 16px; font-weight: 800; }
.device-account-metrics .metric-online { color: #16713d; }
.device-account-metrics .metric-attention { color: #b54708; }
.device-account-open { display: inline-block; border-radius: 9px; padding: 10px 13px; color: #fff; background: #087f8c; font-size: 13px; font-weight: 800; text-decoration: none; text-align: center; white-space: nowrap; }
.device-pagination { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 8px; color: #596d7e; font-size: 13px; font-weight: 800; }
.device-pagination a { border-radius: 8px; padding: 8px 11px; color: #0c6872; background: #e7f5f6; text-decoration: none; }
.device-account-focus { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: 18px; padding: 18px; border: 1px solid #cfe2e7; border-radius: 16px; background: #edf7f8; }
.device-account-focus h3 { margin: 5px 0 2px; font-size: 22px; overflow-wrap: anywhere; }
.device-account-focus p { margin: 0; color: #66758a; font-size: 13px; overflow-wrap: anywhere; }
.device-account-focus-metrics { display: grid; grid-template-columns: repeat(3, minmax(74px, 1fr)); gap: 8px; margin: 0; }
.device-account-focus-metrics div { min-width: 0; padding: 9px; border-radius: 9px; background: #fff; text-align: center; }
.account-notification-diagnostic { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(420px, 1.7fr); gap: 18px; padding: 17px 18px; border: 1px solid #d9e4e9; border-radius: 15px; background: #fff; box-shadow: 0 4px 13px #22334408; }
.account-notification-heading h3 { margin: 5px 0 4px; font-size: 19px; }
.account-notification-heading p { margin: 0; color: #66758a; font-size: 12px; line-height: 1.5; }
.account-notification-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.account-notification-metrics div { min-width: 0; padding: 10px; border-radius: 10px; background: #f4f8fa; }
.account-notification-metrics dt { color: #6b7c8e; font-size: 11px; font-weight: 800; }
.account-notification-metrics dd { margin: 5px 0 0; color: #233044; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.account-notification-metrics dd small { display: block; margin-top: 4px; color: #6b7c8e; font-size: 11px; font-weight: 700; line-height: 1.35; }
.account-notification-metrics .diagnostic-ready { color: #16713d; }
.account-notification-metrics .diagnostic-attention { color: #b54708; }
.account-notification-error { grid-column: 1 / -1; margin: -4px 0 0; padding: 9px 11px; border-radius: 9px; color: #9d271d; background: #fff1ef; font-size: 12px; overflow-wrap: anywhere; }
.device-card-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 15px; }
.device-card { border: 1px solid #dce5eb; border-radius: 16px; background: #fff; padding: 18px; box-shadow: 0 5px 16px #2233440b; }
.device-card.online { border-top: 4px solid #2a9d5c; }
.device-card.offline { border-top: 4px solid #d0534b; }
.device-card.unknown { border-top: 4px solid #8b9aaa; }
.device-card.blocked { border-color: #f0b5af; background: #fffafb; }
.device-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.device-card-id { color: #708096; font-size: 12px; font-weight: 800; }
.device-card-header h3 { margin: 5px 0 2px; font-size: 21px; overflow-wrap: anywhere; }
.device-card-header p { margin: 0; color: #66758a; font-size: 13px; overflow-wrap: anywhere; }
.device-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.device-access-status { display: inline-block; border-radius: 99px; padding: 4px 8px; color: #176439; background: #dcfce7; font-size: 12px; font-weight: 800; }
.device-access-status.blocked { color: #991b1b; background: #fee2e2; }
.device-card-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0; }
.device-card-details div { min-width: 0; border-radius: 10px; padding: 10px; background: #f5f8fa; }
.device-card-details dt { color: #6b7c8e; font-size: 11px; font-weight: 800; }
.device-card-details dd { margin: 5px 0 0; color: #223042; font-size: 13px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.device-parameter-editor { border-top: 1px solid #e2e8ee; padding-top: 13px; }
.device-parameter-editor summary { color: #0c6872; font-weight: 800; }
.device-parameter-editor[open] summary { margin-bottom: 9px; }
.device-parameter-editor p { margin: 0 0 11px; color: #66758a; font-size: 12px; line-height: 1.5; }
.device-parameter-form { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, .55fr) auto; gap: 9px; align-items: end; padding: 13px; border: 1px solid #cfe5e8; border-radius: 11px; background: #f8fcfd; }
.device-parameter-form label { display: grid; gap: 5px; color: #3e5365; font-size: 12px; font-weight: 800; }
.device-parameter-form select, .device-parameter-form input { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 9px; background: #fff; font: inherit; }
.device-parameter-form button { background: #087f8c; color: #fff; padding: 9px 12px; }

/* 判定設定：欄位多，改用分區的自動排版，手機上自動收成單欄 */
.device-judgement-editor { border-top: 1px solid #e2e8ee; padding-top: 13px; }
.device-judgement-editor summary { color: #0c6872; font-weight: 800; }
.device-judgement-editor[open] summary { margin-bottom: 9px; }
.device-judgement-editor p { margin: 0 0 11px; color: #66758a; font-size: 12px; line-height: 1.5; }
.device-judgement-editor code { background: #eef4f6; padding: 1px 5px; border-radius: 5px; font-size: 11.5px; }
.device-judgement-form { display: grid; gap: 11px; padding: 13px; border: 1px solid #cfe5e8; border-radius: 11px; background: #f8fcfd; }
.device-judgement-form fieldset { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 9px; margin: 0; padding: 11px; border: 1px solid #dbe7ec; border-radius: 9px; background: #fff; }
.device-judgement-form legend { padding: 0 6px; color: #0c6872; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; }
.device-judgement-form label { display: grid; gap: 5px; color: #3e5365; font-size: 12px; font-weight: 800; }
.device-judgement-form label.switch { display: flex; gap: 7px; align-items: center; font-weight: 700; }
.device-judgement-form label.switch input { width: auto; }
.device-judgement-form select, .device-judgement-form input { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 9px; background: #fff; font: inherit; }
.device-judgement-form button { justify-self: start; background: #087f8c; color: #fff; padding: 9px 14px; }
.device-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.device-card-actions form { margin: 0; }
.device-card-actions button { padding: 9px 12px; }
.device-card-actions .block-device { color: #991b1b; background: #fee2e2; }
.device-card-actions .restore-device { color: #0c6872; background: #e7f5f6; }
.device-empty { display: grid; gap: 5px; grid-column: 1 / -1; border: 1px dashed #cbd7df; border-radius: 14px; background: #f8fafb; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin-bottom: 6px; }
.section-heading p { margin: 0; }

/* Outbox work is operational data: show only the actionable backlog, not an
   unbounded delivery history. */
.delivery-panel { display: grid; gap: 16px; }
.delivery-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.delivery-summary article { padding: 14px; border: 1px solid #dce5eb; border-radius: 12px; background: #f8fafb; }
.delivery-summary article.attention { border-color: #f1b9b2; background: #fff5f4; }
.delivery-summary span { display: block; color: #6b7c8e; font-size: 12px; font-weight: 800; }
.delivery-summary strong { display: block; margin-top: 6px; color: #223042; font-size: 27px; }
.delivery-summary article.attention strong { color: #a12a20; }
.delivery-failures { border-top: 1px solid #e2e8ee; padding-top: 13px; }
.delivery-failures summary { color: #0c6872; font-weight: 800; }
.delivery-failures[open] summary { margin-bottom: 12px; }

.plan-create {
  margin: 18px 0 20px;
  border: 1px dashed #a9c3ca;
  border-radius: 12px;
  background: #f8fcfd;
}

.plan-create summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  color: #0e6f79;
}

.plan-create summary span { font-weight: 800; }
.plan-create summary small { text-align: right; }
.plan-create .operations-form { padding: 0 15px 15px; margin: 0; }

.plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid #dce5eb; border-radius: 14px; background: #fff; padding: 17px; box-shadow: 0 5px 16px #2233440b; }
.plan-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.plan-card h3 { font-size: 20px; margin: 5px 0 3px; }
.plan-code { color: #557085; font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.plan-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.plan-status.active { background: #dcfce7; color: #166534; }
.plan-status.inactive { background: #e2e8f0; color: #475569; }

.plan-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.plan-metrics div { background: #f4f8fa; border-radius: 10px; padding: 10px; }
.plan-metrics dt { color: #66758a; font-size: 11px; font-weight: 800; }
.plan-metrics dd { margin: 4px 0 0; color: #172033; font-size: 20px; font-weight: 800; }
.plan-metrics dd small { font-size: 12px; font-weight: 700; }

.plan-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-account-link {
  display: inline-block;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: #087f8c;
  font-weight: 800;
  text-decoration: none;
}
.plan-editor summary,
.secondary-action {
  display: inline-block;
  border-radius: 8px;
  padding: 9px 12px;
  color: #0c6872;
  background: #e7f5f6;
  font-weight: 800;
}
.plan-editor[open] { flex-basis: 100%; }
.plan-editor[open] summary { margin-bottom: 10px; }
.plan-edit-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid #cfe5e8; border-radius: 11px; background: #f8fcfd; }
.plan-edit-form label { display: grid; gap: 5px; color: #3e5365; font-size: 12px; font-weight: 800; }
.plan-edit-form input { min-width: 0; border: 1px solid #bdcad4; border-radius: 8px; padding: 9px; background: #fff; font: inherit; }
.plan-edit-form button { grid-column: 1 / -1; justify-self: start; background: #087f8c; color: #fff; padding: 9px 13px; }
.plan-form-note { grid-column: 1 / -1; margin: 0; color: #66758a; font-size: 12px; line-height: 1.5; }
.plan-form-note code { color: #0f5962; font-weight: 800; }
.plan-empty { grid-column: 1 / -1; border: 1px dashed #cbd7df; border-radius: 12px; background: #f8fafb; }

.consumer-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 28px; }
.consumer-heading h3 { margin: 0 0 5px; }
.consumer-heading p { margin: 0; }
.plan-filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.plan-filter-form label { display: grid; gap: 5px; color: #526174; font-size: 12px; font-weight: 800; }
.plan-filter-form select { min-width: 185px; border: 1px solid #bdcad4; border-radius: 8px; padding: 9px; background: #fff; font: inherit; }
.plan-filter-form button { background: #087f8c; color: #fff; padding: 9px 12px; }
.plan-filter-form a { color: #0c6872; font-size: 13px; font-weight: 800; padding: 9px 3px; text-decoration: none; }

/* Subscription administration is an account directory first.  Individual
   subscription mutations only appear after an operator opens one account. */
.subscription-queue,
.consumer-directory,
.consumer-workspace {
  margin-top: 30px;
  border-top: 1px solid #e2e8ee;
  padding-top: 26px;
}
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.workspace-heading h3 { margin: 5px 0 4px; font-size: 25px; }
.workspace-heading p { margin: 0; }
.queue-count { flex: 0 0 auto; border-radius: 999px; background: #edf4f6; color: #4f687a; padding: 7px 11px; font-size: 12px; font-weight: 800; }
.request-row,
.consumer-row {
  display: grid;
  gap: 16px;
  align-items: center;
  border: 1px solid #dce5eb;
  border-radius: 13px;
  background: #fff;
  padding: 16px 18px;
  box-shadow: 0 5px 16px #22334408;
}
.request-row { grid-template-columns: minmax(200px, 1.25fr) minmax(150px, .9fr) minmax(180px, .9fr) auto; }
.request-account,
.request-plan,
.request-time,
.consumer-identity,
.consumer-row > div { display: grid; gap: 3px; min-width: 0; }
.request-account b,
.consumer-identity b { color: #172033; font-size: 16px; overflow-wrap: anywhere; }
.request-plan > span,
.request-time > span,
.consumer-row > div > span { color: #718195; font-size: 11px; font-weight: 800; }
.request-plan b,
.request-time b,
.consumer-row > div > b { color: #263448; font-size: 14px; overflow-wrap: anywhere; }
.request-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.queue-empty { display: grid; gap: 7px; place-items: center; min-height: 125px; border: 1px dashed #c9d7df; border-radius: 13px; background: #fbfcfd; color: #7b8b9c; text-align: center; padding: 22px; }
.queue-empty b { color: #637488; font-size: 16px; }
.consumer-filter-form { display: grid; grid-template-columns: minmax(230px, 1.45fr) minmax(170px, 1fr) minmax(145px, .75fr) auto auto; gap: 10px; align-items: end; margin-bottom: 14px; padding: 14px; border-radius: 13px; background: #f4f8fa; }
.consumer-filter-form label { display: grid; gap: 5px; color: #526174; font-size: 12px; font-weight: 800; }
.consumer-filter-form input,
.consumer-filter-form select { min-width: 0; width: 100%; border: 1px solid #bdcad4; border-radius: 8px; background: #fff; padding: 9px; font: inherit; }
.consumer-filter-form button,
.consumer-open { background: #087f8c; color: #fff; padding: 9px 12px; font-weight: 800; }
.consumer-filter-form a { color: #0c6872; font-size: 13px; font-weight: 800; padding: 9px 3px; text-decoration: none; white-space: nowrap; }
.consumer-list { display: grid; gap: 9px; }
.consumer-row { grid-template-columns: minmax(230px, 1.25fr) 110px minmax(150px, .9fr) minmax(155px, .9fr) auto; }
.consumer-row:hover { border-color: #8abfc5; }
.consumer-row > div > small { overflow-wrap: anywhere; }
.account-state { display: inline-block; width: fit-content; border-radius: 999px; padding: 5px 8px; font-size: 12px !important; font-weight: 800; }
.account-state.active { background: #dcfce7; color: #166534 !important; }
.account-state.suspended { background: #fee2e2; color: #991b1b !important; }
.consumer-open { border-radius: 8px; text-decoration: none; white-space: nowrap; }
.directory-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 15px; color: #5c7182; font-size: 13px; font-weight: 800; }
.directory-pagination a { border-radius: 8px; background: #e7f5f6; color: #0c6872; padding: 8px 11px; text-decoration: none; }
.workspace-back { display: inline-block; margin-bottom: 18px; color: #0c6872; font-size: 14px; font-weight: 800; text-decoration: none; }
.consumer-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.consumer-summary div { min-width: 0; border-radius: 11px; background: #f4f8fa; padding: 12px; }
.consumer-summary dt { color: #718195; font-size: 11px; font-weight: 800; }
.consumer-summary dd { margin: 5px 0 0; color: #223042; font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.consumer-actions { display: grid; gap: 10px; }
.consumer-actions details { border: 1px solid #dce5eb; border-radius: 11px; background: #fff; }
.consumer-actions summary { padding: 13px 15px; color: #184355; }
.consumer-actions details[open] summary { border-bottom: 1px solid #e2e8ee; }
.consumer-action-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 14px 15px; }
.consumer-action-form label { display: grid; flex: 1 1 220px; gap: 5px; color: #526174; font-size: 12px; font-weight: 800; }
.consumer-action-form label small { font-weight: 500; }
.consumer-action-form input,
.consumer-action-form select { width: 100%; border: 1px solid #bdcad4; border-radius: 8px; background: #fff; padding: 9px; font: inherit; }
.consumer-action-form button { background: #087f8c; color: #fff; padding: 9px 12px; font-weight: 800; }
.danger-action { border-color: #f2c3bd !important; background: #fff9f8 !important; }
.danger-action summary { color: #a12a20; }
.danger-action .consumer-action-form { display: grid; grid-template-columns: 1fr auto; }
.danger-action p { margin: 0; color: #73413b; line-height: 1.5; }
.danger-action button { background: #b42318; }

.operations-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.operations-form input,
.operations-form select,
.mini-form input,
.mini-form select {
  border: 1px solid #bdcad4;
  border-radius: 8px;
  padding: 7px;
  background: #fff;
}

.operations-form button,
.mini-form button {
  background: #087f8c;
  color: #fff;
  padding: 9px 12px;
}

.mini-form .secondary-action { background: #e7f5f6; color: #0c6872; }

.mini-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-link {
  align-self: center;
  background: #e4edf1;
  border-radius: 8px;
  color: #164153;
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none;
}

.claim-code {
  color: #0f5962;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .4px;
}

.factory-edit { margin-top: 8px; }
.factory-edit .mini-form { margin-top: 8px; align-items: end; }
.factory-edit label { display: grid; gap: 4px; font-size: 11px; font-weight: 800; }
.danger-form { margin-top: 8px; }
.danger-form button { background: #b42318; }

.transfer-form { margin-top: 6px; }

.pairing-label {
  max-width: 620px;
  margin: 40px auto;
  text-align: center;
}

.pairing-label h1 { margin-bottom: 8px; }
.pairing-qr { width: min(340px, 90%); margin: 18px auto; display: block; }
.pairing-label dl { display: grid; gap: 10px; text-align: left; }
.pairing-label dl div { background: #f5f8fa; border-radius: 10px; padding: 12px; }
.pairing-label dt { color: #66758a; font-size: 12px; font-weight: 800; }
.pairing-label dd { margin: 5px 0 0; font-size: 21px; font-weight: 800; overflow-wrap: anywhere; }
.pairing-label code { display: block; margin-top: 10px; overflow-wrap: anywhere; }
.label-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.label-actions button, .button-link { background: #087f8c; color: #fff; padding: 11px 16px; border-radius: 9px; text-decoration: none; font-weight: 700; }
.print-notice { color: #66758a; font-size: 13px; line-height: 1.5; margin: 14px auto 0; max-width: 540px; }

@media print {
  .topbar, .label-actions, .pairing-label details, .print-notice { display: none; }
  .container { padding: 0; }
  .pairing-label { border: 0; box-shadow: none; margin: 0 auto; }
}

.mini-form input,
.mini-form select {
  min-width: 90px;
  max-width: 155px;
}

@media (max-width: 700px) {
  .section-heading { align-items: flex-start; flex-direction: column; }
  .delivery-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-create summary { align-items: flex-start; flex-direction: column; }
  .plan-create summary small { text-align: left; }
  .plan-list { grid-template-columns: 1fr; }
  .plan-edit-form { grid-template-columns: 1fr; }
  .consumer-heading { align-items: flex-start; flex-direction: column; }
  .plan-filter-form { width: 100%; }
  .plan-filter-form select { width: 100%; }
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .request-row,
  .consumer-row { grid-template-columns: 1fr; }
  .request-actions { justify-content: flex-start; }
  .consumer-filter-form { grid-template-columns: 1fr; }
  .directory-pagination { justify-content: flex-start; }
  .consumer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .danger-action .consumer-action-form { grid-template-columns: 1fr; }
  .factory-create-card { grid-template-columns: 1fr; padding: 18px; }
  .factory-create-form { grid-template-columns: 1fr; }
  .factory-device-list { grid-template-columns: 1fr; }
  .factory-device-details, .factory-edit-form { grid-template-columns: 1fr; }
  .factory-device-details .factory-code-detail, .factory-edit-form label:last-of-type, .factory-edit-form button { grid-column: auto; }
  .factory-create-drawer summary { align-items: flex-start; flex-direction: column; }
  .factory-create-drawer summary small { text-align: left; }
  .factory-directory-filter { grid-template-columns: 1fr; }
  .factory-directory-filter a { padding: 4px 0; }
  .factory-directory-heading { align-items: flex-start; flex-direction: column; }
  .factory-device-row { grid-template-columns: 1fr; gap: 12px; }
  .factory-device-open { justify-self: stretch; }
  .factory-device-focus { grid-template-columns: 1fr; gap: 12px; }
  .factory-device-focus-metrics { grid-template-columns: 1fr; }
  .device-directory-filter { grid-template-columns: 1fr; }
  .device-directory-filter a { padding: 4px 0; }
  .device-directory-heading { align-items: flex-start; flex-direction: column; }
  .device-account-row { grid-template-columns: 1fr; gap: 12px; }
  .device-account-metrics { max-width: none; }
  .device-account-open { justify-self: stretch; }
  .device-account-focus { grid-template-columns: 1fr; gap: 12px; }
  .device-account-focus-metrics { max-width: none; }
  .account-notification-diagnostic { grid-template-columns: 1fr; }
  .account-notification-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-pagination { flex-wrap: wrap; gap: 8px; }
  .device-card-list { grid-template-columns: 1fr; }
  .device-card-details, .device-parameter-form { grid-template-columns: 1fr; }
  .device-judgement-form fieldset { grid-template-columns: 1fr; }
}
