:root {
  /* Resgat.me Design System Colors (from Mobile App) */
  --primary: #00e881;
  --primary-hover: #00f298;
  --primary-dark: #04c47e;
  --primary-glow: rgba(0, 232, 129, 0.25);
  --primary-bg: rgba(0, 232, 129, 0.08);

  /* Backgrounds */
  --bg-app: #121212;
  --bg-sidebar: #181818;
  --bg-surface: #222222;
  --bg-surface-elevated: #2a2a2a;
  --bg-surface-box: #303030;
  --bg-input: #1a1a1a;

  /* Borders */
  --border-subtle: #2a2a2a;
  --border-inner-element: rgb(0 0 0 / 25%);
  --border-default: rgb(0 0 0 / 50%);
  --border-focus: #00e881;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #8e8e93;
  --text-dark: #121212;

  /* Status Colors */
  --color-success: #00e881;
  --color-warning: #ffb703;
  --color-danger: #e63946;
  --color-info: #3a86ff;

  /* Fonts */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-primary: 0 4px 16px rgba(0, 232, 129, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  width: 100%;
  max-width: 100%;
  margin: 0;
  border: none;
}

.app-main-content {
  box-sizing: border-box;
  min-width: 0;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

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

.resgat-inline-spinner {
  width: 14px;
  height: 14px;
  display: inline-block;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 14px;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Utility UI components styling */
.resgat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  min-height: 40px;
  box-sizing: border-box;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.resgat-btn .animate-spin,
.resgat-btn .resgat-inline-spinner {
  flex: 0 0 14px;
}

.resgat-btn .resgat-loader {
  min-height: 0;
  padding: 0 !important;
  gap: 0;
  flex: 0 0 auto;
}

.resgat-btn-primary {
  background-color: var(--primary);
  color: var(--text-dark);
  box-shadow: var(--shadow-primary);
}

.resgat-btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 232, 129, 0.35);
}

.resgat-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.resgat-btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.resgat-btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-box);
  border-color: #444;
}

.resgat-btn-danger {
  background-color: rgba(230, 57, 70, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

.resgat-btn-danger:hover:not(:disabled) {
  background-color: var(--color-danger);
  color: #fff;
}

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

.resgat-card {
  background-color: var(--bg-surface);
  /* border: 1px solid var(--border-subtle) !important; */
  border-radius: var(--radius-lg);
  padding: 13px;
  box-shadow: var(--shadow-md);
}

.resgat-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-inner-element);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 14px;
  transition: all 0.2s ease;
  outline: none;
}

.resgat-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

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

.merchant-page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.merchant-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.merchant-page-header h1 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.merchant-page-header p {
  margin: 0;
  color: #8e8e93;
  font-size: 13px;
}

.client-toolbar,
.client-segments,
.client-search,
.company-summary,
.company-summary-brand,
.client-contact,
.client-detail-contact,
.client-detail-row,
.rescue-list-controls {
  display: flex;
  align-items: center;
}

.client-toolbar {
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.client-segments {
  gap: 6px;
  padding: 4px;
  border: 1px solid rgb(0 0 0 / 50%);
  border-radius: 12px;
  background: #181818;
}

.client-segment {
  padding: 9px 12px;
  border-radius: 9px;
  background: transparent;
  color: #aaa;
  font-weight: 700;
  white-space: nowrap;
}

.client-segment.active {
  background: rgba(0, 232, 129, .14);
  color: #00e881;
}

.client-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 440px;
}

.client-search svg {
  position: absolute;
  left: 13px;
  color: #777;
}

.client-search input {
  padding-left: 40px;
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}

.client-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px;
  border: 1px solid rgb(0 0 0 / 50%);
  border-radius: 14px;
  background: #181818;
  color: inherit;
  text-align: left;
}

.client-card:hover,
.client-card:focus-visible {
  border-color: rgba(0, 232, 129, .55);
  background: #1c211e;
}

.client-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #262626;
  color: #00e881;
  font-weight: 800;
}

.client-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.client-main strong {
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-main small,
.client-metric small,
.client-detail-row small {
  color: #888;
  font-size: 11px;
}

.client-contact {
  flex-wrap: wrap;
  gap: 8px;
  color: #aaa;
  font-size: 11px;
}

.client-contact span,
.client-card-count,
.client-detail-contact span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.client-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: #00e881;
}

.client-metric strong {
  font-size: 16px;
}

.client-card-count {
  grid-column: 2 / 4;
  color: #999;
  font-size: 11px;
}

.client-empty {
  padding: 45px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #888;
  text-align: center;
}

.client-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.client-detail-contact {
  flex-wrap: wrap;
  gap: 12px;
  color: #aaa;
  font-size: 13px;
}

.client-detail h4 {
  margin: 6px 0 0;
  color: #fff;
}

.client-detail-row {
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid #292929;
  border-radius: 10px;
  background: #181818;
}

.client-detail-row>span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.client-detail-row strong {
  color: #fff;
}

.client-detail-row b {
  color: #00e881;
  white-space: nowrap;
}

.rescue-list-controls {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.rescue-list-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #999;
  font-size: 12px;
}

.rescue-list-controls select {
  min-width: 160px;
  width: auto;
  padding: 8px 10px;
}

.rescue-result-count {
  margin-left: auto;
  color: #888;
  font-size: 12px;
}

.company-summary {
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  flex-wrap: wrap;
}

.company-summary-brand {
  gap: 16px;
  min-width: 0;
}

.company-summary-brand img {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  object-fit: cover;
}

.company-summary-brand div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: #999;
  font-size: 13px;
}

.company-summary-brand strong {
  color: #fff;
  font-size: 16px;
}

.modal-content-scroll {
  max-height: calc(90vh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

/* Sidebar & Mobile Drawer Styles */
.app-sidebar {
  width: 260px;
  background-color: #181818;
  border-right: 1px solid rgb(0 0 0 / 50%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 100;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
}

.sidebar-preferences {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 18px;
  box-shadow: 0px -3px 12px rgba(0, 0, 0, 0.35);

  /* border-top: 1px solid rgb(0 0 0 / 50%); */
  background: #181818;
}

.sidebar-preference-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: #8e8e93;
  font-size: 11px;
}

.sidebar-preference-label .resgat-input {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 12px;
}

.app-sidebar.app-sidebar-collapsed .sidebar-preferences {
  gap: 7px;
  padding: 10px 6px;
}

.app-sidebar.app-sidebar-collapsed .sidebar-preference-label>span {
  display: none;
}

.app-sidebar.app-sidebar-collapsed .sidebar-preference-label .resgat-input {
  min-height: 34px;
  padding: 4px 2px;
  font-size: 10px;
}

.app-sidebar.app-sidebar-collapsed .sidebar-language-select {
  min-width: 0;
  padding: 4px 1px;
  font-size: 9px;
}

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

.app-sidebar.app-sidebar-collapsed span {
  display: none;
}

.app-sidebar.app-sidebar-collapsed a {
  justify-content: center;
  padding: 12px;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: 280px !important;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .app-sidebar.app-sidebar-collapsed {
    width: 280px !important;
  }

  .app-sidebar.app-sidebar-collapsed span {
    display: inline;
  }

  .app-sidebar.app-sidebar-open {
    transform: translateX(0) !important;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.85);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 95;
    animation: fadeIn 0.2s ease;
  }

  .app-main-content {
    padding: 16px 18px !important;
  }

  .resgat-card {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .app-main-content {
    padding: 14px 12px !important;
  }

  .merchant-page-header {
    align-items: stretch;
  }

  .merchant-page-header h1 {
    font-size: 21px;
  }

  .client-toolbar {
    align-items: stretch;
  }

  .client-segments {
    width: 100%;
  }

  .client-segment {
    flex: 1;
    padding-inline: 7px;
    font-size: 11px;
  }

  .client-search {
    max-width: none;
    flex-basis: 100%;
  }

  .client-card {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 12px;
  }

  .client-avatar {
    width: 36px;
    height: 36px;
  }

  .client-contact {
    flex-direction: column;
    align-items: flex-start;
  }

  .rescue-list-controls {
    align-items: stretch;
  }

  .rescue-list-controls label {
    flex: 1 1 145px;
    align-items: stretch;
    flex-direction: column;
  }

  .rescue-list-controls select {
    width: 100%;
    min-width: 0;
  }

  .rescue-result-count {
    flex-basis: 100%;
    margin-left: 0;
  }

  .company-summary {
    align-items: stretch;
    padding: 16px;
  }

  .company-summary-brand img {
    width: 54px;
    height: 54px;
  }

  .company-summary>button {
    width: 100%;
  }

  .modal-form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .modal-content-scroll form [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .resgat-card {
    padding: 16px !important;
  }

  .app-header {
    height: auto !important;
    min-height: 58px;
    padding: 8px 10px !important;
    gap: 8px;
  }

  .app-header-identity {
    gap: 8px !important;
    flex: 1;
    overflow: hidden;
  }

  .app-header-identity h2 {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px !important;
    margin: 0;
  }

  .app-header-identity span {
    display: none;
  }

  .app-header-user {
    padding: 6px !important;
    border: 0 !important;
    background: transparent !important;
  }

  .app-header-user>span {
    display: none;
  }

  .app-header>div:last-child {
    gap: 4px !important;
  }

  .app-header .resgat-btn {
    min-height: 38px;
    padding: 7px 9px !important;
    font-size: 11px !important;
  }

  .app-header .resgat-btn span {
    display: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
.merchant-partner-form .form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #a0a0a0;
  font-size: 13px;
  font-weight: 600;
}
