/* ===========================
   Gestor - Main CSS
   Design ref: clean dashboard UI
   =========================== */

:root {
  --bg:          #F0EBFA;
  --surface:     #FFFFFF;
  --sidebar-w:   240px;
  --header-h:    64px;
  --control-h:   42px;   /* unified height: inputs, selects, buttons */

  --primary:     #7C3AED;
  --primary-hover:#6D28D9;
  --primary-light:#EDE9FE;

  --dark:        #1A1A2E;
  --text:        #1F2937;
  --text-muted:  #6B7280;
  --text-light:  #9CA3AF;

  --border:      #E5E7EB;
  --border-focus:#7C3AED;
  --focus-ring:  rgba(124,58,237,.12);

  --success:     #10B981;
  --success-bg:  #D1FAE5;
  --warning:     #F59E0B;
  --warning-bg:  #FEF3C7;
  --danger:      #EF4444;
  --danger-bg:   #FEE2E2;
  --info:        #3B82F6;
  --info-bg:     #DBEAFE;

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   24px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);

  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --transition:  .2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-muted); }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-body {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  height: var(--header-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-logo img { width: 32px; height: 32px; border-radius: var(--radius-sm); object-fit: contain; }
.sidebar-logo-text { font-size: 1.1rem; font-weight: 700; color: var(--dark); }

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-light);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Top Header ── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.page-title-area { flex: 1; }
.page-title-area h1 { font-size: 1.2rem; font-weight: 700; }
.page-breadcrumb { font-size: .8rem; color: var(--text-muted); }


.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body { padding: 20px 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  cursor: pointer;
}
.stat-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn-primary:hover { background: #2d2d4e; color: #fff; }


.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); }

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

.btn-sm { height: 34px; padding: 0 12px; font-size: .8rem; }
.btn-icon { padding: 0; aspect-ratio: 1; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── intl-tel-input (v29) — styled to match our own UI ── */
.iti { width: 100%; }

/* Flag + dial-code = a single grey "chip" divided from the input.
   Disable the library's per-element hover on the selector button ONLY (so the
   chip is one colour, not two-toned); the dropdown list is a sibling and keeps
   its own hover, which we restyle below. */
.iti .iti__selected-country { --iti-hover-color: transparent; }
.iti .iti__country-container {
  z-index: 2;                 /* above the input, whose opaque background would hide the chip */
  background: #F3F4F6;
  border-right: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
}
.iti .iti__country-container:hover { background: #E9EAEC; }
.iti .iti__selected-dial-code { color: var(--text); font-weight: 600; padding-right: 10px; }
/* gap so the typed number has the same left breathing room as a normal field */
.iti .iti__tel-input { text-indent: 12px; }

/* Country dropdown — match our searchable .ss dropdown */
.iti .iti__country-selector {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  overflow: hidden;
  margin-top: 4px;
}
.iti .iti__search-input-wrapper { padding: 8px; border-bottom: 1px solid var(--border); }
.iti .iti__search-input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  font-family: var(--font);
  outline: none;
}
.iti .iti__search-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--focus-ring); outline: none; }
.iti .iti__search-input::placeholder { color: var(--text-light); }
.iti .iti__search-icon { left: 18px; }   /* keep the icon inside the padded, bordered field */
.iti .iti__country-list { padding: 4px; }
.iti .iti__country {
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text);
}
.iti .iti__country:hover,
.iti .iti__country.iti__highlight { background-color: var(--primary-light); color: var(--primary); }
.iti .iti__country[aria-selected="true"] { color: var(--primary); font-weight: 600; }
.iti .iti__country-check { color: var(--primary); }
.iti .iti__dial-code { color: var(--text-muted); }
