:root {
    color-scheme: light;
    --page-background:
        radial-gradient(circle at top, rgba(123, 109, 247, 0.22), transparent 38%),
        linear-gradient(180deg, #f8f2ff 0%, #eeecfe 100%);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-border: rgba(80, 0, 170, 0.14);
    --text-main: #1b1b1e;
    --text-muted: #5c5c5f;
    --accent: #5000aa;
    --accent-strong: #3a007d;
    --accent-soft: rgba(80, 0, 170, 0.08);
    --accent-ring: rgba(80, 0, 170, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--page-background);
    color: var(--text-main);
}

.page-shell {
    display: grid;
    min-height: 100vh;
    padding: 2rem;
    place-items: center;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 64px;
    border-bottom: 1px solid var(--surface-border);
    background: #fff;
    box-shadow: 0 4px 16px rgba(80, 0, 170, 0.06);
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-nav-link {
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
}

.app-nav-link:hover,
.app-nav-link:focus-visible {
    background: var(--accent-soft);
    color: var(--accent);
}

.app-nav-link.is-active {
    background: var(--accent);
    color: #fff;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.app-user-email {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.app-main {
    flex: 1;
    padding: 2.5rem clamp(1rem, 3vw, 2rem);
}

.content-card {
    width: min(1600px, 100%);
    margin: 0 auto;
    min-height: 60vh;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(80, 0, 170, 0.12);
    overflow: hidden;
}

.hero {
    width: min(720px, 100%);
    padding: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 80px rgba(80, 0, 170, 0.16);
}

.eyebrow {
    margin: 0 0 1rem;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    line-height: 0.95;
}

.lead {
    margin: 1.5rem 0 0;
    max-width: 52ch;
    color: var(--text-muted);
    font-size: 1.125rem;
    line-height: 1.65;
}

.feature-list {
    display: grid;
    gap: 0.75rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--accent);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.5rem;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--text-main);
    font-size: 0.95rem;
}

.user-bar strong {
    color: var(--accent);
}

.hero-actions {
    margin: 2rem 0 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.4rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button-primary {
    background: var(--accent);
    color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
    background: var(--accent-strong);
}

.button-ghost {
    background: transparent;
    border-color: var(--surface-border);
    color: var(--text-main);
}

.button-ghost:hover,
.button-ghost:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

.login-form {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0 0;
}

.login-form label {
    display: grid;
    gap: 0.35rem;
}

.login-form label span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-form input {
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    color: var(--text-main);
}

.login-form input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-form button {
    margin-top: 0.5rem;
    width: 100%;
}

.login-error {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid #c0392b;
    border-radius: 10px;
    background: rgba(192, 57, 43, 0.08);
    color: #8e2a1f;
    font-weight: 600;
}

.login-back {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.9rem;
}

.login-back a {
    color: var(--text-muted);
    text-decoration: none;
}

.login-back a:hover {
    color: var(--accent);
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.5rem;
}

.content-title {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2;
}

.content-empty {
    color: var(--text-muted);
    font-style: italic;
}

.data-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

.data-table col.col-id { width: 80px; }
.data-table col.col-name { width: 16%; }
.data-table col.col-url { width: auto; }
.data-table col.col-actions { width: 100px; }

.data-table thead th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(80, 0, 170, 0.06);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table code {
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
}

.data-table-url {
    color: var(--text-muted);
    font-size: 0.85rem;
    word-break: break-all;
}

.data-table-url a {
    color: inherit;
    text-decoration: none;
}

.data-table-url a:hover,
.data-table-url a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
}

.data-table-actions {
    text-align: right;
    white-space: nowrap;
}

.data-table-actions > * + * {
    margin-left: 0.4rem;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    vertical-align: middle;
}

.icon-button svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.icon-button:hover,
.icon-button:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.icon-button-danger:hover,
.icon-button-danger:focus-visible {
    border-color: #c0392b;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
}

.button-small {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.button-danger {
    background: transparent;
    border: 1px solid #c0392b;
    color: #c0392b;
}

.button-danger:hover,
.button-danger:focus-visible {
    background: #c0392b;
    color: #fff;
}

.link-form {
    display: grid;
    gap: 1rem;
    max-width: 640px;
}

.form-field {
    display: grid;
    gap: 0.35rem;
}

.form-field label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-field input {
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: #fff;
    font-size: 1rem;
    color: var(--text-main);
}

.form-field input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-field ul {
    margin: 0;
    padding: 0;
    list-style: none;
    color: #8e2a1f;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
}

.inline-form {
    display: inline;
}

.link-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    margin: 0 0 2rem;
    padding: 1.25rem;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--accent-soft);
}

.link-meta-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.link-meta-url {
    display: inline-block;
    margin-top: 0.35rem;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.link-qrcode {
    width: 140px;
    height: 140px;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
}

.store-landing {
    text-align: center;
}

.store-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1.75rem 0;
}

.store-badge img {
    height: 56px;
}

.store-qrcode {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.store-qrcode-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.store-qrcode img {
    width: 180px;
    height: 180px;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
}

@media (max-width: 640px) {
    .page-shell {
        padding: 1rem;
    }

    .hero {
        border-radius: 18px;
    }

    .user-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-topbar {
        gap: 0.75rem;
        padding: 0 1rem;
        height: 56px;
    }

    .app-user-email {
        display: none;
    }

    .app-main {
        padding: 1.25rem 1rem;
    }

    .app-nav {
        overflow-x: auto;
    }

    .content-card {
        border-radius: 16px;
    }
}
