:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dde6;
  --brand: #126e82;
  --brand-dark: #0b4d5d;
  --danger: #a33a3a;
  --ok: #2f7d52;
  --warn: #a86516;
  --shadow: 0 8px 24px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  padding: 10px 14px;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #eef3f5;
  color: var(--text);
}

button.secondary:hover {
  background: #dce7eb;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

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

.shell {
  min-height: 100vh;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login form,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login form {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
}

.login h1,
.view h1,
.view h2 {
  margin: 0;
}

.app-frame {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #10252d;
  color: #fff;
  padding: 20px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  background: transparent;
  color: #fff;
  text-align: left;
  width: 100%;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.user-box {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #dce7eb;
  margin-top: 24px;
  padding-top: 16px;
}

.content {
  padding: 24px;
}

.view {
  display: grid;
  gap: 18px;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) 180px auto;
}

.saas-lookup-toolbar {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.customer-care-toolbar {
  grid-template-columns: minmax(240px, 1fr) 180px auto;
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card {
  padding: 16px;
}

.card strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
}

.panel {
  overflow: hidden;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

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

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
}

.status.active,
.status.trial,
.status.online,
.status.enrolled {
  background: #e2f3ea;
  color: var(--ok);
}

.status.suspended,
.status.degraded,
.status.pending {
  background: #fff1d8;
  color: var(--warn);
}

.status.inactive,
.status.offline,
.status.expired,
.status.revoked {
  background: #f8e4e4;
  color: var(--danger);
}

.status.unknown,
.status.grace {
  background: #e8ebef;
  color: #475467;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.action-bar {
  justify-content: flex-start;
  padding-top: 16px;
}

.inline-form,
.maintenance-slot,
.device-slot {
  border-top: 1px solid var(--line);
}

.compact-actions {
  justify-content: flex-start;
  padding: 0;
}

.maintenance-history {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.stack {
  display: grid;
  gap: 10px;
}

.feature-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 16px;
}

.check-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: flex;
  gap: 10px;
  padding: 10px 12px;
}

.check-row input {
  width: auto;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.activation-code div:last-child {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.message {
  color: var(--danger);
  min-height: 20px;
}

.panel-note {
  margin: 0;
  padding: 16px;
}

.support-conversation { display: grid; gap: 10px; }
.support-message { max-width: 78%; padding: 12px; border: 1px solid #d8e0e8; border-radius: 6px; background: #f7f9fb; }
.support-message.operator { margin-left: auto; background: #e8f5f7; border-color: #a9d7df; }
.support-message p { margin: 6px 0 0; white-space: pre-wrap; }
.support-message-meta { color: #667085; font-size: 12px; }
.support-attachment { display: grid; gap: 5px; margin-top: 10px; color: #087489; }
.support-attachment img { display: block; max-width: min(420px, 100%); max-height: 280px; object-fit: contain; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.support-reply input { width: 100%; }

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

@media (max-width: 760px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
  }

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