:root {
  --ink: #111827;
  --muted: #647181;
  --line: #d2dce5;
  --panel: #ffffff;
  --surface: #f3f7fa;
  --accent: #0f766e;
  --accent-dark: #0b5d56;
  --working: #0f6e60;
  --standby: #cf9723;
  --alarm: #b23d37;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #edf2f6;
  font-family: "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.scroll-top-button {
  position: fixed;
  z-index: 60;
  left: 16px;
  bottom: 18px;
  width: 76px;
  height: 74px;
  display: grid;
  place-content: center;
  gap: 5px;
  transform: none;
  border: 0;
  border-radius: 7px;
  background: rgba(72, 72, 72, 0.82);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.16);
}

.scroll-top-button span {
  font-size: 11px;
  line-height: 1;
}

.scroll-top-button strong {
  font-size: 13px;
}

.scroll-top-button:hover {
  background: rgba(47, 47, 47, 0.9);
}

.scroll-top-button:focus-visible {
  outline: 3px solid rgba(90, 174, 241, 0.55);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px;
}

.brand-panel {
  padding-right: 40px;
}

.brand-logo {
  display: block;
  width: 189px;
  height: 68px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 22px;
}

.brand-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.brand-panel p {
  margin: 14px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 18px 42px rgba(28, 43, 56, 0.12);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.tab,
.secondary {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  min-height: 38px;
  cursor: pointer;
}

.tab.active {
  background: #dcebe8;
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  height: 42px;
  border: 1px solid #b9c7d2;
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.primary {
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--alarm);
}

.dashboard {
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 18px 20px;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
}

.company-block {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 18px;
}

.company-logo {
  display: block;
  width: 174px;
  height: auto;
  flex: 0 0 auto;
}

.company-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.topbar h1 {
  font-size: 28px;
}

.identity-block {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "identity actions"
    "last-seen last-seen";
  gap: 6px 12px;
  justify-items: end;
  text-align: right;
}

.dashboard-identity {
  grid-area: identity;
  align-self: center;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.dashboard-identity strong {
  color: var(--ink);
  font-size: 19px;
}

.top-device-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.device-summary-bar {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #eaf0f4;
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  appearance: none;
  border: 1px solid #c6d5df;
  border-radius: 5px;
  background: #f8fbfc;
  padding: 0 12px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.04);
}

.summary-chip:hover {
  border-color: #8db7c6;
  background: #edf7fa;
}

.summary-chip:focus-visible {
  outline: 3px solid rgba(22, 119, 147, 0.28);
  outline-offset: 2px;
}

.summary-chip strong {
  font-size: 14px;
  white-space: nowrap;
}

.summary-chip em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.summary-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--alarm);
  box-shadow: 0 0 0 3px rgba(201, 70, 63, 0.12);
}

.summary-chip.state-working .summary-dot {
  background: var(--working);
  box-shadow: 0 0 0 3px rgba(34, 147, 95, 0.14);
}

.summary-chip.state-standby .summary-dot {
  background: var(--standby);
  box-shadow: 0 0 0 3px rgba(211, 161, 31, 0.16);
}

.summary-chip.state-alarm .summary-dot,
.summary-chip.state-offline .summary-dot {
  background: var(--alarm);
}

.summary-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.top-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-icon-link {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.page-icon-link:hover {
  background: transparent;
}

.page-icon-link.active {
  background: transparent;
  box-shadow: none;
}

.nav-glyph {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #5aaef1;
  font-family: "Segoe MDL2 Assets", "Segoe UI Symbol", sans-serif;
  font-size: 19px;
  line-height: 1;
  transition: background 120ms ease;
}

.page-icon-link:hover .nav-glyph {
  background: #429ee5;
}

.home-glyph::before {
  content: "\E80F";
}

.monitor-glyph::before {
  content: "\E7F4";
}

.last-seen {
  grid-area: last-seen;
  color: var(--muted);
  font-size: 13px;
}

.last-seen.offline {
  color: var(--alarm);
  font-weight: 800;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #167793;
  cursor: pointer;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.icon-button:hover {
  background: transparent;
  opacity: 0.82;
}

.action-icon {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.refresh-button {
  color: #167793;
}

.refresh-button svg {
  display: block;
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.refresh-button:hover {
  background: transparent;
  opacity: 0.82;
}

.secondary {
  padding: 0 14px;
}

.dashboard-body {
  display: block;
}

.dashboard-body.admin-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-link-panel {
  position: sticky;
  top: 18px;
  min-height: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.07);
}

.admin-link-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid #e5ecf2;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

.admin-link-title::after {
  content: "허용";
  border: 1px solid #c8d9d6;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #edf7f5;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.admin-link-list {
  display: grid;
  gap: 8px;
}

.admin-link-button {
  width: 100%;
  border: 1px solid #d7e1e8;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.admin-link-button:hover {
  border-color: #9eb1bf;
  background: #ffffff;
}

.admin-link-button.active {
  background: #e9f5f2;
  color: var(--accent-dark);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-link-button strong,
.admin-link-button span {
  display: block;
}

.admin-link-button strong {
  font-size: 13px;
  margin-bottom: 3px;
}

.admin-link-button span,
.admin-link-empty {
  font-size: 11px;
  line-height: 1.35;
}

.admin-link-empty {
  color: var(--muted);
  text-align: center;
  border: 1px dashed #cbd7e1;
  border-radius: 7px;
  padding: 16px 10px;
  background: #f8fafc;
}

.device-area {
  min-width: 0;
}

.admin-layout .device-area {
  border: 1px solid #dbe5ed;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
}

.device-list {
  display: grid;
  gap: 18px;
}

.utility-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
}

.utility-panel h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.utility-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.settings-dialog {
  width: min(760px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  background: var(--panel);
  border: 1px solid #cfdbe4;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}

.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.settings-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.settings-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
}

.setting-check {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d2dde5;
  border-radius: 6px;
  background: #f8fbfc;
  padding: 6px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.setting-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dbe5ed;
}

.settings-password-panel {
  margin: 12px 0 0;
  padding: 12px;
  box-shadow: none;
}

.admin-users-dialog {
  width: min(900px, 100%);
}

.tool-life-dialog {
  width: min(1040px, 100%);
}

.tool-life-table-wrap {
  position: relative;
  max-height: min(590px, calc(100vh - 145px));
  overflow: auto;
  border: 1px solid #cfdbe4;
  border-radius: 6px;
}

.tool-life-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.tool-life-table th,
.tool-life-table td {
  height: 38px;
  padding: 7px 10px;
  border-bottom: 1px solid #d7e1e8;
  text-align: left;
  overflow-wrap: anywhere;
}

.tool-life-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #dceaf3;
  color: var(--ink);
  font-weight: 900;
}

.tool-life-table tbody tr:nth-child(even) {
  background: #f3f8fb;
}

.tool-life-table tbody tr:last-child td {
  border-bottom: 0;
}

.tool-life-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tool-life-empty {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.tool-status {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.tool-status-normal {
  color: #0f6e60;
  background: #e2f4ef;
}

.tool-status-warning {
  color: #8a6300;
  background: #fff3cd;
}

.tool-status-expired {
  color: #a52f2a;
  background: #fde8e7;
}

.admin-account-list {
  display: grid;
  gap: 10px;
}

.admin-account-empty,
.admin-account-form {
  border: 1px solid #d2dde5;
  border-radius: 6px;
  background: #f8fbfc;
  padding: 12px;
}

.admin-account-empty {
  color: var(--muted);
  font-weight: 700;
}

.admin-account-form {
  display: grid;
  gap: 10px;
}

.admin-account-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.admin-account-heading strong {
  color: var(--ink);
  font-size: 15px;
}

.admin-account-heading span,
.admin-account-created,
.admin-account-status {
  color: var(--muted);
  font-size: 12px;
}

.admin-account-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.admin-account-fields label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.admin-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-account-created {
  margin-right: auto;
}

.admin-account-status.error {
  color: var(--alarm);
}

.danger {
  border: 1px solid #c9463f;
  border-radius: 6px;
  background: #fff6f5;
  color: #a33a34;
  font-weight: 800;
  cursor: pointer;
}

.danger:hover {
  background: #fee7e5;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) auto auto;
  gap: 10px;
  align-items: end;
}

.compact {
  min-height: 38px;
  height: 38px;
  padding: 0 14px;
}

.job-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.job-empty,
.job-item {
  border: 1px solid #d2dde5;
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
}

.job-empty {
  color: var(--muted);
  font-weight: 700;
}

.job-item {
  display: grid;
  gap: 3px;
  border-left: 5px solid var(--standby);
}

.job-item.status-processing {
  border-left-color: #2563eb;
}

.job-item.status-completed {
  border-left-color: var(--working);
}

.job-item.status-failed {
  border-left-color: var(--alarm);
}

.job-item span,
.job-item small {
  color: var(--muted);
  font-size: 12px;
}

.device-card {
  display: grid;
  grid-template-columns: minmax(230px, 320px) 1fr;
  gap: 22px;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.device-card.link-offline {
  border-color: #d9e2ea;
  background: #ffffff;
}

.device-card.device-card-target {
  animation: device-card-target 1.8s ease-out;
}

@keyframes device-card-target {
  0% {
    border-color: #167793;
    box-shadow: 0 0 0 5px rgba(22, 119, 147, 0.28), 0 8px 24px rgba(17, 24, 39, 0.06);
  }
  100% {
    border-color: var(--line);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  }
}

.machine-side {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  background: #f8fafc;
  border: 1px solid #d9e2e8;
  border-radius: 6px;
  overflow: hidden;
}

.state-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  height: 10px;
  border-radius: 999px;
  background: var(--alarm);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.state-working .state-bar {
  background: var(--working);
}

.state-standby .state-bar {
  background: var(--standby);
}

.state-alarm .state-bar,
.state-offline .state-bar {
  background: var(--alarm);
}

.machine-side img {
  max-width: 90%;
  max-height: 250px;
  object-fit: contain;
  margin-top: 22px;
}

.monitor-side {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.device-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.device-header h2 {
  margin: 0;
  font-size: 24px;
}

.device-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.state-pill {
  min-width: 120px;
  min-height: 38px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 7px 12px;
  background: var(--alarm);
}

.state-working .state-pill {
  background: var(--working);
}

.state-standby .state-pill {
  background: var(--standby);
  color: #2d2205;
}

.progress-section {
  display: grid;
  gap: 5px;
}

.progress-summary {
  color: #46596b;
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #dde7ed;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.link-offline .progress-fill {
  background: var(--alarm);
}

.offline-notice {
  border: 1px solid #efc1bd;
  border-radius: 6px;
  background: #fff6f5;
  color: #a33a34;
  font-weight: 800;
  padding: 10px 12px;
}

.file-transfer-launch {
  display: flex;
  justify-content: flex-end;
}

.file-transfer-launch-button {
  min-width: 110px;
  min-height: 40px;
}

.file-transfer-dialog {
  width: min(1240px, 100%);
}

.file-transfer-head {
  margin-bottom: 14px;
}

.file-transfer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr);
  gap: 12px;
  min-height: 500px;
}

.file-transfer-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 9px;
  border: 1px solid #cfdbe4;
  border-radius: 7px;
  padding: 10px;
  background: #f8fbfc;
}

.file-transfer-pane:last-child {
  grid-template-rows: auto minmax(0, 1fr);
}

.file-transfer-pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-transfer-pane-head strong {
  border: 1px solid #c9d7e1;
  border-radius: 5px;
  background: #eef4f7;
  padding: 4px 8px;
  font-size: 16px;
}

.file-transfer-pane-head span {
  color: var(--muted);
  font-size: 12px;
}

.file-picker-button {
  justify-self: start;
  cursor: pointer;
}

.file-picker-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-picker-button span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid #9eb4c3;
  border-radius: 5px;
  background: #fff;
  padding: 6px 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.file-table-wrap {
  position: relative;
  min-height: 0;
  overflow: auto;
  border: 1px solid #cfdbe4;
  background: #fff;
}

.file-transfer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.file-transfer-table th,
.file-transfer-table td {
  height: 31px;
  padding: 5px 8px;
  border-bottom: 1px solid #d7e1e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-transfer-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e6f0f6;
  font-weight: 900;
}

.file-transfer-table th:first-child {
  width: 58%;
}

.file-transfer-table tbody tr:nth-child(even) {
  background: #f5f9fb;
}

.file-transfer-empty {
  position: absolute;
  inset: 31px 0 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.file-transfer-controls {
  display: grid;
  align-content: center;
  gap: 10px;
}

.file-transfer-arrow,
.file-transfer-refresh {
  width: 44px;
  height: 44px;
  border: 1px solid #a8bdcc;
  border-radius: 6px;
  background: #fff;
  color: #56a8fc;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.file-transfer-arrow:disabled,
.file-transfer-refresh:disabled {
  opacity: 0.45;
  cursor: default;
}

.file-transfer-footer {
  min-height: 28px;
  padding-top: 10px;
}

.file-transfer-footer .message.error,
#passwordMessage.error {
  color: var(--alarm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
}

.metric {
  min-height: 64px;
  background: #f3f7fa;
  border: 1px solid #d2dde5;
  border-radius: 6px;
  padding: 9px 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.metric-value {
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-line;
  word-break: break-word;
}

.metric-tool-life {
  display: grid;
  align-content: start;
}

.tool-life-open-button {
  width: 100%;
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #0f756d;
  border-radius: 5px;
  background: #0f756d;
  color: #fff;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.tool-life-open-button:hover {
  background: #0b625c;
  border-color: #0b625c;
}

.tool-life-open-button strong {
  min-width: 31px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 7px;
  text-align: center;
}

/* NC programs can have long, descriptive file names.  Let this one card
   grow to show the complete name over two or three lines. */
.metric.metric-program {
  min-height: 90px;
}

.metric-program .metric-value {
  font-size: 12.6px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.part-count-chart {
  min-width: 0;
  margin-top: 4px;
  border-top: 1px solid #cfdbe4;
  padding-top: 18px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.chart-head div {
  display: grid;
  gap: 2px;
}

.chart-head strong {
  font-size: 14px;
}

.chart-head span {
  color: var(--muted);
  font-size: 11px;
}

.chart-period {
  min-width: 92px;
  height: 34px;
  border: 1px solid #b9cbd7;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 30px 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chart-period:focus {
  outline: 2px solid rgba(22, 119, 147, 0.2);
  border-color: #167793;
}

.chart-body {
  width: 100%;
  min-height: 220px;
  overflow: hidden;
}

.part-count-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 190px;
}

.chart-grid-line {
  stroke: #d6e0e7;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #647181;
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke: #4477ca;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #4477ca;
  stroke: #fff;
  stroke-width: 1.5;
}

.empty {
  background: var(--panel);
  border: 1px dashed #aebdca;
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

@media (max-width: 920px) {
  .auth-layout,
  .device-card {
    grid-template-columns: 1fr;
  }

  .topbar,
  .device-header {
    flex-direction: column;
    align-items: stretch;
  }

  .identity-block {
    justify-items: start;
    text-align: left;
  }

  .company-block {
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-body.admin-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-link-panel {
    position: static;
    min-height: auto;
    border-radius: 12px;
  }

  .admin-link-title {
    min-height: 0;
    margin-bottom: 12px;
    font-size: 22px;
  }

  .admin-link-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .file-transfer-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .file-transfer-pane {
    min-height: 290px;
  }

  .file-transfer-controls {
    display: flex;
    justify-content: center;
  }

  .settings-head,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 560px) {
  .dashboard {
    padding: 0;
  }

  .topbar {
    gap: 10px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    padding: 12px;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.05);
  }

  .company-block {
    column-gap: 10px;
  }

  .company-logo {
    width: 112px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .top-device-summary {
    gap: 6px;
  }

  .device-summary-bar {
    margin-bottom: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-left: 0;
    border-radius: 0;
    padding: 10px 12px;
  }

  .summary-chip {
    min-height: 38px;
    gap: 6px;
    padding: 0 9px;
  }

  .summary-chip strong {
    font-size: 12px;
  }

  .summary-chip em {
    font-size: 11px;
  }

  .identity-block {
    width: 100%;
    gap: 5px 10px;
  }

  .dashboard-identity strong {
    font-size: 16px;
  }

  .dashboard-identity,
  .last-seen {
    font-size: 11px;
  }

  .top-actions {
    gap: 6px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .refresh-button {
    font-size: inherit;
  }

  .refresh-button svg {
    width: 34px;
    height: 34px;
  }

  .device-list {
    gap: 12px;
  }

  .device-card {
    gap: 14px;
    border-radius: 6px;
    padding: 10px;
  }

  .machine-side {
    min-height: 250px;
  }

  .machine-side img {
    max-width: 76%;
    max-height: 205px;
  }

  .device-header h2 {
    font-size: 20px;
  }

  .state-pill {
    min-height: 36px;
    border-radius: 5px;
  }

  .settings-modal {
    align-items: stretch;
    padding: 10px;
  }

  .settings-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-life-table {
    min-width: 760px;
  }

  .setting-check {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .chart-body {
    min-height: 170px;
    overflow: hidden;
  }

  .part-count-svg {
    min-width: 0;
    min-height: 165px;
  }
}
