:root {
    --lt-bg: #f6f4ef;
    --lt-surface: #ffffff;
    --lt-ink: #171717;
    --lt-muted: #77706a;
    --lt-soft: #ece7df;
    --lt-line: #e5ded4;
    --lt-accent: #fe6b7a;
    --lt-accent-dark: #e64f61;
    --lt-lemon: #f4dc70;
    --lt-success: #23865b;
    --lt-danger: #d54747;
    --lt-warning: #ac7a12;
    --lt-shadow: 0 24px 70px rgba(30, 22, 16, .10);
    --lt-radius-xl: 30px;
    --lt-radius-lg: 22px;
    --lt-radius-md: 14px;
    --lt-font: 'Jost', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--lt-bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--lt-ink);
    font-family: var(--lt-font);
    background:
        radial-gradient(circle at 10% 0%, rgba(254, 107, 122, .18), transparent 32rem),
        radial-gradient(circle at 95% 10%, rgba(244, 220, 112, .34), transparent 34rem),
        var(--lt-bg);
}

a {
    color: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 26px;
    color: #fff;
    background: linear-gradient(165deg, #191716 0%, #302721 100%);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 18px;
    color: #171717;
    font-weight: 800;
    letter-spacing: -.06em;
    background: linear-gradient(135deg, var(--lt-lemon), var(--lt-accent));
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1.1rem;
    line-height: 1;
}

.brand small {
    margin-top: 5px;
    color: rgba(255, 255, 255, .62);
    font-size: .86rem;
}

.nav {
    display: grid;
    gap: 8px;
    margin-top: 42px;
}

.nav a {
    padding: 14px 16px;
    border-radius: 16px;
    color: rgba(255, 255, 255, .68);
    font-weight: 600;
    text-decoration: none;
    transition: .2s ease;
}

.nav a:hover,
.nav a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, .10);
}

.sidebar-footer {
    display: grid;
    gap: 16px;
    margin-top: auto;
}

.user-pill {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 18px;
    background: rgba(255, 255, 255, .06);
}

.user-pill > span {
    display: grid;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 999px;
    color: #171717;
    font-weight: 800;
    background: var(--lt-lemon);
}

.user-pill strong,
.user-pill small {
    display: block;
    max-width: 166px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-pill small {
    color: rgba(255, 255, 255, .58);
}

.logout {
    color: rgba(255, 255, 255, .65);
    text-decoration: none;
}

.logout:hover {
    color: #fff;
}

.main {
    min-width: 0;
    padding: 34px;
}

.main-auth {
    grid-column: 1 / -1;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
}

.topbar {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--lt-accent-dark);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: .98;
    letter-spacing: -.055em;
}

h2 {
    font-size: 1.4rem;
    letter-spacing: -.035em;
}

h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

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

.grid {
    display: grid;
    gap: 18px;
}

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

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

.card {
    padding: 24px;
    border: 1px solid rgba(30, 22, 16, .08);
    border-radius: var(--lt-radius-xl);
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--lt-shadow);
    backdrop-filter: blur(16px);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -30px;
    bottom: -40px;
    width: 140px;
    height: 140px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(244, 220, 112, .55), rgba(254, 107, 122, .30));
}

.stat-card span {
    color: var(--lt-muted);
    font-size: .9rem;
    font-weight: 600;
}

.stat-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 10px;
    font-size: 2.4rem;
    line-height: 1;
    letter-spacing: -.06em;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--lt-line);
    border-radius: 20px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--lt-line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--lt-muted);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: #fbfaf7;
}

tr:last-child td {
    border-bottom: 0;
}

tr:nth-child(even) td {
    background: rgba(246, 244, 239, .45);
}

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

.button,
button {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 16px;
    border: 0;
    border-radius: 999px;
    color: var(--lt-ink);
    font: 700 .94rem/1 var(--lt-font);
    text-decoration: none;
    cursor: pointer;
    background: var(--lt-soft);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--lt-accent);
    box-shadow: 0 12px 28px rgba(254, 107, 122, .28);
}

.button-dark {
    color: #fff;
    background: #171717;
}

.button-ghost {
    border: 1px solid var(--lt-line);
    background: #fff;
}

.button-danger {
    color: #fff;
    background: var(--lt-danger);
}

.button-small {
    min-height: 34px;
    padding: 8px 12px;
    font-size: .84rem;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

.field {
    display: grid;
    gap: 8px;
}

label {
    font-size: .9rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--lt-line);
    border-radius: 16px;
    color: var(--lt-ink);
    font: 500 1rem/1.35 var(--lt-font);
    background: #fff;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(254, 107, 122, .65);
    box-shadow: 0 0 0 4px rgba(254, 107, 122, .12);
}

.help {
    color: var(--lt-muted);
    font-size: .88rem;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 600;
}

.alert-success {
    color: #0e5f3d;
    background: #dff6eb;
}

.alert-error {
    color: #8c2727;
    background: #ffe2e2;
}

.alert-warning {
    color: #714b00;
    background: #fff1cc;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--lt-muted);
    font-size: .82rem;
    font-weight: 800;
    background: var(--lt-soft);
}

.badge-success {
    color: #146a46;
    background: #daf6e8;
}

.badge-danger {
    color: #9b3030;
    background: #ffe0e0;
}

.short-url {
    display: inline-flex;
    max-width: 280px;
    overflow: hidden;
    color: var(--lt-accent-dark);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-card {
    width: min(100%, 460px);
    padding: 34px;
    border: 1px solid rgba(30, 22, 16, .08);
    border-radius: 34px;
    background: rgba(255, 255, 255, .88);
    box-shadow: var(--lt-shadow);
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 28px;
}

.auth-brand .brand-mark {
    width: 58px;
    height: 58px;
}

.auth-card h1 {
    margin-bottom: 12px;
}

.auth-card p {
    color: var(--lt-muted);
}

.empty-state {
    padding: 30px;
    border: 1px dashed var(--lt-line);
    border-radius: 24px;
    color: var(--lt-muted);
    text-align: center;
    background: rgba(255, 255, 255, .6);
}

.copy-button {
    white-space: nowrap;
}

.url-preview {
    word-break: break-all;
}

.section-title {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 14px;
}

.inline-form {
    display: inline;
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 18px;
        border-radius: 0 0 28px 28px;
    }

    .nav {
        grid-template-columns: repeat(3, 1fr);
        margin-top: 22px;
    }

    .sidebar-footer {
        display: none;
    }

    .main {
        padding: 22px;
    }

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

    .grid-2,
    .grid-3,
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .nav {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px;
        border-radius: 26px;
    }

    .card {
        padding: 18px;
        border-radius: 22px;
    }
}

.stat-card .stat-text {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -.035em;
}

.short-url {
    font-weight: 500;
}

.chart-card {
    overflow: hidden;
}

.chart-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chart-controls input[type="range"] {
    width: 150px;
    min-height: 34px;
    padding: 0;
    accent-color: var(--lt-accent);
}

.chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    border: 1px solid var(--lt-line);
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(246,244,239,.72));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.chart-scroll canvas {
    display: block;
}

@media (max-width: 560px) {
    .chart-controls {
        width: 100%;
    }

    .chart-controls input[type="range"] {
        flex: 1;
        width: auto;
    }
}
