/* =====================================================
   TYM Pro - Design System
   Purpose-built for tattoo studio management
   ===================================================== */

/* ---- CSS Variables (Light Theme) ---- */
:root {
    /* Primary palette - TYM Teal */
    --primary: #33c8c8;
    --primary-dark: #2aa3a3;
    --primary-light: #67d6d6;
    --primary-50: #edfafa;
    --primary-100: #d5f5f5;
    --primary-900: #134e4e;

    /* Secondary - Dark */
    --secondary: #1a1a2e;
    --secondary-dark: #0d0d1a;
    --secondary-light: #2d2d4a;

    /* Accent - Amber */
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-light: #fbbf24;

    /* Status */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Gradients */
    --gradient-brand: linear-gradient(135deg, #33c8c8, #2aa3a3, #1a8a8a);
    --gradient-sidebar: linear-gradient(180deg, #0d1117 0%, #161b22 50%, #1c2333 100%);
    --gradient-card: linear-gradient(135deg, #33c8c8 0%, #2aa3a3 100%);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;

    /* Theme colors (swapped in dark mode) */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-sidebar: var(--gradient-sidebar);
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --gray-50: #1e293b;
    --gray-100: #334155;
    --gray-200: #475569;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

code, .font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- App Layout ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow: hidden;
}

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-slow);
}

.app-sidebar.collapsed ~ .app-main {
    margin-left: var(--sidebar-collapsed);
}

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* ---- Sidebar Styles ---- */
.sidebar-logo {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo-icon svg {
    width: 40px;
    height: 40px;
    display: block;
}

.sidebar-logo-text {
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
}

.sidebar-logo-mini { display: none; }
.collapsed .sidebar-logo-full { display: none; }
.collapsed .sidebar-logo-mini { display: block; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.collapsed .sidebar-section-title {
    display: none;
}

/* Sidebar collapsed link centering */
.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.625rem;
}
/* Sidebar tooltip (JS-rendered, appended to body) */
.sidebar-tooltip {
    position: fixed;
    background: var(--gray-900);
    color: #fff;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.15s;
}
.sidebar-tooltip.visible { opacity: 1; }
.sidebar-tooltip::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right-color: var(--gray-900);
}
/* Tooltip for user footer */
.collapsed .sidebar-user {
    justify-content: center;
}
.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    margin: 1px 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.sidebar-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: inset 3px 0 0 var(--secondary);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--secondary);
    border-radius: 0 2px 2px 0;
}

.sidebar-link-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-link.active .sidebar-link-icon {
    opacity: 1;
}

.sidebar-link-text {
    transition: var(--transition);
}

.collapsed .sidebar-link-text {
    display: none;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--secondary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.collapsed .sidebar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 0.0625rem 0.3125rem;
    font-size: 0.625rem;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.sidebar-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.collapsed .sidebar-user-info {
    display: none;
}

/* ---- Header Styles ---- */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.header-toggle:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.header-breadcrumb a {
    color: var(--text-secondary);
}

.header-breadcrumb a:hover {
    color: var(--primary);
}

.header-breadcrumb-separator {
    color: var(--text-muted);
}

/* Header action buttons */
.header-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.header-btn-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

/* Studio selector */
.studio-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
}

.studio-selector:hover {
    border-color: var(--primary);
}

.studio-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--success);
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--gray-100);
    color: var(--warning);
}

/* User dropdown */
.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.header-user:hover {
    background: var(--gray-100);
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    margin-top: 0.75rem;
}

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
}

.stat-card-trend.up {
    color: var(--success);
    background: var(--success-light);
}

.stat-card-trend.down {
    color: var(--danger);
    background: var(--danger-light);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-card);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(51, 200, 200, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 200, 200, 0.15);
}

.form-input.error {
    border-color: var(--danger);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

/* ---- Badges / Pills ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary { background: var(--primary-100); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: #15803d; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #b91c1c; }
.badge-info { background: var(--info-light); color: #1d4ed8; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ---- Client Tags ---- */
.client-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.175rem 0.5rem;
    font-size: 0.675rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
    line-height: 1.5;
    border: 1px solid transparent;
}
.client-tag i { width: 10px; height: 10px; }
.client-tag-primary { background: #e0f7f7; color: #1a8a8a; border-color: #67d6d6; }
.client-tag-success { background: #d1fae5; color: #15803d; border-color: #86efac; }
.client-tag-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.client-tag-danger  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.client-tag-info    { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.client-tag-gray    { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.client-tag[data-source="ai"] { border-style: dashed; opacity: 0.85; }

/* Tag picker buttons (client profile add-tag popover) */
.client-tag-picker {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.3rem 0.65rem; font-size: 0.725rem; font-weight: 600;
    border-radius: var(--radius-full); border: 1.5px solid transparent;
    cursor: pointer; transition: var(--transition); white-space: nowrap;
    line-height: 1.4; font-family: inherit; -webkit-appearance: none;
    appearance: none; outline: none;
}
.client-tag-picker.client-tag-primary { background: #e0f7f7; color: #1a8a8a; border-color: #67d6d6; }
.client-tag-picker.client-tag-success { background: #d1fae5; color: #15803d; border-color: #86efac; }
.client-tag-picker.client-tag-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.client-tag-picker.client-tag-danger  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.client-tag-picker.client-tag-info    { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.client-tag-picker.client-tag-gray    { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.client-tag-picker:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); filter: brightness(0.93); }
.client-tag-picker:disabled { opacity: 0.4; cursor: default; transform: none !important; filter: none !important; box-shadow: none !important; }
.client-tag-picker-active { border-width: 2px; }

/* ---- Dropdown ---- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 1050;
    margin-top: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.375rem 0;
}

/* ---- Flash Messages / Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--danger-light); color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light); color: #1d4ed8; border: 1px solid #bfdbfe; }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: inherit;
    opacity: 0.5;
}

.alert-close:hover {
    opacity: 1;
}

/* ---- Skeleton Loading ---- */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    height: 120px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

/* ---- Slide-in Panel ---- */
.slide-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.slide-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-card);
    z-index: 2001;
    box-shadow: var(--shadow-xl);
    transition: var(--transition-slow);
    display: flex;
    flex-direction: column;
}

.slide-panel.active {
    right: 0;
}

.slide-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.slide-panel-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.slide-panel-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ---- Animations ---- */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ---- Utility Classes ---- */
.text-primary { color: var(--primary) !important; }
.text-secondary-color { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-light { background: var(--primary-100) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }
.grid > * { min-width: 0; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-full { border-radius: var(--radius-full); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        z-index: 1100;
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
        overflow-x: hidden;
        max-width: 100vw;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .app-content {
        padding: 1rem;
    }

    .slide-panel {
        width: 100vw;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Force tables to scroll horizontally */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Utility: force 1-col on mobile */
    .mob-1col { grid-template-columns: 1fr !important; }

    /* grid-column span fix when parent collapses to 1 col */
    .grid-cols-3 > div[style*="grid-column:span 2"],
    .grid-cols-3 > div[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

}

/* Mobile sidebar overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

@media (max-width: 768px) {
    .mobile-overlay.active {
        display: block;
    }
}

/* ---- Auth Pages (Login / Register / Forgot Password) ---- */
.auth-page {
    display: flex;
    min-height: 100vh;
}

/* Left branding panel */
.auth-brand {
    flex: 0 0 480px;
    background: linear-gradient(160deg, #0d1117 0%, #111827 40%, #1a2332 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
}

.auth-brand-logo {
    height: 40px;
    margin-bottom: 2.5rem;
}

.auth-brand-headline {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin: 0 0 1rem;
}

.auth-brand-tagline {
    font-size: 1.0625rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
    margin: 0 0 2.5rem;
    max-width: 360px;
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.auth-brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.9375rem;
}

.auth-brand-feature svg {
    color: #33c8c8;
    flex-shrink: 0;
}

.auth-brand-footer {
    position: absolute;
    bottom: 2rem;
    left: 3rem;
    right: 3rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    z-index: 1;
}

.auth-brand-decor {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-brand-decor-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(42,163,163,0.12), transparent 70%);
    top: -120px;
    right: -120px;
}

.auth-brand-decor-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(6,182,212,0.1), transparent 70%);
    bottom: -80px;
    left: -80px;
}

/* Right form panel */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #ffffff;
    min-height: 100vh;
}

.auth-form-container {
    width: 100%;
    max-width: 400px;
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}

.auth-form-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.auth-form-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0 0 2rem;
}

/* Input with icon */
.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.auth-pass-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.auth-pass-toggle:hover {
    color: var(--text-secondary);
}

.auth-forgot-link {
    font-size: 0.8125rem;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

/* Submit button */
.auth-submit-btn {
    width: 100%;
    padding: 0.8125rem;
    font-size: 1rem;
    font-weight: 700;
    background: var(--gradient-card);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.auth-submit-btn:hover {
    box-shadow: 0 4px 20px rgba(42,163,163,0.4);
    transform: translateY(-1px);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Secondary button (outline) */
.auth-secondary-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.auth-secondary-btn:hover {
    border-color: var(--primary);
    background: var(--primary-50);
}

/* Auth form shared styles (register, forgot-password) */
.auth-form {
    margin-top: 0;
}

.auth-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

.auth-alt {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-alt a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.auth-alt a:hover {
    text-decoration: underline;
}

.auth-trial-info {
    margin-top: 1.25rem;
}

.trial-features {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trial-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.trial-feature i, .trial-feature svg {
    width: 16px;
    height: 16px;
    color: var(--success);
}

/* Radio cards (register) */
.radio-cards {
    display: flex;
    gap: 0.75rem;
}

.radio-card {
    flex: 1;
    cursor: pointer;
}

.radio-card input { display: none; }

.radio-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
}

.radio-card-body i, .radio-card-body svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
}

.radio-card-body strong {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.radio-card-body small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.radio-card input:checked + .radio-card-body {
    border-color: var(--primary);
    background: var(--primary-50);
}

.radio-card input:checked + .radio-card-body i,
.radio-card input:checked + .radio-card-body svg {
    color: var(--primary-dark);
}

/* Input icon wrapper (register) */
.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrapper .form-control,
.input-icon-wrapper .form-input {
    padding-left: 2.75rem;
}

/* Form row (side-by-side fields) */
.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .form-group { flex: 1; }

/* Mobile: hide branding, show mobile logo */
@media (max-width: 900px) {
    .auth-page {
        flex-direction: column;
    }

    .auth-brand {
        display: none;
    }

    .auth-mobile-logo {
        display: block;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: 1.5rem;
    }

    .auth-form-title {
        text-align: center;
    }

    .auth-form-subtitle {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .radio-cards {
        flex-direction: column;
    }
}

/* ---- Modal Overlay ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Alpine.js Utilities ---- */
[x-cloak] { display: none !important; }

/* Transition classes used by Alpine x-transition */
.transition { transition-property: all; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.duration-100 { transition-duration: 100ms; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.translate-y-0 { transform: translateY(0); }
.-translate-y-1 { transform: translateY(-4px); }
.translate-y-1 { transform: translateY(4px); }

/* =====================================================
   MOBILE APP EXPERIENCE
   Bottom nav, compact header, touch-friendly spacing
   ===================================================== */

/* Bottom Navigation - hidden on desktop */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* ---- Bottom Tab Bar ---- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(80px + env(safe-area-inset-bottom, 0));
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        z-index: 1200;
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 500;
        padding: 0.5rem 0;
        transition: color 0.15s;
        border: none;
        background: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item i,
    .mobile-nav-item svg {
        width: 28px;
        height: 28px;
    }

    .mobile-nav-item.active {
        color: var(--primary);
        font-weight: 700;
    }

    .mobile-nav-item.active i,
    .mobile-nav-item.active svg {
        stroke-width: 2.5;
    }

    .mob-nav-icon-wrap {
        position: relative;
        display: inline-flex;
    }

    .mob-nav-badge {
        position: absolute;
        top: -5px;
        right: -8px;
        background: #ef4444;
        color: #fff;
        font-size: 0.5625rem;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        text-align: center;
        border-radius: 8px;
        padding: 0 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    /* ---- Body padding for bottom nav ---- */
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
    }

    /* ---- Native app: extra space for Android nav bar ---- */
    .native-app body {
        padding-bottom: 140px;
    }
    .native-app .mobile-bottom-nav {
        bottom: 0;
        height: auto;
        padding-bottom: 18px;
    }

    /* ---- App content scrollable ---- */
    .app-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Notification prefs: responsive table ---- */
    .notif-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .notif-table-wrap .table th,
    .notif-table-wrap .table td {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 0.5rem 0.625rem;
    }
    .notif-table-wrap .table th:first-child,
    .notif-table-wrap .table td:first-child {
        padding-left: 0.75rem;
    }

    /* ---- Compact Header ---- */
    .app-header {
        height: calc(52px + env(safe-area-inset-top, 0));
        padding: env(safe-area-inset-top, 0) 0.75rem 0;
    }

    .header-title {
        font-size: 1rem !important;
    }

    .header-breadcrumb {
        display: none;
    }

    .header-btn,
    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .header-btn i,
    .theme-toggle i {
        width: 18px !important;
        height: 18px !important;
    }

    /* Hide header sidebar toggles — bottom nav has "More" */
    #mobileMenuToggle,
    .header-toggle {
        display: none !important;
    }

    /* ---- Content spacing ---- */
    .app-content {
        padding: 0.75rem;
        padding-bottom: 1rem;
    }

    /* ---- Page headers ---- */
    .app-content h2 {
        font-size: 1.25rem !important;
    }

    /* ---- Cards ---- */
    .card {
        border-radius: var(--radius-sm);
    }

    .card-body {
        padding: 0.875rem;
    }

    .card-header {
        padding: 0.75rem 0.875rem;
    }

    /* ---- Stat cards compact ---- */
    .stat-card {
        padding: 0.75rem;
    }

    .stat-card-value {
        font-size: 1.25rem;
    }

    .stat-card-label {
        font-size: 0.65rem;
    }

    /* ---- Tables scroll horizontally ---- */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        white-space: nowrap;
        padding: 0.5rem 0.625rem;
        font-size: 0.8rem;
    }

    /* ---- Buttons touch-friendly ---- */
    .btn {
        min-height: 38px;
        -webkit-tap-highlight-color: transparent;
    }

    .btn-sm {
        min-height: 32px;
        font-size: 0.75rem;
    }

    /* ---- Forms touch-friendly ---- */
    .form-input,
    .form-select {
        min-height: 40px;
        font-size: 16px !important; /* prevent iOS zoom */
    }

    /* ---- Modals full-screen on mobile ---- */
    .modal-content,
    #addClientModal > div:last-child {
        max-width: 100% !important;
        width: 100% !important;
        min-height: 100vh;
        border-radius: 0 !important;
        margin: 0;
    }

    /* ---- Flex helpers ---- */
    .flex.gap-3 {
        gap: 0.5rem;
    }

    /* ---- Filter forms stack ---- */
    .card-body form.flex {
        flex-wrap: wrap;
    }

    .card-body form.flex .flex.items-center.gap-2 {
        width: 100%;
    }

    /* ---- Slide panel full screen ---- */
    .slide-panel {
        width: 100vw !important;
    }

    .booking-panel-body {
        padding: 0.75rem 1rem !important;
    }

    /* ---- Client cards grid ---- */
    .grid.grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* ---- Pagination compact ---- */
    .flex.items-center.justify-between,
    .flex.items-center.justify-center {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* ---- Show mobile-only elements ---- */
    .show-mobile {
        display: flex !important;
    }
}

/* Small phone (< 380px) */
@media (max-width: 380px) {
    .mobile-bottom-nav {
        height: 54px;
    }

    .mobile-nav-item {
        font-size: 0.5625rem;
    }

    .mobile-nav-item i,
    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
    }

    .app-content {
        padding: 0.5rem;
    }

    .stat-card-value {
        font-size: 1.1rem;
    }
}

/* Dashboard wide card (spans 2 cols on desktop, 1 on mobile) */
.dashboard-wide-card {
    grid-column: span 2;
}

/* Desktop: hide mobile-only */
.show-mobile {
    display: none !important;
}

/* =====================================================
   TABLET / MOBILE OVERRIDES (≤ 768px)
   Must come before the 480px block so phone rules win.
   ===================================================== */
@media (max-width: 768px) {
    /* Settings layout handled in page-level CSS (list → detail pattern) */

    /* --- Profile: inline grid overrides --- */
    .profile-grid-2col {
        grid-template-columns: 1fr !important;
    }

    .profile-name-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- Filter form inputs: override inline min-widths --- */
    .card-body .flex.flex-wrap > div[style*="min-width"],
    .card-body .flex.flex-wrap > select[style*="min-width"] {
        min-width: unset !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* --- Dashboard wide card: span 1 in collapsed 1-col grids --- */
    .dashboard-wide-card {
        grid-column: span 1 !important;
    }
}

/* =====================================================
   PHONE BREAKPOINT (≤ 480px)
   Comes after 768px so these rules override on phones.
   ===================================================== */
@media (max-width: 480px) {
    /* Tighter content padding */
    .app-content {
        padding: 0.625rem;
    }

    /* Filter forms: full-width children */
    .flex.flex-wrap.gap-3 > div,
    .flex.flex-wrap.gap-3 > select {
        min-width: unset !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* Tables: smaller text + padding */
    .table th, .table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 36px;
    }

    /* Guide TOC: 2 columns */
    .guide-toc-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
