/* ── base ── */
:root {
  --bg:        #0d0d0d;
  --bg-surface: #161616;
  --bg-panel:  #1c1c1c;
  --bg-row:    #222222;
  --border:    #2a2a2a;
  --accent:    #7c3aed;
  --accent-h:  #6d28d9;
  --text:      #e2e2e2;
  --text-muted:#888;
  --ok:        #22c55e;
  --err:       #ef4444;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin-bottom: 60px;
}

a { color: var(--accent); }
a:hover { color: var(--accent-h); }

/* ── navbar ── */
.rg-navbar {
  background: var(--bg-surface) !important;
  border-bottom: 1px solid var(--border);
}

.rg-brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .5px;
  color: var(--accent) !important;
}

.rg-navbar .nav-link {
  color: var(--text-muted) !important;
  font-size: .875rem;
  transition: color .15s;
}

.rg-navbar .nav-link:hover,
.rg-navbar .nav-link.active {
  color: var(--text) !important;
}

/* ── footer ── */
.rg-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 50px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* ── panels ── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.panel-count {
  font-weight: 400;
  color: var(--accent);
}

.panel-scroll {
  max-height: 380px;
  overflow-y: auto;
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}

.panel-row:last-child { border-bottom: none; }

.panel-row:hover { background: var(--bg-row); }

.item-name {
  color: var(--text);
  font-weight: 500;
}

.item-meta {
  color: var(--text-muted);
  font-size: .75rem;
  font-family: monospace;
}

.panel-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: .85rem;
  margin: 0;
}

/* ── admin layout ── */
.admin-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.admin-meta {
  font-size: .8rem;
  color: var(--text-muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .admin-grid { grid-template-columns: 1fr; }
}

/* ── send message ── */
.panel-send { padding: .75rem 1rem 1rem; }

.send-row {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

.send-select {
  background: var(--bg-row);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .4rem .6rem;
  font-size: .85rem;
  min-width: 200px;
}

.send-input {
  flex: 1;
  background: var(--bg-row);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .4rem .75rem;
  font-size: .85rem;
}

.send-input::placeholder { color: var(--text-muted); }

.send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: .4rem 1.1rem;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s;
}

.send-btn:hover { background: var(--accent-h); }

.send-result {
  font-size: .85rem;
  padding: .35rem .75rem;
  border-radius: 4px;
  margin-bottom: .5rem;
  display: inline-block;
}

.send-ok  { background: #14532d44; color: var(--ok); border: 1px solid #166534; }
.send-err { background: #7f1d1d44; color: var(--err); border: 1px solid #991b1b; }

/* ── forms (login etc) ── */
.form-control, .form-select {
  background: var(--bg-row);
  color: var(--text);
  border-color: var(--border);
}

.form-control:focus, .form-select:focus {
  background: var(--bg-row);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #7c3aed33;
}

.form-label { color: var(--text-muted); font-size: .85rem; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
}

/* ── tables ── */
.rg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.rg-table th {
  text-align: left;
  padding: .5rem 1rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.rg-table td {
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.rg-table tbody tr:last-child td { border-bottom: none; }
.rg-table tbody tr:hover td { background: var(--bg-row); }

.text-muted { color: var(--text-muted) !important; }

.table-actions {
  white-space: nowrap;
  text-align: right;
}

.btn-row {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: .2rem .65rem;
  font-size: .78rem;
  cursor: pointer;
  transition: all .15s;
  margin-left: .25rem;
}

.btn-edit:hover  { border-color: var(--accent); color: var(--accent); }
.btn-retire      { border-color: #4b1818; color: #b91c1c; }
.btn-retire:hover { background: #7f1d1d44; border-color: var(--err); color: var(--err); }

/* ── toolbar ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: .75rem;
  flex-wrap: wrap;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  min-width: 200px;
}

.toolbar-actions {
  display: flex;
  gap: .5rem;
}

.btn-muted {
  background: var(--bg-row) !important;
  color: var(--text-muted) !important;
}

.btn-clear {
  color: var(--text-muted);
  font-size: .8rem;
  text-decoration: none;
}
.btn-clear:hover { color: var(--text); }

/* ── modals ── */
.rg-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.rg-modal .modal-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.rg-modal .modal-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.rg-modal .modal-title { font-size: .95rem; font-weight: 600; }

/* ── section divider ── */
.section-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin: 1.75rem 0 .85rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── status badges ── */
.status-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 3px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-active   { background: #14532d44; color: var(--ok);  border: 1px solid #166534; }
.badge-inactive { background: #450a0a44; color: #ef4444;  border: 1px solid #7f1d1d; }
.badge-warn     { background: #451a0344; color: #f97316;  border: 1px solid #7c2d12; }
.filter-chip-error { background: rgba(239,68,68,.1); color: #ef4444; border-color: rgba(239,68,68,.25); }

/* ── SOQL runner ── */
.soql-input {
  width: 100%;
  resize: vertical;
  font-family: monospace;
  font-size: .83rem;
}

.soql-result {
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .75rem 1rem;
  font-size: .78rem;
  font-family: monospace;
  color: var(--text-muted);
  max-height: 360px;
  overflow: auto;
  white-space: pre;
  margin: 0;
}

/* ── user portal info grid ── */
.info-grid { padding: .75rem 0; }

.info-row {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.info-row:last-child { border-bottom: none; }

.info-label {
  color: var(--text-muted);
  font-size: .78rem;
  min-width: 110px;
  flex-shrink: 0;
}

.info-value { color: var(--text); }

/* ── inventory stats bar ── */
.stat-bar {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .6rem 1rem;
  background: var(--bg-panel);
  gap: .1rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

/* ── filter chip ── */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #7c3aed22;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: .2rem .6rem;
  font-size: .78rem;
  text-decoration: none;
  transition: background .15s;
}
.filter-chip:hover { background: #7c3aed44; color: var(--accent); }

/* ── owner link in table ── */
.owner-link {
  color: var(--text);
  text-decoration: none;
  font-size: .85rem;
}
.owner-link:hover { color: var(--accent); text-decoration: underline; }

/* ── filter bar (shared) ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: .75rem;
}

.filter-input {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .85rem;
  padding: .35rem .65rem;
  outline: none;
  min-width: 180px;
  flex: 1 1 180px;
}
.filter-input::placeholder { color: var(--text-muted); }
.filter-input:focus { border-color: var(--accent); }

.filter-select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .82rem;
  padding: .35rem .6rem;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ── pagination ── */
.pagination-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0 .25rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

.page-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: .82rem;
  padding: .25rem .6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-panel);
  transition: background .15s;
}
.page-btn:hover { background: var(--bg-row); color: var(--accent); }

.page-info { font-size: .82rem; color: var(--text-muted); }

/* ── active filter chip ── */
.filter-chip-active {
  background: rgba(124,58,237,.25);
  color: var(--accent);
  border-color: rgba(124,58,237,.4);
}

/* ── auth pages ── */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card-wrap {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .5px;
  color: #fff;
  margin-bottom: .75rem;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .25rem;
}

.auth-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 0;
}

.auth-form .form-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.auth-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 6px;
  color: var(--err);
  font-size: .85rem;
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}

.auth-success {
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.3);
  border-radius: 6px;
  color: var(--ok);
  font-size: .85rem;
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
}

.auth-link {
  font-size: .8rem;
  color: var(--text-muted);
  text-decoration: none;
}
.auth-link:hover { color: var(--accent); }

.btn-accent {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: .55rem 1rem;
  border-radius: 6px;
  transition: background .15s;
}
.btn-accent:hover { background: var(--accent-h); color: #fff; }

.btn-sm-accent {
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  padding: .28rem .7rem;
  border-radius: 5px;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.btn-sm-accent:hover { background: var(--accent-h); color: #fff; text-decoration: none; }

/* ── admin hub ── */
.admin-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.admin-hub-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  transition: border-color .15s, background .15s;
}
.admin-hub-card:hover {
  border-color: var(--accent);
  background: var(--bg-row);
  color: var(--text);
}

.hub-card-icon {
  font-size: 1.6rem;
  margin-bottom: .25rem;
}

.hub-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.hub-card-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.hub-card-meta {
  font-size: .75rem;
  color: var(--accent);
  margin-top: .25rem;
}

/* ── breadcrumb ── */
.breadcrumb-line {
  margin-bottom: .35rem;
}
.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .2rem .55rem;
  transition: color .15s, border-color .15s;
}
.breadcrumb-back:hover { color: var(--accent); border-color: var(--accent); }

/* ── scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
