* {
    box-sizing: border-box;
}

:root {
    --brand: #4267e8;
    --brand-dark: #3456d4;
    --brand-tint: #eef3ff;
    --ink: #14141a;
    --muted: #8a8a95;
    --border: #e7e7ec;
    --bg: #f7f7f9;
    --success: #1e8e3e;
    --success-bg: #eaf7ee;
    --danger: #c62828;
    --danger-bg: #fff0f0;
    --sidebar-w: 220px;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ---------- Login ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 20px 45px -18px rgba(20, 20, 26, 0.16);
    border: 1px solid rgba(20, 20, 26, 0.04);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: var(--brand);
    margin-bottom: 20px;
}

.login-box h1 {
    font-size: 22px;
    margin: 0 0 20px;
}

/* ---------- Shared UI ---------- */

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    background: #fcfcfd;
}

.input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(66, 103, 232, .10);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

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

.btn-secondary {
    background: #fff;
    color: var(--ink);
    border: 1.5px solid var(--border);
}

.btn-small {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    background: var(--brand-tint);
    color: var(--brand);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #ffd9d9;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #cdeed9;
}

/* ---------- Layout ---------- */

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

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: var(--brand);
    padding: 0 8px;
    margin-bottom: 24px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav a {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.sidebar-nav a:hover {
    background: var(--bg);
    color: var(--ink);
}

.sidebar-nav a.active {
    background: var(--brand-tint);
    color: var(--brand);
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 8px 0;
    border-top: 1px solid var(--border);
}

.admin-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.logout-link {
    font-size: 13px;
    color: var(--danger);
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 700;
    font-size: 15px;
}

.hamburger {
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.hamburger span {
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.content {
    padding: 28px 32px;
    max-width: 1100px;
}

/* ---------- Page pieces ---------- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 22px;
    margin: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-active .stat-value {
    color: var(--success);
}

.stat-inactive .stat-value {
    color: var(--muted);
}

.card-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    max-width: 420px;
}

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.inline-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.filter-bar .input {
    max-width: 240px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg);
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    white-space: nowrap;
}

.url-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    font-size: 12.5px;
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 30px !important;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inactive {
    background: var(--bg);
    color: var(--muted);
}

.pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
}

.pagination a {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
}

.pagination a.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.detail-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    max-width: 560px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.detail-row:last-of-type {
    border-bottom: none;
}

.detail-label {
    color: var(--muted);
    flex-shrink: 0;
}

.detail-value {
    text-align: right;
    word-break: break-word;
}

.detail-box .btn {
    margin-top: 18px;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 0 2000px rgba(0,0,0,0);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 0 2000px rgba(0,0,0,0.25);
    }

    .topbar {
        display: flex;
    }

    .content {
        padding: 20px 16px;
    }

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

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .data-table thead {
        display: none;
    }

    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        border-top: 1px solid var(--border);
        padding: 10px 16px;
    }

    .data-table td {
        border: none;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
        gap: 12px;
        white-space: normal;
    }

    .data-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 600;
        flex-shrink: 0;
    }

    .url-cell {
        max-width: 60%;
    }

    .detail-row {
        flex-direction: column;
        gap: 4px;
    }

    .detail-value {
        text-align: left;
    }
}
