/* ═══════════════════════════════════════════════════════════════════════════
   PhoneYa2 Agent Network — Shared Design System v2
   Defensive rewrite: fixes overlaps, hidden content, mobile issues
   Brand: dark navy + orange accent + green action
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --navy:    #0a0a1a;
  --navy2:   #12122a;
  --navy3:   #1c1c3a;
  --orange:  #ff6000;
  --orange2: #ff9f43;
  --green:   #25d366;
  --green2:  #128c7e;
  --text:    #1a1a2e;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --light:   #f9fafb;
  --white:   #ffffff;
  --red:     #ef4444;
  --yellow:  #f59e0b;
  --purple:  #8b5cf6;
  --grad-o:  linear-gradient(135deg,#ff6000,#ff9f43);
  --grad-g:  linear-gradient(135deg,#25d366,#128c7e);
  --grad-n:  linear-gradient(135deg,#0a0a1a,#1c1c3a);
  --shadow:  0 4px 20px rgba(0,0,0,.08);
  --shadow2: 0 8px 32px rgba(0,0,0,.12);
  --r:       12px;
  --r2:      16px;
}

/* ── GLOBAL RESET — DEFENSIVE ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;         /* prevents flex items from overflowing */
}
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Prevent images and iframes from breaking layout */
img, svg, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Prevent long URLs and codes from breaking layout */
code, .mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; overflow-wrap: anywhere; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: 'Syne', sans-serif; font-weight: 800; line-height: 1.2; overflow-wrap: break-word; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.8rem); }
h2 { font-size: clamp(1.35rem, 3.5vw, 2rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p  { line-height: 1.7; overflow-wrap: break-word; }
a  { color: var(--orange); text-decoration: none; overflow-wrap: break-word; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.container     { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }
.container-sm  { max-width: 680px;  margin: 0 auto; padding: 0 20px; width: 100%; }
.container-xs  { max-width: 480px;  margin: 0 auto; padding: 0 20px; width: 100%; }

/* ── NAVBAR ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.07);
  width: 100%;
}
.navbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0; min-width: 0;
}
.nav-logo img {
  height: 36px; width: 36px; border-radius: 8px; object-fit: contain;
  flex-shrink: 0;
}
.nav-brand {
  font-family: 'Syne',sans-serif; font-weight: 800; font-size: 16px;
  color: white; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
.nav-brand span { color: var(--orange); }
.nav-badge {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; color: var(--green);
  background: rgba(37,211,102,.15); border: 1px solid rgba(37,211,102,.3);
  border-radius: 100px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.nav-spacer { flex: 1; min-width: 8px; }
.nav-link {
  font-size: 14px; font-weight: 600; color: rgba(255,255,255,.6);
  padding: 6px 12px; border-radius: 8px;
  transition: color .2s, background .2s; text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { color: white; background: rgba(255,255,255,.08); text-decoration: none; }

/* Primary "Apply Now" button */
.nav-cta {
  background: var(--grad-o); color: white;
  font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 8px;
  text-decoration: none; transition: opacity .2s, transform .18s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.nav-cta:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; }

/* Secondary outline button */
.nav-btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.25);
  color: white; font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 8px;
  text-decoration: none; transition: border-color .2s, background .2s, transform .18s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.nav-btn-outline:hover { border-color: var(--orange); background: rgba(255,96,0,.1); text-decoration: none; }

@media(max-width:420px) { .hide-xs { display: none; } }

/* ── CARDS ──────────────────────────────────────────────────────────────── */
.card {
  background: white; border-radius: var(--r2); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 24px;
  overflow-wrap: break-word;
}
.card-dark { background: var(--navy2); border-color: rgba(255,255,255,.08); color: white; }
.card + .card { margin-top: 16px; }

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'DM Sans',sans-serif; font-weight: 700; font-size: 15px;
  padding: 12px 24px; border-radius: var(--r); border: none; cursor: pointer;
  transition: transform .18s, box-shadow .18s, opacity .18s;
  text-decoration: none; white-space: nowrap;
  text-align: center;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad-o); color: white; box-shadow: 0 4px 16px rgba(255,96,0,.3); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(255,96,0,.4); }
.btn-green  { background: var(--grad-g); color: white; box-shadow: 0 4px 16px rgba(37,211,102,.3); }
.btn-green:hover { box-shadow: 0 8px 24px rgba(37,211,102,.4); }
.btn-dark   { background: var(--navy); color: white; }
.btn-dark:hover { background: var(--navy3); }
.btn-outline { background: none; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }
.btn-ghost  { background: none; border: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; padding: 8px 12px; border-radius: 8px; transition: background .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-ghost:hover { background: var(--light); color: var(--text); }
.btn-sm { font-size: 13px; padding: 8px 16px; border-radius: 8px; }
.btn-lg { font-size: 17px; padding: 16px 32px; border-radius: 14px; }
.btn-full { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
@media(max-width:480px){ .btn-lg { font-size: 15px; padding: 13px 22px; } }

/* Button text shouldn't overflow */
.btn > span, .btn > i { flex-shrink: 0; }

/* ── FORM ELEMENTS ──────────────────────────────────────────────────────── */
.field { margin-bottom: 20px; }
.label { display: block; font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.label .req { color: var(--red); margin-left: 2px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-family: 'DM Sans',sans-serif; font-size: 15px;
  color: var(--text); background: white; transition: border-color .2s, box-shadow .2s;
  outline: none;
  overflow-wrap: break-word;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,96,0,.12);
}
.input.error, .select.error, .textarea.error { border-color: var(--red); }
.textarea { resize: vertical; min-height: 100px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:580px) { .field-row { grid-template-columns: 1fr; } }
.err-msg { font-size: 12px; color: var(--red); margin-top: 4px; display: none; }
.err-msg.show { display: block; }

/* Read-only + calculated display inputs */
.input-readonly {
  background: var(--light) !important; color: var(--muted) !important;
  cursor: not-allowed; font-weight: 700;
}
.input-calc {
  background: #fffbf8 !important; color: var(--orange) !important;
  font-weight: 800; font-size: 15px;
}

/* ── CHECKBOX / RADIO ───────────────────────────────────────────────────── */
.check-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 10px;
}
.check-item:hover { border-color: var(--orange); background: rgba(255,96,0,.03); }
.check-item input { margin-top: 2px; accent-color: var(--orange); flex-shrink: 0; width: 16px; height: 16px; }
.check-item .check-label { font-size: 14px; line-height: 1.5; min-width: 0; }
.check-item .check-label strong { display: block; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.check-item .check-label span { color: var(--muted); font-size: 13px; }

/* ── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 100px; text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap;
}
.badge-orange { background: rgba(255,96,0,.12); color: var(--orange); border: 1px solid rgba(255,96,0,.25); }
.badge-green  { background: rgba(37,211,102,.12); color: #16a34a; border: 1px solid rgba(37,211,102,.25); }
.badge-yellow { background: rgba(245,158,11,.12); color: #92400e; border: 1px solid rgba(245,158,11,.25); }
.badge-red    { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.badge-navy   { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.15); }

/* ── STATUS PILL ────────────────────────────────────────────────────────── */
.pill-pending  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; border-radius: 100px; padding: 3px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; display: inline-block; }
.pill-approved { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; border-radius: 100px; padding: 3px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; display: inline-block; }
.pill-rejected { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 100px; padding: 3px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; display: inline-block; }

/* ── STAT CARD ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  min-width: 0;
}
.stat-card {
  background: white; border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px;
  min-width: 0;
  overflow-wrap: break-word;
}
.stat-card.dark { background: var(--navy2); border-color: rgba(255,255,255,.08); }
.stat-value {
  font-family: 'Syne',sans-serif; font-size: clamp(1.3rem, 4vw, 2rem); font-weight: 800;
  color: var(--text); line-height: 1.1; margin-bottom: 6px;
  overflow-wrap: break-word; word-break: break-word;
}
.stat-card.dark .stat-value { color: white; }
.stat-label {
  font-size: 12px; color: var(--muted); font-weight: 600;
  overflow-wrap: break-word;
}
.stat-card.dark .stat-label { color: rgba(255,255,255,.45); }

/* ── TABLE ──────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
}
.table-wrap table { min-width: 500px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead { background: var(--light); }
th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: break-word;
  word-break: break-word;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; cursor: pointer; }
tbody tr:hover { background: #fffbf8; }

/* Mobile table — allow horizontal scroll instead of hiding content */
@media(max-width:600px) {
  .table-wrap { border-radius: var(--r); }
  table { font-size: 13px; }
  th, td { padding: 10px 12px; }
}

/* ── TOAST ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--navy); color: white;
  padding: 12px 20px; border-radius: 100px;
  font-size: 14px; font-weight: 600; z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  max-width: calc(100vw - 32px);
  text-align: center;
  overflow-wrap: break-word;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 500;
  display: none;
  align-items: flex-end; justify-content: center;
  padding: 0;
  overflow-y: auto;
}
@media(min-width:601px) { .modal-overlay { align-items: center; padding: 20px; } }
.modal-overlay.open { display: flex; }
.modal-box {
  background: white;
  border-radius: var(--r2) var(--r2) 0 0;
  max-width: 560px; width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
  overflow-wrap: break-word;
}
@media(min-width:601px) { .modal-box { border-radius: var(--r2); max-height: 90vh; } }
.modal-hdr {
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.modal-hdr h3 { font-size: 1.1rem; min-width: 0; overflow-wrap: break-word; flex: 1; }
.modal-close {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--muted); padding: 4px 8px; border-radius: 6px;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--light); color: var(--text); }
.modal-body { padding: 20px 24px 24px; }

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty h3 { font-size: 1.1rem; margin-bottom: 6px; }
.empty p { font-size: 14px; color: var(--muted); }

/* ── STEP INDICATOR ─────────────────────────────────────────────────────── */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 32px; min-width: 0; }
.step-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
  border: 2px solid var(--border); color: var(--muted); background: white;
  transition: all .3s;
}
.step-item.active .step-num { background: var(--orange); border-color: var(--orange); color: white; }
.step-item.done .step-num { background: #16a34a; border-color: #16a34a; color: white; }
.step-label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step-item.active .step-label { color: var(--orange); }
.step-item.done .step-label { color: #16a34a; }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; min-width: 20px; }
.step-item.done + .step-line { background: #16a34a; }

/* ── SECTION SPACING ────────────────────────────────────────────────────── */
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.section-hdr { text-align: center; margin-bottom: 48px; }
.section-hdr h2 { margin-bottom: 12px; }
.section-hdr p { color: var(--muted); max-width: 560px; margin: 0 auto; }

/* ── DIVIDER ────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.divider-dark { height: 1px; background: rgba(255,255,255,.08); margin: 20px 0; }

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
.footer {
  background: var(--navy); color: rgba(255,255,255,.45);
  text-align: center; padding: 24px 20px; font-size: 13px;
  overflow-wrap: break-word;
}
.footer a { color: rgba(255,255,255,.55); }
.footer strong { color: white; }

/* ── LOADING SPINNER ────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--orange); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ALERT BANNERS ──────────────────────────────────────────────────────── */
.alert {
  padding: 14px 16px; border-radius: var(--r); font-size: 14px;
  margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start;
  overflow-wrap: break-word;
}
.alert i { flex-shrink: 0; margin-top: 2px; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ── FILTER PILLS ───────────────────────────────────────────────────────── */
.filter-pill {
  padding: 7px 16px; border-radius: 100px;
  border: 1.5px solid var(--border); background: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .2s; color: var(--muted);
  white-space: nowrap;
}
.filter-pill.active, .filter-pill:hover {
  border-color: var(--orange); color: var(--orange);
  background: rgba(255,96,0,.05);
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media(max-width:768px) {
  .section { padding: 48px 0; }
  .nav-link { display: none; }
  .hide-mobile { display: none !important; }
  .navbar-inner { gap: 8px; padding: 0 14px; }
  .nav-cta, .nav-btn-outline { font-size: 12px; padding: 7px 12px; }
  .nav-brand { font-size: 14px; max-width: 160px; }
}

@media(max-width:480px) {
  h1 { font-size: 1.6rem; }
  .stat-value { font-size: 1.4rem; }
  .nav-brand { font-size: 13px; max-width: 130px; }
  .nav-logo img { height: 30px; width: 30px; }
  .nav-badge { display: none; }
  .step-label { display: none; }
}

/* Very small screens */
@media(max-width:360px) {
  .container, .container-sm { padding: 0 14px; }
  .card { padding: 18px; }
  .navbar-inner { padding: 0 10px; gap: 6px; }
  .nav-cta, .nav-btn-outline { padding: 6px 10px; font-size: 11px; }
  .nav-brand { font-size: 12px; max-width: 110px; }
}

/* ── UTILITY CLASSES ────────────────────────────────────────────────────── */
.flex-row    { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-width: 0; }
.flex-col    { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.flex-1      { flex: 1; min-width: 0; }
.text-wrap   { overflow-wrap: anywhere; word-break: break-word; }
.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-small  { font-size: 13px; }
.hide        { display: none !important; }

/* Ensure grids don't break on tiny screens */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; min-width: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; min-width: 0; }
@media(max-width:700px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media(max-width:480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
