@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --primary: #0f172a;
    --primary-light: #1e293b;
    --brand: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-accent: #3b82f6;
    --brand-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --line: #e2e8f0;
    --line-focus: #93c5fd;
    --green-bg: #dcfce7;
    --green-text: #15803d;
    --amber-bg: #fef3c7;
    --amber-text: #b45309;
    --red-bg: #fee2e2;
    --red-text: #b91c1c;
    --slate-bg: #f1f5f9;
    --slate-text: #475569;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--brand-hover);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 14px;
}

/* Shell Layout */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    margin-bottom: 32px;
    padding: 0 8px;
    font-weight: 700;
    font-size: 17px;
}

.brand span, .login-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a {
    color: #94a3b8;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(3px);
}

.sidebar nav a.active {
    background: var(--brand-gradient);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-label {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 700;
    padding: 24px 16px 8px;
}

/* Main Area & Topbar */
.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 76px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.user-menu a {
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.user-menu a:hover {
    background: var(--slate-bg);
}

.user-menu form, .actions form {
    display: inline;
}

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
}

.content {
    padding: 32px;
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.footer {
    padding: 20px 32px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--line);
    background: #fff;
    margin-top: auto;
}

/* Stats Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat, .panel {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat {
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--line-focus);
}

.stat span {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat strong {
    display: block;
    font-size: 36px;
    font-weight: 800;
    margin-top: 8px;
    color: var(--brand);
    letter-spacing: -0.03em;
}

/* Panels & Tables */
.panel {
    padding: 26px;
    margin-bottom: 28px;
}

.panel h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.panel-head h2 {
    margin: 0;
}

/* Buttons */
.button {
    border: 0;
    background: var(--brand-gradient);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.button:hover {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.button.secondary {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
    background: var(--slate-bg);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.button.full {
    width: 100%;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.link-button:hover {
    background: rgba(37, 99, 235, 0.08);
}

.danger-text {
    color: var(--red-text);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f8fafc;
}

td small {
    display: block;
    color: var(--text-muted);
    margin-top: 2px;
    font-size: 12px;
}

.actions {
    white-space: nowrap;
}

.actions form {
    display: inline-block;
    margin: 0;
}

.actions > * {
    margin-right: 8px;
    vertical-align: middle;
}


/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 9999px;
    background: var(--slate-bg);
    color: var(--slate-text);
    font-size: 12px;
    font-weight: 600;
}

.badge.active, .badge.published, .badge.confirmed {
    background: var(--green-bg);
    color: var(--green-text);
}

.badge.inactive, .badge.closed, .badge.waiting {
    background: var(--amber-bg);
    color: var(--amber-text);
}

.badge.blocked, .badge.cancelled, .badge.danger {
    background: var(--red-bg);
    color: var(--red-text);
}

.badge.draft {
    background: var(--slate-bg);
    color: var(--slate-text);
}

/* Filters & Forms */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filters input, .filters select {
    min-width: 220px;
    width: auto;
}


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

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

.form label, .login-card label, .checkin-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

.form input, .form select, .form textarea,
.login-card input, .filters input, .filters select,
.checkin-form input, .checkin-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    background: #ffffff;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

.form input:focus, .form select:focus, .form textarea:focus,
.login-card input:focus, .filters input:focus, .filters select:focus,
.checkin-form input:focus, .checkin-form select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.hint, .empty {
    color: var(--text-muted);
    font-size: 14px;
}

.empty {
    text-align: center;
    padding: 40px;
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.alert.error {
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid #fecaca;
}

/* Auth Screens */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #eff6ff 0%, #f8fafc 60%);
}

.login-card {
    width: min(440px, 100%);
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 36px;
}

.login-card h1 {
    margin: 20px 0 6px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.login-card p {
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 14px;
}

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

.login-card small {
    display: block;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.checkin-form {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    align-items: end;
    gap: 14px;
    margin-top: 20px;
}

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

.export-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 22px;
    display: grid;
    gap: 12px;
    background: #fff;
    transition: all 0.2s ease;
}

.export-card:hover {
    border-color: var(--line-focus);
    box-shadow: var(--shadow-md);
}

.export-card span {
    color: var(--text-muted);
    font-size: 14px;
}

.details {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
}

.details dt {
    color: var(--text-muted);
    font-weight: 500;
}

.details dd {
    margin: 0;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 40;
        width: 260px;
        transition: left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .menu-open .sidebar {
        left: 0;
    }
    .menu-button {
        display: block;
    }
    .content {
        padding: 20px;
    }
    .topbar {
        padding: 0 20px;
    }
    .checkin-form {
        grid-template-columns: 1fr;
    }
    .export-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .cards, .grid.two {
        grid-template-columns: 1fr;
    }
    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }
    .filters > * {
        width: 100%;
        min-width: 0;
    }
    .user-menu > a {
        display: none;
    }
    .topbar h1 {
        font-size: 18px;
    }
    .panel {
        padding: 18px;
    }
}
