/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f5;
    color: #111;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Layout ---------- */

header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 12px 20px;
}

.app-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* ---------- Landing ---------- */

.landing-hero {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-hero-inner {
    max-width: 640px;
    text-align: center;
}

.landing-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #666;
    margin-bottom: 8px;
}

.landing-title {
    font-size: 28px;
    margin: 0 0 8px;
}

.landing-subtitle {
    margin: 0 0 24px;
    color: #555;
    font-size: 14px;
}

.landing-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 720px) {
    .landing-actions {
        grid-template-columns: 1fr 1fr;
        text-align: left;
    }
}

.landing-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.landing-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.landing-card p {
    margin: 0 0 12px;
    font-size: 14px;
    color: #444;
}

.hint {
    margin-top: 8px;
    font-size: 12px;
    color: #777;
}

/* ---------- Buttons & Inputs ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    background: #f5f5f5;
}

.btn-primary {
    background: #111111;
    color: #ffffff;
}

.btn-primary:hover {
    background: #000000;
}

.btn-ghost {
    background: #ffffff;
    border-color: #d4d4d4;
}

.btn-ghost:hover {
    background: #f3f3f3;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 9px;
}

.tenant-open-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tenant-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid #d4d4d4;
    font-size: 14px;
}

/* ---------- Tenant dashboard ---------- */

.tenant-header {
    margin-bottom: 16px;
}

.tenant-header-top {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}

.tenant-name {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.tenant-slug {
    font-size: 13px;
    color: #666;
}

.env-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11px;
    background: #111;
    color: #fff;
    margin-left: 6px;
}

.text-muted {
    color: #777;
    font-size: 14px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0 8px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
}

.event-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}

@media (min-width: 720px) {
    .event-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 12px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.event-card-header {
    margin-bottom: 8px;
}

.event-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px;
}

.event-slug {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.event-meta {
    font-size: 12px;
    color: #666;
    margin: 4px 0 10px;
}

.tag {
    display: inline-flex;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    background: #f3f3f3;
    color: #555;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
/* ---------- Page actions / breadcrumb ---------- */

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.breadcrumb {
    font-size: 13px;
    color: #777;
}

.breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ---------- Link list / badges ---------- */

.card-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0 0 10px;
}

.link-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
}

.link-item {
    padding: 6px 0;
    border-top: 1px solid #eeeeee;
}

.link-item:first-child {
    border-top: none;
}

.link-label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}

.link-url {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    background: #f5f5f5;
    padding: 4px 6px;
    border-radius: 6px;
    word-break: break-all;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    background: #f3f3f3;
    color: #555;
}

/* ---------- Job Manager table ---------- */
.job-page-header {
    margin-bottom: 16px;
}

.job-page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.job-manager-card {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 16px;
    overflow: hidden;
}

.job-manager-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
}

.job-manager-filters,
.job-manager-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.job-filter-input,
.job-filter-select {
    height: 42px;
    border-radius: 14px;
    border: 1px solid #d9d9d9;
    padding: 0 14px;
    font-size: 16px;
    background: #fff;
}

.job-filter-input {
    min-width: 240px;
}

.job-filter-select {
    min-width: 140px;
}

.tenant-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d9d9d9;
    border-radius: 999px;
    padding: 9px 14px;
    background: #fff;
    font-size: 14px;
    color: #344054;
}

.tenant-chip-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1db97f;
    flex: 0 0 12px;
}

.job-table-wrap {
    overflow-x: auto;
}

.job-table {
    width: 100%;
    border-collapse: collapse;
}

.job-table th,
.job-table td {
    padding: 16px 14px;
    text-align: left;
    border-bottom: 1px solid #e9e9e9;
    vertical-align: middle;
}

.job-table th {
    background: #f5f6f8;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}

.job-row {
    cursor: pointer;
}

.job-row:hover {
    background: #fafafa;
}

.sort-link,
.slug-link {
    color: #2563eb;
    text-decoration: none;
}

.sort-link:hover,
.slug-link:hover,
.quick-links a:hover {
    text-decoration: underline;
}

.quick-links {
    white-space: nowrap;
}

.quick-links a {
    color: #2563eb;
    text-decoration: none;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
}

.status-active {
    background: #8ae98a;
    color: #163b16;
}

.status-draft {
    background: #d9d9d9;
    color: #3f3f46;
}

.status-archived {
    background: #f1aaaa;
    color: #6b1d1d;
}

.status-over_quota {
    background: #ffe3a3;
    color: #6b4f00;
}

.job-empty {
    text-align: center;
    color: #777;
}

.job-manager-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.job-count,
.page-indicator {
    font-size: 14px;
    color: #666;
}

.job-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-disabled {
    pointer-events: none;
    opacity: 0.45;
}


/* ---------- Job Editor ---------- */
.job-editor-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-alert {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 14px;
}

.editor-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.editor-alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.job-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr);
    gap: 18px;
}

.job-editor-main,
.job-editor-side {
    display: grid;
    gap: 16px;
}

.editor-tabs {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #344054;
    text-decoration: none;
    font-weight: 600;
}

.editor-tab-active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.editor-panel,
.editor-preview-card {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 14px;
    padding: 18px;
}

.editor-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.editor-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
    color: #344054;
}

.form-field-span-2 {
    grid-column: span 2;
}

.editor-form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 14px;
    background: #fafafa;
    cursor: pointer;
}

.toggle-card input {
    margin: 0;
}

.color-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-swatch-input {
    width: 52px;
    min-width: 52px;
    height: 42px;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
}

.color-code-input {
    min-width: 120px;
}

.landing-preview-phone-shell {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 8px 0 2px;
    overflow: hidden;
}

.landing-preview-phone {
    position: relative;
    width: min(100%, 250px);
    aspect-ratio: 430 / 932;
    max-height: 540px;
    border-radius: 18px;
    overflow: hidden;
    background-color: #0f172a;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: auto 100%;
    color: var(--preview-text, #ffffff);
    font-family: "Kanit", system-ui, sans-serif;
    text-align: center;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
    user-select: none;
    pointer-events: none;
}

.preview-lang-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    height: 26px;
    padding: 2px 8px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 13px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.20);
}

.preview-lang-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.landing-preview-phone-logo {
    display: block;
    max-width: 170px;
    width: min(62%, 170px);
    max-height: 34%;
    margin: 1.1rem auto 0;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.18));
}

.landing-preview-phone-title {
    margin: .6rem 12px 0;
    font-size: .72rem;
    line-height: 1.22;
    font-weight: 600;
    color: var(--preview-primary, #ffffff);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.28);
}

.landing-preview-phone-subtitle {
    margin: .25rem 12px 0;
    font-size: 1rem;
    line-height: 1.35;
    color: var(--preview-text, #ffffff);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.25);
}

.landing-preview-phone-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    margin-top: 1rem;
}

.landing-preview-phone-button {
    width: min(180px, 76%);
    min-height: 34px;
    padding: .38rem .65rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .45rem;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.20);
    font-weight: 500;
    font-size: .68rem;
}

.landing-preview-phone-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.landing-preview-phone-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.30);
}

/* ---------- Guest Landing ---------- */
.guest-landing {
    min-height: calc(100vh - 140px);
    border-radius: 24px;
    background: linear-gradient(135deg, #101828, #344054);
    background-size: cover;
    background-position: center;
    color: var(--guest-text, #ffffff);
    overflow: hidden;
}

.guest-landing-inner {
    min-height: calc(100vh - 140px);
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 22px;
}

.guest-landing-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    padding: 12px;
}

.guest-landing-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.guest-landing-copy {
    max-width: 560px;
}

.guest-landing-copy h2 {
    margin: 6px 0 10px;
    font-size: clamp(32px, 6vw, 56px);
    line-height: 1.02;
}

.guest-landing-copy p {
    margin: 0;
    font-size: 18px;
    line-height: 1.6;
}

.guest-landing-eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 13px;
    opacity: .85;
}

.guest-landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.guest-landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
}

.guest-landing-btn-primary {
    background: var(--guest-primary, #111111);
    color: #ffffff;
}

.guest-landing-btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: var(--guest-text, #ffffff);
}

@media (max-width: 960px) {
    .job-editor-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .editor-form-grid,
    .toggle-grid {
        grid-template-columns: 1fr;
    }

    .form-field-span-2 {
        grid-column: span 1;
    }

    .guest-landing-inner {
        padding: 28px 20px;
    }
}
