/* NTRC brand palette, taken from the logo:
   teal #2f9e9a (the lettering) and gold #d69a2d (the signal mark). */
:root {
  --dark: #1c3a3a;
  --accent: #2f9e9a;
  --accent-dark: #237e7b;
  --gold: #d69a2d;
  --gold-dark: #b07d1e;
  --gray: #6b7280;
  --light-gray: #e5e7eb;
  --bg: #f2f7f7;
  --green: #1a7f37;
  --amber: #b45309;
  --red: #b91c1c;
  --card: #ffffff;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

.topbar {
  background: #fff;
  color: var(--dark);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar .brand-logo {
  height: 52px;
  width: auto;
  display: block;
}

.topbar .brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-dark);
  letter-spacing: 0.2px;
  line-height: 1.25;
}

.topbar .brand-sub {
  font-size: 11.5px;
  color: var(--gold-dark);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.topbar nav a {
  color: var(--accent-dark);
  opacity: 1;
  font-weight: 600;
}

.topbar nav a {
  color: var(--accent-dark);
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
}
.topbar nav a:hover { background: var(--accent); color: #fff; }

.container {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 20px;
}

.container.wide {
  max-width: 1280px;
}

.card {
  background: var(--card);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  padding: 28px;
  margin-bottom: 24px;
}

.section-band {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-left: 5px solid var(--gold);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 6px;
  margin: 28px 0 18px;
}
.section-band:first-child { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dark);
}
label .hint {
  display: block;
  font-weight: 400;
  font-style: italic;
  color: var(--gray);
  font-size: 12px;
  margin-top: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  font-size: 14px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  background: #fff;
  color: var(--dark);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,158,154,0.18);
}

.radio-group {
  display: flex;
  gap: 20px;
  align-items: center;
  padding-top: 4px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  margin-bottom: 0;
}
.radio-group input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  color: var(--dark);
  border: 1px solid var(--light-gray);
}
.btn.secondary:hover { background: var(--bg); }
.btn.ghost {
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--light-gray);
  font-weight: 500;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
}
.notice.success { background: #e6f4ea; color: var(--green); border: 1px solid #b7e0c3; }
.notice.error { background: #fdecea; color: var(--red); border: 1px solid #f3c2bd; }
.notice.info { background: #eaf1fe; color: var(--accent-dark); border: 1px solid #c9dcfb; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--light-gray);
  white-space: nowrap;
}
th {
  background: var(--accent-dark);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
}
tr:hover td { background: #f9fafb; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: #fef3e2; color: var(--amber); }
.badge.approved, .badge.installed { background: #e6f4ea; color: var(--green); }
.badge.rejected { background: #fdecea; color: var(--red); }
.badge.not-installed { background: #f3f4f6; color: var(--gray); }
.badge.muted { background: #f3f4f6; color: var(--gray); }

/* Subscription / disconnection countdown */
.badge.exp-active { background: #e6f4ea; color: var(--green); }
.badge.exp-expiring { background: #fdf0d9; color: var(--gold-dark); border: 1px solid #f0d69a; }
.badge.exp-expired { background: #fdecea; color: var(--red); border: 1px solid #f3c2bd; }

tr.row-expiring td { background: #fffaf0; }
tr.row-expiring td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
tr.row-expired td { background: #fef6f5; }
tr.row-expired td:first-child { box-shadow: inset 4px 0 0 var(--red); }

/* Comment column: wrap instead of stretching the table sideways. */
td.comment-cell {
  white-space: normal;
  max-width: 300px;
  min-width: 200px;
  font-size: 12.5px;
  color: var(--dark);
  border-left: 3px solid var(--gold);
  background: #fffdf7;
}
td.comment-cell .no-comment {
  color: #b6bcc4;
  font-style: italic;
}
#recordsTable th:nth-child(3) { background: var(--gold-dark); }

/* Applicant name stays put while the rest of the table scrolls sideways. */
#recordsTable th:first-child,
#recordsTable td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  font-weight: 600;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}
#recordsTable th:first-child { z-index: 3; background: var(--accent-dark); }
tr.row-expiring td.sticky-col { background: #fffaf0; }
tr.row-expired td.sticky-col { background: #fef6f5; }

.hint {
  font-size: 12px;
  color: var(--gray);
  margin-top: 5px;
  font-weight: 500;
}
.hint.ok { color: var(--green); }
.hint.warn { color: var(--gold-dark); font-weight: 600; }
.hint.danger { color: var(--red); font-weight: 600; }

.notice.warn { background: #fdf0d9; color: var(--gold-dark); border: 1px solid #f0d69a; }
.notice.warn a { color: var(--gold-dark); font-weight: 600; }

.stat-card.warn { border-top: 4px solid var(--gold); }
.stat-card.warn .value { color: var(--gold-dark); }
.stat-card.danger { border-top: 4px solid var(--red); }
.stat-card.danger .value { color: var(--red); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.filters .field { min-width: 150px; }
.filters label { margin-bottom: 4px; font-size: 12px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}
.stat-card { border-top: 4px solid var(--accent); }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--accent-dark); }
.stat-card .label { font-size: 12px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--light-gray);
}
.tabs button {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.table-scroll {
  overflow-x: auto;
  max-height: 65vh;
  overflow-y: auto;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 26px;
  width: 560px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal .close { float: right; cursor: pointer; color: var(--gray); font-size: 20px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  font-size: 13.5px;
  margin: 16px 0;
}
.detail-grid .k { color: var(--gray); font-weight: 600; }

.footer-note {
  text-align: center;
  color: var(--gray);
  font-size: 12px;
  margin: 40px 0 20px;
}

.login-wrap {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 360px;
  max-width: 90vw;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.report-card {
  border: 1px solid var(--light-gray);
  border-radius: 10px;
  padding: 16px;
}
.report-title {
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 4px;
}
.report-desc {
  font-size: 12.5px;
  color: var(--gray);
  margin-bottom: 14px;
  min-height: 32px;
}
.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.report-actions .btn {
  padding: 7px 12px;
  font-size: 12.5px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row { display: grid; grid-template-columns: 120px 1fr 60px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { background: var(--light-gray); border-radius: 4px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%); border-radius: 4px; }

.card { border-top: 3px solid var(--accent); }
.report-card { border-top: 3px solid var(--gold); }
