/* =========================================================
   It's Your Idea — Customer Launchpad styles
   Extends css/styles.css design tokens. Dark-first app surface.
   ========================================================= */

[hidden] { display: none !important; }

/* ─── Layout ───────────────────────────────────────────── */

.launchpad-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Anek Gurmukhi", Helvetica, Verdana, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ─── Top bar ──────────────────────────────────────────── */

.lp-topbar {
  background: var(--navy);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.lp-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.lp-topbar__brand img {
  height: 26px;
  display: block;
}

.lp-topbar__tag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(33, 193, 243, .12);
  padding: 2px 8px;
  border-radius: 999px;
}

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

.lp-user-name {
  font-size: .9rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ─── Main content area ────────────────────────────────── */

.lp-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px 60px;
}

/* ─── Auth card (login / register) ────────────────────── */

.lp-auth-wrap {
  width: 100%;
  max-width: 440px;
}

.lp-auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.lp-auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.lp-auth-logo img {
  height: 34px;
}

.lp-auth-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.lp-auth-sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

/* Tabs */
.lp-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.lp-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 0;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}

.lp-tab.is-active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.lp-tab:hover:not(.is-active) {
  color: var(--ink);
}

.lp-tab-panel { display: none; }
.lp-tab-panel.is-active { display: block; }

/* Fields */
.lp-field {
  margin-bottom: 16px;
}

.lp-field label {
  display: block;
  font-size: .87rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.lp-field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}

.lp-field input:focus {
  border-color: var(--blue);
}

.lp-field input::placeholder {
  color: var(--muted);
}

/* Error */
.lp-form-error {
  min-height: 20px;
  font-size: .85rem;
  color: #f87171;
  margin: 8px 0;
}

/* ─── Launchpad / logged-in state ──────────────────────── */

.lp-shell {
  width: 100%;
  max-width: 860px;
}

.lp-greeting {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 700;
}

.lp-greeting-sub {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: .95rem;
}

/* Product tile grid */
.lp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.lp-tile {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .2s, box-shadow .2s;
}

.lp-tile--active {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(22, 182, 201, .18), var(--shadow-sm);
}

.lp-tile__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lp-tile__name {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
}

.lp-tile__badge {
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.lp-tile__badge--active {
  background: rgba(22, 182, 201, .15);
  color: var(--teal);
}

.lp-tile__badge--available {
  background: rgba(148, 170, 191, .12);
  color: var(--muted);
}

.lp-tile__blurb {
  font-size: .88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
  flex: 1;
}

.lp-tile__footer {
  margin-top: 4px;
}

/* ─── Plan picker ──────────────────────────────────────── */

.lp-plan-picker {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lp-plan-tier-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lp-plan-tier {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  transition: background .15s;
}

.lp-plan-tier:last-child {
  border-bottom: none;
}

.lp-plan-tier:not(.lp-plan-tier--unavailable):hover {
  background: rgba(33, 193, 243, .06);
}

.lp-plan-tier__label {
  flex: 1;
  font-size: .87rem;
  font-weight: 600;
  color: var(--ink);
}

.lp-plan-tier__price {
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
}

.lp-plan-tier--unavailable .lp-plan-tier__label,
.lp-plan-tier--unavailable .lp-plan-tier__price {
  opacity: .45;
}

/* Extra-small button variant for plan tiers */
.btn--xs {
  padding: 4px 10px;
  font-size: .78rem;
  line-height: 1.4;
}

/* Hub services tile */
.lp-tile--hub {
  border-color: var(--blue-deep);
}

.lp-tile--hub .lp-tile__badge--active {
  background: rgba(79, 155, 217, .15);
  color: var(--blue);
}

/* Toast */
.lp-toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.lp-toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: .9rem;
  box-shadow: var(--shadow-sm);
  animation: lp-toast-in .2s ease;
}

.lp-toast--error {
  border-color: #f87171;
  color: #f87171;
}

@keyframes lp-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Account hub: section nav ─────────────────────────── */

.lp-hubnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 28px;
}

.lp-hubnav__btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}

.lp-hubnav__btn:hover:not(.is-active) { color: var(--ink); }

.lp-hubnav__btn.is-active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.lp-section { display: none; }
.lp-section.is-active { display: block; }

/* ─── Account hub: panels ──────────────────────────────── */

.lp-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.lp-panel:last-child { margin-bottom: 0; }

.lp-panel__title {
  margin: 0 0 16px;
  font-size: 1.08rem;
  font-weight: 700;
}

.lp-note {
  color: var(--muted);
  font-size: .87rem;
  margin: 14px 0 0;
}

.lp-empty,
.lp-empty-line {
  color: var(--muted);
  font-size: .9rem;
}

.lp-empty p { margin: 0 0 6px; }

.lp-linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
}

/* Generic badge (tickets / invoices) */
.lp-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
}

.lp-badge--up { background: rgba(34, 197, 94, .15); color: #4ade80; }
.lp-badge--down { background: rgba(248, 113, 113, .15); color: #f87171; }
.lp-badge--info { background: rgba(33, 193, 243, .14); color: var(--cyan); }
.lp-badge--muted { background: rgba(148, 170, 191, .12); color: var(--muted); }
.lp-badge--source { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }

/* ─── Tile secondary deep link ─────────────────────────── */

.lp-tile__deeplink {
  display: inline-block;
  margin-top: 8px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--cyan);
  cursor: pointer;
}

.lp-tile__deeplink:hover { text-decoration: underline; }

/* ─── Monitoring stat cards ────────────────────────────── */

.lp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}

.lp-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.lp-stat__value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}

.lp-stat__label {
  font-size: .8rem;
  color: var(--muted);
}

.lp-stat--up { border-color: rgba(34, 197, 94, .4); }
.lp-stat--up .lp-stat__value { color: #4ade80; }
.lp-stat--down { border-color: rgba(248, 113, 113, .4); }
.lp-stat--down .lp-stat__value { color: #f87171; }

/* ─── Forms (ticket / details) ─────────────────────────── */

.lp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lp-form select,
.lp-form textarea,
.lp-form input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}

.lp-form select:focus,
.lp-form textarea:focus,
.lp-form input:focus { border-color: var(--blue); }

.lp-form textarea { resize: vertical; min-height: 96px; }

.lp-form select { cursor: pointer; }

.lp-field-hint {
  margin: 6px 0 0;
  font-size: .78rem;
  color: var(--muted);
}

/* ─── Ticket list ──────────────────────────────────────── */

.lp-ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lp-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.lp-ticket:last-child { border-bottom: none; }

.lp-ticket__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}

.lp-ticket__ref {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
}

.lp-ticket__subject {
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink);
}

.lp-ticket__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.lp-ticket__date,
.lp-ticket__count {
  font-size: .8rem;
  color: var(--muted);
}

/* ─── Invoices table ───────────────────────────────────── */

.lp-table-wrap { overflow-x: auto; }

.lp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.lp-table th,
.lp-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.lp-table th {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.lp-table tbody tr:last-child td { border-bottom: none; }

.lp-table tbody tr:hover { background: rgba(33, 193, 243, .05); }

.lp-invoice__links a { color: var(--cyan); }
.lp-invoice__links a:hover { text-decoration: underline; }

/* ─── Loading state ────────────────────────────────────── */

.lp-loading {
  color: var(--muted);
  font-size: .95rem;
  padding: 40px 0;
  text-align: center;
}

/* ─── Responsive ───────────────────────────────────────── */

/* ── Small phones (≤ 480px) ──────────────────────────── */
@media (max-width: 480px) {

  /* 1. Top bar — brand + user/sign-out wrap without overflow */
  .lp-topbar {
    height: auto;
    min-height: 52px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lp-topbar__brand img {
    height: 22px;
  }

  .lp-topbar__tag {
    font-size: .65rem;
    padding: 2px 6px;
  }

  .lp-topbar__right {
    gap: 8px;
  }

  /* Hide name on very small screens — only show sign-out button */
  .lp-user-name {
    display: none;
  }

  /* 2. Main padding — phone-friendly margins */
  .lp-main {
    padding: 20px 12px 48px;
    align-items: flex-start;
  }

  /* 3. Auth card — full-width with comfortable margins */
  .lp-auth-wrap {
    width: 100%;
    max-width: 100%;
  }

  .lp-auth-card {
    padding: 24px 16px;
    border-radius: 10px;
  }

  .lp-auth-logo img {
    height: 28px;
  }

  .lp-auth-title {
    font-size: 1.15rem;
  }

  /* Auth tabs — full-width, ≥ 44px tap target */
  .lp-tab {
    padding: 12px 0;
    font-size: .9rem;
    min-height: 44px;
  }

  /* Auth inputs — already full-width via box-sizing; confirm 44px height */
  .lp-field input {
    padding: 12px 12px;
    min-height: 44px;
  }

  /* 4. Section nav (#lpHubNav) — horizontal scroll row on phones */
  .lp-hubnav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    gap: 0;
    padding-bottom: 0;
    /* Extend flush to screen edges for a native feel */
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .lp-hubnav::-webkit-scrollbar { display: none; }

  .lp-hubnav__btn {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: .88rem;
    min-height: 44px;
    white-space: nowrap;
  }

  /* 5. Tiles grid — 1 column on phones */
  .lp-tiles {
    grid-template-columns: 1fr;
  }

  /* Tile buttons / links — comfortable on phone */
  .lp-tile__footer .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .lp-tile__deeplink {
    display: block;
    margin-top: 10px;
  }

  /* Plan picker tiers — prevent overflow */
  .lp-plan-tier {
    flex-wrap: wrap;
    gap: 6px;
  }

  .lp-plan-tier .btn--xs {
    width: 100%;
    text-align: center;
  }

  /* 6. Monitoring stat cards — 2 columns on phones */
  .lp-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* 7. Forms — collapse two-column rows to one column */
  .lp-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .lp-form select,
  .lp-form textarea,
  .lp-form input {
    font-size: 1rem; /* prevent iOS zoom (≥16px equivalent) */
    padding: 12px 12px;
    min-height: 44px;
  }

  .lp-form textarea {
    min-height: 96px;
  }

  /* Submit buttons — full-width on phone */
  .lp-panel .btn--sm {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
    font-size: .95rem;
  }

  /* 8. Ticket list — let subject wrap, keep badges readable */
  .lp-ticket {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .lp-ticket__main {
    min-width: 0;
    width: 100%;
  }

  .lp-ticket__meta {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* 9. Invoices table — already wrapped in .lp-table-wrap by JS;
     ensure it doesn't break page width and links are tappable */
  .lp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Negative margin so table can breathe within panel padding */
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .lp-table th,
  .lp-table td {
    padding: 10px 10px;
    font-size: .85rem;
  }

  .lp-invoice__links a {
    display: inline-block;
    min-height: 36px;
    line-height: 36px;
  }

  /* 10. Toast — full-width at bottom on phone */
  .lp-toast-stack {
    left: 12px;
    right: 12px;
    bottom: 16px;
  }

  .lp-toast {
    text-align: center;
  }

  /* 11. Hub panels — tighter padding */
  .lp-panel {
    padding: 16px 16px;
  }

  /* 12. Shell greeting — smaller on phone */
  .lp-greeting {
    font-size: 1.25rem;
  }

  .lp-greeting-sub {
    font-size: .88rem;
    margin-bottom: 24px;
  }
}

/* ── Tablets (481px – 768px) ─────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {

  /* Top bar — slightly smaller but don't need to wrap */
  .lp-topbar {
    padding: 0 18px;
  }

  .lp-user-name {
    max-width: 160px;
  }

  /* Main padding */
  .lp-main {
    padding: 32px 20px 56px;
  }

  /* Auth card — max width, centred, a bit narrower padding */
  .lp-auth-wrap {
    max-width: 420px;
  }

  .lp-auth-card {
    padding: 30px 24px;
  }

  /* Section nav — horizontal scroll on small tablets too */
  .lp-hubnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .lp-hubnav::-webkit-scrollbar { display: none; }

  .lp-hubnav__btn {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 44px;
  }

  /* Tiles — 2 columns on tablet */
  .lp-tiles {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Monitoring stats — 3 columns on tablet */
  .lp-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Forms — collapse two-column rows to one column on small tablets */
  .lp-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Invoices table — scrollable on tablet */
  .lp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ticket list — keep readable */
  .lp-ticket {
    flex-wrap: wrap;
  }

  .lp-ticket__main {
    min-width: 0;
    flex: 1 1 100%;
  }
}
