@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-muted: #fafafa;
  --border: #e6e6e6;
  --border-strong: #d8d8d8;
  --text: #111111;
  --muted: #6c6c6c;
  --accent: #111111;
  --accent-soft: #f2f2f2;
  --success: #0f8a3b;
  --success-soft: #eef8f1;
  --warn: #9c4b16;
  --warn-soft: #fff5eb;
  --shadow: 0 12px 30px rgba(17, 17, 17, 0.04);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

code,
textarea,
.inventory-meta,
.helper-text,
.metric-value {
  font-family: "IBM Plex Mono", monospace;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 16px;
}

.login-widget {
  display: flex;
  justify-content: center;
}

.login-error {
  max-width: 360px;
  padding: 10px 14px;
  border: 1px solid #f1d4d4;
  border-radius: 999px;
  color: #8f2d2d;
  background: #fff4f4;
  text-align: center;
  font-size: 0.94rem;
}

.app-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 24px;
}

.app-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.app-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.current-user {
  color: var(--text);
  font-weight: 600;
}

.section-block {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.compact-block {
  padding: 16px 20px;
}

.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-headline h1,
.section-headline h2,
.editor-head h2 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form input,
.profile-form input,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.inline-form input:focus,
.profile-form input:focus,
textarea:focus {
  border-color: #bdbdbd;
}

textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.inline-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.primary-button {
  background: #111111;
  color: #ffffff;
}

.secondary-button,
.ghost-button,
.inline-button {
  background: var(--accent-soft);
  color: var(--text);
}

.danger-button {
  background: #fff3f0;
  color: #9c4b16;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.inline-button:hover {
  transform: translateY(-1px);
}

.table-shell {
  overflow-x: auto;
}

.inventory-table,
.client-table {
  width: 100%;
  border-collapse: collapse;
}

.inventory-table th,
.client-table th {
  text-align: left;
  padding: 0 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inventory-table td,
.client-table td {
  padding: 14px 0;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.inventory-owner-row td {
  background: #fff;
}

.inventory-owner-row.is-open td {
  background: var(--panel-muted);
}

.inventory-device-row td,
.inventory-form-row td,
.inventory-empty-row td {
  background: #fff;
}

.owner-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.owner-name {
  font-weight: 700;
}

.inventory-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.expander-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.is-open .expander-button {
  transform: rotate(90deg);
}

.device-name {
  font-weight: 600;
}

.device-subline {
  color: var(--muted);
  font-size: 0.84rem;
}

.device-indent {
  padding-left: 38px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--accent-soft);
}

.pill.is-on {
  background: var(--success-soft);
  color: var(--success);
}

.pill.is-off {
  background: var(--warn-soft);
  color: var(--warn);
}

.owner-actions,
.device-actions,
.download-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.download-links a {
  color: var(--muted);
}

.download-links a:hover,
.app-bar a:hover,
.client-table a:hover {
  color: var(--text);
}

.profile-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-form-row td {
  padding-top: 8px;
  padding-bottom: 18px;
}

.empty-state {
  color: var(--muted);
}

.help-block {
  padding: 0;
}

.help-block > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 700;
}

.help-block > summary::-webkit-details-marker {
  display: none;
}

.help-content {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.help-steps {
  margin: 14px 0 20px 18px;
  padding: 0;
}

.help-steps li + li {
  margin-top: 8px;
}

.help-table-wrap {
  overflow-x: auto;
}

.lists-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.lists-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.dashboard-block {
  margin-bottom: 8px;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

.metrics-row,
.services-row {
  display: grid;
  gap: 12px;
}

.metrics-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.services-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.service-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
}

.metric-label,
.service-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-word;
}

.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
}

.notice-success {
  border-color: #d7ebdd;
  background: #f5fbf7;
}

.notice-error {
  border-color: #f1d4d4;
  background: #fff5f5;
}

.notice-info {
  border-color: #e8e8e8;
  background: #fafafa;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .lists-grid,
  .metrics-row,
  .services-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 20px, 1080px);
    padding-top: 10px;
  }

  .app-bar,
  .inline-form,
  .profile-form,
  .editor-head,
  .section-headline {
    flex-direction: column;
    align-items: stretch;
  }

  .owner-actions,
  .device-actions,
  .download-links,
  .lists-footer {
    justify-content: flex-start;
  }

  .inventory-table th:nth-child(4),
  .inventory-table th:nth-child(5),
  .inventory-table th:nth-child(6),
  .inventory-table td:nth-child(4),
  .inventory-table td:nth-child(5),
  .inventory-table td:nth-child(6) {
    min-width: 130px;
  }
}
