body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: #0b1220;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  gap: 1.5rem;
  transition: width 0.2s ease;
  height: 100vh;
  overflow: hidden;
  flex: 0 0 auto;
}

.sidebar.collapsed,
.sidebar-collapsed .sidebar {
  width: 80px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar.collapsed .sidebar-header,
.sidebar-collapsed .sidebar .sidebar-header {
  justify-content: center;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.9rem;
  color: #e2e8f0;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
  background: #1e293b;
  color: #ffffff;
}

.sidebar-link.active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px #334155;
}

.sidebar-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  background: #1e293b;
  font-weight: 700;
  color: #93c5fd;
  flex-shrink: 0;
}

.sidebar-label {
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: #94a3b8;
}

.sidebar-user-name {
  color: #e2e8f0;
  font-weight: 600;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.9rem;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5f5;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.sidebar-toggle:hover {
  border-color: #64748b;
  color: #ffffff;
}

.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-subtitle,
.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .btn-secondary,
.sidebar-collapsed .sidebar .sidebar-label,
.sidebar-collapsed .sidebar .sidebar-subtitle,
.sidebar-collapsed .sidebar .sidebar-user,
.sidebar-collapsed .sidebar .btn-secondary {
  display: none;
}

.sidebar-title-collapsed {
  display: none;
}

.sidebar.collapsed .sidebar-brand,
.sidebar-collapsed .sidebar .sidebar-brand {
  align-items: center;
  width: 100%;
}

.sidebar.collapsed .sidebar-title-full,
.sidebar-collapsed .sidebar .sidebar-title-full {
  display: none;
}

.sidebar.collapsed .sidebar-title-collapsed,
.sidebar-collapsed .sidebar .sidebar-title-collapsed {
  display: block;
}

.sidebar.collapsed .sidebar-link,
.sidebar-collapsed .sidebar .sidebar-link {
  justify-content: center;
}

.sidebar.collapsed .sidebar-toggle,
.sidebar-collapsed .sidebar .sidebar-toggle {
  justify-content: center;
  padding: 0.5rem;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.9);
  position: relative;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.topbar-breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-link {
  color: #cbd5f5;
  text-decoration: none;
}

.topbar-link:hover {
  color: #93c5fd;
}

.topbar-sep {
  color: #64748b;
}

.topbar-current {
  color: #e2e8f0;
}

.topbar-clock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.95rem;
  font-weight: 600;
  color: #cbd5f5;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.topbar-name {
  color: #e2e8f0;
  font-weight: 600;
}

.topbar-role {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar-role-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.topbar-role-link:hover {
  border-color: #64748b;
  color: #ffffff;
}

.content {
  flex: 1;
  padding: 1.75rem;
  min-height: 0;
  overflow-y: auto;
}

.nav-link {
  color: #cbd5f5;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background: #1e293b;
  color: #ffffff;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 0.45rem 0.9rem;
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  border-color: #64748b;
  color: #ffffff;
}

.btn-danger {
  background: #b91c1c;
  color: #ffffff;
  padding: 0.45rem 0.9rem;
  border-radius: 0.75rem;
}

.btn-link {
  color: #60a5fa;
  font-weight: 600;
}

.btn-link:hover {
  color: #93c5fd;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #cbd5f5;
}

.form-input,
.form-textarea,
.form-select {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  color: #e2e8f0;
  color-scheme: dark;
}

.state-suggest,
.city-suggest {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.state-suggest .form-input,
.city-suggest .form-input {
  padding-right: 2.5rem;
}

.state-suggest-toggle,
.city-suggest-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.5rem;
  border: 1px solid #334155;
  background: #0b1328;
  color: #cbd5f5;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.state-suggest-toggle:hover,
.city-suggest-toggle:hover {
  border-color: #64748b;
  color: #ffffff;
}

.state-suggest-list,
.city-suggest-list {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  background: #0b1224;
  border: 1px solid #1f2a44;
  border-radius: 0.75rem;
  padding: 0.35rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.45);
  z-index: 20;
  display: none;
}

.state-suggest.open .state-suggest-list,
.city-suggest.open .city-suggest-list {
  display: block;
}

.state-suggest-item,
.city-suggest-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e2e8f0;
  padding: 0.45rem 0.6rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.state-suggest-item:hover,
.city-suggest-item:hover {
  background: #1f2a44;
  color: #ffffff;
}

.state-suggest-empty,
.city-suggest-empty {
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7l5 5 5-5' stroke='%23cbd5f5' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.proxy-number-input {
  padding-right: 2.25rem;
}

.proxy-number-input::-webkit-inner-spin-button,
.proxy-number-input::-webkit-outer-spin-button {
  opacity: 0.7;
  filter: invert(0.85) hue-rotate(180deg);
  margin-right: 0.2rem;
}

.form-select::-ms-expand {
  display: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.form-select option {
  background: #0f172a;
  color: #e2e8f0;
}

.form-select option:checked {
  background: #1e293b;
  color: #f8fafc;
}

.card {
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  padding: 1.5rem;
}

.card-title {
  font-size: 0.95rem;
  color: #94a3b8;
}

.card-value {
  margin-top: 0.5rem;
  font-size: 2rem;
  font-weight: 700;
}

.panel {
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  padding: 1.5rem;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
}

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

.fixed-table {
  table-layout: fixed;
}

.fixed-table th:first-child,
.fixed-table td:first-child {
  width: 35%;
}

.fixed-table th:last-child,
.fixed-table td:last-child {
  width: 65%;
}

.fixed-table td {
  word-break: break-word;
}

.resizable-table {
  table-layout: fixed;
}

.resizable-table th,
.resizable-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resizable-table th {
  position: relative;
}

.profiles-table th,
.profiles-table td {
  white-space: nowrap;
  text-overflow: clip;
  overflow: hidden;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  opacity: 1;
}

.col-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(148, 163, 184, 0.35);
  transform: translateX(-50%);
}

.col-resizer:hover {
  background: rgba(148, 163, 184, 0.12);
}

.col-resizer:hover::before {
  width: 2px;
  background: rgba(148, 163, 184, 0.7);
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.8);
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable::after {
  content: "↕";
  margin-left: 0.5rem;
  font-size: 0.65rem;
  color: #64748b;
}

.table th.sortable.sorted-asc::after {
  content: "↑";
  color: #93c5fd;
}

.table th.sortable.sorted-desc::after {
  content: "↓";
  color: #93c5fd;
}

.table td {
  padding: 1rem 1.5rem;
  border-top: 1px solid #1e293b;
  font-size: 0.9rem;
}

.table-compact th,
.table-compact td {
  padding: 0.6rem 0.9rem;
  vertical-align: middle;
}

.proxy-location {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  min-width: 0;
}

.proxy-location-text {
  display: inline-block;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proxy-location-form.is-hidden {
  display: none;
}

.proxy-location-fields {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  position: relative;
  z-index: 30;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.6rem;
  padding: 0.35rem;
}

.proxy-status-detail {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 0.4rem;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: #64748b;
  color: #ffffff;
}

.icon-btn-danger {
  background: #1f0d0d;
  border-color: #4c1d1d;
  color: #fecaca;
}

.icon-btn-danger:hover {
  border-color: #ef4444;
  color: #ffffff;
}

.detail-editing .table td,
.detail-editing .table th {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.table td.profile-cell {
  position: relative;
}

.table td.profile-cell:hover {
  background: rgba(30, 41, 59, 0.55);
}

.table td.profile-cell.editing {
  background: rgba(30, 41, 59, 0.55);
}

.table td.profile-cell .cell-text {
  display: inline-block;
  padding-right: 1.75rem;
}

.table-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-top: 0;
  position: relative;
  min-height: 240px;
}

.table-card-grid.layout-pending {
  visibility: hidden;
}

.table-card-grid.free-layout {
  display: block;
}

.table-card-grid.free-layout .table-card {
  position: absolute;
  flex: none;
  z-index: 1;
}

.table-card-grid.free-layout .table-card.dragging {
  z-index: 10;
}

.table-card {
  flex: 1 1 360px;
  min-width: 320px;
  max-width: 100%;
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  padding: 1rem;
  overflow: auto;
}


.table-card.resizable {
  resize: none;
  position: relative;
}

.table-card.resizable::after {
  content: '';
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 1rem;
  height: 1rem;
  border: 1px solid #1e293b;
  border-top: none;
  border-left: none;
  border-radius: 0 0 1rem 0;
  pointer-events: none;
}

.table-card-grid:not(.free-layout) .table-card.resizable {
  flex: 0 0 auto;
  width: 360px;
}

.table-card.dragging {
  opacity: 0.6;
}

.table-card.drop-target {
  outline: 1px dashed #475569;
  background: rgba(148, 163, 184, 0.12);
}

.table-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.table-card-head.draggable {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.table-card-head.draggable:active {
  cursor: grabbing;
}

.table-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
}

.field-label-edit,
.field-add-form,
.detail-group-input,
.detail-add-group,
.profile-type-select,
.profile-column-add-form,
.profile-type-row,
.detail-type-row,
.detail-tab-input,
.detail-tab-delete {
  display: none;
}

.field-label-display,
.detail-group-label {
  display: block;
}

.table-card.editing .field-label-display,
.detail-editing .field-label-display {
  display: none;
}

.table-card.editing .field-label-edit,
.table-card.editing .field-add-form,
.detail-editing .field-label-edit,
.detail-editing .field-add-form {
  display: flex;
}

.detail-editing .detail-add-group {
  display: block;
}

.detail-editing .detail-group-input {
  display: block;
}

.detail-editing .profile-type-select {
  display: block;
}

.detail-editing .profile-type-row {
  display: flex;
}

.detail-editing .detail-type-row {
  display: flex;
}

.detail-editing .profile-column-add-form {
  display: flex;
}

.detail-editing .profile-field-value .editable-display,
.detail-editing .detail-field-value .editable-display {
  display: none;
}

.profile-field-value .profile-type-select {
  width: 100%;
}

.profile-type-row .profile-type-select {
  width: auto;
  flex: 1 1 auto;
}

.detail-type-row .field-type-select {
  width: auto;
  flex: 1 1 auto;
}

.profile-column-add-form {
  margin-top: 0.75rem;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.profile-column-input {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}

.detail-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-group-input {
  width: 100%;
  max-width: 320px;
}

.detail-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.45rem 1.5rem 0;
  z-index: 2;
}

.detail-panel {
  position: relative;
  border: none;
  background: transparent;
  isolation: isolate;
}

.detail-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--detail-tabs-offset, 0px);
  bottom: 0;
  border: 1px solid #1e293b;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.7);
  pointer-events: none;
  z-index: 0;
}


.detail-tabs {
  background: transparent;
}

.detail-tabs-content {
  padding-top: var(--detail-tabs-offset, 0px);
  position: relative;
  z-index: 1;
}

.detail-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  z-index: 1;
  margin-left: 0;
}

.detail-tab:first-child {
  margin-left: 0;
}

.detail-tab:hover {
  z-index: 2;
}

.detail-tab-button,
.detail-tab-add {
  --tab-bg: #141c2a;
  --tab-border: #2b3a52;
  --tab-cutout: rgba(15, 23, 42, 0.7);
  background: var(--tab-bg);
  border: 1px solid var(--tab-border);
  color: #e2e8f0;
  border-radius: 0.85rem 0.85rem 0.35rem 0.35rem;
  padding: 0.45rem 1.05rem 0.4rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
}

.detail-tab-button::before,
.detail-tab-button::after,
.detail-tab-add::before,
.detail-tab-add::after {
  content: none;
  display: none;
  position: absolute;
  bottom: -1px;
  width: 12px;
  height: 12px;
  background: var(--tab-cutout);
  pointer-events: none;
}

.detail-tab-button::before,
.detail-tab-add::before {
  left: -6px;
  border-top-right-radius: 12px;
  box-shadow: 1px -1px 0 0 var(--tab-border);
}

.detail-tab-button::after,
.detail-tab-add::after {
  right: -6px;
  border-top-left-radius: 12px;
  box-shadow: -1px -1px 0 0 var(--tab-border);
}

.detail-tab-button:hover,
.detail-tab-add:hover {
  border-color: #4b617f;
  color: #ffffff;
  transform: translateY(-1px);
}

.detail-tab.active .detail-tab-button {
  --tab-bg: rgba(15, 23, 42, 0.7);
  --tab-border: #1e293b;
  border-bottom-color: transparent;
  color: #f8fafc;
  box-shadow: none;
  position: relative;
  z-index: 4;
}

.detail-tab.active .detail-tab-button::before,
.detail-tab.active .detail-tab-button::after {
  background: var(--tab-cutout);
}


.detail-tab.active {
  z-index: 3;
}

.detail-tab-add {
  margin-left: auto;
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 0.9rem;
}


.detail-tab.editing .detail-tab-button {
  display: none;
}

.detail-tab-delete {
  display: none !important;
}

.detail-editing .detail-tab-delete {
  display: inline-flex !important;
}

.detail-editing .detail-tab.editing .detail-tab-input {
  display: inline-flex;
}

.detail-tab-input {
  max-width: 220px;
}

.detail-tab-hidden {
  display: none !important;
}

.field-label-edit {
  margin-top: 0.5rem;
  flex-direction: column;
  gap: 0.5rem;
}

.field-inline-edit {
  margin-top: 0;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
}

.field-inline-edit .field-label-input {
  flex: 1 1 0;
  min-width: 0;
}

.field-inline-edit .field-type-select,
.field-inline-edit .profile-type-select {
  flex: 0 0 160px;
}

.profile-type-row,
.detail-type-row {
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.field-add-form {
  margin-top: 0.75rem;
  gap: 0.5rem;
  flex-wrap: nowrap;
  align-items: center;
}

.field-label-input,
.field-add-input {
  width: 100%;
}

.field-add-input {
  flex: 1 1 0;
  min-width: 0;
}

.file-link {
  color: #93c5fd;
  text-decoration: underline;
  word-break: break-word;
}

.file-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-input-control {
  color: #e2e8f0;
}

.file-input-status {
  font-size: 0.75rem;
  color: #94a3b8;
}

.files-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.files-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.files-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.files-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.files-search-input {
  min-width: 160px;
}

.files-filter-select,
.files-sort-select {
  min-width: 150px;
}

.files-actions .active {
  background: #1e40af;
  border-color: #1e40af;
  color: #e2e8f0;
}

.files-upload-btn {
  position: relative;
  overflow: hidden;
}

.files-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.files-hint {
  font-size: 0.75rem;
  color: #94a3b8;
}

.files-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .files-body {
    grid-template-columns: minmax(0, 1fr) 8px minmax(240px, var(--files-preview-width, 320px));
    align-items: stretch;
  }
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.files-table-wrap {
  display: none;
}

.files-content {
  min-width: 0;
}

.files-splitter {
  display: block;
  cursor: col-resize;
  position: relative;
  width: 8px;
  align-self: stretch;
  min-height: 100%;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 1px;
}

.files-splitter::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: rgba(148, 163, 184, 0.55);
  border-radius: 1px;
}

.files-body.is-resizing {
  user-select: none;
}

.files-body.is-resizing .files-splitter::after {
  background: #38bdf8;
}

.files-preview {
  min-width: 240px;
}

.files-view-table .files-list {
  display: none;
}

.files-view-table .files-table-wrap {
  display: block;
}

.files-view-table .files-preview,
.files-view-table .files-splitter {
  display: none;
}

.files-view-table .files-body {
  grid-template-columns: minmax(0, 1fr);
}

.files-view-list .files-table-wrap {
  display: none;
}

@media (max-width: 599px) {
  .files-splitter {
    display: none;
  }
}

.files-view-list .file-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid #1f2937;
  border-radius: 0;
  padding: 0.5rem 0.25rem;
  align-items: center;
  gap: 0.75rem;
}

.files-view-list .file-item.is-active {
  background: rgba(56, 189, 248, 0.08);
  box-shadow: none;
}

.files-view-list .file-thumb {
  width: 32px;
  height: 32px;
  border-radius: 0.4rem;
}

.files-view-list .file-meta {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

.files-view-list .file-name,
.files-view-list .file-comment-text,
.files-view-list .file-comment-empty {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-view-list .file-name {
  max-width: 240px;
}

.files-view-list .file-comment-text,
.files-view-list .file-comment-empty {
  max-width: 300px;
}

.files-view-list .file-name-input,
.files-view-list .file-comment-input {
  height: 32px;
}

.files-view-list .file-comment-input {
  max-height: 32px;
  resize: none;
  overflow: hidden;
}

.files-view-list .file-size {
  white-space: nowrap;
}

.files-view-list .file-actions {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.file-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #1f2937;
  border-radius: 0.8rem;
  background: #0b1220;
  align-items: flex-start;
}

.file-item.is-hidden {
  display: none;
}

.files-card-host {
  min-height: 320px;
}


.file-item.is-active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.file-thumb {
  width: 56px;
  height: 56px;
  border-radius: 0.6rem;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-icon {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5f5;
}

.file-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.file-name {
  font-weight: 600;
  color: #e2e8f0;
}

.file-name-text {
  color: inherit;
}

.totp-display {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.totp-secret {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #94a3b8;
  word-break: break-all;
}

.totp-code {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #e2e8f0;
  cursor: copy;
}

.totp-inline {
  flex-direction: row;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
}

.totp-inline .totp-timer {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: normal;
}

.totp-timer {
  font-size: 0.75rem;
  color: #64748b;
}

.active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
}

.active-true {
  color: #22c55e;
}

.active-false {
  color: #ef4444;
}

.active-docs {
  color: #38bdf8;
}

.active-empty {
  color: #64748b;
}

.file-name a {
  color: inherit;
  text-decoration: none;
}

.file-name a:hover {
  text-decoration: underline;
}

.file-comment-input,
.file-comment-text,
.file-comment-empty {
  font-size: 0.85rem;
  color: #94a3b8;
}

.file-comment-input {
  min-height: 48px;
  resize: vertical;
}

.file-size {
  font-size: 0.75rem;
  color: #64748b;
}

.file-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.files-table th,
.files-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #1f2937;
  text-align: left;
  vertical-align: top;
  color: #e2e8f0;
}

.files-table th {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.file-row.is-hidden {
  display: none;
}

.file-row.is-active {
  background: rgba(56, 189, 248, 0.08);
}

.file-row-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.file-row-thumb {
  width: 32px;
  height: 32px;
  border-radius: 0.4rem;
  object-fit: cover;
}

.file-row-icon {
  font-size: 0.7rem;
  font-weight: 600;
  color: #cbd5f5;
  background: #111827;
  border-radius: 0.4rem;
  padding: 0.25rem 0.45rem;
}

.file-cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  white-space: nowrap;
}

.files-empty-row td {
  color: #94a3b8;
  font-size: 0.85rem;
}

.files-context-menu {
  position: fixed;
  z-index: 50;
  display: none;
  min-width: 180px;
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 0.6rem;
  padding: 0.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.files-context-menu button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: none;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  border-radius: 0.4rem;
}

.files-context-menu button:hover {
  background: rgba(56, 189, 248, 0.12);
}

.files-table a {
  color: inherit;
  text-decoration: none;
}

.files-table a:hover {
  text-decoration: underline;
}

.file-cell-name .form-input,
.file-cell-comment .form-input {
  width: 100%;
}


.files-preview {
  border: 1px solid #1f2937;
  border-radius: 0.8rem;
  padding: 0.75rem;
  background: #0b1220;
  min-height: 220px;
  resize: vertical;
  overflow: auto;
}

.files-preview-title {
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
}

.files-preview-body img {
  max-width: 100%;
  border-radius: 0.5rem;
  display: block;
}

.files-preview-body iframe {
  width: 100%;
  height: 420px;
  border: 0;
  border-radius: 0.5rem;
  background: #0f172a;
}

.files-preview-text {
  margin: 0;
  padding: 0.75rem;
  background: #0f172a;
  border-radius: 0.5rem;
  color: #e2e8f0;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 420px;
  overflow: auto;
}

.files-preview-empty {
  color: #94a3b8;
  font-size: 0.85rem;
}

.files-dropzone {
  border: 1px dashed #334155;
  border-radius: 0.8rem;
  padding: 0.75rem;
  text-align: center;
  color: #94a3b8;
}

.files-dropzone.is-active {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}

.files-empty {
  font-size: 0.85rem;
  color: #94a3b8;
}

.field-add-select,
.profile-column-select {
  flex: 0 0 160px;
}

.table-card-body {
  min-width: 280px;
}

.table-card-empty {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.5rem 0;
}

.card-drag-handle {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  background: #1e293b;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
}

.card-drag-handle:active {
  cursor: grabbing;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-add-group {
  margin-top: 0.75rem;
}

.detail-add-group-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.detail-settings-gear {
  width: 30px;
  height: 30px;
  border-radius: 0.6rem;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  z-index: 2;
  position: relative;
  pointer-events: auto;
}

.detail-settings-gear::before {
  content: "⚙";
  font-size: 0.75rem;
  line-height: 1;
}

.detail-settings-gear:hover,
.detail-settings-gear.active {
  color: #e2e8f0;
  border-color: #475569;
  background: rgba(30, 41, 59, 0.6);
}

.detail-groups {
  display: grid;
  gap: 1rem;
}

.detail-group-card {
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  padding: 1rem;
}

.detail-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.75rem;
}

.detail-group-table th {
  background: rgba(15, 23, 42, 0.6);
}

.detail-group-empty,
.detail-empty {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.75rem 0;
}

.detail-settings {
  margin-top: 1.5rem;
}

.btn-small {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  border-radius: 0.6rem;
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  min-width: 28px;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.detail-editing .btn-icon {
  width: 28px;
  height: 28px;
}

.detail-editing .field-label-input,
.detail-editing .field-type-select,
.detail-editing .profile-type-select,
.detail-editing .detail-group-input,
.detail-editing .detail-tab-input {
  height: 1.75rem;
  padding: 0 0.5rem;
  font-size: 0.85rem;
}

.detail-editing .field-add-input,
.detail-editing .field-add-select,
.detail-editing .profile-column-input,
.detail-editing .profile-column-select {
  height: 1.75rem;
  padding: 0 0.5rem;
  font-size: 0.85rem;
}

.btn-add-square {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 0.6rem;
  font-size: 1.1rem;
  line-height: 1;
}

.cell-gear {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 0.6rem;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cell-gear::before {
  content: "⚙";
  font-size: 0.75rem;
  line-height: 1;
}

.table td.profile-cell:hover .cell-gear,
.cell-gear:focus,
.cell-gear:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.cell-gear:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.cell-gear:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.4);
}

.table tbody tr:hover {
  background: rgba(30, 41, 59, 0.4);
}

.table tbody tr.row-link {
  cursor: default;
}

.account-link-cell {
  cursor: pointer;
}

.account-link-cell:hover {
  color: #93c5fd;
}

.email-cell {
  cursor: pointer;
}

.email-cell:hover {
  color: #bae6fd;
}

.add-row td {
  background: rgba(15, 23, 42, 0.6);
}

.add-row-cell {
  padding: 0.75rem 1.5rem;
}

.add-row-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.add-row-input {
  width: min(360px, 100%);
}

.add-row-country {
  min-width: 90px;
}

.add-row-number {
  width: 140px;
}

.add-row-country-custom {
  width: 90px;
}

.is-hidden {
  display: none;
}

.country-select-wrapper {
  position: relative;
}

.country-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid #334155;
  background: #0f172a;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.45);
}

.country-popover-input {
  width: 80px;
  text-transform: uppercase;
}

.editable-cell {
  cursor: text;
}

.editable-cell.editing {
  background: rgba(30, 41, 59, 0.4);
}

.editable-input {
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
}

select.editable-input {
  padding: 0.35rem 2rem 0.35rem 0.6rem;
  border: 1px solid #334155;
  border-radius: 0.6rem;
  background: #0f172a;
  color: #e2e8f0;
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7l5 5 5-5' stroke='%23cbd5f5' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

select.editable-input option {
  background: #0f172a;
  color: #e2e8f0;
}

select.editable-input option:checked {
  background: #1e293b;
  color: #f8fafc;
}

.editable-input:focus {
  outline: none;
}

.order-strip {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  overflow-x: auto;
}

.order-empty {
  padding: 1rem;
  font-size: 0.9rem;
  color: #94a3b8;
}

.order-card {
  min-width: 260px;
  border-radius: 0.9rem;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.85);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.order-index {
  font-size: 0.75rem;
  color: #94a3b8;
}

.order-card-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.order-card-form--stacked {
  flex-direction: column;
  align-items: stretch;
}

.order-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.order-card-actions--below {
  justify-content: flex-start;
}

.drag-handle {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  background: #1e293b;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

tr.dragging,
.order-card.dragging {
  opacity: 0.6;
}

tr.drop-target,
.order-card.drop-target {
  outline: 1px dashed #475569;
  background: rgba(148, 163, 184, 0.12);
}

.toast {
  position: fixed;
  top: var(--toast-top, 24px);
  left: 50%;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.9rem;
  opacity: 0;
  transform: translate(-50%, calc(-50% - 6px));
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.6);
  color: #fecdd3;
  background: rgba(127, 29, 29, 0.6);
}

.cell-tooltip {
  position: fixed;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.75rem;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 80;
  white-space: nowrap;
}

.cell-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.email-popover {
  position: absolute;
  min-width: 220px;
  max-width: 320px;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.5);
  z-index: 60;
}

.email-popover-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.email-popover-row + .email-popover-row {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.email-popover-label {
  color: #94a3b8;
  text-transform: none;
}

.email-popover-value {
  color: #e2e8f0;
  font-weight: 600;
  word-break: break-all;
  text-align: right;
}

.column-menu {
  position: fixed;
  min-width: 220px;
  padding: 0.4rem;
  border-radius: 0.85rem;
  border: 1px solid #334155;
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.5);
  z-index: 70;
}

.column-menu button {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-radius: 0.6rem;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.85rem;
  cursor: pointer;
}

.column-menu button:hover {
  background: rgba(30, 41, 59, 0.7);
}

.column-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.column-menu button:disabled:hover {
  background: transparent;
}

.column-menu-separator {
  height: 1px;
  margin: 0.35rem 0.4rem;
  background: rgba(51, 65, 85, 0.6);
}

.column-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  z-index: 80;
}

.column-picker {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 92vw);
  max-height: 78vh;
  border-radius: 1rem;
  border: 1px solid #334155;
  background: #0f172a;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.5);
  z-index: 81;
  display: flex;
  flex-direction: column;
}

.column-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
}

.column-picker-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
}

.column-picker-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
}

.column-picker-search {
  padding: 0.65rem 0.9rem 0;
}

.column-picker-input {
  width: 100%;
}

.column-picker-list {
  padding: 0.5rem 0.6rem 0.8rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.column-picker-item {
  border: none;
  border-radius: 0.6rem;
  padding: 0.45rem 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
}

.column-picker-item:hover {
  background: rgba(30, 41, 59, 0.9);
}

.column-picker-empty {
  padding: 0.8rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #334155 #0b1220;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #0b1220;
}

*::-webkit-scrollbar-thumb {
  background-color: #334155;
  border-radius: 999px;
  border: 2px solid #0b1220;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: #475569;
}

*::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
  border: 0;
}

*::-webkit-scrollbar-button:single-button {
  width: 0;
  height: 0;
  display: none;
}

*::-webkit-scrollbar-button:horizontal:decrement,
*::-webkit-scrollbar-button:horizontal:increment,
*::-webkit-scrollbar-button:vertical:decrement,
*::-webkit-scrollbar-button:vertical:increment {
  width: 0;
  height: 0;
  display: none;
}

body::-webkit-scrollbar-button,
.content::-webkit-scrollbar-button,
.order-strip::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

body::-webkit-scrollbar-button:single-button,
.content::-webkit-scrollbar-button:single-button,
.order-strip::-webkit-scrollbar-button:single-button {
  width: 0;
  height: 0;
  display: none;
}
