/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a2233;
    background: #f4f6fb;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --border: #e5e7ed;
    --border-light: #f1f3f7;

    --text: #1a2233;
    --text-muted: #6b7588;
    --text-soft: #9ba3b4;

    --sidebar-bg: #1e2533;
    --sidebar-bg-darker: #181e2a;
    --sidebar-text: #c5cbd9;
    --sidebar-text-hover: #ffffff;
    --sidebar-active: #4f46e5;
    --sidebar-group-label: #6b7588;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 2px 6px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, .08);

    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 6px;

    --sidebar-w: 248px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: none; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 12px; font-weight: 600; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 10px; }

pre {
    background: #f7f8fc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 12px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

details summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 13px;
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 60;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand-mark {
    display: inline-flex;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    align-items: center; justify-content: center;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px 16px;
    scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; }

.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-label {
    padding: 6px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--sidebar-group-label);
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin: 1px 4px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,.05);
    color: var(--sidebar-text-hover);
}
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
}
.sidebar-nav a .nav-ico {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .9;
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 12px;
    color: var(--sidebar-text);
}
.sidebar-footer .user-line {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px;
}
.sidebar-footer .user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.sidebar-footer .user-name { color: #fff; font-weight: 600; line-height: 1.2; }
.sidebar-footer .user-role { color: var(--sidebar-text); font-size: 11px; }
.sidebar-footer a.logout-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: #ff8a8a;
    font-size: 12px;
}
.sidebar-footer a.logout-link:hover { color: #ffb3b3; }

/* main area */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex; flex-direction: column;
}

.topbar-app {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 14px;
    position: sticky; top: 0; z-index: 40;
}
.sidebar-toggle {
    display: none;
    width: 38px; height: 38px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    align-items: center; justify-content: center;
    padding: 0;
    color: var(--text);
}
.topbar-title { font-weight: 600; font-size: 15px; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: var(--bg);
}
.topbar-user .user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 12px;
}
.topbar-user .user-name { font-size: 13px; font-weight: 600; }
.topbar-user .user-role { font-size: 11px; color: var(--text-muted); }

.content {
    padding: 22px 24px 40px;
    flex: 1;
    max-width: 100%;
}

/* sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 55;
}
body.sidebar-open .sidebar-overlay { display: block; }

/* ===== PAGE TITLE ===== */
.page-title {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

/* ===== CARD ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    padding: 20px;
    margin-bottom: 18px;
}
.card h3 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card h4 {
    margin: 16px 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

/* statistic card */
.stat {
    font-size: 26px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* ===== GRID ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ===== FORMS ===== */
label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
input[type="checkbox"], input[type="radio"] {
    width: auto;
    accent-color: var(--primary);
}
textarea { min-height: 90px; resize: vertical; }

input[disabled], select[disabled], textarea[disabled] {
    background: #f7f8fc;
    color: var(--text-muted);
    cursor: not-allowed;
}

form .row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
form .row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

/* ===== BUTTONS ===== */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}
button:hover, .btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    text-decoration: none;
}
button:active, .btn:active { transform: translateY(1px); }

.btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
}
.btn-secondary:hover { background: #4b5563; border-color: #4b5563; }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-success {
    background: var(--success);
    border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-light {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
.btn-light:hover {
    background: var(--bg);
    color: var(--text);
    border-color: #d4d8e0;
}

button[type=submit] { /* default submit */ }

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.inline-form { display: inline; }

/* ===== TABLE ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 13.5px;
}
th, td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    vertical-align: top;
}
th {
    background: #fafbfd;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: .2px;
}
.badge-booked { background: #dbeafe; color: #1d4ed8; }
.badge-confirmed { background: #cffafe; color: #0e7490; }
.badge-completed { background: #d1fae5; color: #047857; }
.badge-canceled { background: #fee2e2; color: #b91c1c; }
.badge-no_show { background: #fef3c7; color: #b45309; }
.badge-canceled_appointment { background: #fee2e2; color: #b91c1c; }
.badge-paid { background: #d1fae5; color: #047857; }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-active { background: #d1fae5; color: #047857; }
.badge-inactive { background: #e5e7eb; color: #4b5563; }

/* ===== ALERT ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.flash-toast-container {
    position: fixed;
    top: 80px; right: 24px;
    z-index: 200;
    display: flex; flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.flash-toast {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    font-size: 13.5px;
    border-left: 4px solid var(--primary);
    animation: toastIn .25s ease;
}
.flash-toast.success { border-left-color: var(--success); color: #065f46; }
.flash-toast.error { border-left-color: var(--danger); color: #991b1b; }
@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== CHECKBOX LIST ===== */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.checkbox-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fafbfd;
    border: 1px solid var(--border-light);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 13.5px;
}
.checkbox-item:hover {
    background: var(--primary-light);
    border-color: #c7d2fe;
}
.checkbox-item input {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}
.checkbox-item .small { color: var(--text-muted); }

/* ===== SERVICE EDITOR ===== */
.service-editor { display: grid; gap: 10px; }
.service-editor-row {
    display: grid;
    grid-template-columns: 30px 1fr 150px 150px;
    gap: 12px;
    align-items: start;
    background: #fafbfd;
    border: 1px solid var(--border-light);
    padding: 12px;
    border-radius: var(--radius-sm);
}
.service-editor-row input[type="checkbox"] {
    width: auto;
    margin-top: 10px;
}
.service-editor-row label { font-size: 12px; color: var(--text-muted); }

/* ===== AUTH ===== */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,.15);
    padding: 32px;
}
.auth-card h1 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 24px;
}
.auth-card h2 {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 24px;
}

/* ===== PUBLIC LAYOUT (online booking) ===== */
.public-topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}
.public-topbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.public-topbar .brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    display: flex; align-items: center; gap: 10px;
}
.public-topbar .brand:hover { text-decoration: none; }
.public-topbar nav { display: flex; gap: 16px; }
.public-topbar nav a {
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.public-topbar nav a:hover, .public-topbar nav a.active {
    background: var(--primary-light);
    color: var(--primary);
}
.public-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ===== HELP / SMALL ===== */
.muted { color: var(--text-muted); font-size: 13px; }
.small { font-size: 12px; color: var(--text-muted); }
.help-text { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.right { text-align: right; }

/* ===== CALENDAR ===== */
.calendar-legend {
    display: flex; gap: 16px; flex-wrap: wrap;
    padding: 4px 0;
}
.calendar-legend-item {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted);
}
.calendar-legend-box {
    width: 14px; height: 14px; border-radius: 4px;
    border: 1px solid var(--border);
}
.calendar-legend-work { background: #fff; }
.calendar-legend-busy { background: #eef2ff; border-color: #c7d2fe; }
.calendar-legend-off { background: #f4f6fb; }
.calendar-legend-blocked { background: #fef3c7; border-color: #fde68a; }

.calendar-table-wrap { overflow-x: auto; }
.calendar-table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.calendar-table th,
.calendar-table td {
    border: 1px solid var(--border-light);
    padding: 8px;
    vertical-align: top;
}
.calendar-table th {
    background: #fafbfd;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    color: var(--text);
}
.calendar-table .time-col {
    width: 80px; min-width: 80px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    background: #fafbfd;
    position: sticky; left: 0; z-index: 2;
    color: var(--text-muted);
    font-size: 12px;
}
.calendar-table thead .time-col { z-index: 3; }
.calendar-master-header { min-width: 220px; }
.calendar-master-name {
    font-weight: 600; margin-bottom: 4px;
    color: var(--text); font-size: 13.5px;
}
.calendar-cell {
    min-width: 220px;
    height: 54px;
    background: #fff;
    position: relative;
    padding: 4px;
}
.calendar-cell-off { background: #f4f6fb; }
.calendar-cell-blocked { background: #fffbeb; }
.calendar-cell-occupied { background: #eef2ff; }
.calendar-slot-empty {
    display: flex; align-items: center; justify-content: center;
    min-height: 38px;
}
.calendar-add-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    transition: background .15s;
}
.calendar-add-link:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}
.calendar-muted-center {
    display: flex; align-items: center; justify-content: center;
    min-height: 38px;
    color: var(--text-soft);
    font-size: 12px;
}
.calendar-blocked-label,
.calendar-continued-label {
    display: flex; align-items: center; justify-content: center;
    min-height: 38px;
    font-size: 11px; font-weight: 600;
}
.calendar-blocked-label { color: #b45309; }
.calendar-continued-label { color: var(--primary); }
.calendar-card {
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-left: 3px solid var(--primary);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.calendar-card:last-child { margin-bottom: 0; }
.calendar-card.status-booked { background: #eff6ff; border-left-color: #3b82f6; }
.calendar-card.status-confirmed { background: #ecfeff; border-left-color: #06b6d4; }
.calendar-card.status-completed { background: #ecfdf5; border-left-color: #10b981; }
.calendar-card.status-canceled { background: #fef2f2; border-left-color: #ef4444; }
.calendar-card.status-no_show { background: #fffbeb; border-left-color: #f59e0b; }
.calendar-card-head {
    display: flex; justify-content: space-between; gap: 8px;
    margin-bottom: 4px; align-items: center;
}
.calendar-card-time {
    font-weight: 700; font-size: 12px; color: var(--text);
}
.calendar-card-client {
    font-weight: 600; margin-bottom: 2px; font-size: 13px;
    color: var(--text);
}
.calendar-card-services {
    font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.calendar-card-footer {
    display: flex; justify-content: space-between;
    gap: 6px; align-items: center; flex-wrap: wrap;
}
.calendar-card-link { font-size: 11.5px; font-weight: 600; }
.calendar-toolbar-title {
    display: flex; justify-content: space-between;
    gap: 12px; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }

    .grid-2, .grid-3, .grid-4,
    form .row, form .row-3,
    .checkbox-list,
    .service-editor-row {
        grid-template-columns: 1fr;
    }
    .content { padding: 16px; }
    .topbar-app { padding: 0 14px; }
    .calendar-toolbar-title { align-items: flex-start; }
}

@media (max-width: 600px) {
    .topbar-user .user-name,
    .topbar-user .user-role { display: none; }
    .topbar-user { padding: 4px; }
    .page-title { font-size: 19px; }
    .card { padding: 16px; }
    .stat { font-size: 22px; }
}

/* Печать */
@media print {
    .sidebar, .topbar-app, .inline-actions, .sidebar-overlay { display: none !important; }
    .main { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid var(--border); }
}

/* ===== UX/UI ENHANCEMENTS v2 ===== */

/* Плавные переходы */
.card { transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: 0 4px 16px rgba(15,23,42,.08); }

/* Sticky table headers */
.table-wrap table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fafbfd;
}

/* Stat cards: subtle gradient and icon support */
.card .stat {
    background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 28px;
    letter-spacing: -1px;
}

/* Better forms */
input:hover, select:hover, textarea:hover { border-color: #c7d2fe; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}

/* Buttons: subtle scale on hover */
button, .btn { transition: all .2s ease; }
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.25); }
button:active, .btn:active { transform: translateY(0); }

/* Badges: lighter shadow */
.badge { box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* Table row hover: smoother */
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f5f7fb; }

/* Sidebar nav: better active indicator */
.sidebar-nav a {
    position: relative;
    border-radius: 8px;
}
.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: -4px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: #fff;
    border-radius: 2px;
}

/* Alert pulse animation on appearance */
.alert {
    animation: alertSlide .35s ease;
    border-radius: 10px;
}
@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Empty state styling */
tbody td[colspan] {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 12px;
    font-style: italic;
}

/* Loading dots for buttons (optional class) */
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Improved cards on focus/hover for clickable items */
.calendar-card { transition: transform .15s, box-shadow .15s; }
.calendar-card:hover { transform: translateX(2px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* Modern scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c7d2fe transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Detail summary icons */
details summary { padding: 6px 0; }
details[open] summary { margin-bottom: 8px; }

/* Stronger focus states for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Compact mobile improvements */
@media (max-width: 600px) {
    .card { padding: 14px; border-radius: 12px; }
    .page-title { font-size: 20px; margin-bottom: 12px; }
    input, select, textarea, button, .btn { font-size: 15px; }
    th, td { padding: 8px 10px; font-size: 13px; }
}

/* Print: clean reports */
@media print {
    canvas { max-width: 100% !important; height: auto !important; }
    .topbar-app, .sidebar, form, .inline-actions { display: none !important; }
}

/* === UX v2.0 — дополнения === */
.btn-success { font-weight: 600; }
.btn-success.btn-big { padding: 14px 28px; font-size: 16px; }

.form-hint {
    background: #eef2ff;
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text);
}

.quick-action-tile {
    display: block;
    padding: 20px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
    transition: all .2s;
    text-decoration: none;
    color: var(--text);
}
.quick-action-tile:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79,70,229,.15);
    text-decoration: none;
}
.quick-action-tile .icon { font-size: 32px; margin-bottom: 8px; }
.quick-action-tile .title { font-weight: 600; }

@media (max-width: 768px) {
    .card { padding: 14px; margin-bottom: 12px; }
    .stat { font-size: 22px; }
    .btn, button { padding: 10px 14px; font-size: 14px; }
}

.badge { padding: 4px 10px; }

/* Быстрый платёж — визуальные кнопки способов */
.qp-method-label:hover {
    border-color: var(--primary) !important;
    background: var(--primary-light) !important;
}
.qp-method-label input:checked + div {
    color: #fff;
}

/* Pop-up календаря */
#calBookingModal label {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

/* Details — скрытие расширенных операций */
details summary {
    list-style: none;
    user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: '▶ ';
    display: inline-block;
    transition: transform .2s;
    margin-right: 4px;
}
details[open] summary::before {
    transform: rotate(90deg);
}

/* Подсветка карточек со срочными уведомлениями */
.card.card-urgent {
    border-left: 4px solid var(--danger);
    background: #fef2f2;
}
.card.card-success-highlight {
    border-left: 4px solid var(--success);
}

/* ===== UX/UI 2026 ENHANCEMENTS ===== */

/* Glass-morphism cards */
.card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.92);
}

/* Smooth page transitions */
.content {
    animation: contentFadeIn 0.3s ease;
}
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modern input styling */
input, select, textarea {
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12), 0 2px 8px rgba(79,70,229,0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Gradient stat cards */
.card .stat {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1.2px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Button micro-interactions */
button, .btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
button::after, .btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    pointer-events: none;
}
button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.3);
}
button:active, .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79,70,229,0.2);
}

/* Sidebar 2026 */
.sidebar {
    background: linear-gradient(180deg, #1a1f2e 0%, #131825 100%);
}
.sidebar-nav a {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    transition: all 0.15s ease;
}
.sidebar-nav a:hover {
    background: rgba(79,70,229,0.12);
    color: #fff;
    transform: translateX(4px);
}
.sidebar-nav a.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.sidebar-nav a.active::before { display: none; }

/* Topbar glass effect */
.topbar-app {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(229,231,237,0.6);
}

/* Table 2026 */
.table-wrap {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
table {
    border-collapse: separate;
    border-spacing: 0;
}
th {
    background: linear-gradient(135deg, #f8f9fc 0%, #f3f4f8 100%);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
}
tbody tr {
    transition: all 0.15s ease;
}
tbody tr:hover {
    background: linear-gradient(90deg, rgba(79,70,229,0.03), rgba(124,58,237,0.02));
}

/* Badge 2026 */
.badge {
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Calendar cards enhanced */
.calendar-card {
    border-radius: 10px;
    border-left-width: 4px;
    transition: all 0.2s ease;
}
.calendar-card:hover {
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Alert 2026 */
.alert {
    border-radius: 12px;
    padding: 14px 18px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Auth page 2026 */
.auth-wrap {
    background: linear-gradient(135deg, #1a1f2e 0%, #4f46e5 50%, #7c3aed 100%);
}
.auth-card {
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    padding: 36px;
}

/* Page title 2026 */
.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #1a2233 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Loyalty level badges */
.loyalty-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

/* Quick action cards */
.quick-action-tile {
    border-radius: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.quick-action-tile:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(79,70,229,0.2);
}

/* Fiscal receipt status */
.fiscal-done { color: #10b981; }
.fiscal-wait { color: #f59e0b; }
.fiscal-fail { color: #ef4444; }
.fiscal-pending { color: #6b7588; }

/* Dark mode skeleton (opt-in via data-theme="dark") */
[data-theme="dark"] {
    --bg: #0f1117;
    --card-bg: #1a1d27;
    --border: #2a2d3a;
    --border-light: #22253a;
    --text: #e4e6ed;
    --text-muted: #8b91a3;
    --text-soft: #5a6073;
}
[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0d0f16 0%, #0a0c12 100%);
}
[data-theme="dark"] .topbar-app {
    background: rgba(26,29,39,0.9);
}
[data-theme="dark"] .card {
    background: rgba(26,29,39,0.9);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #1a1d27;
    color: #e4e6ed;
    border-color: #2a2d3a;
}
[data-theme="dark"] th {
    background: #1a1d27;
}
[data-theme="dark"] table {
    background: #1a1d27;
}

/* Better mobile 2026 */
@media (max-width: 768px) {
    .page-title { font-size: 20px; }
    .stat { font-size: 24px !important; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .card { border-radius: 14px; padding: 16px; }
    button, .btn { border-radius: 10px; padding: 12px 16px; }
    .sidebar-nav a { font-size: 14px; padding: 12px 16px; }
}

@media (max-width: 480px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .topbar-app { height: 54px; padding: 0 12px; }
    .content { padding: 14px 12px 30px; }
}

/* Skeleton loading animation */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Notification dot */
.nav-notification-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ef4444;
    display: inline-block;
    margin-left: 4px;
    animation: dotPulse 2s infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}