:root {
    --bg: #0f1117;
    --panel: #171a23;
    --card: #1e2230;
    --border: #2a2f40;
    --text: #e6e8ef;
    --muted: #8b90a3;
    --accent: #7c5cff;
    --accent-2: #3dd6c6;
    --danger: #ff5c7a;
}

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

body {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

h1 { font-size: 1.8rem; margin-bottom: .4rem; }
h2 { font-size: 1.15rem; margin-bottom: .6rem; }
p  { line-height: 1.6; margin-bottom: .6rem; }
ul { padding-left: 1.2rem; line-height: 1.9; }
.muted { color: var(--muted); margin-bottom: 1.5rem; }

.logo {
    font-weight: 800;
    font-size: 1.3rem;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Sidebar layout */
.sidebar {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.sidebar nav a {
    color: var(--muted);
    text-decoration: none;
    padding: .65rem .9rem;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: var(--card); color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: #fff; }

.user-box {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: .9rem;
}
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: grid; place-items: center;
    font-weight: 700;
}
.logout { margin-left: auto; color: var(--danger); text-decoration: none; font-size: .85rem; }

.content { flex: 1; padding: 2.5rem 3rem; overflow-x: auto; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.2rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; margin-bottom: 1.2rem; }
.stat { display: flex; flex-direction: column; margin-bottom: 0; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--accent-2); }
.stat-label { color: var(--muted); font-size: .9rem; }
.tag {
    display: inline-block;
    font-size: .75rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: rgba(124, 92, 255, .2);
    color: var(--accent);
    margin-bottom: .6rem;
}

/* Auth page */
.auth-body {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 20% 20%, #241b4a 0%, var(--bg) 55%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.auth-card h1 { margin-top: 1rem; font-size: 1.5rem; }
.auth-card form { display: flex; flex-direction: column; gap: .5rem; }
.auth-card label { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
.auth-card input {
    padding: .75rem .9rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: .95rem;
}
.auth-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.auth-card button {
    margin-top: 1rem;
    padding: .8rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent), #9b7dff);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform .1s, filter .15s;
}
.auth-card button:hover { filter: brightness(1.1); }
.auth-card button:active { transform: scale(.98); }
.alert {
    background: rgba(255, 92, 122, .12);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: .6rem .8rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: .5rem;
}
.hint { margin-top: 1.4rem; font-size: .8rem; color: var(--muted); text-align: center; }
code { background: var(--card); padding: .1rem .35rem; border-radius: 4px; color: var(--accent-2); }

@media (max-width: 720px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 1rem; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .content { padding: 1.5rem; }
}
/* ---------- Raw file output ---------- */
pre.raw {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .85rem;
    color: var(--accent-2);
}

.muted-sm { color: var(--muted); font-size: .85rem; }

/* ---------- Quick links ---------- */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-top: .8rem; }
.quick-link {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, border-color .15s;
}
.quick-link:hover { transform: translateY(-3px); border-color: var(--accent); }
.ql-icon { font-size: 1.6rem; }
.ql-title { font-weight: 700; }

/* ---------- Form controls ---------- */
.content label { display: block; font-size: .85rem; color: var(--muted); margin: .8rem 0 .35rem; }
.content input[type=text],
.content input[type=number],
.content input[type=date],
.content select,
.content textarea {
    width: 100%;
    padding: .6rem .8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: .92rem;
}
.content textarea { resize: vertical; }
.content input:focus, .content select:focus, .content textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.content input:disabled, .content select:disabled { opacity: .55; }
.content input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; align-items: end; }
.form-row label { margin-top: 0; }
.status-cell { display: flex; justify-content: flex-end; padding-bottom: .4rem; }

.radio-group { display: flex; gap: 1.2rem; }
.radio-group label { display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--text); cursor: pointer; }
.radio-group input { accent-color: var(--accent); }

.two-col { display: grid; grid-template-columns: minmax(280px, 1fr) 1.3fr; gap: 1.2rem; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1.2rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent), #9b7dff);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1.2rem; }

.link-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .85rem; }
.link-btn:hover { text-decoration: underline; }

.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table th, .table td { padding: .6rem .5rem; border-bottom: 1px solid var(--border); }
.table tfoot td { border-bottom: none; padding-top: .9rem; }
.table input[type=number] { max-width: 90px; }
#ts-total.over { color: var(--danger); }
.new-row { animation: highlight 1.6s ease-out; }
@keyframes highlight { from { background: rgba(124, 92, 255, .25); } to { background: transparent; } }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.draft   { background: rgba(139, 144, 163, .18); color: var(--muted); }
.badge.pending { background: rgba(255, 196, 61, .15); color: #ffc43d; }
.badge.done    { background: rgba(61, 214, 198, .15); color: var(--accent-2); }
.badge.low     { background: rgba(61, 214, 198, .12); color: var(--accent-2); }
.badge.medium  { background: rgba(255, 196, 61, .12); color: #ffc43d; }
.badge.high    { background: rgba(255, 92, 122, .15); color: var(--danger); }

/* ---------- Rooms ---------- */
.room { display: flex; flex-direction: column; gap: .3rem; transition: opacity .2s; }
.room .btn { margin-top: auto; align-self: flex-start; }
.room.unavailable { opacity: .5; }
.booking-list { list-style: none; padding: 0; }
.booking-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.booking-list li:last-child { border-bottom: none; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: .6rem; z-index: 100; }
.toast {
    min-width: 240px;
    padding: .8rem 1.1rem;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    font-size: .9rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--danger); }
.toast.info  { border-left-color: var(--accent); }
