:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --page: #f8fafc;
    --card: #ffffff;
    --border: #e5e7eb;
    --line: #edf1f7;
    --text: #0f172a;
    --muted: #64748b;
    --sidebar: #111a3a;
    --sidebar-deep: #0d1632;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page);
}

a {
    text-decoration: none;
}

svg,
.lucide {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
}

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

.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    background:
        radial-gradient(circle at 20% 0%, rgba(99, 102, 241, .22), transparent 17rem),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
    padding: 1.65rem 1.05rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    padding: 0 .7rem 1.45rem;
}

.sidebar-brand:hover {
    color: #fff;
}

.brand-link-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    place-items: center;
    color: #6d5dfc;
}

.brand-link-icon svg,
.brand-link-icon .lucide {
    width: 2.85rem;
    height: 2.85rem;
}

.sidebar-brand strong {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.035em;
}

.sidebar-brand small {
    display: block;
    margin-top: .22rem;
    color: rgba(255, 255, 255, .78);
    font-size: .92rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .75rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    box-shadow: 0 12px 24px rgba(99, 102, 241, .25);
    font-weight: 800;
}

.sidebar-nav {
    display: grid;
    gap: .85rem;
    margin-top: 1.1rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .95rem;
    width: 100%;
    min-height: 3.35rem;
    border: 0;
    border-radius: .75rem;
    color: rgba(255, 255, 255, .92);
    background: transparent;
    padding: .85rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, #6d5dfc, #5137f1);
    box-shadow: 0 14px 30px rgba(79, 70, 229, .35);
}

.sidebar-icon {
    display: grid;
    width: 1.45rem;
    height: 1.45rem;
    flex: 0 0 auto;
    place-items: center;
}

.sidebar-icon svg,
.sidebar-icon .lucide {
    width: 1.35rem;
    height: 1.35rem;
}

.sidebar-admin {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding: 1.05rem .55rem 0;
    color: #fff;
}

.admin-avatar {
    display: grid;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 999px;
    color: #94a3b8;
    background: #f8fafc;
}

.admin-avatar svg,
.admin-avatar .lucide {
    width: 1.5rem;
    height: 1.5rem;
}

.sidebar-admin strong,
.sidebar-admin small {
    display: block;
}

.sidebar-admin strong {
    font-size: .95rem;
    font-weight: 800;
}

.sidebar-admin small {
    color: rgba(255, 255, 255, .7);
    font-size: .78rem;
}

.app-main {
    min-width: 0;
    background: #fff;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 96px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    padding: 1.55rem 2rem;
}

.topbar-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.035em;
}

.topbar-eyebrow {
    margin: .35rem 0 0;
    color: #475569;
    font-size: .98rem;
    font-weight: 400;
}

.topbar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 2.9rem;
    border: 1px solid #d6deeb;
    border-radius: .85rem;
    color: #334155;
    background: #fff;
    padding: 0 1.05rem;
    font-size: .95rem;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.topbar-logout svg,
.topbar-logout .lucide {
    width: 1.1rem;
    height: 1.1rem;
}

.content-panel {
    padding: 1.65rem 2rem 2rem;
    background:
        radial-gradient(circle at 58% 0%, rgba(99, 102, 241, .1), transparent 23rem),
        radial-gradient(circle at 88% 0%, rgba(168, 85, 247, .1), transparent 24rem),
        #fff;
}

.auth-page {
    display: block;
    min-height: 100vh;
    padding: 0;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 8%, rgba(99, 102, 241, .18), transparent 30rem),
        radial-gradient(circle at 86% 0%, rgba(168, 85, 247, .16), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 52%, #faf5ff 100%);
    padding: 32px 16px;
}

.login-card {
    width: 420px;
    max-width: calc(100vw - 32px);
    min-width: 0;
    border: 1px solid rgba(214, 222, 234, .95);
    border-radius: 24px;
    background: #fff;
    padding: 32px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, .12);
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-bottom: 28px;
    text-align: center;
}

.login-logo {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    box-shadow: 0 16px 28px rgba(99, 102, 241, .28);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.login-title {
    color: #0f172a;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.login-subtitle {
    margin-top: 6px;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.login-error {
    width: 100%;
    margin-bottom: 20px;
    border: 1px solid #fecaca;
    border-radius: 14px;
    color: #7f1d1d;
    background: #fee2e2;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form .form-group {
    display: grid;
    gap: 8px;
    margin: 0;
}

.login-form .form-label {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
}

.login-form .form-input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 48px;
    border: 1px solid #d6deea;
    border-radius: 12px;
    background: #fff;
    padding: 0 14px;
    color: var(--text);
    font-size: 16px;
    line-height: 48px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
    appearance: none;
}

.login-form .form-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 0 18px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    box-shadow: 0 16px 30px rgba(79, 70, 229, .3);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
    appearance: none;
}

.login-button:hover {
    background: linear-gradient(135deg, #6d5dfc, #5137f1);
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(79, 70, 229, .34);
}

.login-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18), 0 16px 30px rgba(79, 70, 229, .3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
    margin-bottom: 1.65rem;
}

.metric-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    min-height: 132px;
    border: 1px solid rgba(226, 232, 240, .98);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .76);
    padding: 1.35rem 1.45rem;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .035);
}

.metric-blue { background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(255, 255, 255, .92)); border-color: #cdd5ff; }
.metric-green { background: linear-gradient(135deg, rgba(16, 185, 129, .09), rgba(255, 255, 255, .92)); border-color: #c9f0df; }
.metric-amber { background: linear-gradient(135deg, rgba(245, 158, 11, .1), rgba(255, 255, 255, .92)); border-color: #fedfb3; }
.metric-purple { background: linear-gradient(135deg, rgba(168, 85, 247, .1), rgba(255, 255, 255, .92)); border-color: #edd3ff; }

.metric-card p {
    margin: 0 0 .55rem;
    font-size: .95rem;
    font-weight: 800;
}

.metric-card strong {
    display: block;
    color: var(--text);
    font-size: 1.78rem;
    font-weight: 800;
    line-height: 1.05;
}

.metric-card span {
    display: block;
    margin-top: .75rem;
    color: #475569;
    font-size: .86rem;
}

.metric-blue p { color: #25339a; }
.metric-green p { color: #047857; }
.metric-amber p { color: #d95b00; }
.metric-purple p { color: #9333ea; }
.metric-blue span,
.metric-green span,
.metric-amber span { color: #475569; }
.metric-purple span { color: #9333ea; font-weight: 700; }

.metric-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: .65rem;
}

.metric-icon svg,
.metric-icon .lucide {
    width: 1.55rem;
    height: 1.55rem;
}

.metric-blue .metric-icon { color: #4f46e5; background: #ddd6fe; }
.metric-green .metric-icon { color: #059669; background: #bbf7d0; }
.metric-amber .metric-icon { color: #ea580c; background: #fed7aa; }
.metric-purple .metric-icon { color: #a855f7; background: #f0abfc; }

.panel-card {
    border: 1px solid #dbe2ec;
    border-radius: .85rem;
    background: #fff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .055);
}

.create-panel {
    margin-bottom: 1.3rem;
    padding: 1.25rem 1.45rem;
}

.panel-title-row {
    margin-bottom: 1.05rem;
}

.panel-title-row h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -.025em;
}

.form-card label {
    display: block;
    margin-bottom: .55rem;
    color: #111827;
    font-size: .78rem;
    font-weight: 800;
}

.toolbar-search input,
.toolbar-filters select,
.form-card input {
    width: 100%;
    height: 2.9rem;
    border: 1px solid #d8e0ec;
    border-radius: .55rem;
    background: #fff;
    padding: .75rem .95rem;
    color: var(--text);
    font-size: .92rem;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.form-card input::placeholder,
.toolbar-search input::placeholder {
    color: #8a96a8;
}

.toolbar-search input:focus,
.form-card input:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}

.preview-box > div {
    display: flex;
    align-items: center;
    gap: .45rem;
    height: 2.9rem;
    overflow: hidden;
    border: 1px solid #d8e0ec;
    border-radius: .55rem;
    background: #f8fafc;
    padding: .6rem .85rem;
    font-size: .86rem;
}

.preview-box span {
    color: #111827;
    white-space: nowrap;
}

.preview-box b {
    border-radius: .45rem;
    color: #4f46e5;
    background: #ece9ff;
    padding: .25rem .5rem;
    white-space: nowrap;
}

.preview-box em {
    display: grid;
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: .45rem;
    color: #64748b;
    background: #eef2f7;
    font-style: normal;
    margin-left: auto;
}

.preview-box em svg,
.preview-box em .lucide {
    width: 1rem;
    height: 1rem;
}

.primary-gradient-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 2.65rem;
    border: 0;
    border-radius: .45rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: .72rem 1.05rem;
    font-size: .9rem;
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(79, 70, 229, .28);
}

.primary-gradient-button:hover {
    color: #fff;
    transform: translateY(-1px);
}

.primary-gradient-button svg,
.primary-gradient-button .lucide {
    width: 1.05rem;
    height: 1.05rem;
}

.links-panel {
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #dbe2ec;
    padding: .8rem 1.15rem;
}

.toolbar-search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 350px;
    gap: .6rem;
    height: 2.55rem;
    border: 1px solid #d8e0ec;
    border-radius: .45rem;
    background: #fff;
    padding: 0 .75rem;
}

.toolbar-search span {
    display: grid;
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    place-items: center;
    color: #64748b;
}

.toolbar-search input {
    height: auto;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.toolbar-search input:focus {
    box-shadow: none;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-left: auto;
}

.toolbar-filters select {
    width: 170px;
    height: 2.55rem;
    border-radius: .45rem;
    padding: 0 .8rem;
}

.toolbar-filters button,
.toolbar-filters .create-new-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    height: 2.55rem;
    border: 0;
    border-radius: .45rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 0 1.05rem;
    font-size: .84rem;
    font-weight: 800;
}

.toolbar-filters button svg,
.toolbar-filters button .lucide,
.toolbar-filters .create-new-button svg,
.toolbar-filters .create-new-button .lucide {
    width: 1rem;
    height: 1rem;
}

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

.admin-table thead {
    background: #f8fafc;
}

.admin-table th {
    color: #0f172a;
    padding: .8rem 1.35rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table td {
    border-top: 1px solid #e6ebf2;
    padding: .92rem 1.35rem;
    color: #0f172a;
    vertical-align: middle;
}

.title-cell {
    min-width: 210px;
    max-width: 260px;
    overflow: hidden;
    color: #0f172a;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slug-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #3730ff;
    font-weight: 700;
}

.slug-link .lucide {
    width: .95rem;
    height: .95rem;
}

.destination-cell {
    max-width: 420px;
}

.destination-link {
    display: inline-block;
    max-width: 330px;
    overflow: hidden;
    color: #111827;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.provider-badge {
    display: inline-flex;
    align-items: center;
    border-radius: .45rem;
    margin-left: .55rem;
    padding: .32rem .55rem;
    font-size: .78rem;
    font-weight: 600;
}

.provider-klook,
.provider-facebook,
.provider-trip { color: #475569; background: #f1f5f9; }
.provider-agoda,
.provider-booking { color: #475569; background: #f1f5f9; }
.provider-shopee,
.provider-lazada { color: #475569; background: #f1f5f9; }
.provider-tiktok,
.provider-youtube,
.provider-line,
.provider-amazon,
.provider-other { color: #475569; background: #f1f5f9; }

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

.action-button {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 0;
    border-radius: .45rem;
}

.action-button svg,
.action-button .lucide {
    width: 1.05rem;
    height: 1.05rem;
}

.action-button.purple { color: #4f46e5; background: #ede9fe; }
.action-button.blue { color: #2287ee; background: #e3f2ff; }
.action-button.amber { color: #f59e0b; background: #fff1d6; }
.action-button.red { color: #ef4444; background: #ffe2e2; }

.empty-table {
    padding: 3rem 1rem;
    color: var(--muted);
    text-align: center;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid #dbe2ec;
    padding: 1rem 1.35rem;
}

.pagination-row p {
    margin: 0;
    color: #475569;
    font-size: .9rem;
}

.pagination-row nav {
    display: flex;
    gap: .65rem;
}

.pager {
    display: grid;
    min-width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    border: 1px solid #d8e0ec;
    border-radius: .45rem;
    color: #0f172a;
    background: #fff;
    font-size: .9rem;
    font-weight: 600;
}

.pager.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 10px 22px rgba(79, 70, 229, .28);
}

.pager.disabled {
    pointer-events: none;
    opacity: .45;
}

.form-card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.form-page {
    display: flex;
    justify-content: center;
}

.form-page .form-card {
    width: min(860px, 100%);
    padding: 1.55rem;
}

.form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.form-card-header p {
    margin: 0 0 .35rem;
    color: #4f46e5;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.form-card-header h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8e0ec;
    border-radius: .55rem;
    color: #334155;
    background: #fff;
    padding: .7rem .95rem;
    font-size: .88rem;
    font-weight: 700;
}

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

.form-field.full,
.preview-box.full {
    grid-column: 1 / -1;
}

.form-submit {
    margin-top: 1.15rem;
}

@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        min-height: auto;
    }

    .sidebar-nav {
        margin-top: 1rem;
    }

    .sidebar-admin {
        margin-top: 1rem;
    }

    .topbar,
    .table-toolbar,
    .pagination-row {
        flex-direction: column;
        align-items: stretch;
    }

    .content-panel {
        padding: 1rem;
    }

    .toolbar-search {
        max-width: none;
    }

    .toolbar-filters {
        flex-wrap: wrap;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .stats-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .destination-cell {
        min-width: 280px;
    }
}
