/* ============ InstagramReplyBot — design system ============ */
:root {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --border: #e7e7f0;
    --text: #17172b;
    --text-2: #5d5d78;
    --text-3: #9494ab;
    --accent: #5b4df0;
    --accent-dark: #4638cf;
    --accent-soft: #eeecfe;
    --accent-grad: linear-gradient(135deg, #6a5cff 0%, #a34ef0 55%, #e34fa2 100%);
    --green: #14a06d;
    --green-soft: #e2f6ee;
    --red: #d64545;
    --red-soft: #fdeaea;
    --amber: #b97f10;
    --amber-soft: #fdf3dd;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(23, 23, 43, .04), 0 8px 24px -12px rgba(23, 23, 43, .12);
    --shadow-lg: 0 2px 4px rgba(23, 23, 43, .05), 0 24px 48px -16px rgba(23, 23, 43, .18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-2); font-size: .92rem; }
.small { font-size: .85rem; }

/* ---------- nav ---------- */
.navbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem clamp(1rem, 4vw, 2.5rem);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.brand {
    font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em;
    color: var(--text); display: flex; align-items: center; gap: .5rem;
}
.brand:hover { text-decoration: none; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.nav-links { display: flex; align-items: center; gap: 1.1rem; }
.nav-links a { color: var(--text-2); font-weight: 500; font-size: .93rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links .nav-cta { color: #fff; font-weight: 700; }
.nav-links .nav-cta:hover { color: #fff; background: var(--accent-dark); }
.nav-links .nav-cta:focus-visible {
    color: #fff; outline: 3px solid rgba(91, 77, 240, .28); outline-offset: 2px;
}
.nav-user { color: var(--text-3); font-size: .9rem; }

/* ---------- layout ---------- */
.container {
    max-width: 1040px; margin: 0 auto;
    padding: 2rem clamp(1rem, 4vw, 2rem) 4rem;
}
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--text-2); font-size: .9rem; }

/* ---------- buttons & forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .6rem 1.15rem; border-radius: var(--radius-sm);
    font-size: .93rem; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
    text-decoration: none !important;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(91, 77, 240, .6); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: #cfcfe0; background: #fbfbfe; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; border-radius: 11px; }
.btn-block { width: 100%; }

.link-button {
    background: none; border: none; padding: 0; font: inherit; font-size: .9rem;
    color: var(--red); cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.inline-form { display: inline-block; }

.form-group { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.form-group label { font-size: .84rem; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="url"], input[type="email"], input[type="password"],
select, textarea, .form-input {
    width: 100%; padding: .6rem .75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface);
    font: inherit; font-size: .93rem; color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 77, 240, .15);
}
textarea { resize: vertical; }

/* ---------- cards ---------- */
.card, .account-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.5rem; margin-bottom: 1.4rem;
}
.account-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.account-header h2 { margin-bottom: .15rem; }
.account-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.empty-state {
    text-align: center; padding: 3rem 1.5rem; background: var(--surface);
    border: 1px dashed #d4d4e4; border-radius: var(--radius); color: var(--text-2);
}

/* ---------- badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .74rem; font-weight: 700; letter-spacing: .02em;
    padding: .22rem .6rem; border-radius: 99px; text-transform: uppercase;
}
.badge-on { background: var(--green-soft); color: var(--green); }
.badge-off { background: #ededf3; color: var(--text-3); }
.badge-dm { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }

/* ---------- rules ---------- */
.rule-builder { border-top: 1px solid var(--border); margin-top: 1.2rem; padding-top: 1.2rem; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem 1rem; }
.rules-list { border-top: 1px solid var(--border); margin-top: 1.2rem; padding-top: 1.2rem; }
.rule-row {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: .5rem; background: #fbfbfe; font-size: .93rem;
}
.rule-row strong { font-weight: 600; }

/* ---------- tables ---------- */
.posts-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .93rem; }
.posts-table th {
    text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-3); font-weight: 700; padding: .5rem .75rem; border-bottom: 1px solid var(--border);
}
.posts-table td { padding: .7rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.posts-table tr:last-child td { border-bottom: none; }
.caption-cell { max-width: 320px; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.message {
    padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem;
    font-size: .93rem; border: 1px solid transparent;
}
.message.success { background: var(--green-soft); color: #0d7a52; border-color: #bfe9d7; }
.message.error { background: var(--red-soft); color: #b03030; border-color: #f5c9c9; }
.message.info, .message.warning { background: var(--amber-soft); color: var(--amber); border-color: #f0dfb4; }

/* ---------- usage meter ---------- */
.plan-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
    flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.1rem 1.5rem; margin-bottom: 1.4rem;
}
.plan-banner .meter { flex: 1 1 260px; }
.profile-header { margin-bottom: .8rem; }
.profile-label { margin: 0 0 .15rem; font-size: .82rem; font-weight: 700; text-transform: uppercase; }
.plan-banner h3 { margin: .45rem 0 .1rem; }
.meter-summary, .quota-summary { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; }
.quota-summary { margin-top: .45rem; }
.quota-paused { color: var(--red); font-size: .85rem; margin: .45rem 0 0; }
.meter-track { height: 8px; border-radius: 99px; background: #ececf4; overflow: hidden; margin-top: .4rem; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--accent-grad); transition: width .4s ease; }
.meter-fill.full { background: var(--red); }

/* ---------- code box ---------- */
.code-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem;
    background: #f2f2f8; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .7rem .9rem; word-break: break-all; margin-bottom: .9rem;
}

/* ---------- footer ---------- */
.site-footer {
    display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap;
    padding: 2rem 1rem 2.5rem; border-top: 1px solid var(--border);
    font-size: .88rem; color: var(--text-3); background: var(--surface);
}
.site-footer a { color: var(--text-3); }
.site-footer a:hover { color: var(--text); }

/* ============ landing page ============ */
.hero {
    text-align: center; padding: 4.5rem 1rem 3.5rem; max-width: 780px; margin: 0 auto;
}
.hero-eyebrow {
    display: inline-block; background: var(--accent-soft); color: var(--accent);
    font-size: .8rem; font-weight: 700; padding: .3rem .9rem; border-radius: 99px;
    margin-bottom: 1.1rem; letter-spacing: .02em;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; margin-bottom: 1rem;
}
.hero .grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.1rem; color: var(--text-2); max-width: 560px; margin: 0 auto 1.8rem; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.section { max-width: 1040px; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 2rem); }
.section-title { text-align: center; margin-bottom: .4rem; font-size: 1.7rem; }
.section-sub { text-align: center; color: var(--text-2); max-width: 520px; margin: 0 auto 2.2rem; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.feature {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow);
}
.feature-icon {
    width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center; font-size: 1.15rem; margin-bottom: .8rem;
}

/* pricing */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; align-items: stretch; }
.price-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.7rem 1.5rem; box-shadow: var(--shadow); display: flex; flex-direction: column;
    position: relative;
}
.price-card.featured { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.price-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--accent-grad); color: #fff; font-size: .72rem; font-weight: 700;
    padding: .25rem .8rem; border-radius: 99px; letter-spacing: .04em; text-transform: uppercase;
}
.price-amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; }
.price-amount span { font-size: .95rem; font-weight: 500; color: var(--text-3); }
.price-list { list-style: none; padding: 0; margin: 1rem 0 1.4rem; flex: 1; }
.price-list li { padding: .38rem 0; font-size: .93rem; color: var(--text-2); display: flex; gap: .5rem; }
.price-list li::before { content: "✓"; color: var(--green); font-weight: 700; }

/* contact */
.contact-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 2rem; text-align: center; max-width: 620px; margin: 0 auto;
}
.contact-methods { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
.contact-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .95rem;
    padding: .6rem 1.1rem; border-radius: 99px;
}
.contact-chip:hover { background: #e2defd; text-decoration: none; }

/* upgrade panel on dashboard */
.upgrade-panel { text-align: center; padding: 2.5rem 1.5rem; }
.upgrade-panel .pricing { margin-top: 1.8rem; text-align: left; }

/* auth pages */
.auth-card {
    max-width: 420px; margin: 3rem auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 2rem;
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 1.2rem; }
.auth-card .helptext, .auth-card ul.errorlist { font-size: .8rem; color: var(--text-3); }
.auth-card ul.errorlist { color: var(--red); list-style: none; padding: 0; margin: .2rem 0; }
.auth-alt, .auth-switch { text-align: center; margin-top: 1.1rem; font-size: .9rem; color: var(--text-2); }
.auth-card .btn { width: 100%; margin-top: .3rem; }
.field-error { color: var(--red); font-size: .8rem; margin: .15rem 0 0; }
.field-help { color: var(--text-3); font-size: .78rem; margin: .15rem 0 0; }
.form-errors {
    background: var(--red-soft); color: #b03030; border: 1px solid #f5c9c9;
    border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: .88rem; margin-bottom: .9rem;
}
.danger-zone { border-color: #f2c4c4; }
.danger-zone .link-button { padding: .6rem 1.15rem; background: var(--red); color: #fff; border-radius: var(--radius-sm); }

@media (max-width: 640px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .account-header { flex-direction: column; }
}
