/* ==========================================================================
   PhyllHost design system — light theme
   Shared by the public site, customer portal and admin panel.
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --accent: #06b6d4;
  --bg: #f6f7fb;
  --surface: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { vertical-align: middle; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.text-center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius);
  font: 600 15px/1 var(--font); cursor: pointer; border: 1px solid transparent;
  transition: background .15s, transform .05s, box-shadow .15s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 30px; font-size: 16px; }

.link { background: none; border: none; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }

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

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
  background: #eef2ff; color: var(--primary-dark);
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #cffafe; color: #0e7490; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.input {
  width: 100%; padding: 12px 14px; font: 400 15px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.input::placeholder { color: #94a3b8; }
textarea.input { min-height: 110px; resize: vertical; }
select.input { appearance: none; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form-error { font-size: 12.5px; color: var(--danger); margin-top: 6px; }
.code-input { letter-spacing: .35em; text-align: center; font-size: 20px; font-weight: 700; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 16px; font: 600 14px var(--font); color: var(--muted);
  border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 200;
}
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); max-width: 520px; width: 100%; padding: 28px; }
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
  padding: 13px 16px; border-radius: var(--radius); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
  animation: toast-in .25s forwards;
}
.toast-info { background: #0f172a; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { to { opacity: 1; transform: none; } }

/* ---------- Spinner ---------- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn-ghost .spinner { border-color: rgba(79, 70, 229, .25); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Marketing site chrome: header, hero, sections, footer
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none !important; }
.logo span { letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a.nav-link { color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: none !important; }
.nav-links a.nav-link:hover { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; }

.hero {
  background: radial-gradient(1000px 480px at 50% -80px, rgba(79, 70, 229, .14), transparent 70%),
              linear-gradient(180deg, #eef0ff 0%, var(--bg) 100%);
  padding: 96px 0 72px; text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  color: var(--primary-dark); background: #eef2ff; border: 1px solid #e0e7ff;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(36px, 5.4vw, 60px); font-weight: 800; margin-bottom: 18px; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 32px; }
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.hero-trust { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.hero-trust strong { color: var(--text); }

.section { padding: 72px 0; }
.section-title { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; text-align: center; margin-bottom: 12px; }
.section-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 44px; font-size: 17px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.feature-card:hover { transform: translateY(-3px); }
.feature-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; margin-bottom: 16px;
}
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { color: var(--muted); font-size: 14.5px; margin: 0; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 30px 28px; display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative; }
.price-card.highlighted { border: 2px solid var(--primary); box-shadow: 0 18px 40px -18px rgba(79, 70, 229, .45); }
.price-flag {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 14px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.price-card h3 { font-size: 18px; margin-bottom: 4px; }
.price-card .plan-desc { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.price { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
.price small { font-size: 15px; font-weight: 500; color: var(--muted); }
.plan-features { list-style: none; padding: 0; margin: 20px 0 26px; flex: 1; }
.plan-features li { padding: 7px 0; font-size: 14.5px; color: var(--text); display: flex; gap: 10px; align-items: flex-start; }
.plan-features li svg { flex: none; margin-top: 3px; color: var(--success); }

.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 18px 20px; font: 600 16px var(--font); color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-q .chev { transition: transform .2s; color: var(--muted); flex: none; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.faq-a p { padding: 0 20px 18px; margin: 0; color: var(--muted); font-size: 15px; }

.cta-banner {
  background: linear-gradient(120deg, var(--primary-dark), var(--primary) 55%, var(--accent));
  border-radius: 18px; padding: 56px 32px; text-align: center; color: #fff; margin: 24px 0 0;
}
.cta-banner h2 { color: #fff; font-size: clamp(26px, 3.4vw, 36px); margin-bottom: 12px; }
.cta-banner p { color: rgba(255, 255, 255, .85); max-width: 560px; margin: 0 auto 28px; font-size: 17px; }
.cta-banner .btn-primary { background: #fff; color: var(--primary-dark); box-shadow: none; }
.cta-banner .btn-primary:hover { background: #eef2ff; }

.site-footer { background: #0f172a; color: #94a3b8; margin-top: 88px; padding: 56px 0 28px; font-size: 14.5px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 40px; }
.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { max-width: 300px; }
.site-footer h4 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 10px; }
.site-footer a { color: #94a3b8; text-decoration: none !important; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; }
.status-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 74, .2); }

/* ---------- Auth pages ---------- */
.auth-wrap { max-width: 460px; padding-top: 56px; padding-bottom: 56px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); margin: 18px 0 0; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 24px; }

/* ---------- Dashboard shell (portal/admin, later phases reuse) ---------- */
.app-shell { display: flex; min-height: calc(100vh - 68px); }
.sidebar { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 12px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14.5px; text-decoration: none !important; }
.sidebar a:hover { background: #f1f5f9; color: var(--text); }
.sidebar a.active { background: #eef2ff; color: var(--primary-dark); font-weight: 600; }
.app-main { flex: 1; padding: 28px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .features-grid, .pricing-grid { grid-template-columns: 1fr; max-width: 520px; margin-left: auto; margin-right: auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { display: none; }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; align-items: stretch; padding: 12px 20px 20px; gap: 6px;
  }
  .nav-links.open { display: flex; }
  .nav-links a.nav-link { padding: 10px 4px; }
  .nav-cta { flex-direction: column; align-items: stretch; }
  .nav-cta .btn { width: 100%; }
}
@media (max-width: 640px) {
  .section { padding: 52px 0; }
  .hero { padding: 64px 0 52px; }
  .footer-grid { grid-template-columns: 1fr; }
  .app-main { padding: 18px 14px; }
}
