@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

/* ═══════════════════════════════════════════════════════════════════
   FLOWBYTE IDENTITY — DESIGN SYSTEM
   Modern · Clean · Enterprise
═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  --accent:           #2563EB;
  --accent-hover:     #1D4ED8;
  --accent-active:    #1E40AF;
  --accent-subtle:    rgba(37, 99, 235, 0.07);
  --accent-border:    rgba(37, 99, 235, 0.18);

  --success:          #059669;
  --success-subtle:   rgba(5, 150, 105, 0.08);
  --success-border:   rgba(5, 150, 105, 0.2);
  --warning:          #D97706;
  --warning-subtle:   rgba(217, 119, 6, 0.08);
  --danger:           #DC2626;
  --danger-hover:     #B91C1C;
  --danger-subtle:    rgba(220, 38, 38, 0.08);
  --danger-border:    rgba(220, 38, 38, 0.2);

  --sidebar-width:    236px;

  --bg:               #F7F8FA;
  --surface:          #FFFFFF;

  --border:           #E4E7EC;
  --border-strong:    #C8CDD8;

  --text-primary:     #101828;
  --text-secondary:   #667085;
  --text-muted:       #98A2B3;
  --text-on-accent:   #FFFFFF;

  --header-height:    52px;
  --footer-height:    40px;
  --header-bg:        #FFFFFF;
  --header-border:    #E4E7EC;
  --footer-bg:        #FFFFFF;
  --footer-border:    #E4E7EC;

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px -4px rgba(16, 24, 40, 0.14), 0 4px 10px rgba(16, 24, 40, 0.07);

  --font-display: 'Outfit', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* ── Fluent token overrides ── */
  --body-font: var(--font-body);
  --type-ramp-base-font-size: 14px;
  --accent-fill-rest:           var(--accent);
  --accent-fill-hover:          var(--accent-hover);
  --accent-fill-active:         var(--accent-active);
  --accent-foreground-rest:     var(--accent);
  --accent-foreground-hover:    var(--accent-hover);
  --foreground-on-accent-rest:  var(--text-on-accent);
  --foreground-on-accent-hover: var(--text-on-accent);
  --neutral-fill-layer-rest:    var(--bg);
  --neutral-fill-rest:          #F2F4F7;
  --neutral-fill-hover:         #E9ECF1;
  --neutral-fill-active:        #D8DCE5;
  --neutral-fill-stealth-rest:  transparent;
  --neutral-fill-stealth-hover: rgba(16, 24, 40, 0.04);
  --neutral-fill-stealth-active:rgba(16, 24, 40, 0.08);
  --neutral-foreground-rest:    var(--text-primary);
  --neutral-foreground-hint:    var(--text-secondary);
  --neutral-stroke-rest:        var(--border);
  --neutral-stroke-hover:       var(--border-strong);
  --neutral-stroke-active:      var(--border-strong);
  --neutral-layer-1: var(--surface);
  --neutral-layer-2: #F7F8FA;
  --neutral-layer-3: #F2F4F7;
  --neutral-layer-4: var(--surface);
}

/* ─── Dark Mode ──────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:               #0D1117;
  --surface:          #161B22;
  --border:           #30363D;
  --border-strong:    #484F58;
  --text-primary:     #E6EDF3;
  --text-secondary:   #8B949E;
  --text-muted:       #6E7681;
  --header-bg:        #161B22;
  --header-border:    #30363D;
  --footer-bg:        #161B22;
  --footer-border:    #30363D;
  --neutral-fill-layer-rest: #0D1117;
  --neutral-fill-rest:       #1C2128;
  --neutral-fill-hover:      #21262D;
  --neutral-fill-active:     #2D333B;
  --neutral-foreground-rest: #E6EDF3;
  --neutral-foreground-hint: #8B949E;
  --neutral-stroke-rest:     #30363D;
  --neutral-layer-1:         #161B22;
  --neutral-layer-2:         #1C2128;
  --neutral-layer-3:         #21262D;
  --neutral-layer-4:         #161B22;
}

/* ═══════════════════════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: 0;
  margin: 0;
  color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Header ─── */
.app-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow-xs);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none !important;
  user-select: none;
}

.header-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--text-primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.header-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  line-height: 1;
}

.header-brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  padding: 2px 8px;
  border-radius: 4px;
}

.header-spacer { flex: 1; }

.header-company-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--neutral-fill-rest);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* ─── Body ─── */
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
}

/* ─── Footer ─── */
.app-footer {
  height: var(--footer-height);
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.footer-brand-accent { color: var(--accent); }
.footer-spacer { flex: 1; }

.footer-copy {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE LAYOUT
═══════════════════════════════════════════════════════════════════ */
.page-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 36px 28px;
}

.page-header { margin-bottom: 28px; }

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  height: 34px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.13s, border-color 0.13s, box-shadow 0.13s, transform 0.09s;
  white-space: nowrap;
  user-select: none;
  text-decoration: none !important;
  line-height: 1;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.30);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--neutral-fill-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--neutral-fill-hover);
  color: var(--text-primary);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-subtle);
  color: var(--danger);
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 5px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn svg { flex-shrink: 0; }

/* ─── Action Bar ─── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.action-bar-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════
   FORM INPUTS
═══════════════════════════════════════════════════════════════════ */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.13s, box-shadow 0.13s;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2398A2B3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 30px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:disabled,
.form-select:disabled { opacity: 0.55; cursor: not-allowed; background: var(--neutral-fill-rest); }

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-hint { font-size: 12px; color: var(--text-muted); }

/* ─── Checkbox ─── */
.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--neutral-fill-rest);
  cursor: pointer;
  user-select: none;
}

.form-checkbox-row:hover { background: var(--neutral-fill-hover); }

.form-checkbox {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}

.form-checkbox:checked { background: var(--accent); border-color: var(--accent); }

.form-checkbox:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e") center/contain no-repeat;
}

.form-checkbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-checkbox-label {
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   SEARCH
═══════════════════════════════════════════════════════════════════ */
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-box-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input {
  height: 34px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  width: 280px;
  transition: border-color 0.13s, box-shadow 0.13s;
  -webkit-appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.search-input::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   SPINNER / LOADING
═══════════════════════════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-border); }
.badge-success .badge-dot { background: var(--success); }
.badge-neutral { background: var(--neutral-fill-rest); color: var(--text-muted); border: 1px solid var(--border); }
.badge-neutral .badge-dot { background: var(--text-muted); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-danger { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-border); }

/* ═══════════════════════════════════════════════════════════════════
   FLUENT DATAGRID OVERRIDES
═══════════════════════════════════════════════════════════════════ */
.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

fluent-data-grid {
  width: 100%;
  border: none !important;
  background: var(--surface) !important;
  --neutral-layer-1: var(--surface);
}

fluent-data-grid-row {
  border-bottom: 1px solid var(--border) !important;
}

fluent-data-grid-row:last-child {
  border-bottom: none !important;
}

fluent-data-grid-row[row-type="header"] {
  background: #F9FAFB !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] fluent-data-grid-row[row-type="header"] {
  background: var(--neutral-layer-2) !important;
}

fluent-data-grid-row:not([row-type="header"]):hover {
  background: var(--neutral-fill-rest) !important;
}

fluent-data-grid-cell[cell-type="columnheader"] {
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.07em !important;
  color: var(--text-muted) !important;
  padding: 9px 16px !important;
}

fluent-data-grid-cell {
  padding: 11px 16px !important;
  font-size: 13.5px !important;
  color: var(--text-primary) !important;
  align-items: center !important;
  border: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FLUENT DIALOG OVERRIDES
═══════════════════════════════════════════════════════════════════ */
fluent-dialog::part(overlay) {
  background: rgba(16, 24, 40, 0.45) !important;
  backdrop-filter: blur(4px) !important;
}

fluent-dialog::part(dialog) {
  border-radius: var(--radius-xl) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  background: var(--surface) !important;
}

/* ─── Dialog structural helpers ─── */
.dialog-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.dialog-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.dialog-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 64vh;
  overflow-y: auto;
}

.dialog-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Import email chips ─── */
.email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}

.email-chip-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition: background 0.12s;
}

.email-chip-remove:hover { background: rgba(255, 255, 255, 0.35); }

/* ─── Progress bar ─── */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── Import result items ─── */
.import-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.import-result-success {
  background: var(--success-subtle);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.import-result-error {
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.import-result-message {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════
   FLUENT PAGINATOR OVERRIDES
═══════════════════════════════════════════════════════════════════ */
.pagination-wrap {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════
   STATES
═══════════════════════════════════════════════════════════════════ */
.error-state {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--danger-subtle);
  border: 1px solid var(--danger-border);
  font-size: 13.5px;
  color: var(--danger);
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   HOME — DASHBOARD CARDS
═══════════════════════════════════════════════════════════════════ */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.nav-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  box-shadow: var(--shadow-xs);
  text-decoration: none !important;
}

.nav-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.nav-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-card-body { flex: 1; min-width: 0; }

.nav-card-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0;
  margin-bottom: 3px;
}

.nav-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.nav-card-arrow {
  font-size: 15px;
  color: var(--text-muted);
  transition: transform .15s, color .15s;
  flex-shrink: 0;
}

.nav-card:hover .nav-card-arrow { transform: translateX(3px); color: var(--accent); }

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  margin-bottom: 14px;
}

.welcome-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.welcome-badge-text { font-size: 12px; font-weight: 500; color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════
   MANAGE ACCOUNT LAYOUT
═══════════════════════════════════════════════════════════════════ */
.manage-layout {
  padding: 36px 28px;
  max-width: 900px;
  margin: 0 auto;
}

.manage-layout-header { margin-bottom: 24px; }

.manage-layout-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.manage-layout-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.manage-layout-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 28px;
}

.manage-layout-body {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 36px;
  align-items: start;
}

.manage-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: sticky;
  top: 20px;
}

.manage-nav-link {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 450;
  color: var(--text-secondary);
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0;
}

.manage-nav-link:hover { background: var(--neutral-fill-hover); color: var(--text-primary); }

.manage-nav-link.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 550;
}

/* ═══════════════════════════════════════════════════════════════════
   ALERT / ERROR
═══════════════════════════════════════════════════════════════════ */
.alert {
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  font-size: 13.5px;
}

.alert-danger {
  background: var(--danger-subtle) !important;
  border-color: var(--danger-border) !important;
  border-left-color: var(--danger) !important;
  color: var(--danger) !important;
}

.alert-success {
  background: var(--success-subtle) !important;
  border-color: var(--success-border) !important;
  border-left-color: var(--success) !important;
  color: var(--success) !important;
}

/* ── Manage account form styles ── */
.manage-section { margin-bottom: 32px; }

.manage-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.manage-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.manage-submit {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s;
}

.manage-submit:hover { background: var(--accent-hover); }

/* Manage alerts */
.manage-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.manage-alert svg { flex-shrink: 0; margin-top: 1px; }
.manage-alert strong { display: block; margin-bottom: 2px; }
.manage-alert-warning {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}
.manage-alert-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}
.manage-alert-warning a, .manage-alert-danger a { color: inherit; font-weight: 600; }

/* Manage info cards */
.manage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--surface);
}
.manage-card-header { display: flex; flex-direction: column; gap: 3px; }
.manage-card-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.manage-card-desc { font-size: 13px; color: var(--text-secondary); margin: 0; }
.manage-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ═══════════════════════════════════════════════════════════════════
   BLAZOR ERROR / LOADING PROGRESS
═══════════════════════════════════════════════════════════════════ */
#blazor-error-ui {
  background: #FFFBEB;
  border-top: 2px solid #F59E0B;
  bottom: 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  display: none;
  left: 0;
  padding: 12px 20px;
  position: fixed;
  width: 100%;
  z-index: 10000;
  font-family: var(--font-body);
  font-size: 13px;
  color: #92400E;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  font-style: normal;
}

#blazor-error-ui .dismiss:hover { opacity: 1; }

.blazor-error-boundary {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: #991B1B;
  font-family: var(--font-body);
}

.blazor-error-boundary::before { content: "An error has occurred. "; font-weight: 600; }

.loading-progress {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  margin: 20vh auto 1.5rem auto;
}

.loading-progress circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 5;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.08s ease;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  inset: calc(20vh + 5rem) 0 auto 0.2rem;
}

.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGES (Login, Register)
═══════════════════════════════════════════════════════════════════ */
.auth-shell {
  min-height: calc(100dvh - var(--header-height) - var(--footer-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-xl);
  width: 420px;
  max-width: 100%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 40px;
  height: 40px;
  background: var(--text-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto 16px auto;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-field { margin-bottom: 18px; }

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.auth-input::placeholder { color: var(--text-muted); }

.auth-submit {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s, box-shadow 0.13s;
  margin-top: 6px;
}

.auth-submit:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.auth-forgot {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}

.auth-forgot a { font-size: 13px; color: var(--accent); text-decoration: none; }
.auth-forgot a:hover { text-decoration: underline; }

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-remember input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.auth-remember label {
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-divider span {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.auth-footer a { color: var(--accent); font-weight: 500; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.text-danger { font-size: 12px; color: var(--danger); margin-top: 4px; display: block; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .search-input { width: 200px; }
  .page-wrap { padding: 20px 16px; }
  .manage-layout { padding: 20px 16px; }
  .manage-layout-body { grid-template-columns: 1fr; }
  .app-body { overflow: visible; }
  .app-main { overflow-y: auto; }
}

/* ==========================================================================
   SHADCN-STYLE REDESIGN LAYER
   Compact neutral surfaces, crisp borders, and token-driven controls.
   NavMenu.razor keeps its scoped styles.
========================================================================== */
:root {
  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-active: #09090b;
  --accent-subtle: #f4f4f5;
  --accent-border: #d4d4d8;

  --success: #16a34a;
  --success-subtle: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #ca8a04;
  --warning-subtle: #fefce8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-subtle: #fef2f2;
  --danger-border: #fecaca;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-subtle: #f4f4f5;
  --surface-muted: #f8fafc;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --ring: rgba(24, 24, 27, 0.16);

  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-on-accent: #fafafa;

  --header-height: 56px;
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-border: #e4e4e7;
  --footer-bg: #ffffff;
  --footer-border: #e4e4e7;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.18);

  --font-display: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --accent-fill-rest: var(--accent);
  --accent-fill-hover: var(--accent-hover);
  --accent-fill-active: var(--accent-active);
  --accent-foreground-rest: var(--accent);
  --accent-foreground-hover: var(--accent-hover);
  --foreground-on-accent-rest: var(--text-on-accent);
  --foreground-on-accent-hover: var(--text-on-accent);
  --neutral-fill-layer-rest: var(--bg);
  --neutral-fill-rest: var(--surface-subtle);
  --neutral-fill-hover: #e4e4e7;
  --neutral-fill-active: #d4d4d8;
  --neutral-fill-stealth-rest: transparent;
  --neutral-fill-stealth-hover: var(--surface-subtle);
  --neutral-fill-stealth-active: #e4e4e7;
  --neutral-foreground-rest: var(--text-primary);
  --neutral-foreground-hint: var(--text-muted);
  --neutral-stroke-rest: var(--border);
  --neutral-stroke-hover: var(--border-strong);
  --neutral-stroke-active: var(--border-strong);
  --neutral-layer-1: var(--surface);
  --neutral-layer-2: var(--surface-subtle);
  --neutral-layer-3: #e4e4e7;
  --neutral-layer-4: var(--surface);
}

html, body {
  font-family: var(--font-body);
  letter-spacing: 0;
  color: var(--text-primary);
  background:
    linear-gradient(180deg, rgba(244, 244, 245, 0.7) 0, rgba(250, 250, 250, 0) 280px),
    var(--bg);
}

h1, h2, h3, h4, h5, h6,
.page-title,
.nav-card-title,
.dialog-title,
.auth-title,
.manage-layout-title,
.manage-section-title {
  font-family: var(--font-display);
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 4px;
}

.app-header {
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.header-brand-icon,
.auth-logo {
  background: var(--accent);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.header-brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.header-brand-badge,
.header-company-pill,
.welcome-badge {
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.header-company-pill {
  height: 30px;
}

.app-main {
  background:
    radial-gradient(circle at top left, rgba(228, 228, 231, 0.55), transparent 360px),
    var(--bg);
}

.app-footer {
  border-top: 1px solid var(--border);
  box-shadow: none;
}

.page-wrap {
  max-width: 1280px;
  padding: 32px;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}

.page-title {
  font-size: 26px;
  font-weight: 650;
  line-height: 1.15;
}

.page-subtitle {
  max-width: 720px;
  color: var(--text-muted);
}

.action-bar {
  min-height: 54px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(10px);
}

.btn,
.auth-submit,
.manage-submit,
.fluent-button,
button[type="submit"] {
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}

.btn {
  height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-primary,
.auth-submit,
.manage-submit {
  background: var(--accent);
  color: var(--text-on-accent);
  border: 1px solid var(--accent);
}

.btn-primary:hover:not(:disabled),
.auth-submit:hover,
.manage-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.btn-ghost,
.btn-danger-ghost {
  color: var(--text-muted);
}

.btn-icon {
  width: 34px;
  height: 34px;
}

.form-label,
.auth-label {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea,
.search-input,
.auth-input,
.form-control,
.form-select.form-control {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--surface);
  box-shadow: none;
  font-size: 13px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus,
.auth-input:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.search-input {
  width: min(320px, 38vw);
}

.form-checkbox-row,
.user-select-item {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-md);
}

.form-checkbox-row:hover,
.user-select-item:hover {
  background: var(--surface-subtle);
}

.form-checkbox {
  border-color: var(--border-strong);
}

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

fluent-data-grid {
  background: var(--surface) !important;
}

fluent-data-grid-row[row-type="header"] {
  background: var(--surface-subtle) !important;
}

fluent-data-grid-cell[cell-type="columnheader"] {
  color: var(--text-muted) !important;
  font-size: 11px !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

fluent-data-grid-cell {
  color: var(--text-primary) !important;
  font-size: 13px !important;
}

.pagination-wrap {
  justify-content: flex-end;
  color: var(--text-muted);
}

.badge {
  border-radius: 999px;
  font-size: 12px;
}

.badge-success {
  background: var(--success-subtle);
  color: #15803d;
}

.badge-neutral {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

fluent-dialog::part(overlay) {
  background: rgba(9, 9, 11, 0.48) !important;
}

fluent-dialog::part(dialog) {
  border-radius: var(--radius-xl) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}

.dialog-header {
  padding: 22px 24px 16px;
}

.dialog-title {
  font-size: 18px;
  font-weight: 650;
}

.dialog-subtitle,
.form-hint,
.auth-subtitle,
.manage-layout-subtitle {
  color: var(--text-muted);
}

.dialog-body {
  gap: 16px;
}

.dialog-footer {
  background: var(--surface-muted);
}

.empty-state,
.error-state,
.loading-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.error-state {
  border-color: var(--danger-border);
  background: var(--danger-subtle);
}

.grid-container {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.page-note {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
}

.info-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 620px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.info-panel-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--accent);
}

.info-panel-title {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.info-panel-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.detail-card {
  display: flex;
  min-height: 96px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.nav-card {
  min-height: 128px;
  align-items: flex-start;
  border-radius: var(--radius-lg);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.nav-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.nav-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
}

.nav-card-title {
  font-size: 14px;
  font-weight: 600;
}

.nav-card-desc {
  color: var(--text-muted);
}

.welcome-badge-dot {
  background: var(--accent);
}

.welcome-badge-text {
  color: var(--text-secondary);
}

.auth-shell {
  align-items: flex-start;
  padding: 56px 20px;
  background:
    radial-gradient(circle at top, rgba(228, 228, 231, 0.75), transparent 360px),
    var(--bg);
}

.auth-card {
  width: 420px;
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-header {
  margin-bottom: 24px;
}

.auth-title {
  font-size: 22px;
  font-weight: 650;
}

.auth-input {
  padding: 8px 11px;
}

.auth-submit,
.manage-submit {
  height: 38px;
}

.auth-divider {
  margin: 20px 0;
}

.manage-layout {
  max-width: 1040px;
  padding: 32px;
}

.manage-layout-header {
  margin-bottom: 18px;
}

.manage-layout-title {
  font-size: 24px;
  font-weight: 650;
}

.manage-layout-divider {
  margin-bottom: 20px;
  background: var(--border);
}

.manage-layout-body {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
}

.manage-content {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.manage-section {
  margin-bottom: 0;
}

.manage-section-title {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 650;
}

.manage-card,
.alert,
.manage-alert {
  border-radius: var(--radius-lg);
  border-color: var(--border);
  background: var(--surface);
}

.breadcrumb {
  margin-bottom: 10px;
}

.breadcrumb-current,
.breadcrumb-sep {
  color: var(--text-muted);
}

.user-select-list {
  border-color: var(--border);
  border-radius: var(--radius-lg);
}

.user-select-item--selected {
  background: var(--surface-subtle);
}

.app-main > h1,
.app-main > h2,
.app-main > p,
.app-main > hr,
.app-main > fluent-grid {
  margin-left: 32px;
  margin-right: 32px;
}

.app-main > h1 {
  margin-top: 32px;
  font-size: 26px;
  font-weight: 650;
}

.app-main > h2 {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 400;
}

.app-main > fluent-grid {
  max-width: 520px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

fluent-text-field,
fluent-button {
  border-radius: var(--radius-md);
}

@media (max-width: 900px) {
  .page-wrap,
  .manage-layout {
    padding: 24px 18px;
  }

  .action-bar {
    align-items: stretch;
  }

  .action-bar .search-box,
  .search-input {
    width: 100%;
  }

  .action-bar-spacer {
    display: none;
  }

  .manage-layout-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-title {
    font-size: 23px;
  }

  .action-bar {
    flex-direction: column;
  }

  .btn,
  .action-bar .form-select {
    width: 100%;
  }
}

/* ==========================================================================
   NATIVE DATA TABLE  (replaces fluent-data-grid)
========================================================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--surface-subtle, #f4f4f5);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-subtle, #f4f4f5);
}

.data-table .col-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.data-table .cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.data-table .cell-muted {
  color: var(--text-muted);
}

.data-table-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ==========================================================================
   MODAL  (replaces fluent-dialog)
========================================================================== */
.fb-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  overflow-y: auto;
}

.fb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(9, 9, 11, 0.48);
  backdrop-filter: blur(4px);
  animation: modal-fade 0.14s ease;
}

.fb-modal-dialog {
  position: relative;
  z-index: 1;
  width: var(--modal-width, 480px);
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-modal-dialog .dialog-header {
  position: relative;
  padding-right: 48px;
}

.fb-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.fb-modal-close:hover {
  background: var(--surface-subtle, #f4f4f5);
  color: var(--text-primary);
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   PAGER  (replaces fluent-paginator)
========================================================================== */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pager-info {
  font-size: 12.5px;
  color: var(--text-muted);
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pager-btn:hover:not(:disabled):not(.active) {
  background: var(--surface-subtle, #f4f4f5);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pager-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  cursor: default;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ==========================================================================
   STATUS PAGE CARD  (account confirmation / error pages)
========================================================================== */
.status-card {
  background: var(--surface);
  width: 440px;
  max-width: 100%;
  padding: 36px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.status-card-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-card-icon.is-info    { background: var(--accent-subtle); color: var(--accent); }
.status-card-icon.is-success { background: var(--success-subtle); color: var(--success); }
.status-card-icon.is-warning { background: var(--warning-subtle); color: var(--warning); }
.status-card-icon.is-danger  { background: var(--danger-subtle);  color: var(--danger); }

.status-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 650;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.status-card-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.status-card-text a {
  color: var(--accent);
  font-weight: 500;
}

.status-card-actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Auth helper: code grid + checkbox row reused on 2FA pages */
.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-checkbox label {
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}


/* ═══════════════════════════════════════════════════════════════════
   APP LAUNCHER (waffle)
   Appended last on purpose: the shadcn redesign layer above re-declares
   :root and would otherwise win. Class names are namespaced fb-launcher-*
   to stay clear of Bootstrap's .dropdown-menu.
═══════════════════════════════════════════════════════════════════ */

/* Per-repo token mapping — the only part of this block that differs between apps. */
.fb-launcher {
  --fbl-surface:    var(--surface);
  --fbl-border:     var(--border);
  --fbl-text:       var(--text-primary);
  --fbl-muted:      var(--text-secondary);
  --fbl-hover:      var(--neutral-fill-stealth-hover, rgba(16, 24, 40, 0.04));
  --fbl-accent:     var(--accent);
  --fbl-radius:     var(--radius-lg);
  --fbl-shadow:     var(--shadow-lg);

  position: relative;
  display: inline-flex;
}

.fb-launcher-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--fbl-muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.fb-launcher-btn:hover,
.fb-launcher-btn.is-open {
  background: var(--fbl-hover);
  border-color: var(--fbl-border);
  color: var(--fbl-text);
}

.fb-launcher-btn:focus-visible {
  outline: 2px solid var(--fbl-accent);
  outline-offset: 2px;
}

.fb-launcher-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: transparent;
  border: none;
  padding: 0;
  cursor: default;
}

.fb-launcher-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 380px;
  max-width: calc(100vw - 24px);
  padding: 10px;
  background: var(--fbl-surface);
  border: 1px solid var(--fbl-border);
  border-radius: var(--fbl-radius);
  box-shadow: var(--fbl-shadow);
}

.fb-launcher-head {
  padding: 2px 6px 8px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fbl-muted);
}

.fb-launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.fb-launcher-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: var(--radius-md, 8px);
  text-decoration: none !important;
  color: var(--fbl-text);
  transition: background 120ms ease;
}

a.fb-launcher-tile:hover {
  background: var(--fbl-hover);
}

a.fb-launcher-tile:focus-visible {
  outline: 2px solid var(--fbl-accent);
  outline-offset: -2px;
}

.fb-launcher-tile.is-current {
  background: var(--fbl-hover);
  cursor: default;
}

.fb-launcher-tile.is-unavailable {
  cursor: default;
  opacity: 0.5;
}

.fb-launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md, 8px);
  /* Fallback tint for browsers without color-mix(); the inline style overrides both. */
  background: var(--fbl-hover);
  color: var(--fbl-accent);
  font-size: 15px;
}

.fb-launcher-monogram {
  font-family: var(--font-display, sans-serif);
  font-size: 14px;
  font-weight: 700;
}

.fb-launcher-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.fb-launcher-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fbl-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-launcher-desc {
  font-size: 11px;
  line-height: 1.3;
  color: var(--fbl-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-launcher-here {
  position: absolute;
  top: 6px;
  right: 7px;
  font-family: var(--font-mono, monospace);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fbl-muted);
}

.fb-launcher-empty {
  padding: 18px 10px 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--fbl-muted);
}

/* Skeleton */
.fb-launcher-tile.is-skeleton .fb-launcher-icon,
.fb-launcher-tile.is-skeleton .fb-launcher-name,
.fb-launcher-tile.is-skeleton .fb-launcher-desc {
  background: var(--fbl-hover);
  border-radius: 4px;
  animation: fb-launcher-pulse 1.4s ease-in-out infinite;
}

.fb-launcher-tile.is-skeleton .fb-launcher-icon { border-radius: var(--radius-md, 8px); }
.fb-launcher-tile.is-skeleton .fb-launcher-name { width: 74px; height: 10px; }
.fb-launcher-tile.is-skeleton .fb-launcher-desc { width: 52px; height: 8px; margin-top: 4px; }

@keyframes fb-launcher-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-launcher-tile.is-skeleton .fb-launcher-icon,
  .fb-launcher-tile.is-skeleton .fb-launcher-name,
  .fb-launcher-tile.is-skeleton .fb-launcher-desc { animation: none; }
}

@media (max-width: 560px) {
  .fb-launcher-panel { width: 300px; padding: 8px; }
  .fb-launcher-grid  { grid-template-columns: minmax(0, 1fr); }
}

/* ─── Applications admin page — launcher metadata ─────────────────── */

.app-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.app-name-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm, 6px);
  background: var(--neutral-fill-rest);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.form-section-label {
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md, 8px);
  background: var(--neutral-fill-layer-rest);
}

.tile-preview .app-name-icon { width: 34px; height: 34px; font-size: 15px; border-radius: var(--radius-md, 8px); }

.tile-preview-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tile-preview-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.tile-preview-desc { font-size: 11px; color: var(--text-secondary); }

@media (max-width: 560px) {
  .form-row { grid-template-columns: minmax(0, 1fr); }
}
