:root {
    --bg: #0a0a0b;
    --surface: #18181b;
    --surface2: #232327;
    --border: #27272a;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --primary: #ee72f1;
    --primary2: #ec4899;
    --primary-glow: rgba(238, 114, 241, 0.18);
    --danger: #f85149;
    --danger2: #da3633;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: clamp(18px, 1.25vw, 24px);
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container {
    flex: 1;
}

/* ── Navbar ─────────────────────────────────────────────────────────── */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0 clamp(24px, 4vw, 64px);
    gap: 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 24px var(--primary-glow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.navbar-brand:hover {
    color: var(--primary);
}

.nav-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-name {
    font-size: clamp(18px, 1.4vw, 26px);
    font-weight: 600;
    color: var(--text);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar-links a,
.nav-user {
    color: var(--muted);
    text-decoration: none;
    font-size: clamp(15px, 1.2vw, 20px);
    line-height: 1;
    transition: color 0.1s;
}

.navbar-links a:hover {
    color: var(--primary);
}

/* ── Layout ─────────────────────────────────────────────────────────── */

.container {
    /* body is a column flexbox: auto side margins here would cancel the
       cross-axis stretch and shrink the page to its content width */
    width: 100%;
    padding: 48px clamp(32px, 4vw, 80px);
}

.page-wrap {
    max-width: 1000px;
    margin: 0 auto;
}

.page-title {
    font-size: 38px;
    font-weight: 600;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 20px;
    margin-bottom: 40px;
}

.section {
    margin-bottom: 48px;
}

.section-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 20px;
}

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

.small {
    font-size: 15px;
}

/* ── Tiles ──────────────────────────────────────────────────────────── */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
    border-color: var(--primary);
    box-shadow: 0 0 24px var(--primary-glow);
}

.tile-name {
    font-size: 22px;
    font-weight: 600;
}

.tile-description {
    font-size: 16px;
    color: var(--muted);
    flex: 1;
}

.tile-url {
    font-size: 15px;
    color: var(--primary);
}

/* ── Status card ────────────────────────────────────────────────────── */

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--danger);
    border-radius: 10px;
    color: var(--danger);
    font-size: 16px;
    padding: 12px 20px;
    margin-bottom: 24px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 48px;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-card-on .status-dot {
    background: #3fb950;
    box-shadow: 0 0 12px rgba(63, 185, 80, 0.6);
}

.status-card-off .status-dot {
    background: var(--muted);
}

.status-body {
    flex: 1;
    min-width: 0;
}

.status-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.status-label {
    font-size: 18px;
    color: var(--muted);
}

.status-name {
    font-size: 20px;
    font-weight: 600;
}

.status-name-sep {
    color: var(--muted);
    font-weight: 400;
    margin: 0 2px;
}

.name-toggle {
    background: none;
    border: none;
    padding: 0;
    margin-left: 8px;
    color: var(--muted);
    cursor: pointer;
    vertical-align: middle;
    line-height: 0;
}

.name-toggle svg {
    width: 20px;
    height: 20px;
}

.name-toggle svg[hidden] {
    display: none;
}

.name-toggle:hover {
    color: var(--primary);
}

.status-sub {
    font-size: 15px;
    color: var(--muted);
    margin-top: 4px;
}

.status-action {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .status-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 20px;
    }
}

/* ── Platform rows ──────────────────────────────────────────────────── */

.platform-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.platform-row {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 200px;
    padding: 32px 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.platform-row:hover {
    border-color: var(--primary);
    box-shadow: 0 0 32px var(--primary-glow);
}

.platform-art {
    position: absolute;
    top: 50%;
    right: clamp(0px, 3vw, 40px);
    transform: translateY(-50%);
    height: 150%;
    aspect-ratio: 260 / 200;
    color: var(--primary);
    opacity: 0.16;
    pointer-events: none;
    transition: opacity 0.15s;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 35%);
    mask-image: linear-gradient(to right, transparent, #000 35%);
}

.platform-art svg {
    width: 100%;
    height: 100%;
}

.platform-row:hover .platform-art {
    opacity: 0.32;
}

.platform-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 65%;
}

.platform-name {
    font-size: 30px;
    font-weight: 600;
}

.platform-description {
    font-size: 18px;
    color: var(--muted);
}

.platform-url {
    font-size: 16px;
    color: var(--primary);
}

@media (max-width: 600px) {
    .platform-row {
        min-height: 160px;
        padding: 24px;
    }

    .platform-art {
        right: -20px;
        opacity: 0.1;
    }

    .platform-body {
        max-width: 100%;
    }

    .platform-name {
        font-size: 24px;
    }
}

/* ── Action rows (slim full-width links) ────────────────────────────── */

.action-row {
    min-height: 110px;
    padding: 20px 40px;
}

.action-row .platform-name {
    font-size: 24px;
}

.action-art {
    aspect-ratio: 260 / 120;
    height: 120%;
}

@media (max-width: 600px) {
    .action-row {
        min-height: 90px;
        padding: 18px 24px;
    }
}

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.placeholder-card {
    border-style: dashed;
}

/* ── Membership badge ───────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
}

.badge-active {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid #3fb950;
    color: #3fb950;
}

.badge-inactive {
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.badge-none {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
}

.status-membership {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.status-membership .badge {
    font-size: 13px;
    padding: 2px 12px;
}

.status-membership-text {
    font-size: 16px;
    color: var(--muted);
}

.status-membership-text strong {
    color: var(--text);
    font-weight: 600;
}

/* ── Tickets ────────────────────────────────────────────────────────── */

.page-wrap-narrow {
    max-width: 800px;
}

.back-link {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 16px;
    margin-bottom: 20px;
}

.back-link:hover {
    color: var(--primary);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ticket-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

a.ticket-row:hover {
    border-color: var(--primary);
}

.ticket-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: var(--text);
}

.ticket-title {
    font-size: 17px;
    font-weight: 600;
}

.ticket-excerpt {
    font-size: 15px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-date {
    font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
}

.ticket-status {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.ticket-status-open {
    background: rgba(238, 114, 241, 0.12);
    border: 1px solid var(--primary);
    color: var(--primary);
}

.ticket-status-working {
    background: rgba(210, 153, 34, 0.12);
    border: 1px solid #d29922;
    color: #d29922;
}

.ticket-status-closed {
    background: rgba(63, 185, 80, 0.12);
    border: 1px solid #3fb950;
    color: #3fb950;
}

.ticket-card {
    margin-top: 24px;
}

/* ── Ticket detail ──────────────────────────────────────────────────── */

.ticket-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.ticket-head-icon {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--primary);
    padding: 12px;
}

.ticket-head-icon svg {
    width: 100%;
    height: 100%;
}

.ticket-head-info {
    flex: 1;
    min-width: 0;
}

.ticket-head .page-title {
    margin-bottom: 0;
}

.ticket-head-sub {
    font-size: 17px;
    color: var(--muted);
}

.ticket-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ticket-meta-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
}

.ticket-meta-label {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ticket-meta-value {
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.ticket-attachment-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--primary);
    text-decoration: none;
    font-size: 15px;
}

.ticket-attachment-chip:hover {
    border-color: var(--primary);
}

/* ── Ticket conversation ────────────────────────────────────────────── */

.ticket-conversation {
    margin-top: 28px;
}

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.msg {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.msg-admin {
    align-self: flex-start;
    background: var(--surface);
    border-color: var(--primary);
}

.msg-user {
    align-self: flex-end;
    background: var(--surface2);
}

.msg-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
}

.msg-author {
    font-size: 14px;
    font-weight: 700;
}

.msg-admin .msg-author {
    color: var(--primary);
}

.msg-date {
    font-size: 12px;
    color: var(--muted);
}

.msg-body {
    font-size: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.msg-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.msg-textarea {
    width: 100%;
    min-height: 90px;
}

.msg-hint {
    margin-top: 4px;
}

.ticket-section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 8px;
}

.ticket-card .ticket-section-title:first-child {
    margin-top: 0;
}

.ticket-description {
    font-size: 16px;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ticket-attachments {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket-attachments a {
    color: var(--primary);
    font-size: 16px;
}

.ticket-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ── Status segments (admin) ────────────────────────────────────────── */

.status-segments {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.status-segment {
    display: inline-block;
    padding: 8px 22px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

button.status-segment:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.status-segment.active {
    cursor: default;
}

.ticket-status-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ticket-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 12px;
    flex-wrap: wrap;
}

.ticket-filters-kind {
    margin-top: 0;
    margin-bottom: 24px;
}

.ticket-filter-label {
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 48px;
}

.ticket-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
}

.filter-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.filter-icon svg {
    width: 17px;
    height: 17px;
}

.ticket-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ticket-filter.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-weight: 600;
}

@media (max-width: 600px) {
    .ticket-row {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* ── Forms ──────────────────────────────────────────────────────────── */

.ticket-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
}

.form-label {
    font-size: 16px;
    font-weight: 600;
    margin-top: 16px;
}

.form-choices {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-choice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    color: var(--muted);
    transition: border-color 0.15s, color 0.15s;
}

.form-choices .form-choice {
    flex: 1;
    min-width: 220px;
}

.form-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.choice-icon svg {
    width: 48px;
    height: 48px;
}

.choice-label {
    font-size: 20px;
    font-weight: 600;
}

.form-choice:hover {
    border-color: var(--muted);
}

.form-choice:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 16px var(--primary-glow);
}

.form-choice:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.platform-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-choice {
    padding: 16px 28px;
}

.form-input,
.form-select,
.form-textarea,
.form-file {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    padding: 10px 14px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select-inline {
    padding: 6px 10px;
    font-size: 14px;
}

.form-textarea {
    resize: vertical;
    min-height: 160px;
}

.form-submit {
    align-self: flex-end;
    margin-top: 20px;
}

.file-input {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.file-btn {
    font-size: 15px;
    padding: 10px 22px;
}

.file-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.file-names {
    font-size: 15px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ── Hero (errors) ──────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 120px 0;
}

.hero h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    text-decoration: none;
}

.btn:hover {
    border-color: var(--muted);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 28px;
    box-shadow: 0 0 16px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary2);
    border-color: var(--primary2);
}

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
    font-weight: 600;
}

.btn-danger:hover {
    background: var(--danger2);
    border-color: var(--danger2);
    color: #fff;
}

/* ── Footer ─────────────────────────────────────────────────────────── */

.footer {
    border-top: 1px solid var(--border);
    padding: 48px clamp(32px, 4vw, 80px);
    margin-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 100%;
    margin: 0 auto;
    justify-items: center;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.footer-col p,
.footer-col a {
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    line-height: 1.6;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-email {
    color: var(--primary) !important;
}

.footer-credit {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-top: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Large screens ──────────────────────────────────────────────────── */

@media (min-width: 1500px) {
    .page-wrap {
        max-width: 1520px;
    }

    .page-wrap-narrow {
        max-width: 1000px;
    }

    .page-title {
        font-size: 52px;
    }

    .page-subtitle {
        font-size: 26px;
        margin-bottom: 56px;
    }

    .section-title {
        font-size: 34px;
        margin-bottom: 28px;
    }

    .section {
        margin-bottom: 64px;
    }

    .platform-row {
        min-height: 260px;
        padding: 44px 56px;
    }

    .platform-name {
        font-size: 40px;
    }

    .platform-description {
        font-size: 24px;
    }

    .platform-url {
        font-size: 20px;
    }

    .tile {
        padding: 32px;
    }

    .tile-name {
        font-size: 28px;
    }

    .tile-description {
        font-size: 20px;
    }

    .card {
        padding: 32px;
        font-size: 22px;
    }

    .small {
        font-size: 18px;
    }

    .action-row {
        min-height: 130px;
        padding: 26px 56px;
    }

    .action-row .platform-name {
        font-size: 30px;
    }

    .page-wrap-narrow {
        max-width: 1200px;
    }

    .back-link {
        font-size: 19px;
    }

    .ticket-row {
        padding: 24px 32px;
        gap: 24px;
    }

    .ticket-title {
        font-size: 21px;
    }

    .ticket-excerpt {
        font-size: 18px;
    }

    .ticket-date {
        font-size: 16px;
    }

    .ticket-status {
        font-size: 15px;
        padding: 4px 16px;
    }

    .ticket-meta-label {
        font-size: 15px;
    }

    .ticket-meta-value,
    .ticket-description,
    .ticket-attachment-chip,
    .msg-body {
        font-size: 19px;
    }

    .ticket-head-sub {
        font-size: 21px;
    }

    .ticket-head-icon {
        width: 88px;
        height: 88px;
    }

    .msg-author {
        font-size: 16px;
    }

    .msg-date {
        font-size: 14px;
    }

    .ticket-section-title {
        font-size: 22px;
    }

    .ticket-filter {
        font-size: 18px;
        padding: 8px 22px;
    }

    .filter-icon svg {
        width: 20px;
        height: 20px;
    }

    .form-label {
        font-size: 20px;
    }

    .choice-label {
        font-size: 24px;
    }

    .choice-icon svg {
        width: 60px;
        height: 60px;
    }

    .form-select,
    .form-textarea,
    .form-file {
        font-size: 19px;
        padding: 12px 16px;
    }

    .form-choice {
        padding: 26px 34px;
    }

    .platform-choice {
        padding: 20px 34px;
    }

    .status-card {
        padding: 32px 40px;
    }

    .status-label {
        font-size: 22px;
    }

    .status-name {
        font-size: 26px;
    }

    .status-sub {
        font-size: 18px;
    }

    .name-toggle svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
        justify-items: start;
    }

    .footer {
        padding: 32px 24px;
        margin-top: 40px;
    }

    .footer-col h4 {
        font-size: 18px;
    }

    .page-title {
        font-size: 30px;
    }
}
