/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #333;
}

/* ── Login page ───────────────────────────────────────────── */
body.login-page {
  background: #eef0f4;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.login-logo {
  margin-bottom: -2px;
  z-index: 1;
}

.login-card {
  width: 360px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  overflow: hidden;
  margin-top: 10px;
}

.login-card-header {
  background: #0d1b6e;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 14px 24px;
  text-align: center;
}

.login-card-body {
  padding: 28px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card-body form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-intro {
  color: #555;
  font-size: 13px;
  text-align: center;
}

.alert {
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 13px;
}
.alert-danger  { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb; }
.alert-info    { background: #e8f4fd; color: #0c5460; border: 1px solid #bee5eb; }
.alert-success { background: #eafaf1; color: #155724; border: 1px solid #c3e6cb; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
  padding: 10px 12px;
  border: 1px solid #c8ccd4;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: #2979d4;
  box-shadow: 0 0 0 3px rgba(41,121,212,0.15);
}

.btn-signin {
  width: 100%;
  padding: 11px;
  background: #2979d4;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-signin:hover { background: #1a5fb4; }

/* ── App pages (dashboard, list pages) ───────────────────── */
body.app-page {
  background: #f4f6f9;
  min-height: 100vh;
}

/* Top nav */
.topnav {
  background: #0d1b6e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav-email {
  font-size: 13px;
  color: #a8b8f8;
}

.btn-logout {
  background: transparent;
  border: 1px solid #a8b8f8;
  color: #a8b8f8;
  border-radius: 3px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: #fff;
}

/* Main content area */
.main-content {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
  min-width: 0;
  overflow-x: hidden;
}

.main-content h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0d1b6e;
  margin-bottom: 16px;
}

/* ── Topnav extras ────────────────────────────────────────── */
.topnav-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.topnav-link {
  font-size: 13px;
  color: #a8b8f8;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}
.topnav-link:hover,
.topnav-link--active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.topnav-divider {
  color: #3a4a8a;
  font-size: 13px;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.09);
  overflow: hidden;
}

.card-header {
  background: #0d1b6e;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.show-inactive-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 400;
  color: #a8b8f8;
  cursor: pointer;
  user-select: none;
}
.show-inactive-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: #a8b8f8;
}

.card-body {
  padding: 20px;
}

.admin-card {
  max-width: 1100px;
}

/* ── Form layout ──────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 220px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="file"] {
  padding: 9px 11px;
  border: 1px solid #c8ccd4;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}

.form-group select:focus,
.form-group input[type="text"]:focus {
  border-color: #2979d4;
  box-shadow: 0 0 0 3px rgba(41,121,212,0.15);
}

.input-error {
  border-color: #d32f2f !important;
  box-shadow: 0 0 0 3px rgba(211,47,47,0.12) !important;
}

.field-hint {
  font-size: 12px;
  color: #888;
}

.field-error {
  font-size: 12px;
  color: #d32f2f;
  font-weight: 600;
}

.req { color: #d32f2f; }

.form-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  padding: 9px 20px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: #2979d4; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1a5fb4; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #f0f2f7;
  color: #444;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #dde1ea;
  white-space: nowrap;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #ebeef3;
  color: #333;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7f9fc; }

.data-table a {
  color: #2979d4;
  text-decoration: none;
}
.data-table a:hover { text-decoration: underline; }

.mono { font-family: monospace; font-size: 12px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(255,255,255,0.2);
}

.badge-green  { background: #e6f4ea; color: #1e7d34; }
.badge-yellow { background: #fff8e1; color: #b56a00; }
.badge-gray   { background: #f0f0f0; color: #777; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 28px;
}

/* ── Admin sub-tabs ───────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #dde1ea;
  margin-top: 8px;
}

.admin-tab {
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tab:hover { color: #2979d4; }

.admin-tab--active {
  color: #2979d4;
  border-bottom-color: #2979d4;
}

/* ── Platform page ────────────────────────────────────────── */
.page-header-sub {
  font-size: 12px;
  color: #888;
  margin-left: 10px;
}

.platform-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-group-body {
  padding: 4px 0;
}

.bucket-divider {
  border-top: 1px dashed #e4e8f0;
  margin: 6px 16px;
}

.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  border-bottom: 1px solid #f0f2f7;
  gap: 12px;
}

.platform-row:last-child { border-bottom: none; }
.platform-row:hover { background: #f7f9fc; }

.platform-name {
  font-size: 13px;
  color: #333;
  flex: 1;
  min-width: 0;
}

.platform-group-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.platform-group-form select {
  font-size: 12px;
  padding: 3px 7px;
  border: 1px solid #dde1ea;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
  min-width: 180px;
}

.platform-group-form select:focus {
  outline: none;
  border-color: #2979d4;
}

.saving-indicator {
  font-size: 11px;
  color: #2979d4;
  font-style: italic;
}

/* ── Rate card mode toggle (billing party form) ───────────── */
.rc-mode-tabs {
  display: flex;
  gap: 0;
  border: 1px solid #ccd2dc;
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
  margin-top: 4px;
}

.rc-mode-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  color: #555;
  border: none;
  border-right: 1px solid #ccd2dc;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.rc-mode-btn:last-child { border-right: none; }
.rc-mode-btn:hover { background: #f0f4fb; }
.rc-mode-btn.active { background: #2979d4; color: #fff; }

/* ── PO Group label ───────────────────────────────────────── */
.po-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #2979d4;
  background: #f0f5fc;
  padding: 4px 16px;
  border-bottom: 1px solid #e4eaf5;
}

/* ── Delete billing party button ──────────────────────────── */
.platform-group-header { position: relative; }

.delete-party-form { margin-left: auto; }

.btn-delete-party {
  background: none;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  color: rgba(255,255,255,0.7);
  width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}

.btn-delete-party:hover {
  background: rgba(220,50,50,0.75);
  border-color: transparent;
  color: #fff;
}

/* ── Page header action link ──────────────────────────────── */
.page-header { display: flex; align-items: baseline; gap: 14px; }

.page-header-action {
  font-size: 12px;
  font-weight: 600;
  color: #2979d4;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.page-header-action:hover { opacity: 1; text-decoration: underline; }

/* ── Tab warning badge ────────────────────────────────────── */
.tab-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.6;
}

.tab-badge--warn { background: #fde8e8; color: #c0392b; }

.admin-tab--active .tab-badge--warn { background: rgba(220,50,50,0.18); color: #e05050; }

/* ── Runtime input ────────────────────────────────────────── */
.runtime-form {
  display: flex;
  align-items: center;
  gap: 5px;
}

.runtime-input {
  width: 96px;
  font-family: monospace;
  font-size: 13px;
  padding: 4px 7px;
  border: 1px solid #ccd2dc;
  border-radius: 4px;
}

.runtime-input:focus { outline: none; border-color: #2979d4; }
.runtime-input.input-error { border-color: #e05050; }

.btn-runtime-save {
  background: #2979d4;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-runtime-save:hover:not(:disabled) { background: #1a5fb4; }
.btn-runtime-save:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 5px 11px;
  border: 1px solid #ccd2dc;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #2979d4;
  text-decoration: none;
  background: #fff;
  transition: background 0.12s;
}

.page-btn:hover { background: #eef2fa; }
.page-btn--active { background: #2979d4; color: #fff; border-color: #2979d4; }

.page-ellipsis { font-size: 12px; color: #aaa; padding: 0 4px; }

/* ── Missing Runtimes toolbar ─────────────────────────────── */
.page-subheading {
  margin: 0 0 10px;
  font-size: 13px;
  color: #888;
}

.runtime-panel {
  background: #fff;
  border: 1px solid #e4e8f0;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.runtime-panel-divider {
  border-top: 1px solid #ebeef3;
  margin: 0 -16px;
}

.type-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  background: #f0f2f7;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, color 0.12s;
}

.type-pill:hover { background: #e2e7f3; color: #2979d4; }

.type-pill--active {
  background: #2979d4;
  color: #fff;
  border-color: #2979d4;
}

.type-pill--active .type-pill-count { color: rgba(255,255,255,0.75); }

.type-pill-count {
  font-size: 10px;
  font-weight: 700;
  color: #999;
}

.bulk-runtime-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: fit-content;
}

.bulk-runtime-form .btn {
  padding: 5px 12px;
  font-size: 12px;
}

.bulk-label {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}
