*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  font-size: 15px;
  line-height: 1.5;
}

header {
  background: #1a1a2e;
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}

header h1 { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
header .subtitle { font-size: 12px; opacity: 0.6; }

nav {
  background: white;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 0;
  padding: 0 24px;
}

nav button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  font-weight: 500;
  transition: all 0.15s;
}

nav button:hover { color: #1a1a2e; }
nav button.active { color: #1a1a2e; border-bottom-color: #e63946; font-weight: 600; }

main { max-width: 1080px; margin: 0 auto; padding: 28px 24px; }

.card {
  background: white;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #1a1a2e; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #333; }

.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.status-item { background: #f8f9fa; border: 1px solid #e4e4e4; border-radius: 7px; padding: 14px 16px; }
.status-item .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #555; margin-bottom: 6px; font-weight: 600; }
.status-item .value { font-size: 15px; font-weight: 600; color: #1a1a2e; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-green { background: #d4edda; color: #155724; }
.badge-red { background: #f8d7da; color: #721c24; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-blue { background: #d1ecf1; color: #0c5460; }
.badge-grey { background: #e9ecef; color: #495057; }

form .field { margin-bottom: 16px; }
form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }
form input, form select, form textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: #1a1a2e;
}
form textarea { min-height: 100px; resize: vertical; font-family: monospace; font-size: 13px; }

.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary { background: #1a1a2e; color: white; }
.btn-primary:hover { background: #2d2d44; }
.btn-danger { background: #e63946; color: white; }
.btn-danger:hover { background: #c1121f; }
.btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #ccc; }
.btn-secondary:hover { background: #e0e0e0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; background: #f8f8f8; border-bottom: 2px solid #e0e0e0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: #666; }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
tr:hover td { background: #fafafa; }
td a { color: #1a1a2e; text-decoration: underline; cursor: pointer; }

.msg { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.msg-success { background: #d4edda; color: #155724; }
.msg-error { background: #f8d7da; color: #721c24; }
.msg-info { background: #d1ecf1; color: #0c5460; }

.sms-preview {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 14px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  margin-top: 8px;
}

.hidden { display: none; }
.loading { color: #888; font-style: italic; }

.detail-row { display: flex; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.detail-row .dk { font-weight: 600; color: #555; min-width: 160px; }
.detail-row .dv { color: #1a1a2e; word-break: break-all; }

/* Device status card */
.device-status-card {
  border: 1px solid #e0e0e0;
  border-left: 6px solid #aaa;
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 28px;
  background: white;
}
.device-status-card.status-online  { border-left-color: #28a745; background: #f6fff8; }
.device-status-card.status-stale   { border-left-color: #e6a817; background: #fffcf0; }
.device-status-card.status-offline { border-left-color: #c0392b; background: #fff8f8; }
.device-status-card.status-unknown { border-left-color: #adb5bd; background: #f8f9fa; }

.device-status-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.device-status-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.status-online  .device-status-icon { color: #28a745; }
.status-stale   .device-status-icon { color: #c07f00; }
.status-offline .device-status-icon { color: #c0392b; }
.status-unknown .device-status-icon { color: #6c757d; }

.device-status-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.device-status-label {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.2;
}
.device-status-subtitle {
  font-size: 13px;
  color: #555;
  font-weight: 400;
}

.device-status-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.device-status-row {
  background: rgba(0,0,0,0.025);
  border-radius: 6px;
  padding: 10px 12px;
}
.device-status-row dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  font-weight: 600;
  margin-bottom: 4px;
}
.device-status-row dd {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
}

/* Section heading inside status content */
.section-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 12px;
}

/* Readiness list */
.readiness-list { display: flex; flex-direction: column; gap: 6px; }
.rl-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 8px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
}
.rl-row.rl-pass    { background: #f6fff8; border-color: #c3e6cb; }
.rl-row.rl-warn    { background: #fffdf0; border-color: #ffeeba; }
.rl-row.rl-fail    { background: #fff8f8; border-color: #f5c6cb; }
.rl-row.rl-unknown { background: #f8f8f8; border-color: #dee2e6; }

.rl-icon { font-size: 15px; font-weight: 700; text-align: center; }
.rl-pass    .rl-icon { color: #28a745; }
.rl-warn    .rl-icon { color: #c79100; }
.rl-fail    .rl-icon { color: #dc3545; }
.rl-unknown .rl-icon { color: #6c757d; }

.rl-label  { font-weight: 500; color: #1a1a2e; }
.rl-status { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.rl-pass    .rl-status { color: #155724; }
.rl-warn    .rl-status { color: #856404; }
.rl-fail    .rl-status { color: #721c24; }
.rl-unknown .rl-status { color: #6c757d; }

.rl-note {
  grid-column: 2 / 4;
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

/* Alert log expandable rows */
.alert-row:hover td { background: #f0f4ff; }
.alert-expand-row td { padding: 0; }
.alert-expand-body {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 10px 16px 12px;
  background: #fafbff;
  border-top: 1px dashed #d0d8ff;
  font-size: 13px;
  color: #444;
}

/* Contact summary bar */
.contact-summary {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #555;
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.contact-summary strong { color: #1a1a2e; }

/* Notice banners */
.notice {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 8px;
}
.notice-warn { color: #856404; background: #fff3cd; }

/* Tablet — constrain nav/header padding on mid-width screens */
@media (max-width: 1120px) {
  main { padding: 24px 16px; }
}

/* Test mode banner */
.test-mode-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-left: 5px solid #e6a817;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #5d4200;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Disarm banner */
.disarm-banner {
  background: #f0f4ff;
  border: 1px solid #c5d0f5;
  border-left: 5px solid #4a6cf7;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Settings fieldsets */
.settings-group {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.settings-group legend {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  padding: 0 6px;
}
.field-inline label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
  cursor: pointer;
}
.field-inline label input[type=checkbox] {
  width: auto;
  margin: 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.field-hint {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  margin-left: 26px;
  line-height: 1.4;
}

/* Mobile */
@media (max-width: 600px) {
  header { padding: 0 12px; height: 48px; }
  header h1 { font-size: 16px; }
  main { padding: 12px; }
  nav { padding: 0 8px; overflow-x: auto; }
  nav button { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
  .card { padding: 14px; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .device-status-card { padding: 16px 14px; }
  .device-status-label { font-size: 17px; }
  .device-status-details { grid-template-columns: 1fr 1fr; }
  table { font-size: 12px; }
  th, td { padding: 7px 8px; }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row .dk { min-width: unset; }
  .rl-row { font-size: 13px; }
}
