* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #7c879b;
    --border: #e8ecf3;
    --primary: #5865f2;
    --primary-dark: #4652dc;
    --danger: #e05252;
    --success: #25a36f;
    --shadow: 0 10px 30px rgba(26, 35, 58, .06);
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    color: var(--text);
    background: var(--bg);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

/* 404 */

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.error-box {
    text-align: center;
}

.error-code {
    font-size: 92px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -5px;
}

.error-title {
    margin-top: 18px;
    font-size: 22px;
    font-weight: 600;
}

.error-text {
    margin-top: 8px;
    color: #777;
    font-size: 15px;
}

/* Admin */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #111827;
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 30px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6674ff, #8a5cf6);
    font-weight: 800;
    font-size: 20px;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
}

.brand-subtitle {
    color: #7f8ba3;
    font-size: 11px;
    margin-top: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #9ca8bc;
    text-decoration: none;
    padding: 12px 13px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
}

.nav-item.active {
    background: rgba(255,255,255,.09);
    color: white;
}

.nav-item span {
    font-size: 18px;
}

.sidebar-bottom {
    margin-top: auto;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
    color: #9ca8bc;
    font-size: 12px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #35c98a;
    box-shadow: 0 0 0 4px rgba(53,201,138,.1);
}

.logout-btn {
    width: 100%;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    color: #aab4c5;
    padding: 10px;
    border-radius: 8px;
}

.logout-btn:hover {
    background: rgba(255,255,255,.08);
    color: white;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 38px 46px;
    max-width: 1500px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -.6px;
}

.topbar p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.admin-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #626d80;
    font-size: 13px;
    font-weight: 600;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecff;
    color: var(--primary);
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-value {
    margin-top: 9px;
    font-size: 25px;
    font-weight: 750;
}

.stat-value.online {
    color: var(--success);
    font-size: 22px;
}

.stat-domain {
    margin-top: 11px;
    font-size: 17px;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-description {
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}

.panel-header {
    padding: 21px 23px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
}

.panel-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.create-form {
    display: grid;
    grid-template-columns: 1fr 280px auto;
    gap: 15px;
    align-items: end;
    padding: 21px 23px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: #5d687b;
    font-size: 12px;
    font-weight: 650;
}

.field input {
    width: 100%;
    height: 43px;
    border: 1px solid #dfe4ed;
    border-radius: 8px;
    outline: none;
    padding: 0 12px;
    color: var(--text);
    background: #fbfcfe;
    transition: .15s;
}

.field input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(88,101,242,.1);
}

.slug-input {
    display: flex;
    height: 43px;
    border: 1px solid #dfe4ed;
    border-radius: 8px;
    background: #fbfcfe;
    overflow: hidden;
}

.slug-input span {
    display: flex;
    align-items: center;
    padding-left: 12px;
    color: #9aa4b5;
}

.slug-input input {
    height: 41px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.create-btn {
    height: 43px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    background: var(--primary);
    color: white;
    font-weight: 650;
    white-space: nowrap;
}

.create-btn:hover {
    background: var(--primary-dark);
}

.links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.count-badge {
    min-width: 30px;
    height: 28px;
    padding: 0 9px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2ff;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

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

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

th {
    padding: 12px 23px;
    text-align: left;
    color: #9aa3b3;
    background: #fafbfc;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
}

td {
    padding: 15px 23px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

.short-link {
    color: var(--primary);
    font-weight: 650;
    text-decoration: none;
}

.short-link:hover {
    text-decoration: underline;
}

.source-url {
    max-width: 440px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #667185;
}

.date {
    color: #8c96a7;
    white-space: nowrap;
    font-size: 12px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.copy-btn,
.delete-btn {
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 650;
}

.copy-btn {
    border: 1px solid #dfe4ed;
    color: #586377;
    background: white;
}

.copy-btn:hover,
.copy-btn.copied {
    border-color: #cdd2ff;
    color: var(--primary);
    background: #f5f6ff;
}

.delete-btn {
    border: 1px solid #f0d9d9;
    color: var(--danger);
    background: #fffafa;
}

.delete-btn:hover {
    background: #fff1f1;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #f0d5d5;
    border-radius: 9px;
    color: #a74646;
    background: #fff7f7;
    font-size: 13px;
}

.alert span {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e05252;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.empty {
    padding: 55px 20px;
    text-align: center;
}

.empty-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2ff;
    color: var(--primary);
    font-size: 21px;
}

.empty h3 {
    margin: 0;
    font-size: 15px;
}

.empty p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

footer {
    padding: 5px 0 20px;
    color: #a0a9b8;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 1000px) {
    .sidebar {
        width: 210px;
    }

    .main {
        padding: 30px;
    }

    .create-form {
        grid-template-columns: 1fr 1fr;
    }

    .create-btn {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .admin-layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        padding: 15px;
    }

    .brand {
        padding-bottom: 15px;
    }

    .nav-item {
        display: none;
    }

    .sidebar-bottom {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .server-status {
        margin: 0;
        flex: 1;
    }

    .logout-btn {
        width: auto;
        padding: 8px 13px;
    }

    .main {
        padding: 22px 15px;
    }

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

    .admin-badge {
        display: none;
    }

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

    .create-form {
        grid-template-columns: 1fr;
    }

    .create-btn {
        grid-column: auto;
    }

    th,
    td {
        padding-left: 14px;
        padding-right: 14px;
    }
}
