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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #4f46e5;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   Nav
   ============================================================ */
nav {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    height: 56px;
}

nav .nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a1a;
    text-decoration: none;
}

nav .brand:hover {
    text-decoration: none;
    color: #4f46e5;
}

nav .nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

nav .nav-links a {
    color: #374151;
    font-size: 0.95rem;
}

nav .nav-links a:hover {
    color: #4f46e5;
    text-decoration: none;
}

/* ============================================================
   Main Content
   ============================================================ */
main {
    max-width: 960px;
    margin: 32px auto;
    padding: 0 24px;
}

/* ============================================================
   Alerts / Flash Messages
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s ease, opacity 0.15s ease;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.9;
}

.btn-primary {
    background: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
    color: #fff;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
    color: #374151;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

/* ============================================================
   Webhook Row
   ============================================================ */
.webhook-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.webhook-row input {
    flex: 1;
}

.webhook-row .btn {
    flex-shrink: 0;
    padding: 9px 14px;
    font-size: 0.9rem;
}

.webhook-test-result {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
}

.webhook-test-ok {
    color: #065f46;
}

.webhook-test-error {
    color: #991b1b;
}

/* ============================================================
   Form Actions
   ============================================================ */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.form-actions > div {
    display: flex;
    gap: 8px;
}

/* ============================================================
   Platform Toggle
   ============================================================ */
.platform-toggle {
    margin-bottom: 24px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    max-width: 500px;
    margin: 0 auto;
}

.form-container h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-container > p {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #6b7280;
}

.form-group {
    margin-bottom: 18px;
}

.form-container form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-container .form-group {
    margin-bottom: 0;
}

.form-container .form-actions {
    margin-top: 0;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

/* Inline checkbox label */
label input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="file"] {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

input[type="file"] {
    padding: 6px;
    cursor: pointer;
}

small {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: #6b7280;
}

/* ============================================================
   Landing Page — Hero & Features
   ============================================================ */
.hero {
    text-align: center;
    padding: 64px 24px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

.hero p {
    font-size: 1.1rem;
    color: #4b5563;
    margin-bottom: 12px;
}

.hero .btn {
    margin: 8px 6px 0;
    font-size: 1rem;
    padding: 12px 28px;
}


.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.feature {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.feature h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.feature p {
    font-size: 0.95rem;
    color: #4b5563;
}

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h1 {
    font-size: 1.6rem;
    color: #111827;
}

.dashboard-footer {
    margin-top: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.legal-links {
    font-size: 0.78rem;
    color: #9ca3af;
}

.legal-links a {
    color: #9ca3af;
}

.legal-links a:hover {
    color: #6b7280;
}

.legal-page {
    max-width: 680px;
}

.legal-page h1 {
    font-size: 1.8rem;
    color: #111827;
    margin-bottom: 4px;
}

.legal-page .legal-date {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 32px;
}

.legal-page h2 {
    font-size: 1.1rem;
    color: #111827;
    margin-top: 32px;
    margin-bottom: 8px;
}

.legal-page h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-top: 16px;
    margin-bottom: 4px;
}

.legal-page p,
.legal-page li {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 12px;
    line-height: 1.7;
}

.legal-page ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.stripe-badge {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #9ca3af;
}

.stripe-wordmark {
    font-size: 0.9rem;
    font-weight: 700;
    color: #635BFF;
    letter-spacing: -0.02em;
}

/* ============================================================
   Dashboard Sections
   ============================================================ */
.dashboard h2 {
    font-size: 1.2rem;
    color: #111827;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard h2 ~ h2 {
    margin-top: 48px;
}

/* ============================================================
   Apps Table
   ============================================================ */
.apps-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.95rem;
}

.apps-table thead {
    background: #f9fafb;
}

.apps-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e5e7eb;
}

.apps-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

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

.apps-table tbody tr:hover {
    background: #f9fafb;
}

.app-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    flex-shrink: 0;
}

.app-icon-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    flex-shrink: 0;
    background: #e5e7eb;
}

.apps-table td form {
    display: inline;
    margin-left: 8px;
}

.apps-table td button {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}

.apps-table td button:hover {
    color: #6b7280;
}

.apps-table td button.btn-delete {
    color: #dc2626;
}

.apps-table td button.btn-delete:hover {
    color: #b91c1c;
}

.apps-table td a {
    color: inherit;
    text-decoration: none;
}

.apps-table td a:hover {
    text-decoration: underline;
}

/* ============================================================
   Billing
   ============================================================ */
.billing {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    max-width: 600px;
}

.billing h1 {
    font-size: 1.6rem;
    color: #111827;
    margin-bottom: 24px;
}

.billing p {
    margin-bottom: 16px;
    color: #374151;
}

.subscription-status {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 1rem;
}

.subscription-status p {
    margin-bottom: 0;
}

.status-active {
    color: #065f46;
    font-weight: 600;
}

.status-past-due {
    color: #92400e;
    font-weight: 600;
}

.status-canceled {
    color: #991b1b;
    font-weight: 600;
}

.status-none {
    color: #6b7280;
    font-weight: 600;
}

.status-trialing {
    color: #1d4ed8;
    font-weight: 600;
}

.status-inactive {
    color: #6b7280;
    font-weight: 600;
}

.billing-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 24px;
    gap: 16px;
}

.billing-banner-active {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.billing-banner p {
    margin: 0;
}

.billing-banner-status {
    flex: 1;
}

.billing-banner-status p {
    margin: 4px 0 0;
}

/* ============================================================
   Subscription Section (App Form)
   ============================================================ */
.subscription-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px 32px;
    max-width: 500px;
    margin: 20px auto 0;
}

.subscription-section h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 12px;
}

.subscription-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
