@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
    --ink: #102033;
    --muted: #607086;
    --line: #dbe7f3;
    --brand: #12b981;
    --brand-dark: #0f8f6a;
    --sky: #2f80ed;
    --sun: #f7c948;
    --bg: #f4fbff;
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: #ffffff;
    --field: #ffffff;
    --danger: #dc2626;
    --shadow: 0 22px 60px rgba(47, 128, 237, 0.13);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 10%, rgba(18, 185, 129, 0.17), transparent 30%),
        radial-gradient(circle at 88% 12%, rgba(47, 128, 237, 0.14), transparent 28%),
        linear-gradient(180deg, #f8fdff 0%, #eef8ff 48%, #f7fbff 100%);
    font: 15px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(47, 128, 237, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(47, 128, 237, 0.055) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 18px 0;
    background: linear-gradient(to bottom, rgba(248, 253, 255, 0.95), rgba(248, 253, 255, 0));
}

header > div {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 14px;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(219, 231, 243, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    box-shadow: 0 14px 42px rgba(47, 128, 237, 0.11);
}

.brand {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    min-width: max-content;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, #12b981, #67e8f9);
    box-shadow: 0 12px 28px rgba(18, 185, 129, 0.28);
}

.brand strong,
h1,
h2,
h3 {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    letter-spacing: 0;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

a {
    color: var(--sky);
    text-decoration: none;
}

nav a {
    color: #25364d;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

nav a:hover,
nav a:focus-visible {
    color: var(--brand-dark);
    border-color: rgba(18, 185, 129, 0.22);
    background: rgba(18, 185, 129, 0.08);
}

main {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 20px 76px;
}

.dashboard-hero,
.login-callout,
.panel,
table {
    border: 1px solid rgba(219, 231, 243, 0.92);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin: 0 0 20px;
    padding: 26px;
    border-radius: 26px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(234, 250, 244, 0.92)),
        var(--panel);
}

.login-callout h2,
.section-heading h2,
.section-heading h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
}

.login-callout p,
.section-heading p {
    margin: 8px 0 0;
}

.panel {
    border-radius: 26px;
    padding: 28px;
    margin-bottom: 20px;
}

.form-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.92)),
        var(--panel-strong);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

label {
    display: block;
    color: #25364d;
    font-weight: 800;
    margin: 14px 0 7px;
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.turnstile-box {
    margin-top: 14px;
}

.turnstile-box .cf-turnstile {
    margin-top: 8px;
}

.permission-list {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f8fcff;
}

.permission-list label {
    display: flex;
    gap: 10px;
    align-items: center;
}

.permission-list input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

input,
textarea,
select {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #cfdeeb;
    border-radius: 14px;
    background: var(--field);
    color: var(--ink);
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(47, 128, 237, 0.26);
    outline-offset: 3px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(47, 128, 237, 0.72);
    box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.11);
    background: #ffffff;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid rgba(18, 185, 129, 0.35);
    border-radius: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #10b981, #2f80ed);
    box-shadow: 0 14px 34px rgba(18, 185, 129, 0.22);
    cursor: pointer;
    font-weight: 800;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 42px rgba(47, 128, 237, 0.2);
}

.button.secondary,
button.secondary {
    color: var(--ink);
    border-color: #cfdeeb;
    background: #ffffff;
    box-shadow: none;
}

.button.danger,
button.danger {
    color: #ffffff;
    border-color: rgba(220, 38, 38, 0.28);
    background: linear-gradient(135deg, #dc2626, #fb7185);
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 30px;
    border-radius: 26px;
    margin-bottom: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 250, 255, 0.92)),
        var(--panel);
}

.dashboard-hero h1 {
    margin: 0;
    font-size: 44px;
    line-height: 1.05;
}

.dashboard-hero.compact h1 {
    font-size: 38px;
}

.dashboard-hero p {
    max-width: 620px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 17px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid rgba(219, 231, 243, 0.94);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff, #f3fbff);
    box-shadow: 0 16px 40px rgba(47, 128, 237, 0.1);
}

.metric-card span {
    color: var(--muted);
    font-weight: 800;
}

.metric-card strong {
    color: #102033;
    font-size: 34px;
}

table {
    width: 100%;
    overflow: hidden;
    border-collapse: collapse;
    border-radius: 20px;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #4b6178;
    background: #f1f8ff;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

td {
    color: #25364d;
    background: rgba(255, 255, 255, 0.82);
}

tr:hover td {
    background: #f7fcff;
}

.status {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid rgba(18, 185, 129, 0.24);
    border-radius: 999px;
    background: rgba(18, 185, 129, 0.1);
    color: #0f8f6a;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
}

.status.closed {
    border-color: rgba(96, 112, 134, 0.22);
    background: rgba(96, 112, 134, 0.09);
    color: #607086;
}

.status.failed {
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.09);
    color: #b91c1c;
}

.status.success {
    border-color: rgba(18, 185, 129, 0.24);
    background: rgba(18, 185, 129, 0.1);
    color: #0f8f6a;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.alert {
    border-radius: 16px;
    margin-bottom: 18px;
    padding: 13px 15px;
    color: #075c43;
    background: rgba(18, 185, 129, 0.12);
    border: 1px solid rgba(18, 185, 129, 0.26);
}

.alert.error {
    color: #991b1b;
    background: rgba(220, 38, 38, 0.09);
    border-color: rgba(220, 38, 38, 0.22);
}

.attachment-field {
    margin-top: 16px;
}

.attachment-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.attachment-list[hidden] {
    display: none;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    padding: 9px 10px 9px 12px;
    background: #f8fbff;
    color: #334155;
    font-size: 0.94rem;
    font-weight: 700;
}

.attachment-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.attachment-remove {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 999px;
    padding: 0;
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    font-size: 1rem;
    line-height: 1;
    box-shadow: none;
}

.attachment-remove:hover {
    background: rgba(220, 38, 38, 0.14);
    transform: none;
    box-shadow: none;
}

.field-error {
    min-height: 20px;
    margin: 8px 0 0;
    color: #b91c1c;
    font-size: 0.92rem;
    font-weight: 700;
}

input.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.reply {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    background: #ffffff;
}

.reply-customer {
    border-color: rgba(47, 128, 237, 0.2);
    background: linear-gradient(180deg, #ffffff, #f3f9ff);
}

.reply-staff {
    border-color: rgba(13, 148, 136, 0.46);
    background: linear-gradient(180deg, #eafff7, #dffdf1);
    box-shadow: inset 6px 0 0 #0d9488, 0 12px 30px rgba(13, 148, 136, 0.11);
}

.reply strong {
    color: var(--ink);
}

.reply.reply-staff strong {
    color: #0f766e;
}

.reply-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.reply-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(13, 148, 136, 0.24);
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(13, 148, 136, 0.12);
    color: #0f766e;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
}

.reply-badge.customer {
    border-color: rgba(47, 128, 237, 0.22);
    background: rgba(47, 128, 237, 0.09);
    color: #2563eb;
}

.muted {
    color: var(--muted);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.ticket-filters {
    margin-top: 18px;
}

.ticket-filters > div {
    min-width: 170px;
    flex: 1 1 170px;
}

.profile-panel,
.reply-panel {
    max-width: 860px;
}

@media (max-width: 900px) {
    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    header {
        padding: 10px 10px 0;
    }

    header > div,
    .login-callout {
        align-items: flex-start;
        flex-direction: column;
    }

    nav {
        justify-content: flex-start;
    }

    main {
        padding: 22px 12px 56px;
    }

    .dashboard-hero,
    .panel,
    .login-callout {
        padding: 20px;
        border-radius: 20px;
    }

    .login-callout h2,
    .section-heading h2,
    .section-heading h1,
    .dashboard-hero h1,
    .dashboard-hero.compact h1 {
        font-size: 32px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
