/* ============================================================
   Rubicon Technologies — Partner Portal
   Shared Stylesheet v1.0  |  May 2026
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  --navy:        #1F3864;
  --navy-dark:   #162848;
  --blue:        #2E75B6;
  --blue-mid:    #4A90D9;
  --blue-light:  #D6E4F0;
  --blue-pale:   #EBF3FB;
  --white:       #FFFFFF;
  --gray-50:     #F8FAFC;
  --gray-100:    #F1F5F9;
  --gray-200:    #E2E8F0;
  --gray-400:    #94A3B8;
  --gray-600:    #475569;
  --gray-900:    #0F172A;
  --green:       #10B981;
  --green-light: #D1FAE5;
  --green-dark:  #065F46;
  --red:         #EF4444;
  --red-light:   #FEE2E2;
  --red-dark:    #991B1B;
  --yellow:      #F59E0B;
  --yellow-light:#FEF3C7;
  --yellow-dark: #92400E;
  --purple:      #8B5CF6;
  --purple-light:#EDE9FE;

  --sidebar-w:   240px;
  --header-h:    52px;
  --font-d:      'Inter', system-ui, -apple-system, sans-serif;
  --font-b:      'Inter', system-ui, -apple-system, sans-serif;
  --radius:      4px;
  --radius-lg:   6px;
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.06);
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:   0 4px 16px rgba(0,0,0,0.10);
  --tr:          0.18s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 12px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-b); color: var(--gray-900); background: var(--gray-50); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--navy); }
button { cursor: pointer; font-family: var(--font-b); }
input, select, textarea { font-family: var(--font-b); }
img { max-width: 100%; height: auto; display: block; }

/* ── Portal Layout ────────────────────────────────────────── */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform var(--tr);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo svg { height: 28px; flex-shrink: 0; }
.sidebar-logo-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  line-height: 1.3;
}
.sidebar-logo-text span {
  display: block;
  color: var(--blue-light);
}

.sidebar-section {
  padding: 20px 12px 6px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--tr);
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}
.nav-item.active {
  background: var(--blue);
  color: white;
}
.nav-item .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
.nav-item .nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.blue { background: var(--blue); }
.nav-badge.green { background: var(--green); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--tr);
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

/* ── Main content area ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top header bar ───────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
  letter-spacing: -0.01em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  transition: all var(--tr);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-btn:hover { border-color: var(--blue); color: var(--blue); }
.topbar-btn.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.topbar-btn.primary:hover { background: var(--blue); border-color: var(--blue); }

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray-600);
  transition: all var(--tr);
  position: relative;
}
.topbar-icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1px solid white;
}

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

/* ── Stat cards ───────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow var(--tr);
}
.stat-card:hover { border-color: var(--gray-300); }
.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.stat-icon.blue  { background: var(--blue-pale);   }
.stat-icon.green { background: var(--green-light);  }
.stat-icon.red   { background: var(--red-light);    }
.stat-icon.yellow{ background: var(--yellow-light); }
.stat-icon.purple{ background: var(--purple-light); }
.stat-body { flex: 1; }
.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.stat-delta {
  font-size: 11px;
  font-weight: 500;
  margin-top: 3px;
}
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red);   }
.stat-delta.flat { color: var(--gray-400); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
  letter-spacing: -0.01em;
}
.card-subtitle {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 2px;
}
.card-body { padding: 16px 18px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 13px;
  color: var(--gray-600);
}

/* ── Grid layouts ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-13{ display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-31{ display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ── Tables ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  border-top: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.data-table td.mono {
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

/* ── Badges / Status pills ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green  { background: #059669; color: white; }
.badge-red    { background: var(--red-light);    color: var(--red-dark);   }
.badge-yellow { background: var(--yellow-light); color: var(--yellow-dark);}
.badge-blue   { background: var(--blue-pale);    color: var(--blue);       }
.badge-purple { background: var(--purple-light); color: var(--purple);     }
.badge-gray   { background: var(--gray-100);     color: var(--gray-600);   }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); }
.btn-secondary { background: white; color: var(--gray-600); border-color: var(--gray-200); }
.btn-secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--green); color: white; border-color: var(--green); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.btn-action { background: #bbf7d0 !important; color: #065f46 !important; border-color: #6ee7b7 !important; font-weight: 600; }
.btn-action:hover { background: #86efac !important; border-color: #4ade80 !important; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}
.form-label .req { color: var(--red); margin-left: 3px; }
.form-label .hint { font-weight: 400; color: var(--gray-400); margin-left: 6px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font-b);
  font-size: 14px;
  color: var(--gray-900);
  background: white;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,117,182,0.12);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 5px; }

/* ── Progress / uptime bars ───────────────────────────────── */
.uptime-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}
.uptime-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.8s ease;
}
.uptime-fill.warn { background: var(--yellow); }
.uptime-fill.crit { background: var(--red); }

/* ── Sparkline placeholder ────────────────────────────────── */
.sparkline {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.spark-bar {
  flex: 1;
  background: var(--blue-light);
  border-radius: 2px 2px 0 0;
  transition: background var(--tr);
}
.spark-bar:hover { background: var(--blue); }

/* ── Alert / notice boxes ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-blue   { background: var(--blue-pale);    border-left: 3px solid var(--blue);   color: var(--navy);       }
.alert-yellow { background: var(--yellow-light); border-left: 3px solid var(--yellow); color: var(--yellow-dark);}
.alert-green  { background: var(--green-light);  border-left: 3px solid var(--green);  color: var(--green-dark); }
.alert-red    { background: var(--red-light);    border-left: 3px solid var(--red);    color: var(--red-dark);   }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform var(--tr);
}
.modal-overlay.open .modal { transform: none; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}
.modal-close {
  width: 30px; height: 30px;
  border: none; background: none;
  font-size: 20px; color: var(--gray-400);
  cursor: pointer; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.empty-sub { font-size: 14px; }

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-13, .grid-31 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); --sidebar-w: 240px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
