:root {
  --sf-primary: #08265f;
  --sf-secondary: #c99a2e;
  --sf-white: #ffffff;
  --sf-bg: #f4f6fb;
  --sf-border: #d9e0ef;
  --sf-text: #1c2638;
  --sf-muted: #667085;
  --sf-sidebar: #071a3c;
}

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

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--sf-text);
  background: var(--sf-bg);
  font-family: "Miranda Sans", "Inter", "Segoe UI", Arial, sans-serif;
}

a { color: var(--sf-primary); text-decoration: none; }
a:hover { color: #0d3c91; }

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--sf-sidebar);
  color: #e8eefc;
  padding: 18px 14px;
}

.sidebar::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 18px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--sf-secondary);
  color: #061733;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 3px 0;
  border-radius: 8px;
  color: #dbe6ff;
  font-weight: 650;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  box-shadow: inset 3px 0 0 var(--sf-secondary);
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0;
}

.muted { color: var(--sf-muted); }

.panel {
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: 8px;
  padding: 18px;
}

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat {
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: 8px;
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 1.55rem;
  color: var(--sf-primary);
}

.btn-primary {
  --bs-btn-bg: var(--sf-primary);
  --bs-btn-border-color: var(--sf-primary);
  --bs-btn-hover-bg: #0b347f;
  --bs-btn-hover-border-color: #0b347f;
}

.btn-warning {
  --bs-btn-bg: var(--sf-secondary);
  --bs-btn-border-color: var(--sf-secondary);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--sf-border);
  border-radius: 8px;
}

.table {
  margin-bottom: 0;
  font-size: .92rem;
  vertical-align: middle;
}

.table td,
.table th {
  white-space: nowrap;
}

.stacked-meta {
  display: grid;
  gap: 2px;
}

.stacked-meta small {
  color: var(--sf-muted);
}

.email-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.email-copy strong {
  overflow-wrap: anywhere;
}

.copy-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.inline-identity-cell {
  cursor: text;
  min-width: 260px;
}

.inline-identity-cell:hover [data-identity-name] {
  color: var(--sf-primary);
}

.inline-identity-cell.is-saving {
  opacity: .7;
}

.inline-identity-input {
  max-width: 360px;
}

.inline-error {
  margin-top: 4px;
  color: #b42318;
  font-size: .78rem;
  font-weight: 700;
}

.form-control,
.form-select {
  border-radius: 8px;
}

.password-wrap {
  position: relative;
}

.password-wrap .toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--sf-muted);
}

.mobile-tabs {
  display: none;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: 66px; }
  .sidebar { display: none; }
  .main { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-tabs {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--sf-border);
  }
  .mobile-tabs a {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 58px;
    color: var(--sf-muted);
    font-size: .72rem;
  }
  .mobile-tabs a.active { color: var(--sf-primary); font-weight: 800; }
  .table-responsive-cards table,
  .table-responsive-cards thead,
  .table-responsive-cards tbody,
  .table-responsive-cards th,
  .table-responsive-cards td,
  .table-responsive-cards tr { display: block; }
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tr {
    margin: 10px;
    border: 1px solid var(--sf-border);
    border-radius: 8px;
    padding: 10px;
  }
  .table-responsive-cards td {
    border: 0;
    white-space: normal;
    padding: 6px 0;
  }
  .table-responsive-cards td::before {
    content: attr(data-label);
    display: block;
    color: var(--sf-muted);
    font-size: .75rem;
    font-weight: 700;
  }
}
