:root {
  --bg: #0B1420;
  --bg-panel: #111C2B;
  --border: #1F2E42;
  --text: #E7EDF5;
  --text-dim: #7C8CA6;
  --accent: #1E88E5;
  --brand: #0D47A1;
  --good: #4ADE80;
  --warn: #FBBF24;
  --critical: #F87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.mono {
  font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13.5px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

header .sub {
  color: var(--text-dim);
  margin: 0 0 32px;
  font-size: 14px;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.brand-header h1,
.brand-header .sub {
  margin: 0;
}

.last-updated {
  margin-top: 4px !important;
  font-size: 12px !important;
  color: var(--text-dim);
}

.brand-logo {
  height: 44px;
  width: auto;
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
}

.brand-footer {
  color: var(--text-dim);
  font-size: 11.5px;
  margin-top: 4px;
}

.stats {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.conn-type-stats {
  margin-top: -24px;
  border-top: none;
}

.conn-type-stats .stat {
  padding-top: 4px;
  padding-bottom: 16px;
}

.conn-type-stats .stat-num {
  font-size: 22px;
}

.stat {
  flex: 1;
  padding: 20px 20px 20px 0;
  border-right: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: opacity 0.15s;
}

.stat:hover { opacity: 0.75; }

.stat:last-child { border-right: none; padding-right: 0; }

.stat-num {
  display: block;
  font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
}

.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
}

.stat.critical .stat-num { color: var(--critical); }
.stat.warn .stat-num { color: var(--warn); }
.stat.accent .stat-num { color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

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

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
}

.panel h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
}

.olt-list { display: flex; flex-direction: column; gap: 12px; }

.olt-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 10px;
}

.olt-name { font-size: 13px; }

.olt-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.olt-bar-fill {
  height: 100%;
  background: var(--critical);
  border-radius: 3px;
}

.olt-count {
  font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: right;
  min-width: 48px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 0 10px 10px 0;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

tr:last-child td { border-bottom: none; }

.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(255,255,255,0.03); }
.olt-row.clickable:hover { background: rgba(255,255,255,0.03); }

td.critical, span.critical { color: var(--critical); }
td.warn, span.warn { color: var(--warn); }
td.good, span.good { color: var(--good); }
td.unknown, span.unknown { color: var(--text-dim); }

.empty {
  color: var(--text-dim);
  font-size: 13.5px;
}

footer {
  margin-top: 32px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.back-link {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 24px;
}

.back-link:hover { color: var(--text); }

.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.range-row h2 { margin: 0; }

.range-tabs a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  margin-left: 4px;
}

.range-tabs a.active {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
}

.chart-holder {
  height: 320px;
  position: relative;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  height: 44px;
  margin-bottom: 20px;
}

.login-box h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.login-box .sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 24px;
}

.login-box form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-box label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 10px;
}

.login-box input[type="text"],
.login-box input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.login-box button {
  margin-top: 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover {
  opacity: 0.9;
}

.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--critical);
  color: var(--critical);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.logout-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12.5px;
}

.logout-link:hover {
  color: var(--text);
}

.summary-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 32px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.summary-block:hover {
  border-color: var(--accent);
}

.summary-block h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.summary-block .sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.summary-block .sub .critical {
  color: var(--critical);
  font-weight: 600;
}

.summary-arrow {
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  margin-bottom: 32px;
}

#customer-search {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
}

#customer-search:focus {
  outline: none;
  border-color: var(--accent);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.search-result-row:last-child {
  border-bottom: none;
}

.search-result-row:hover {
  background: rgba(255,255,255,0.03);
}

.search-result-address {
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 12px 16px;
  color: var(--text-dim);
  font-size: 13px;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.admin-tools-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 24px;
}

.admin-tools-link:hover {
  color: var(--text);
  border-color: var(--accent);
}

.admin-job {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
}

.admin-job-info h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
}

.admin-job-info .sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  max-width: 560px;
}

.admin-job-info .sub strong {
  color: var(--warn);
}

.admin-job-action {
  flex-shrink: 0;
  text-align: right;
  min-width: 220px;
}

.admin-job-action button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.admin-job-action button:hover {
  background: rgba(45, 136, 229, 0.1);
}

.admin-job-action button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-progress {
  margin-top: 10px;
}

.admin-progress-track {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

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

.admin-progress-text {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-dim);
}

.ticket-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.ticket-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ticket-ref {
  font-weight: 600;
  font-size: 14px;
}

.ticket-status-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.ticket-verified {
  font-size: 12.5px;
  font-weight: 600;
}

.ticket-verified.good { color: var(--good); }
.ticket-verified.critical { color: var(--critical); }

.ticket-box button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticket-box button:hover {
  background: rgba(45, 136, 229, 0.1);
}

.ticket-box button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ticket-pill {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}

.ticket-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.log-ticket-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.log-ticket-btn:hover {
  background: rgba(45, 136, 229, 0.1);
}

.log-ticket-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.refresh-reading-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 10px;
  margin-left: 8px;
}

.refresh-reading-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-reading-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reading-timestamp {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}

.ticket-notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-note {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

.ticket-note-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.ticket-note-body {
  font-size: 13.5px;
  white-space: pre-wrap;
}

.reading-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.reading-info {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.reading-value {
  font-size: 24px;
  font-weight: 700;
}

.reading-time {
  font-size: 12.5px;
  color: var(--text-dim);
}

.reading-box button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.reading-box button:hover {
  background: rgba(45, 136, 229, 0.1);
}

.reading-box button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
