:root {
  --navy: #001b3d;
  --navy-mid: #002855;
  --navy-light: #003366;
  --bg: #eef2f8;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-input: #d1d5db;
  --brand-navy: #001b3d;
  --brand: #0052ea;
  --brand-hover: #0046c7;
  --brand-teal: #2dd4bf;
  --brand-soft: #eff6ff;
  --brand-dark: #001b3d;
  --danger: #dc2626;
  --shadow-sm: 0 1px 3px rgba(0, 27, 61, 0.06);
  --shadow: 0 4px 20px rgba(0, 27, 61, 0.08);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background: #eef2f7;
}

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

.btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 82, 234, 0.3);
  transition: background 0.15s;
}

.btn.primary:hover {
  background: var(--brand-hover);
}

.app-body {
  background:
    radial-gradient(circle at 12% 18%, rgba(191, 219, 254, 0.45) 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(186, 230, 253, 0.35) 0%, transparent 38%),
    var(--bg);
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  position: relative;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 50%, var(--navy-light) 100%);
  border-right: none;
  color: #fff;
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 16px;
  width: 64px;
  height: 64px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.5px, transparent 1.5px);
  background-size: 10px 10px;
  opacity: 0.6;
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: block;
  padding: 4px 8px 18px;
  text-decoration: none;
  margin-bottom: 6px;
}

.brand-logo-wrap {
  display: inline-block;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 160px;
  height: auto;
}

.brand-logo.hero {
  max-width: 360px;
}

.brand-logo.mobile {
  max-width: 260px;
}

.brand span,
.user-chip span,
.stat-hint,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: .82rem;
}

.sidebar-nav {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  padding: 0 4px;
}

.nav-label {
  padding: 14px 12px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.nav-item {
  position: relative;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 400;
  font-size: 0.875rem;
  transition: background 0.12s, color 0.12s;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #60a5fa;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 500;
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.14);
  color: var(--brand-teal);
}

.nav-item.disabled {
  opacity: .45;
  pointer-events: none;
}

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

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state.compact {
  padding: 28px 12px;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.empty-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.form11-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.form11-nav,
.form11-panel {
  min-height: 520px;
}

.form11-nav {
  background: var(--card);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.form11-nav-head h2 {
  margin: 6px 0 0;
  font-size: 1.2rem;
}

.form11-sections {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.form11-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}

.form11-link small {
  color: var(--muted);
  font-size: .75rem;
}

.form11-link:hover,
.form11-link.active {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  font-size: .9rem;
  font-weight: 600;
}

.form-grid input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

.summary-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-box div {
  background: var(--card-soft);
  border-radius: 12px;
  padding: 16px;
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-page {
  max-width: 960px;
}

.client-form {
  display: grid;
  gap: 28px;
}

.form-section h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.form-section label em {
  color: var(--danger);
  font-style: normal;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-grid textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
}

.error-list {
  margin: 0;
  padding-left: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.btn-sm {
  padding: 8px 12px;
  font-size: .85rem;
  border-radius: 10px;
}

.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
}

.user-chip strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
}

.user-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .avatar,
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.app-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.header-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  place-items: center;
  padding: 0;
}

.header-menu-btn svg {
  width: 20px;
  height: 20px;
}

.header-divider {
  display: none;
  width: 1px;
  height: 28px;
  background: var(--line);
  flex-shrink: 0;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 520px;
}

.header-search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 52px 10px 42px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.header-search input:focus {
  outline: none;
  border-color: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(0, 82, 234, 0.08);
}

.header-search input::placeholder {
  color: #94a3b8;
}

.header-search-kbd {
  position: absolute;
  right: 12px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  line-height: 1.3;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s;
}

.header-icon-btn:hover {
  background: var(--bg-soft);
}

.header-icon-btn svg {
  width: 18px;
  height: 18px;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.header-profile-text {
  text-align: right;
  line-height: 1.25;
}

.header-profile-text strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.header-profile-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0d9488, #14b8a6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.header-signout {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 2px;
  transition: color 0.12s;
}

.header-signout:hover {
  color: var(--text);
}

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-navy);
}

.main {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1200px;
  width: 100%;
}

.main.dashboard-main {
  max-width: none;
  padding: 0;
}

.main.form11-main {
  max-width: none;
  padding: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid #a7f3d0;
}

.pill.soft {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: #bfdbfe;
}

.pill.inactive {
  background: #f1f5f9;
  color: #64748b;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.alert.success {
  background: #ecfdf5;
  color: #065f46;
}

.alert.error {
  background: #fef2f2;
  color: #991b1b;
}

.stats-grid,
.panel-grid {
  display: grid;
  gap: 20px;
}

.stat-card,
.panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}

.panel-card {
  transition: box-shadow 0.15s;
}

.panel-card:hover {
  box-shadow: var(--shadow);
}

.panel-head h2,
.panel-card h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand-navy);
}

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

.panel-card.accent {
  background: linear-gradient(160deg, #fff 0%, #f0f7ff 100%);
  border-color: #bfdbfe;
}

.panel-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.panel-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.stat-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--brand-navy);
}

.stat-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.mini-metrics div {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.mini-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.mini-metrics strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 2px;
  color: var(--brand-navy);
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.auth-form input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 82, 234, 0.12);
}

.checklist {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: var(--text-secondary);
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .header-menu-btn { display: grid; }
  .header-divider { display: block; }
  .header-search { max-width: none; }
  .header-search-kbd { display: none; }
  .header-profile-text { display: none; }
  .form11-shell { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.form-grid select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.tiny { font-size: .78rem; margin-top: 4px; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal-card { width: min(640px, 100%); max-height: 90vh; overflow: auto; }

.cert-tabs { display: flex; gap: 8px; margin: 8px 0 18px; }
.cert-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.cert-tab.is-active { background: #0f766e; color: #fff; border-color: #0f766e; }
.cert-pane .panel-head { padding: 0 0 16px; }
.field { display: grid; gap: 8px; font-size: .9rem; font-weight: 600; margin-bottom: 14px; }
.field input, .field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 400;
}

.field[hidden], [hidden] { display: none !important; }

.form11-main {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.form11-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  align-items: stretch;
}
.form11-nav,
.form11-panel {
  min-height: 0;
  border-radius: 0;
  box-shadow: none;
}
.form11-nav {
  background: #f8fafc;
  border-right: 1px solid var(--line);
  padding: 22px 16px 32px;
  overflow: auto;
}
.form11-nav-head h2 {
  font-size: 1.15rem;
  margin: 4px 0 6px;
}
.form11-sections { gap: 4px; margin-top: 16px; }
.form11-link {
  padding: 10px 12px;
  font-size: .92rem;
  border-radius: 10px;
}
.form11-panel {
  background: #fff;
  padding: 28px 36px 48px;
  overflow: auto;
}
.form11-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.form11-panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.75rem;
}
.form11-form {
  max-width: 920px;
}
.form11-form label {
  font-size: .95rem;
}
.form11-form input,
.form11-form select {
  min-height: 46px;
}

/* Form 11 panels */
.f11-block {
  max-width: 980px;
  margin: 0 0 28px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
.f11-block:last-of-type { border-bottom: 0; }
.f11-block h3 { margin: 0 0 14px; font-size: 1.15rem; }
.f11-block h4 { margin: 18px 0 10px; font-size: .95rem; color: var(--muted); font-weight: 700; }
.form11-form.form-grid .f11-choice,
.form-grid .f11-choice {
  display: flex !important;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  grid-column: 1 / -1;
}
.f11-radios { display: flex; gap: 16px; font-weight: 500; white-space: nowrap; }
.f11-radios label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.form11-form textarea,
.form11-page-form textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  width: 100%;
}
.f11-inline {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
}
.form11-panel .alert { max-width: 980px; }
.form11-page-form .form-actions { max-width: 980px; }

.form11-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

