/* AdNeed — UX laws layer. One small stylesheet that makes the same ten
   principles hold on every screen. Loaded AFTER each page's own CSS.

   1 Jakob        bottom tab bar + hamburger drawer + standard patterns, nothing exotic
   2 Hick         fewer choices per view: grouped drawer, collapsed rarely-used panels
   3 Miller       lists chunked into groups of <= 5 with a heading
   4 Proximity    label hugs its field; groups are separated by MORE space than their contents
   5 Similarity   one look per job: primary / secondary / ghost / destructive
   6 Common region a border + surface = a group (.ux-group, .dash-card, drawer groups)
   7 Continuity   shared left edge, steady vertical rhythm, step trail on flows
   8 Von Restorff one filled primary per view; everything else is quiet
   9 Serial pos.  most important first, Log out / Settings last
  10 Fitts        >=48px targets, thumb-zone actions, big tab bar                  */

:root {
  --ux-space-1: 4px;   /* inside a unit: label -> field */
  --ux-space-2: 8px;
  --ux-space-3: 16px;  /* between fields */
  --ux-space-4: 32px;  /* between groups */
  --ux-target: 48px;   /* minimum touch target */
  --ux-radius: 14px;
}

/* ---- 10 Fitts: big targets, thumb zone ------------------------------- */
.btn, button.btn, a.btn { min-height: var(--ux-target); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea { min-height: var(--ux-target); }
.topbar-menu-btn, .topbar-avatar, .topbar-credits { min-width: 44px; min-height: 44px; }
.topbar-drawer-link { min-height: var(--ux-target); display: flex; align-items: center; }
.topbar-drawer-close { min-width: 44px; min-height: 44px; }
.app-tabbar-item { min-height: 56px; padding: 8px 4px 8px; }   /* tab bar sits in the thumb zone */
.app-tabbar-item svg { width: 24px; height: 24px; }
.ux-sticky-actions {                                          /* primary action pinned to the thumb zone */
  position: sticky; bottom: 0; z-index: 5; padding: var(--ux-space-3) 0 calc(var(--ux-space-3) + env(safe-area-inset-bottom, 0));
  background: linear-gradient(to top, var(--surface, #fff) 70%, rgba(255,255,255,0));
}
@media (max-width: 600px) { .ux-sticky-actions .btn { width: 100%; } }

/* ---- 5 Similarity + 8 Von Restorff: one look per job ------------------ */
.btn-primary { background: var(--grad); color: #fff; border: 0; }                  /* the ONE loud thing */
.btn-secondary { background: transparent; color: var(--navy-900, #0F1B2E); border: 1.5px solid var(--navy-900, #0F1B2E); box-shadow: none; }
.btn-ghost { background: var(--surface, #fff); color: var(--text-muted, #6B7280); border: 1px solid var(--border, #E7E9EE); box-shadow: none; }
.btn-destructive { background: var(--error, #D64545); color: #fff; border: 0; }    /* red always means "can't undo" */
a:not(.btn):not([class*="topbar"]):not([class*="tabbar"]) { text-underline-offset: 2px; }
.tool-card--featured { border-color: var(--orange-500, #E8491D) !important; box-shadow: 0 6px 20px rgba(232,73,29,.14); }
.tool-card--featured .tool-tag-start { display: inline-block; align-self: flex-start; font-size: 11px; font-weight: 700; color: #fff; background: var(--grad); border-radius: 999px; padding: 2px 10px; margin-bottom: 4px; }

/* ---- 6 Common region + 4 Proximity ------------------------------------ */
.ux-group, .dash-card { background: var(--surface, #fff); border: 1px solid var(--border, #E7E9EE); border-radius: var(--ux-radius); padding: var(--ux-space-3) 18px; }
.dash-card + .dash-card, .ux-group + .ux-group { margin-top: var(--ux-space-3); }
.field { margin-bottom: var(--ux-space-3); }
.field > label { margin-bottom: var(--ux-space-1); }              /* label is closer to its input than to the previous field */
.section-title, .section-heading { margin-bottom: var(--ux-space-2); }
.section-heading + .section-lead { margin-top: calc(-1 * var(--ux-space-1)); }
.dash-container .tool-section { margin-top: var(--ux-space-4); }
.dash-container .tool-section:first-of-type { margin-top: var(--ux-space-3); }

/* ---- 2 Hick: progressive disclosure for rarely used panels ------------ */
details.ux-collapsible > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  min-height: var(--ux-target); gap: 12px;
}
details.ux-collapsible > summary::-webkit-details-marker { display: none; }
details.ux-collapsible > summary .section-title { margin: 0; }
details.ux-collapsible > summary::after { content: "＋"; font-weight: 700; color: var(--text-muted, #6B7280); }
details.ux-collapsible[open] > summary::after { content: "－"; }
details.ux-collapsible[open] > summary { margin-bottom: var(--ux-space-2); }

/* ---- 3 Miller + 6 Common region: grouped drawer ----------------------- */
.topbar-drawer-group { margin: 0 12px 12px; padding: 4px 0; border: 1px solid var(--border, #E7E9EE); border-radius: var(--ux-radius); background: var(--surface, #fff); overflow: hidden; }
.topbar-drawer-group-title {
  margin: 0; padding: 10px 14px 4px; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted, #6B7280);
}
.topbar-drawer-group .topbar-drawer-link { padding: 12px 14px; }
.topbar-drawer { overflow-y: auto; }
.topbar-drawer-logout { margin: auto 12px 12px; width: auto; border: 1px solid var(--border, #E7E9EE); border-radius: var(--ux-radius); justify-content: center; }

/* ---- 7 Continuity: step trail that leads the eye ---------------------- */
.ux-steps { display: flex; align-items: center; justify-content: center; gap: 0; list-style: none; padding: 0; margin: 0 0 var(--ux-space-3); }
.ux-steps li { display: flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--text-muted, #6B7280); }
.ux-steps li + li::before { content: ""; width: 28px; height: 2px; background: var(--border, #E7E9EE); margin: 0 8px; }
.ux-steps .ux-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-right: 6px;
  background: var(--border, #E7E9EE); color: var(--text-muted, #6B7280); font-size: 12px; }
.ux-steps li.is-active { color: var(--navy-900, #0F1B2E); }
.ux-steps li.is-active .ux-dot, .ux-steps li.is-done .ux-dot { background: var(--grad); color: #fff; }
.ux-steps li.is-done + li::before { background: var(--orange-500, #E8491D); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---- polish: buttons never look like links; card buttons share one baseline (Continuity) ---- */
a.btn { text-decoration: none; }
.dash-container .tool-card { height: 100%; }
.dash-container .tool-card > .btn { margin-top: auto; }
.dash-container .tool-card > p:last-of-type { margin-bottom: 12px; }

/* ---- Phone fields: the country-code control is built and styled inline by /js/phone-input.js ---- */
.phone-cc-btn:focus-visible { outline: 2px solid var(--orange-500, #E8491D); outline-offset: -2px; }

/* ---- Unit chips (₹ / %): the unit is part of the field's look, never part of its value ---- */
.affix-field { position: relative; }
.affix-field .affix-chip {
  position: absolute; top: 1px; bottom: 1px; display: flex; align-items: center; padding: 0 12px; pointer-events: none;
  background: var(--bg, #FAFAFA); color: var(--text-muted, #6B7280); font-weight: inherit; font-size: inherit;
  left: 1px; border-right: 1px solid var(--border, #E7E9EE); border-radius: 11px 0 0 11px;
}
.affix-field input { padding-left: 48px !important; }
.affix-field.affix-right .affix-chip { left: auto; right: 1px; border-right: 0; border-left: 1px solid var(--border, #E7E9EE); border-radius: 0 11px 11px 0; }
.affix-field.affix-right input { padding-left: 14px !important; padding-right: 48px !important; }
