.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(10, 102, 194, 0.25);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn.is-loading {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn.is-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: rgba(255, 255, 255, 1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  color: var(--muted);
}

.input,
.select,
.textarea {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.15);
}

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

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  display: none;
}

.form-field.is-error .input,
.form-field.is-error .select,
.form-field.is-error .textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

.form-field.is-error .form-error {
  display: block;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-footer {
  margin-top: var(--space-4);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-verified {
  background: rgba(10, 102, 194, 0.12);
  border-color: rgba(10, 102, 194, 0.25);
  color: var(--primary);
}

.verified-check,
.verified-check-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: text-top;
}

.pro-star-icon {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 6px;
  vertical-align: text-top;
}

.badge-license {
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.25);
  color: var(--success);
}

.badge-status {
  background: rgba(178, 106, 0, 0.12);
  border-color: rgba(178, 106, 0, 0.25);
  color: var(--warning);
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 var(--space-6);
  height: var(--header-height);
  gap: var(--space-4);
  flex-wrap: nowrap;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.header-search {
  position: relative;
  flex: 1 1 420px;
  min-width: 220px;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-50%);
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--muted);
  right: -6px;
  bottom: -4px;
  transform: rotate(45deg);
  border-radius: 999px;
}

.logo {
  font-family: var(--font-head);
  font-size: var(--text-lg);
  letter-spacing: 0.01em;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header .logo-mark {
  color: #f4c542;
}

.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px 8px 40px;
  width: 100%;
}

.header-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  margin-left: auto;
  flex-shrink: 0;
}

.header-link {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.header-link:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
  border-color: var(--border);
}

.nav-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.nav-label {
  font-size: var(--text-sm);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.header-actions .dropdown {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.header-menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 999px;
  height: 34px;
  padding: 0 12px;
  font-size: var(--text-sm);
  color: var(--text);
  align-items: center;
  gap: 6px;
}

.header-menu-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.header-actions .btn.btn-ghost {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  font-weight: 700;
  flex: 0 0 34px;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.34);
  color: #ffffff;
}

.avatar-btn .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.icon-bar {
  display: none;
  align-items: center;
  gap: var(--space-2);
}

.icon-link {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-decoration: none;
}

.icon-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 999px;
}

.header-link .icon-badge {
  top: -6px;
  right: -6px;
}

@media (max-width: 768px) {
  .header {
    height: auto;
    position: sticky;
    top: 0;
  }

  .header-inner {
    height: auto;
    padding: 10px 12px 10px;
    gap: var(--space-3);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "search search";
    align-items: center;
  }

  .header-brand {
    grid-area: brand;
  }

  .header-actions {
    grid-area: actions;
    display: inline-flex;
    align-items: center;
    justify-self: end;
    gap: 8px;
    min-width: 0;
    align-self: center;
  }

  .header-actions .btn {
    height: 40px;
    padding: 0 14px;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1;
    border-radius: 999px;
  }

  .header-actions .btn.btn-secondary {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions .badge-verified {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-search {
    grid-area: search;
    width: 100%;
    max-width: none;
  }

  .header-nav {
    display: none;
  }
}

.icon-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.sidebar {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 0;
  height: calc(100vh - var(--header-height));
  padding: var(--space-6) var(--space-4);
  width: var(--sidebar-width);
  box-shadow: var(--shadow-sm);
  position: fixed;
  top: var(--header-height);
  left: 0;
  z-index: 10;
  overflow-y: auto;
}

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    top: auto;
    left: auto;
    overflow: visible;
  }
}

.role-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.role-avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #d9e5f2;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-link {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-link.active,
.sidebar-link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

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

.pagination {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.pagination .page {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.pagination .page.active {
  background: var(--surface-3);
  color: var(--text);
}

.skeleton {
  background: linear-gradient(90deg, #f0f3f6, #e6ebf0, #f0f3f6);
  border-radius: var(--radius-md);
  animation: shimmer 1.6s infinite;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tab-list {
  display: flex;
  gap: var(--space-2);
}

.tab-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab-button.active {
  background: var(--surface-3);
  color: var(--text);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  z-index: 30;
}

.dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.progress {
  background: var(--surface-3);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #3f8dde);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal-panel {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  max-width: 560px;
  width: 100%;
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.media-viewer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.media-viewer.open {
  display: grid;
  place-items: center;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 30, 0.75);
}

.media-viewer-panel {
  position: relative;
  width: min(84vw, 980px);
  height: min(86vh, 760px);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.media-viewer-stage {
  background: #0b1220;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  height: 100%;
}

.media-viewer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0b1220;
}

.media-viewer-content.is-document {
  overflow: auto;
}

.media-viewer-content.is-image {
  padding: 10px;
}

.media-viewer-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.media-viewer-doc {
  width: 100%;
  height: 100%;
  border: none;
  background: #0b1220;
}

.media-viewer-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(2, 6, 23, 0.92);
  color: #e2e8f0;
  font-size: 13px;
}

.media-viewer-title {
  font-weight: 600;
}

.media-viewer-meta {
  color: #94a3b8;
  font-size: 12px;
}

.media-viewer-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #0f172a;
  color: #e2e8f0;
  cursor: pointer;
  z-index: 2;
}

.media-viewer-nav {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.media-viewer-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  gap: 8px;
  z-index: 2;
}

.media-viewer-zoom button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 720px) {
  .media-viewer.open {
    place-items: stretch;
  }

  .media-viewer-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .media-viewer-stage {
    height: 100%;
    border-radius: 0;
    border: 0;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .media-viewer-content.is-image {
    padding: 8px 8px 4px;
  }

  .media-viewer-img {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 140px);
  }

  .media-viewer-close {
    top: calc(env(safe-area-inset-top) + 12px);
    right: 12px;
    width: 42px;
    height: 42px;
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.5);
  }

  .media-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .media-viewer-prev {
    left: 8px;
  }

  .media-viewer-next {
    right: 8px;
  }

  .media-viewer-caption {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .media-viewer-zoom {
    right: 12px;
    bottom: calc(56px + env(safe-area-inset-bottom));
  }

  .media-viewer-zoom button {
    width: 34px;
    height: 34px;
  }
}

.toast-root {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 60;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #ffffff;
  min-width: 220px;
  box-shadow: var(--shadow-sm);
}

.toast.success {
  border-color: rgba(46, 125, 50, 0.4);
}

.toast.error {
  border-color: rgba(198, 40, 40, 0.4);
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.password-meter {
  display: grid;
  gap: 8px;
  margin-top: -4px;
}

.password-meter-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.password-meter-bar > span {
  display: block;
  height: 100%;
  width: 8%;
  border-radius: 999px;
  transition: width 0.2s ease, background-color 0.2s ease;
  background: var(--danger);
}

.password-meter-bar > span.is-weak {
  background: #d14343;
}

.password-meter-bar > span.is-medium {
  background: #d28d00;
}

.password-meter-bar > span.is-strong {
  background: #2e7d32;
}

.password-meter-label {
  font-size: var(--text-xs);
}

.password-meter-label.is-weak {
  color: #d14343;
}

.password-meter-label.is-medium {
  color: #9a6a00;
}

.password-meter-label.is-strong {
  color: #2e7d32;
}

.password-meter-rules {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.password-meter-rules li.is-ok {
  color: #2e7d32;
}
