/* ===== Fonts: served from frontend/fonts (variable fonts: one file per family covers every weight) =====
   font-display: block = never paint a stand-in font first; the files are preloaded in each page's <head>. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: block;
  src: url('../fonts/nunito-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: block;
  src: url('../fonts/baloo2-latin.woff2') format('woff2');
}

/* ===== Design tokens — PLAN.md Section 5 ke colors ===== */
:root {
  --bg: #FBF7F0;         /* page background: warm cream */
  --ink: #2D2A3E;        /* main text */
  --muted: #6E6884;      /* halka text (descriptions) */
  --card: #FFFFFF;       /* cards ka white */
  --line: #EDE6DA;       /* borders */
  --brand: #6A5AE0;      /* violet accent */
  --brand-soft: #EFE9FB; /* violet ka pastel */

  /* Sidebar palette (deep navy-violet). Change these five to restyle the whole sidebar. */
  --side-bg: #26214A;
  --side-ink: #EDEAF7;
  --side-muted: #B9B3D6;
  --side-line: rgba(255, 255, 255, 0.12);
  --side-hover: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background:
    radial-gradient(900px 550px at 85% -10%, #E4D9FA 0%, transparent 60%),
    radial-gradient(800px 500px at -10% 25%, #FDDCD4 0%, transparent 55%),
    radial-gradient(750px 480px at 50% 115%, #CDEFE9 0%, transparent 55%),
    radial-gradient(650px 420px at 110% 70%, #FAEBBC 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}


/* ===== Header bar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 40px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.nav { display: flex; gap: 8px; margin: 0 auto; }   /* centred between brand and avatar */

.nav-link {
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}
.nav-link:hover { background: #F1EBE1; }
.nav-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 800; }

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 20px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FDE8E4;
  color: #E8604C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

/* ===== Top bar profile menu ===== */
.avatar-menu { position: relative; }   /* dropdown is positioned against this box */

/* The top-bar avatar is a <button>: drop the browser's button look, keep the circle, add a soft ring */
button.avatar {
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px transparent;
  transition: box-shadow .15s ease, transform .15s ease;
}
button.avatar:hover { transform: scale(1.06); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #F8C9BF; }
button.avatar[aria-expanded="true"],
button.avatar:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 14px);   /* just below the avatar */
  right: 0;                 /* right edges aligned, so it never runs off-screen */
  width: 272px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 10px rgba(45, 42, 62, .06), 0 20px 48px rgba(45, 42, 62, .16);
  z-index: 110;             /* above the sidebar (100) and the mobile header (90) */
  transform-origin: top right;
  animation: dropdown-in .16s ease-out;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
/* Small arrow pointing up at the avatar */
.avatar-dropdown::before {
  content: '';
  position: absolute;
  top: -7px;
  right: 13px;
  width: 12px;
  height: 12px;
  background: #EFE9FB;      /* same as the header's right end */
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-top-left-radius: 3px;
  transform: rotate(45deg);
}

/* Header: big avatar + name + email on a warm pastel gradient */
.dropdown-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  border-radius: 17px 17px 0 0;
  background: linear-gradient(90deg, #FDE8E4 0%, #EFE9FB 100%);
  border-bottom: 1px solid var(--line);
}
.avatar-lg { width: 44px; height: 44px; font-size: 16px; flex-shrink: 0; box-shadow: 0 0 0 3px #fff; }
.dropdown-who { min-width: 0; }   /* lets a long email shrink and show an ellipsis */
.dropdown-name { font-weight: 800; font-size: 15px; }
.dropdown-mail {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu rows: icon tile + label + chevron */
.dropdown-list { padding: 6px; }
.dropdown-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  text-decoration: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.dropdown-link::after {   /* chevron on the right */
  content: '\203A';
  margin-left: auto;
  color: #A79FB8;
  font-size: 20px;
  line-height: 1;
}
.dropdown-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s ease, color .12s ease;
}
.dropdown-link:hover { background: var(--brand-soft); color: var(--brand); }
.dropdown-link:hover .dropdown-icon, .dropdown-link:hover::after { background: #fff; color: var(--brand); }
.dropdown-logout:hover { background: #FDE8E4; color: #E8604C; }
.dropdown-logout:hover .dropdown-icon, .dropdown-logout:hover::after { color: #E8604C; }

/* ===== Page container ===== */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px;
}

/* ===== Welcome headline ===== */
.hero h1 {
  margin: 0 0 6px 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 34px;
}

.hero p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* ===== Search + filters row ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  width: 300px;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}

.search-box input::placeholder { color: #A79FB8; }

.filters { display: flex; gap: 8px; }

.filter-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  border: 1.5px solid var(--line);
  cursor: pointer;
}

.filter-pill:hover { border-color: var(--brand); }

.filter-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}
/* ===== Tool cards grid ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(45, 42, 62, 0.12);
}

.tool-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--tool-bg);
  color: var(--tool-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-name {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 17px;
}

.tool-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  flex-grow: 1;
}

.tool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #A79FB8;
}
/* Card poora clickable — link ko card ke upar phaila do, text gayab */
.tool-card { position: relative; }

.tool-foot a {
  position: absolute;
  inset: 0;
  font-size: 0;
  color: transparent;
  border-radius: 18px;
}
.tool-foot a:focus-visible { outline: 3px solid var(--brand); }

.tool-foot a:hover { text-decoration: underline; }
/* ===== Dashboard: dark scene + tool carousel ===== */
body.dash-dark {
  color: #FFFFFF;
  background:
    radial-gradient(760px 440px at 50% 60%, color-mix(in srgb, var(--focus, var(--brand)) 38%, transparent) 0%, transparent 70%),
    radial-gradient(900px 600px at 50% 120%, rgba(255, 255, 255, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #221E3A 0%, #17142A 55%, #0F0D1C 100%);
  background-attachment: fixed;
  transition: --focus .6s ease;   /* the glow colour glides to the next tool's colour (see @property below) */
}
/* Registering the variable as a colour is what makes it animatable */
@property --focus { syntax: '<color>'; inherits: true; initial-value: #6A5AE0; }
/* white surfaces keep dark text: the sidebar, the profile card and the search popover */
body.dash-dark .avatar-dropdown { color: var(--ink); }
/* top bar becomes glass on the dark scene */
body.dash-dark .topbar, body.tool-band .topbar { background: transparent; border-bottom-color: transparent; }
body.dash-dark .topbar .brand-name, body.tool-band .topbar .brand-name { color: #FFFFFF; }
body.dash-dark .nav, body.tool-band .nav { padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); }
body.dash-dark .nav-link, body.tool-band .nav-link { color: rgba(255, 255, 255, 0.75); }
body.dash-dark .nav-link:hover, body.tool-band .nav-link:hover { background: rgba(255, 255, 255, 0.10); color: #FFFFFF; }
body.dash-dark .nav-link.active, body.tool-band .nav-link.active { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }
body.dash-dark .side-open, body.tool-band .side-open { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); color: #FFFFFF; }
body.dash-dark .mobile-top, body.tool-band .mobile-top { background: rgba(23, 20, 42, 0.85); border-bottom-color: rgba(255, 255, 255, 0.10); color: #FFFFFF; }
body.dash-dark .mobile-top .menu-btn, body.tool-band .mobile-top .menu-btn { color: #FFFFFF; border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); }
body.dash-dark .mobile-top .brand-name, body.tool-band .mobile-top .brand-name { color: #FFFFFF; }

.dash { position: relative; padding-top: 6px; }   /* the search/filter popover is placed against this box */
.stage { position: relative; height: 640px; container-type: inline-size; }   /* cqw below = % of the stage width */
.stage-title { text-align: center; }
.stage-cap { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.stage-name { margin: 4px 0 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 30px; color: #FFFFFF; }
.stage-count { margin-top: 4px; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.55); }

/* the deck: cards are positioned from the centre with three CSS variables set per position */
.deck { position: absolute; left: 50%; top: 112px; width: 0; height: 460px; }
.deck-card {
  position: absolute; left: -160px; top: 0;
  width: 320px; height: 460px;
  border-radius: 26px; padding: 24px;
  display: flex; flex-direction: column;
  color: #FFFFFF; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.22) 0 70px, transparent 71px),
    radial-gradient(circle at 92% 90%, rgba(255, 255, 255, 0.10) 0 110px, transparent 111px),
    linear-gradient(165deg, color-mix(in srgb, var(--c) 80%, white) 0%, var(--c) 40%, color-mix(in srgb, var(--c) 68%, black) 100%);
  transform: translateX(var(--x, 0)) scale(var(--s, 1));
  opacity: var(--o, 1);
  filter: blur(var(--b, 0));
  z-index: var(--z, 5);
  /* a longer, springy curve: the incoming card overshoots a touch and settles in front */
  transition: transform .6s cubic-bezier(.22, 1.25, .36, 1), opacity .45s ease, filter .45s ease;
  cursor: pointer;
}
.deck-card.hidden-card { display: none; }
.deck-card .tile { width: 58px; height: 58px; border-radius: 18px; background: rgba(255, 255, 255, 0.22); display: flex; align-items: center; justify-content: center; }
.deck-card .tag { position: absolute; top: 22px; right: 22px; padding: 5px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.deck-card h2 { margin: auto 0 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 27px; line-height: 1.1; }
.deck-card p { margin: 8px 0 0; font-size: 14px; color: rgba(255, 255, 255, 0.88); }
.deck-card .cta { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; }
.deck-card .open { padding: 11px 18px; border-radius: 12px; background: #FFFFFF; color: var(--c); font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 15px; }
.deck-card .cols { font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.85); }
.deck-card.side { --s: .86; --o: .78; --z: 4; }
.deck-card.far  { --s: .72; --o: .5;  --z: 3; --b: .6px; }
/* spread shrinks with the stage, so the far cards never run under the arrows (sidebar open = narrower stage) */
.deck-card.l1 { --x: calc(-1 * min(250px, 22cqw)); } .deck-card.r1 { --x: min(250px, 22cqw); }
.deck-card.l2 { --x: calc(-1 * min(450px, 38cqw)); } .deck-card.r2 { --x: min(450px, 38cqw); }
/* cards further out wait invisible just beyond the far ones, so they slide in instead of popping in */
.deck-card.off { --o: 0; --s: .6; --z: 1; pointer-events: none; }
.deck-card.l3 { --x: calc(-1 * min(600px, 52cqw)); } .deck-card.r3 { --x: min(600px, 52cqw); }
.deck-card.side h2, .deck-card.far h2 { font-size: 22px; }
.deck-card.side p, .deck-card.far p, .deck-card.side .cta, .deck-card.far .cta, .deck-card.side .tag, .deck-card.far .tag { display: none; }
.deck-card:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }
/* A side card lifts a little under the pointer; the real move is the deck turning (dash.js) */
.deck-card.side:hover { --s: .9; --o: .9; }
.deck-card.far:hover { --s: .76; --o: .65; }

.stage-arrow {
  position: absolute; top: 330px; z-index: 6; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.22); color: #FFFFFF;
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer;
}
.stage-arrow.left { left: 0; } .stage-arrow.right { right: 0; }
.stage-arrow:hover { background: rgba(255, 255, 255, 0.18); }
.stage-arrow:disabled { opacity: .25; cursor: default; }

.facts { position: absolute; left: 0; right: 0; top: 600px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.facts span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px); font-size: 12.5px; font-weight: 800; color: #FFFFFF; }
.facts span i { font-style: normal; color: rgba(255, 255, 255, 0.6); font-weight: 700; }
.stage-hint { position: absolute; left: 0; right: 0; top: 658px; text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.45); }
.stage-hint b { color: rgba(255, 255, 255, 0.7); padding: 1px 6px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; font-weight: 800; }
.stage-empty { position: absolute; left: 0; right: 0; top: 280px; text-align: center; color: rgba(255, 255, 255, 0.6); font-weight: 700; }
/* title, counter and facts fade up each time the focused tool changes */
.stage-title.swap, .facts.swap { animation: stage-swap .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes stage-swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .deck-card { transition: none; }
  .stage-title.swap, .facts.swap { animation: none; }
  body.dash-dark { transition: none; }
}

/* floating rail on the left + the search/filter popover beside it */
.dash-rail { position: absolute; left: 0; top: 160px; z-index: 6; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(8px); }
.rail-btn { width: 38px; height: 38px; border: 0; border-radius: 11px; background: none; color: rgba(255, 255, 255, 0.85); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.rail-btn:hover, .rail-btn.active { background: rgba(255, 255, 255, 0.16); color: #FFFFFF; }
.dash .toolbar {
  position: absolute; left: 62px; top: 166px; z-index: 7; margin: 0;
  flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; width: 320px;
  background: rgba(28, 24, 48, 0.97); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px; box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  color: #FFFFFF;
}
.dash .toolbar .search-box { width: auto; }
.dash .toolbar .filters { flex-wrap: wrap; }

/* grid view: the classic card grid, with the toolbar inline above it */
.dash.is-grid .stage { display: none; }
.dash.is-grid .toolbar { position: static; width: auto; flex-direction: row; align-items: center; box-shadow: none; background: transparent; border: 0; padding: 0; margin-top: 14px; }
.dash.is-grid .toolbar .search-box { width: 300px; }
.grid-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-title { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 26px; color: #FFFFFF; }
.btn-small { padding: 8px 14px; font-size: 13px; }
body.dash-dark .btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); color: #FFFFFF; }
body.dash-dark .filter-pill { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.8); }
body.dash-dark .filter-pill.active { background: #FFFFFF; color: var(--brand); border-color: #FFFFFF; }
body.dash-dark .dash.is-grid .toolbar .search-box { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }
body.dash-dark .dash.is-grid .toolbar .search-box input { color: #FFFFFF; }

@media (max-width: 900px) {
  .stage { height: auto; padding-bottom: 20px; }
  .deck { position: static; height: auto; width: auto; display: flex; gap: 14px; overflow-x: auto; padding: 18px 16px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .deck-card { position: relative; left: auto; top: auto; transform: none; opacity: 1; filter: none; flex: 0 0 78vw; height: 420px; scroll-snap-align: center; }
  .deck-card.side p, .deck-card.far p, .deck-card.side .cta, .deck-card.far .cta, .deck-card.side .tag, .deck-card.far .tag { display: flex; }
  .deck-card.side h2, .deck-card.far h2 { font-size: 27px; }
  .stage-arrow, .stage-hint { display: none; }
  .facts { position: static; padding: 6px 0; }
  .dash-rail { position: static; flex-direction: row; justify-content: center; margin: 0 auto 6px; width: max-content; }
  .dash .toolbar { position: static; width: auto; margin: 0 0 12px; }
}

/* ===== Dark scene for content pages (Settings, History): cards become dark glass, text goes light ===== */
body.dash-dark .hero h1 { color: #FFFFFF; }
body.dash-dark .hero p { color: rgba(255, 255, 255, 0.62); }
body.dash-dark .step-card, body.dash-dark .hist-card, body.dash-dark .settings-nav {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  backdrop-filter: blur(6px);
}
body.dash-dark .card-title, body.dash-dark .step-title, body.dash-dark .who-name, body.dash-dark .hist-name, body.dash-dark .hist-items { color: #FFFFFF; }
body.dash-dark .card-sub, body.dash-dark .field-note, body.dash-dark .opt-hint, body.dash-dark .who-mail, body.dash-dark .hist-when,
body.dash-dark .hist-count, body.dash-dark .hist-empty, body.dash-dark .empty-row td { color: rgba(255, 255, 255, 0.62); }
body.dash-dark .hist-header span, body.dash-dark .hist-muted { color: rgba(255, 255, 255, 0.45); }
body.dash-dark .field-label, body.dash-dark .opt-label { color: #FFFFFF; }
body.dash-dark .who, body.dash-dark .opt-row, body.dash-dark .hist-row, body.dash-dark .hist-foot { border-color: rgba(255, 255, 255, 0.10); }
body.dash-dark .avatar-xl { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14); }

/* inputs */
body.dash-dark .text-field { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); color: #FFFFFF; }
body.dash-dark .text-field::placeholder { color: rgba(255, 255, 255, 0.38); }
body.dash-dark .text-field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(106, 90, 224, 0.35); }
body.dash-dark .text-field[readonly] { color: rgba(255, 255, 255, 0.75); }
body.dash-dark .sub-box { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.18); }
body.dash-dark .knob { background: rgba(255, 255, 255, 0.22); }
body.dash-dark .switch input:checked + .knob { background: #3FA65B; }

/* settings side navigation */
body.dash-dark .settings-tab { color: rgba(255, 255, 255, 0.7); }
body.dash-dark .settings-tab:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }
body.dash-dark .settings-tab.active { background: rgba(106, 90, 224, 0.35); color: #FFFFFF; }

/* history controls: segmented view switch, search, selects, pager, row buttons */
body.dash-dark .seg { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); }
body.dash-dark .seg-btn { color: rgba(255, 255, 255, 0.7); }
body.dash-dark .seg-btn.active { background: var(--brand); color: #FFFFFF; }
body.dash-dark .search-box { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); }
body.dash-dark .search-box input { color: #FFFFFF; }
body.dash-dark .search-box input::placeholder { color: rgba(255, 255, 255, 0.38); }
body.dash-dark .select-pill, body.dash-dark .pager-btn, body.dash-dark .icon-btn {
  background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.8);
}
body.dash-dark .icon-btn:hover, body.dash-dark .pager-btn:hover:not(:disabled) { border-color: #FFFFFF; color: #FFFFFF; }
body.dash-dark .icon-btn.danger { color: #FFB4A8; }
body.dash-dark .pager-btn:disabled { color: rgba(255, 255, 255, 0.3); }
body.dash-dark .hist-progress { background: rgba(255, 255, 255, 0.12); }
body.dash-dark .hist-note { color: #FFB4A8; }
body.dash-dark .hist-row:not(.hist-header):hover { background: rgba(255, 255, 255, 0.04); }

/* ===== Tool + results pages: the tool colour paints one band (top bar + hero) and a pastel tint below it ===== */
body.tool-band {
  --band-h: 340px;   /* tool-page.js / results-page.js set the real value: the bottom edge of the hero */
  background:
    radial-gradient(circle at 12% 100%, rgba(255, 255, 255, 0.10) 0 90px, transparent 91px) 0 0 / 100% var(--band-h) no-repeat,
    radial-gradient(circle at 78% 0%, transparent 0 110px, rgba(255, 255, 255, 0.16) 111px 122px, transparent 123px) 0 0 / 100% var(--band-h) no-repeat,
    linear-gradient(165deg, rgba(255, 255, 255, 0.12) 0%, rgba(22, 14, 42, 0.40) 100%) 0 0 / 100% var(--band-h) no-repeat,
    linear-gradient(var(--tool-color, var(--brand)), var(--tool-color, var(--brand))) 0 0 / 100% var(--band-h) no-repeat,
    radial-gradient(900px 550px at 85% 20%, color-mix(in srgb, var(--tool-color, var(--brand)) 30%, white) 0%, transparent 60%),
    radial-gradient(800px 500px at -10% 60%, color-mix(in srgb, var(--tool-color, var(--brand)) 22%, white) 0%, transparent 55%),
    radial-gradient(750px 480px at 50% 115%, color-mix(in srgb, var(--tool-color, var(--brand)) 18%, white) 0%, transparent 55%),
    color-mix(in srgb, var(--tool-color, var(--brand)) 9%, white);
  background-attachment: scroll;   /* the band belongs to the page, so it scrolls with it */
}
/* the hero is no longer a card: its content sits straight on the band */
body.tool-band .tool-hero { background: none; box-shadow: none; border: 0; overflow: visible; padding-top: 8px; }
body.tool-band .side-open { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.35); color: #FFFFFF; }
body.tool-band .mobile-top { background: rgba(0, 0, 0, 0.18); }

/* ===== Login / signup on the dark scene: the card becomes dark glass ===== */
body.auth-body.dash-dark { background-attachment: fixed; }
body.dash-dark .auth-card { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); backdrop-filter: blur(8px); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35); }
body.dash-dark .auth-logo .brand-name, body.dash-dark .auth-title { color: #FFFFFF; }
body.dash-dark .auth-sub, body.dash-dark .auth-note, body.dash-dark .auth-divider { color: rgba(255, 255, 255, 0.62); }
body.dash-dark .auth-divider::before, body.dash-dark .auth-divider::after { background: rgba(255, 255, 255, 0.14); }
body.dash-dark .auth-note a, body.dash-dark .auth-card a { color: #C9C0FF; }
body.dash-dark .error-msg { color: #FFB4A8; }
body.dash-dark .auth-notice { background: rgba(106, 90, 224, 0.28); color: #FFFFFF; }
body.dash-dark .auth-card .btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); color: #FFFFFF; }

/* ===== Confirm dialog (log out) ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 13, 28, 0.62); backdrop-filter: blur(4px);
}
.modal {
  width: 100%; max-width: 380px; padding: 24px;
  background: rgba(38, 33, 74, 0.97); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45); color: #FFFFFF;
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-title { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; }
.modal-text { margin: 8px 0 20px 0; font-size: 14px; color: rgba(255, 255, 255, 0.7); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal .btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); color: #FFFFFF; }

/* ===== Tool page ===== */
.page-narrow { max-width: 820px; }

.tool-title {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 28px;
}

.tool-sub {
  margin: 2px 0 0 0;
  font-size: 14px;
  color: var(--muted);
}
/* ===== Tool page: hero banner ===== */
.tool-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  margin-bottom: 16px;
  border-radius: 18px;
  color: #FFFFFF;
  /* same layered gradient as the home cards, painted over the tool's own colour */
  background:
    radial-gradient(circle at 10% 105%, rgba(255,255,255,0.10) 0 65px, transparent 66px),
    radial-gradient(circle at 72% -14%, transparent 0 78px, rgba(255,255,255,0.16) 79px 86px, transparent 87px),
    radial-gradient(140% 90% at 100% 0%, rgba(255,255,255,0.22) 0%, transparent 45%),
    linear-gradient(165deg, rgba(255,255,255,0.10) 0%, rgba(22,14,42,0.52) 100%),
    var(--tool-color, var(--brand));
}

.hero-back {
  align-self: flex-start;
  font-weight: 700;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}
.hero-back:hover { color: #FFFFFF; text-decoration: underline; }

.hero-head { display: flex; align-items: center; gap: 16px; }

.hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-hero .tool-title { color: #FFFFFF; }
.tool-hero .tool-sub   { color: rgba(255, 255, 255, 0.85); }

.hero-meta  { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero-label { font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.75); margin-right: 4px; }
.hero-cols  { display: flex; flex-wrap: wrap; gap: 8px; }

.hero-col {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 800;
  font-size: 12px;
}

.hero-mode {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
}

/* ===== Tool page: work card (input + options + run) ===== */
.work-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.work-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.work-head .tabs { margin-bottom: 0; }
.work-divider { height: 1px; background: var(--line); }
.work-card .run-row { margin-top: 0; justify-content: space-between; }
.work-card .count { color: var(--tool-color, var(--brand)); }   /* counter wears the tool colour */

.hint-right a { color: var(--brand); font-weight: 800; text-decoration: none; }
.hint-right a:hover { text-decoration: underline; }

/* Option label + small helper line under it */
.opt-text { display: flex; flex-direction: column; gap: 3px; }
.opt-hint { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .tool-hero { padding: 20px; }
  .hero-mode { margin-left: 0; }
  .work-head { flex-wrap: wrap; }
}

/* ===== Step cards (tool page) ===== */
.step-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 16px;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.step-title {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.hidden { display: none !important; }   /* must beat later display:flex rules (e.g. .tabs) */

/* ===== Tabs ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

/* ===== Paste pane ===== */
.list-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: #FDFBF7;
  resize: vertical;
}
.list-input:focus { outline: none; border-color: var(--brand); }

.input-hint {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
}

.count { font-weight: 800; color: var(--brand); }
.hint-right { color: #A79FB8; }

/* ===== Upload pane ===== */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 32px;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
}
.dropzone:hover { border-color: var(--brand); color: var(--brand); }

.drop-title { font-weight: 800; font-size: 14px; color: var(--ink); }
.drop-sub { font-size: 12px; color: #A79FB8; }
.drop-file { font-size: 13px; font-weight: 800; color: var(--brand); }

/* ===== Single URL field (Trip.com Data) ===== */
.field-label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 8px;
}

.text-field {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #FDFBF7;
}
.text-field:focus { outline: none; border-color: var(--brand); }

/* ===== Options card ===== */
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.opt-row:last-child { border-bottom: none; }

.opt-label { font-weight: 700; font-size: 14px; }

.no-options { margin: 0; color: var(--muted); font-size: 14px; }

.num-field { width: 90px; text-align: center; }

/* ===== Settings page: field layout ===== */
.field-gap { height: 14px; }
.field-gap-top { margin-top: 14px; }
.field-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.inline-row { display: flex; align-items: center; gap: 10px; }
.inline-row .text-field { flex: 1; min-width: 0; }
.inline-row .btn-ghost, .inline-row .btn-primary { flex-shrink: 0; white-space: nowrap; }
.inline-row .field-note { margin-top: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }   /* 2 or 3 boxes: fits either, wraps on phones */
.sub-box { margin-top: 14px; padding: 16px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--bg); }

/* ===== Settings page: section navigation on the left, cards on the right ===== */
.settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  max-width: 1040px;
}
.settings-nav {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.settings-tab svg { flex-shrink: 0; }
.settings-tab:hover { background: #F1EBE1; color: var(--ink); }
.settings-tab.active { background: var(--brand-soft); color: var(--brand); }
.settings-panels { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Card header: title + one-line description on the left, the card's own button on the right */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-title { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 20px; }
.card-sub { margin: 4px 0 0 0; font-size: 13px; color: var(--muted); }
.card-head .btn-primary { flex-shrink: 0; white-space: nowrap; }
.card-foot { margin-top: 14px; min-height: 18px; }

/* Profile card: big avatar + name + email */
.who { display: flex; align-items: center; gap: 14px; padding: 4px 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; flex-shrink: 0; box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 4px var(--line); }
.who-name { font-weight: 800; font-size: 16px; }
.who-mail { font-size: 13px; color: var(--muted); word-break: break-all; }

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-tab { white-space: nowrap; }
  .card-head { flex-wrap: wrap; }
}

/* ===== Toggle switch ===== */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }

.knob {
  position: absolute;
  inset: 0;
  background: #D9D2C7;
  border-radius: 999px;
  transition: background .15s;
  cursor: pointer;
}
.knob::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  top: 3px;
  left: 3px;
  transition: left .15s;
}
.switch input:checked + .knob { background: #3FA65B; }
.switch input:checked + .knob::before { left: 21px; }

/* ===== Run button ===== */
.run-row { display: flex; align-items: center; gap: 14px; margin-top: 20px; }

.run-btn {
  border: none;
  border-radius: 14px;
  padding: 14px 28px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #FFFFFF;
  cursor: pointer;
}
.run-btn:disabled { opacity: .5; cursor: not-allowed; }
.run-btn:hover { filter: brightness(0.93); }

.run-note { font-size: 13px; color: var(--muted); }

/* ===== Results page: same hero + work card as the tool page ===== */
.hero-head-run { flex-wrap: wrap; }
.hero-titles { flex: 1; min-width: 200px; }
.hero-actions { display: flex; align-items: center; gap: 10px; }
.tool-hero .status-pill { background: rgba(255, 255, 255, 0.22); color: #FFFFFF; }
.tool-hero .dot { background: #FFFFFF; }
.hero-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.hero-btn:hover { background: rgba(255, 255, 255, 0.24); }

.work-card .alert { margin-bottom: 0; }
.work-card .pct { font-family: 'Baloo 2', sans-serif; font-size: 22px; color: var(--tool-color, var(--brand)); }
.work-card .progress-fill { background: var(--tool-color, var(--brand)); }
.work-card .progress-row { align-items: center; flex-wrap: wrap; gap: 10px; }
.work-card .chips { margin-top: 0; flex-wrap: wrap; }
.work-sub { font-size: 13px; font-weight: 700; color: var(--muted); }
.empty-row td { color: var(--muted); text-align: center; padding: 22px 8px; }
.run-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.work-card .run-btn { background: var(--tool-color, var(--brand)); padding: 12px 22px; font-size: 15px; }

/* ===== Results page ===== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}
.st-run  { background: #E5F0FB; color: #3E8FDD; }
.st-done { background: #E3F4E8; color: #3FA65B; }
.st-warn { background: #FDEEDF; color: #EF8A3C; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #3E8FDD; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #FDEEDF;
  border: 1.5px solid #EF8A3C;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.progress-track { height: 10px; border-radius: 999px; background: #F1EBE1; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--brand); border-radius: 999px; transition: width 0.4s ease; }
.progress-row { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.pct { font-weight: 800; color: var(--muted); }

.chips { display: flex; gap: 8px; margin-top: 12px; }
.chip { padding: 5px 12px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.chip-ok   { background: #E3F4E8; color: #3FA65B; }
.chip-warn { background: #FBF2D7; color: #D9A414; }
.chip-bad  { background: #FDE8E4; color: #E8604C; }

.results-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.results-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #A79FB8;
  padding: 0 8px 10px 8px;
  border-bottom: 1px solid var(--line);
}
.results-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.results-table tr:last-child td { border-bottom: none; }

.row-pill { padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 11px; white-space: nowrap; }
.pill-ok   { background: #E3F4E8; color: #3FA65B; }
.pill-warn { background: #FBF2D7; color: #D9A414; }
.pill-bad  { background: #FDE8E4; color: #E8604C; }

.btn-primary {
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  background: var(--brand);
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(0.93); }

.btn-ghost {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 22px;
  background: var(--card);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

/* ===== History page ===== */
.runs { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }

.run-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
}

.run-icon { width: 40px; height: 40px; border-radius: 12px; }

.run-info { flex-grow: 1; }
.run-name { font-weight: 800; font-size: 15px; }
.run-num  { color: #A79FB8; font-weight: 700; font-size: 13px; }
.run-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; text-decoration: none; }

.st-bad { background: #FDE8E4; color: #E8604C; }

/* ===== History page: table ===== */
.page-wide { max-width: 1080px; }

.hist-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); }
.seg-btn { padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 13px; text-decoration: none; }
.seg-btn.active { background: var(--brand); color: #FFFFFF; }

.toolbar-right { display: flex; gap: 8px; margin-left: auto; }
.select-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.hist-card { margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px 24px 16px 24px; }

.hist-row {
  display: grid;
  grid-template-columns: 2.2fr 0.9fr 1.6fr 1.1fr 1.4fr;
  gap: 12px;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.hist-header span { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: #A79FB8; }
.hist-header .right { text-align: right; }

.hist-tool { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hist-icon { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.hist-icon svg { width: 18px; height: 18px; }
.hist-name { font-weight: 800; font-size: 14px; }
.hist-name .run-num { font-size: 12px; }
.hist-when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hist-items { font-size: 13px; font-weight: 700; }

.hist-result { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.hist-result .chip { padding: 3px 9px; font-size: 11px; }
.hist-note { font-size: 12px; color: #E8604C; font-weight: 700; }
.hist-muted { font-size: 11px; color: #A79FB8; font-weight: 700; white-space: nowrap; }
.hist-progress { flex-grow: 1; height: 8px; border-radius: 999px; background: #F1EBE1; overflow: hidden; }
.hist-progress div { height: 100%; border-radius: 999px; background: #3E8FDD; }

.hist-row .status-pill { padding: 5px 12px; font-size: 12px; justify-self: start; }

.hist-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn.danger { color: #E8604C; }
.icon-btn.danger:hover { border-color: #E8604C; }

.hist-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 0 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.hist-count { font-size: 12.5px; color: var(--muted); }
.pager { display: flex; gap: 6px; }
.pager-btn {
  padding: 6px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.pager-btn:disabled { color: #A79FB8; cursor: default; }
.hist-empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .hist-head { flex-wrap: wrap; }
  .toolbar-right { margin-left: 0; }
  .hist-header { display: none; }
  .hist-row { grid-template-columns: 1fr; gap: 8px; }
  .hist-actions { justify-content: flex-start; }
}

/* ===== Auth pages (login/signup) ===== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-wrap { width: 100%; max-width: 400px; padding: 24px; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-title {
  margin: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 26px;
  text-align: center;
}

.auth-sub {
  margin: 4px 0 22px 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.field { margin-bottom: 14px; }

.btn-full { width: 100%; margin-top: 6px; }

.error-msg {
  color: #E8604C;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.auth-note {
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  margin: 18px 0 0 0;
}

/* "or" line between the form and the Google button */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px 0;
  color: #A79FB8;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex-grow: 1; height: 1px; background: var(--line); }

.google-btn { display: flex; justify-content: center; min-height: 44px; }

/* "You are already logged in" notice on the auth pages */
.auth-notice {
  background: var(--brand-soft);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 4px;
  font-size: 14px;
}
.auth-notice p { margin: 0 0 12px 0; }
.auth-notice-actions { display: flex; gap: 8px; }
.auth-notice-actions .btn-primary { display: inline-block; text-decoration: none; }

/* While logged in, the card shows only the notice */
.auth-card.logged-in form,
.auth-card.logged-in .auth-divider,
.auth-card.logged-in .google-btn,
.auth-card.logged-in .auth-note { display: none; }
.fail-reason { color: #B3261E; font-size: 0.85em; }

/* Trip Images: gallery view */
.gallery-toggle {
  margin-left: 8px; padding: 2px 10px; font-size: 12px; cursor: pointer;
  border: 1px solid #ccc; border-radius: 6px; background: #fff;
}
.gallery-row td { background: #fafafa; padding: 10px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.gallery-grid img {
  width: 100%; height: 90px; object-fit: cover; border-radius: 6px; display: block;
}

/* Inputs pe pyara focus glow */
.search-box:focus-within,
.list-input:focus,
.text-field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Verification code screen */
.auth-sub-left { text-align: left; }
.code-field { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 8px; }
.ok-msg { color: #3FA65B; font-size: 13px; font-weight: 700; margin: 0 0 10px 0; }


/* Card hover: upar rang ki patti + icon halka sa jhoole */
.tool-card {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 20px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  color: #FFFFFF;
  background:
    radial-gradient(circle at 88% 12%, rgba(255,255,255,0.20) 0 46px, transparent 47px),
    radial-gradient(circle at 103% 48%, rgba(255,255,255,0.12) 0 30px, transparent 31px),
    radial-gradient(circle at 10% 105%, rgba(255,255,255,0.10) 0 65px, transparent 66px),
    radial-gradient(circle at 72% -14%, transparent 0 78px, rgba(255,255,255,0.16) 79px 86px, transparent 87px),
    radial-gradient(140% 90% at 100% 0%, rgba(255,255,255,0.22) 0%, transparent 45%),
    linear-gradient(165deg, rgba(255,255,255,0.10) 0%, rgba(22,14,42,0.52) 100%),
    var(--tool-color);
  transition: transform .15s ease, box-shadow .15s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(45, 42, 62, 0.30);
}

.tool-icon { transition: transform .15s ease; }
.tool-card:hover .tool-icon { transform: scale(1.08) rotate(-3deg); }

/* Buttons dabane par halka sa dab jayein */
.btn-primary, .btn-ghost, .run-btn, .filter-pill, .tab {
  transition: transform .12s ease, filter .12s ease,
              background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary:active, .btn-ghost:active, .run-btn:active { transform: scale(0.97); }

/* Table rows pe hover highlight */
.results-table tbody tr:hover td { background: var(--bg); }

/* Table ko scroll dena (Part 3 ka saathi) */
.table-wrap { overflow-x: auto; }
.results-table { min-width: 560px; }

/* ===== Responsive ===== */

/* Tablet / aadhi window */
@media (max-width: 900px) {
  .page { padding: 28px 24px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { width: 100%; }
}

/* Phone */
@media (max-width: 640px) {
  .brand-name { font-size: 17px; }

  .page { padding: 20px 14px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 14px; }

  /* Filter pills ek line me, side scroll ke saath */
  .filters {
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-pill { white-space: nowrap; flex-shrink: 0; }

  .step-card { padding: 18px; }
  .tool-title { font-size: 22px; }
  .run-row { flex-wrap: wrap; }
  .opt-row { flex-wrap: wrap; }

  .tabs { flex-wrap: wrap; }
  .dropzone { padding: 24px 14px; }

  /* History rows phone pe stack ho jayein */
  .run-item { flex-wrap: wrap; }
}
/* ===== Photo-style cards: white text + glass bar ===== */
.tool-icon {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  backdrop-filter: blur(4px);
}

.tool-name { color: #FFFFFF; }
.tool-desc { color: rgba(255, 255, 255, 0.85); }

/* Neeche wali "Explore Now" jaisi frosted bar */
.tool-tag { display: none; }

/* ===== Sidebar layout ===== */
body.has-sidebar { padding-left: 250px; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 250px;
  background: var(--side-bg);
  border-right: 1px solid var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px;
  overflow-y: auto;         /* the whole sidebar scrolls as one, footer included */
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px 8px;
}

/* Group headers (Tools / History) */
.side-group summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover { background: var(--side-hover); }

.side-group summary::after {
  content: '▸';
  color: var(--side-muted);
  transition: transform .15s ease;
}
.side-group[open] summary::after { transform: rotate(90deg); }

/* Sub links */
.side-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 8px 0;
  padding-left: 12px;
}

.side-link {
  display: flex;            /* icon tile + label side by side */
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--side-muted);
  text-decoration: none;
}
.side-link:hover { background: var(--side-hover); color: #FFFFFF; }
.side-link.active { background: var(--brand); color: #FFFFFF; }

/* Tool icon in the sidebar: the dashboard card's SVG and colours in a small tile */
.side-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tool-bg);
  color: var(--tool-color);
}
.side-icon svg { width: 15px; height: 15px; }

/* ===== Sidebar footer: email, Profile (opens the profile card) and Role (later phase) ===== */
.side-profile {
  margin-top: auto;         /* short list: pushed to the bottom; long list: simply the last block, scrolls with it */
  flex-shrink: 0;
  background: var(--side-bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0 6px;
  border-top: 1px solid var(--side-line);
}

/* One footer row: icon tile + text (a div for plain rows, a button for Profile) */
.side-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--side-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}
.side-meta-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  color: #C9C3E6;
}
.side-meta-icon svg { width: 14px; height: 14px; }
/* User block: avatar, name, email and the log-out button (same design as before) */
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 2px;   /* now the last row of the footer */
}
.profile-name { font-weight: 800; font-size: 13.5px; }
.profile-mail { font-size: 11.5px; color: var(--side-muted); word-break: break-all; }
.profile-mail:empty::before { content: '\00a0'; }   /* keeps the line's height before the email arrives, so the footer does not jump */
.logout-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--side-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}
.logout-btn:hover { background: rgba(232, 96, 76, 0.25); color: #FFB4A8; }

/* Settings row is a link; .active marks it on the Settings page */
.side-meta-link { text-decoration: none; transition: background .12s ease; }
.side-meta-link:hover { background: var(--side-hover); }
.side-meta-link.active { background: rgba(106, 90, 224, 0.35); color: #FFFFFF; }
.side-meta-link.active .side-meta-icon { background: rgba(255, 255, 255, 0.16); color: #FFFFFF; }
.side-meta-link::after { content: '\203A'; margin-left: auto; color: var(--side-muted); font-size: 18px; line-height: 1; }

/* Role row: placeholder until roles exist */
.side-meta-soon { color: var(--side-muted); cursor: default; }
.side-pill {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(106, 90, 224, 0.35);
  color: #DED6FA;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .3px;
}

/* ===== Sidebar open/close ===== */
.sidebar { transition: transform .22s ease, box-shadow .22s ease; }

/* Close button: right side of the sidebar header */
.side-close {
  margin-left: auto;
  width: 30px; height: 30px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--side-ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.side-close:hover { background: #F1EBE1; color: var(--ink); }

/* ☰ inside the top bar: desktop only, shown while the sidebar is collapsed */
.side-open {
  display: none;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 18px;
  padding: 6px 12px;
  cursor: pointer;
}
.side-open:hover { background: #F1EBE1; }

/* Backdrop: dark layer behind the mobile drawer */
.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 30, .45);
  z-index: 95;
}

.mobile-top { display: none; }

.menu-btn {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 18px;
  padding: 6px 12px;
  cursor: pointer;
}

/* ---- Desktop: collapse (state is remembered) ---- */
@media (min-width: 901px) {
  html.side-collapsed body.has-sidebar { padding-left: 0; }
  html.side-collapsed .sidebar { transform: translateX(-100%); }
  html.side-collapsed .side-open { display: inline-block; }
}

/* ---- Mobile: drawer ---- */
@media (max-width: 900px) {
  body.has-sidebar { padding-left: 0; padding-top: 58px; }
  body.side-locked { overflow: hidden; }   /* no page scroll while the drawer is open */

  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, .25);
  }

  .side-backdrop.show { display: block; }

  .mobile-top {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 58px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    z-index: 90;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ===== Logout button (sidebar profile) ===== */

/* ===== Roles: sidebar pill + Users page (admin) ===== */
.side-pill:empty { display: none; }   /* nothing to show until /api/me answers with the role */

.users-row { grid-template-columns: 2.2fr 1fr 1.6fr 1fr; }
.card-actions { display: flex; gap: 10px; flex-shrink: 0; }   /* Cancel + Create side by side in the card header */
/* The dark-glass card is its own stacking context, so its open dropdown would paint UNDER the accounts card
   below it. Lifting the whole New user card above its neighbours fixes that. */
#new-user-card { position: relative; z-index: 5; }
/* Same for the accounts card: its last rows' dropdowns open over the Roles card below it. Order = 5 > 4 > auto. */
#users-card { position: relative; z-index: 4; }
.role-select { width: auto; min-width: 110px; padding: 8px 12px; }

.tool-picker { position: relative; }
.tool-picker summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 700;
}
.tool-picker summary::-webkit-details-marker { display: none; }
.tool-picker summary::after { content: ' \25BE'; color: var(--muted); }
.tool-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  max-height: 380px;   /* 11 tools + the search box fit without scrolling; more tools would scroll */
  overflow-y: auto;
}
.tool-picker-menu label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tool-picker-search {
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}
.tool-picker-search:focus { outline: none; border-color: var(--brand); }
.tool-picker-empty { font-size: 12px; color: var(--muted); padding: 2px 0; }

/* dark scene: solid dark surfaces so the open menu stays readable over the page */
body.dash-dark .tool-picker summary, body.dash-dark .tool-picker-menu, body.dash-dark .role-select {
  background: #2A2450;
  border-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}
/* The native dropdown list inherits the select's dark background on Windows, so its options must be light too.
   color-scheme: dark asks the browser for its dark popup; the option colours cover browsers that ignore that. */
body.dash-dark .role-select, body.dash-dark .select-pill { color-scheme: dark; }
body.dash-dark .role-select option, body.dash-dark .select-pill option { background: #2A2450; color: #FFFFFF; }
body.dash-dark .tool-picker-search { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); color: #FFFFFF; }
body.dash-dark .tool-picker-search::placeholder { color: rgba(255, 255, 255, 0.38); }

/* Dashboard note after being sent back from a tool page the account may not open */
.access-note {
  position: fixed;
  bottom: 28px;   /* snackbar at the bottom: nothing of the stage sits there */
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 4px solid #EF8A3C;
  background: rgba(38, 33, 74, 0.97);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}
.access-note-close { border: none; background: transparent; color: inherit; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }
.access-note-close:hover { opacity: 1; }

/* Roles card: chips + add form */
#roles-card { margin-top: 24px; }
.role-add { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.role-add .text-field { width: 220px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}
.role-chip.built-in { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }
.role-chip-del { border: none; background: transparent; color: inherit; font: inherit; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .7; }
.role-chip-del:hover { opacity: 1; }
body.dash-dark .role-chip { background: rgba(106, 90, 224, 0.35); color: #DED6FA; }
body.dash-dark .role-chip.built-in { background: transparent; border-color: rgba(255, 255, 255, 0.22); color: rgba(255, 255, 255, 0.6); }
