:root {
    --primary: #C2703E;
    --primary-light: #D4885A;
    --primary-dark: #A85E32;
    --accent: #B8964A;
    --accent-light: #D4B06A;
    --bg: #F5F0EB;
    --bg-card: #FFFFFF;
    --bg-secondary: #EDE8E3;
    --text: #1A1A1A;
    --text-secondary: #4A4440;
    --text-muted: #706860;
    --border: #D5CFC8;
    --available: #E0EDDA;
    --available-text: #2E5A1E;
    --blocked: #E8E2DC;
    --blocked-text: #5A524A;
    --own-booking: #C2703E;
    --danger: #A0302A;
    --danger-light: #F0DCD9;
    --success: #3A6A2A;
    --success-light: #E0EDDA;
    --warning: #8A6A20;
    --warning-light: #F5EDDB;
    --shadow: 0 1px 3px rgba(45,35,25,0.08);
    --shadow-md: 0 4px 12px rgba(45,35,25,0.1);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
}

[data-theme="dark"] {
    --primary: #D4885A;
    --primary-light: #E0A070;
    --primary-dark: #C2703E;
    --accent: #D4B06A;
    --bg: #1A1816;
    --bg-card: #242220;
    --bg-secondary: #2E2C2A;
    --text: #F0EBE6;
    --text-secondary: #C0BAB4;
    --text-muted: #908A84;
    --border: #3E3C38;
    --available: #2A3328;
    --available-text: #A0D090;
    --blocked: #332E2A;
    --blocked-text: #B0AAA4;
    --danger: #E06A64;
    --danger-light: #3A2220;
    --success: #A0D090;
    --success-light: #2A3328;
    --warning: #E0C070;
    --warning-light: #3A3220;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}
.container { max-width: 1400px; margin: 0 auto; background: var(--bg); min-height: 100vh; }

/* Header */
.header { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 14px 20px; }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.header h1 { font-size: 1.2em; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.header-role { font-size: 11px; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn { padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s; background: var(--bg-card); color: var(--text); }
.btn:hover { border-color: var(--text-muted); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-icon { padding: 6px 8px; font-size: 14px; line-height: 1; background: transparent; border: none; cursor: pointer; color: var(--text-muted); border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--bg-secondary); color: var(--text); }

/* Auth */
.auth-container { max-width: 380px; margin: 80px auto; padding: 32px; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.auth-container h2 { color: var(--text); margin-bottom: 8px; font-size: 1.4em; font-weight: 700; }
.auth-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.auth-tab { flex: 1; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--bg-secondary); color: var(--text-muted); border: none; transition: all 0.15s; }
.auth-tab.active { background: var(--primary); color: #fff; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-weight: 500; font-size: 13px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background: var(--bg-card); color: var(--text); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(194,112,62,0.15); }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.form-actions button { flex: 1; }

/* Alerts */
.alert { padding: 10px 16px; border-radius: var(--radius-sm); margin: 10px; font-size: 13px; position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9999; max-width: 400px; width: calc(100% - 20px); text-align: center; font-weight: 500; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); }
.alert-info { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }

/* Calendar nav */
.calendar-nav { background: var(--bg-card); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid var(--border); }
.calendar-nav h2 { color: var(--text); font-size: 1em; font-weight: 600; }
.nav-buttons { display: flex; gap: 4px; }

/* Calendar grid */
.week-container { padding: 8px; background: var(--bg-card); overflow-x: auto; }
.calendar-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(80px, 1fr)); gap: 1px; background: var(--border); min-width: 700px; border-radius: var(--radius); overflow: hidden; }
.day-header { background: var(--bg-secondary); color: var(--text); padding: 10px 5px; text-align: center; font-weight: 600; font-size: 11px; position: sticky; top: 0; z-index: 10; }
.day-header.weekend { color: var(--primary); }
.time-header { background: var(--bg); color: var(--text-muted); padding: 12px 5px; text-align: center; font-size: 11px; font-weight: 600; position: sticky; left: 0; z-index: 9; }
.time-cell { background: var(--bg-card); position: relative; min-height: 48px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; overflow: hidden; }
.time-cell:hover:not(.past):not(.na) { box-shadow: inset 0 0 0 2px var(--primary); z-index: 2; }
.time-cell.available { background: var(--available); color: var(--available-text); }
.time-cell.booked { cursor: pointer; }
.time-cell.own-booking { background: var(--primary); color: #fff; }
.time-cell.blocked { background: var(--blocked); color: var(--blocked-text); }
.time-cell.past { background: var(--bg); opacity: 0.4; cursor: not-allowed; }
.time-cell.na { background: var(--bg); opacity: 0.2; cursor: not-allowed; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.modal-content { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.modal-content h3 { color: var(--text); margin-bottom: 16px; font-size: 1.1em; font-weight: 700; }

/* Legend */
.legend { display: flex; gap: 16px; padding: 12px 16px; background: var(--bg-card); flex-wrap: wrap; font-size: 11px; justify-content: center; border-top: 1px solid var(--border); color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }

/* Tabs */
.admin-tabs { background: var(--bg-card); padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-buttons { display: flex; gap: 0; min-width: max-content; }
.tab-btn { padding: 12px 16px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--text-muted); transition: all 0.15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Content panels */
.admin-content { padding: 16px; }
.client-list { display: grid; gap: 8px; }
.client-card { background: var(--bg-card); padding: 12px 16px; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--border); border-left: 3px solid; }
.client-card.inactive { opacity: 0.5; }
.client-card-info h4 { font-size: 14px; margin-bottom: 2px; font-weight: 600; }
.client-card-info p { font-size: 11px; color: var(--text-muted); margin: 1px 0; }
.client-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Color picker */
.color-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.color-option { width: 36px; height: 36px; border-radius: var(--radius-sm); cursor: pointer; border: 2px solid transparent; transition: all 0.15s; }
.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text); }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-section { background: var(--bg-card); padding: 20px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--border); }
.settings-section h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

/* Stats */
.stat-card { padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); }
.stat-value { font-size: 2.5em; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Client stats bar */
.client-stats { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.client-stat-card { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); }
.client-stat-card .value { font-size: 2em; font-weight: 700; color: var(--primary); }
.client-stat-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }

/* Pending users badge */
.badge { display: inline-flex; align-items: center; justify-content: center; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; margin-left: 4px; }

/* History list */
.history-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.history-item:last-child { border-bottom: none; }
.history-date { font-weight: 600; font-size: 14px; }
.history-time { color: var(--text-secondary); font-size: 13px; }
.history-notes { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* Footer */
.footer { padding: 24px; text-align: center; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); }

/* Theme toggle */
.theme-toggle { width: 36px; height: 20px; border-radius: 10px; background: var(--border); border: none; cursor: pointer; position: relative; transition: background 0.2s; }
.theme-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg-card); transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
[data-theme="dark"] .theme-toggle { background: var(--primary); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(16px); }

.hidden { display: none !important; }
.time-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (min-width: 769px) {
    .header h1 { font-size: 1.4em; }
    .calendar-grid { grid-template-columns: 72px repeat(7, 1fr); min-width: 900px; }
    .time-cell { min-height: 56px; }
}
