/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F9FAFB;
    color: #111827;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: #4F46E5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Nav === */
.nav {
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    padding: 0 24px;
}
.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #4F46E5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand img { height: 28px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.nav-links a { color: #374151; }
.nav-links a:hover { color: #4F46E5; }
.nav-email { color: #6B7280; font-size: 13px; }

/* === Container === */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all .15s;
}
.btn:hover { background: #F9FAFB; text-decoration: none; }
.btn-primary { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.btn-primary:hover { background: #4338CA; }
.btn-danger { color: #DC2626; border-color: #FCA5A5; }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }

/* === Auth Pages === */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #F9FAFB;
}
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.auth-card h1 { text-align: center; margin-bottom: 4px; }
.auth-card h2 { text-align: center; font-size: 16px; color: #6B7280; font-weight: 400; margin-bottom: 24px; }
.auth-brand { color: #4F46E5; display: inline-flex; align-items: center; gap: 8px; }
.auth-brand:hover { text-decoration: none; }
.auth-brand img { height: 32px; width: auto; }
.auth-card label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
}
.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 16px;
}
.auth-card input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.auth-card .btn { margin-top: 8px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: #6B7280; }

/* === Dashboard === */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.dashboard-header h1 { font-size: 24px; }
.header-actions { display: flex; gap: 8px; }
.subtitle { color: #6B7280; font-size: 14px; margin-top: 2px; }

/* === Popup Cards === */
.popup-list { display: flex; flex-direction: column; gap: 16px; }
.popup-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px 24px;
}
.popup-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.popup-card-header h3 { font-size: 17px; }
.badge {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}
.badge-active { background: #ECFDF5; color: #065F46; }
.badge-inactive { background: #F3F4F6; color: #6B7280; }
.popup-card-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 12px;
}
.popup-card-embed { margin-bottom: 16px; }
.popup-card-embed label { font-size: 12px; color: #6B7280; display: block; margin-bottom: 4px; }
.popup-card-embed input {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    font-family: monospace;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #F9FAFB;
    color: #374151;
}
.popup-card-actions { display: flex; gap: 8px; align-items: center; }
.inline-form { display: inline; }

/* === Forms === */
.form-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    max-width: 560px;
    margin-top: 16px;
}
.form-card label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    margin-top: 16px;
    color: #374151;
}
.form-card label:first-of-type { margin-top: 0; }
.form-card input[type="text"],
.form-card input[type="number"],
.form-card textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
.form-card input:focus,
.form-card textarea:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.checkbox-row label { margin: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 24px; }

/* === Data Table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6B7280;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}
.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #F3F4F6;
}
.data-table tr:last-child td { border-bottom: none; }
.url-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #6B7280;
}
.empty-state h2 { color: #374151; margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* === Footer === */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: #9CA3AF;
    border-top: 1px solid #E5E7EB;
    margin-top: 48px;
}

/* === Landing Page === */
.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 24px;
}
.landing-nav .nav-brand { font-size: 22px; }
.landing-nav .nav-brand img { height: 32px; }
.landing-nav-links { display: flex; gap: 16px; font-size: 14px; }

.hero {
    text-align: center;
    padding: 80px 24px 60px;
    max-width: 700px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 42px;
    line-height: 1.2;
    margin-bottom: 16px;
    color: #111827;
}
.hero p {
    font-size: 18px;
    color: #6B7280;
    margin-bottom: 32px;
    line-height: 1.6;
}
.hero .btn-primary {
    padding: 14px 32px;
    font-size: 16px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 80px;
}
.feature-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 28px;
}
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: #6B7280; line-height: 1.6; }

.steps {
    background: #fff;
    border-top: 1px solid #E5E7EB;
    border-bottom: 1px solid #E5E7EB;
    padding: 60px 24px;
    text-align: center;
}
.steps h2 { font-size: 28px; margin-bottom: 40px; }
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    max-width: 800px;
    margin: 0 auto;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #EEF2FF;
    color: #4F46E5;
    border-radius: 50%;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
}
.steps-grid h3 { font-size: 16px; margin-bottom: 6px; }
.steps-grid p { font-size: 14px; color: #6B7280; }

.landing-cta {
    text-align: center;
    padding: 60px 24px;
}
.landing-cta h2 { font-size: 28px; margin-bottom: 12px; }
.landing-cta p { color: #6B7280; margin-bottom: 24px; }

.landing-footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: #9CA3AF;
    border-top: 1px solid #E5E7EB;
}

/* === Responsive === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
    /* Nav */
    .nav { padding: 0 16px; }
    .nav-email { display: none; }
    .nav-links { gap: 12px; }

    /* Container */
    .container { padding: 20px 16px; }

    /* Landing */
    .hero { padding: 48px 16px 40px; }
    .hero h1 { font-size: 26px; }
    .hero p { font-size: 15px; margin-bottom: 24px; }
    .features { padding: 0 16px 48px; gap: 16px; }
    .steps { padding: 40px 16px; }
    .steps h2 { font-size: 22px; margin-bottom: 28px; }
    .steps-grid { gap: 24px; }
    .landing-cta { padding: 40px 16px; }
    .landing-cta h2 { font-size: 22px; }

    /* Dashboard header */
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .dashboard-header h1 { font-size: 20px; }
    .header-actions { flex-wrap: wrap; gap: 6px; }

    /* Popup cards */
    .popup-card { padding: 16px; }
    .popup-card-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .popup-card-stats { flex-wrap: wrap; gap: 12px; }
    .popup-card-embed input { font-size: 11px; }
    .popup-card-actions { flex-wrap: wrap; }

    /* Data table */
    .data-table { font-size: 13px; min-width: 500px; }
    .data-table th, .data-table td { padding: 10px 12px; white-space: nowrap; }
    .url-cell { max-width: 180px; }

    /* Buttons - larger touch targets */
    .btn { padding: 10px 16px; }
    .btn-sm { padding: 8px 12px; }

    /* Forms */
    .form-card { padding: 16px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }

    /* Auth */
    .auth-card { padding: 24px; }
}
