/* ============================================================
   RESERVADA v3 — Design System  ·  "Soft Modern"
   Light-first, red-forward (#ff1616) with soft pastel accents.
   Drop-in replacement for app.css — same class names, new soul.
   ============================================================ */

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

/* ============================================================
   TOKENS — LIGHT (default, the hero theme)
   ============================================================ */
:root {
    /* Background layers — warm off-white, subtle rosé tint */
    --bg-deep: #f7f2f1;      /* app canvas */
    --bg-base: #ffffff;      /* sidebar */
    --bg-surface: #fbf6f5;   /* insets, table heads */
    --bg-card: #ffffff;      /* cards */
    --bg-card-hover: #fffaf9;
    --bg-elevated: #ffffff;
    --bg-input: #f6f0ef;
    --bg-glass: rgba(255,255,255,0.75);

    /* Borders — barely-there, we lean on shadow instead */
    --border: rgba(28,16,16,0.07);
    --border-hover: rgba(255,22,22,0.22);
    --border-focus: #ff1616;
    --border-glass: rgba(28,16,16,0.06);

    /* Text — warm ink */
    --text-primary: #201a1c;
    --text-secondary: #6d6570;
    --text-muted: #a79fa6;
    --text-inverse: #ffffff;

    /* Brand — RED leads everything */
    --primary: #ff1616;
    --primary-rgb: 255,22,22;
    --amber-rgb: 209,131,10;
    --primary-dark: #d40f0f;
    --primary-light: #ff5252;
    --primary-soft: #fff0ef;                 /* pastel red fill */
    --primary-soft-2: #ffe4e2;
    --primary-glow: rgba(255,22,22,0.09);
    --primary-glow-strong: rgba(255,22,22,0.16);
    --primary-grad: linear-gradient(135deg, #ff3b3b 0%, #ff1616 55%, #e00e0e 100%);

    /* Soft pastel accents (status/legibility) */
    --emerald: #0f9d6b;  --emerald-soft: #e7f6ef;  --emerald-glow: rgba(15,157,107,0.10);
    --purple:  #7c5cf0;  --purple-soft:  #efeafe;  --purple-glow:  rgba(124,92,240,0.10);
    --blue:    #2f6bd8;  --blue-soft:    #e9f0fd;   --blue-glow:    rgba(47,107,216,0.10);
    --amber:   #d1830a;  --amber-soft:   #fdf2df;   --amber-glow:   rgba(209,131,10,0.10);
    --red:     #ef4444;  --red-soft:     #fdecec;   --red-glow:     rgba(239,68,68,0.10);
    --cyan:    #0e9bb5;  --cyan-soft:    #e3f5f8;   --cyan-glow:    rgba(14,155,181,0.10);
    --rose:    #f43f6e;  --rose-soft:    #fdecf1;   --rose-glow:    rgba(244,63,110,0.10);
    --peach:   #f97316;  --peach-soft:   #fdefe2;

    /* Layout */
    --sidebar-w: 276px;
    --sidebar-collapsed: 76px;

    /* Radius — soft & round like the references */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --radius-2xl: 32px;

    /* Type */
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition: 0.2s var(--ease);
    --transition-slow: 0.4s var(--ease);

    /* Shadows — soft, warm-tinted */
    --shadow-sm: 0 1px 2px rgba(60,20,20,0.05);
    --shadow-md: 0 6px 20px rgba(60,20,20,0.07);
    --shadow-lg: 0 16px 40px rgba(60,20,20,0.10);
    --shadow-xl: 0 24px 60px rgba(60,20,20,0.13);
    --shadow-glow: 0 12px 30px rgba(255,22,22,0.20);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

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

::selection { background: var(--primary-soft-2); color: var(--primary-dark); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(28,16,16,0.12); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(28,16,16,0.2); background-clip: padding-box; }

/* ============================================================
   LAYOUT — floating sidebar + main
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-base);
    display: flex; flex-direction: column;
    position: fixed; top: 14px; left: 14px; bottom: 14px;
    z-index: 100;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform var(--transition-slow);
    overflow: hidden;
}
.sidebar::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 180px;
    background: linear-gradient(180deg, rgba(255,22,22,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.sidebar-logo, .sidebar-header {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 22px 22px 14px; position: relative;
}
.sidebar-logo-img, .sidebar-logo img { height: 34px; width: auto; }

.sidebar-nav { flex: 1; padding: 10px 14px; overflow-y: auto; }

.nav-section { margin-bottom: 18px; }
.nav-section-title {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px;
    color: var(--text-muted); padding: 0 14px; margin: 10px 0 8px;
    font-weight: 700;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-weight: 600; font-size: 13.5px;
    transition: all var(--transition); cursor: pointer;
    text-decoration: none; margin-bottom: 3px;
    position: relative;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; opacity: 0.75; transition: transform var(--transition); }
.nav-item:hover { color: var(--primary); background: var(--primary-soft); }
.nav-item:hover i { opacity: 1; transform: scale(1.08); }

.nav-item.active {
    color: #fff;
    background: var(--primary-grad);
    box-shadow: var(--shadow-glow);
}
.nav-item.active i { opacity: 1; }

.nav-badge {
    margin-left: auto; background: var(--primary); color: #fff;
    font-size: 10px; font-weight: 800; padding: 2px 7px;
    border-radius: 10px; min-width: 20px; text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }
.nav-badge-primary {
    margin-left: auto; background: var(--primary-soft); color: var(--primary);
    font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px;
}

.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }

/* Promo / support card in sidebar (references vibe) */
.sidebar-promo {
    background: var(--primary-grad);
    border-radius: var(--radius-lg);
    padding: 18px; color: #fff; margin-bottom: 12px;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-glow);
}
.sidebar-promo::after {
    content: ''; position: absolute; right: -30px; bottom: -30px;
    width: 120px; height: 120px; border-radius: 50%;
    background: rgba(255,255,255,0.14);
}
.sidebar-promo h4 { font-size: 15px; font-weight: 800; margin-bottom: 4px; position: relative; }
.sidebar-promo p { font-size: 12px; opacity: 0.9; margin-bottom: 12px; position: relative; line-height: 1.4; }
.sidebar-promo .btn { background: #fff; color: var(--primary); font-weight: 700; position: relative; box-shadow: none; }
.sidebar-promo .btn:hover { background: #fff; transform: translateY(-1px); }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.sidebar-user:hover { background: var(--primary-soft); }
.sidebar-user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-grad); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11.5px; color: var(--text-muted); }

.main-content {
    flex: 1;
    margin-left: calc(var(--sidebar-w) + 28px);
    padding: 28px 36px 40px;
    min-height: 100vh;
    position: relative;
}
.main-content > * { position: relative; z-index: 1; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; gap: 20px;
}
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.9px; line-height: 1.15; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 5px; font-weight: 500; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ============================================================
   STAT CARDS — bento, big numbers
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px; margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before { content: none; }

.stat-icon {
    width: 46px; height: 46px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; margin-bottom: 16px;
    background: var(--primary-soft); color: var(--primary);
}
.stat-icon.emerald { background: var(--emerald-soft); color: var(--emerald); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.cyan { background: var(--cyan-soft); color: var(--cyan); }

.stat-label { font-size: 12.5px; color: var(--text-secondary); letter-spacing: 0; font-weight: 600; }
.stat-value { font-size: 34px; font-weight: 800; margin-top: 4px; line-height: 1.05; letter-spacing: -1.4px; color: var(--text-primary); }
.stat-value.emerald { color: var(--emerald); }
.stat-value.purple { color: var(--purple); }
.stat-value.amber { color: var(--amber); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-value.cyan { color: var(--cyan); }

.stat-change { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.stat-change.up { color: var(--emerald); }
.stat-change.down { color: var(--red); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-md);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); }

/* Featured / hero bento card */
.card-feature {
    background: var(--primary-grad);
    color: #fff; border: none;
    box-shadow: var(--shadow-glow);
    position: relative; overflow: hidden;
}
.card-feature::after {
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.12);
}
.card-feature .card-title, .card-feature .card-subtitle { color: #fff; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto; border-radius: var(--radius-lg);
    border: 1px solid var(--border); background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
table.rv-table { width: 100%; border-collapse: collapse; }
table.rv-table thead th {
    text-align: left; padding: 15px 20px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
table.rv-table tbody td {
    padding: 15px 20px; border-bottom: 1px solid var(--border);
    font-size: 14px; color: var(--text-secondary); vertical-align: middle;
}
table.rv-table tbody tr { transition: background var(--transition); }
table.rv-table tbody tr:hover { background: var(--primary-soft); }
table.rv-table tbody tr:last-child td { border-bottom: none; }

.table-cell-name { display: flex; align-items: center; gap: 12px; }
.table-cell-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
    background: var(--primary-soft); color: var(--primary);
}

/* Avatar stack (references) */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack > * { margin-left: -10px; border: 2px solid var(--bg-card); border-radius: 50%; }
.avatar-stack > *:first-child { margin-left: 0; }

/* ============================================================
   BADGES / PILLS — soft pastel
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    background: var(--primary-soft); color: var(--primary);
}
.badge-emerald, .badge-confirmed, .badge-paid { background: var(--emerald-soft); color: var(--emerald); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-amber, .badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-red, .badge-cancelled, .badge-unpaid { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }
.badge-gray { background: rgba(28,16,16,0.05); color: var(--text-muted); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 999px;
    font-size: 13.5px; font-weight: 700; cursor: pointer;
    border: 1px solid transparent; transition: all var(--transition);
    text-decoration: none; line-height: 1.4; font-family: var(--font);
    white-space: nowrap;
    /* Salvaguarda: nunca estirarse a lo alto como hijo de flex/grid (evita botones "globo") */
    align-self: center;
}
.btn-primary {
    background: var(--primary-grad); color: #fff;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 16px 34px rgba(255,22,22,0.28); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--border-hover); color: var(--primary); transform: translateY(-1px); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--primary); background: var(--primary-soft); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #6a4bd8; color: #fff; }
.btn-sm { padding: 7px 15px; font-size: 12.5px; }
.btn-lg { padding: 15px 30px; font-size: 15px; }
.btn-icon { padding: 0; width: 40px; height: 40px; justify-content: center; border-radius: 50%; }
.btn-icon i { margin: 0; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 7px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-required { color: var(--primary); }

.form-input, .form-select, .form-textarea, .form-control {
    width: 100%; padding: 12px 16px;
    background: var(--bg-input); color: var(--text-primary);
    border: 1.5px solid transparent; border-radius: var(--radius-sm);
    font-size: 14px; font-family: var(--font);
    transition: all var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus {
    background: var(--bg-card); border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 110px; }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a79fa6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.form-select option { background: var(--bg-card); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-secondary); }
.form-switch input { display: none; }
.form-switch-track {
    width: 46px; height: 26px; border-radius: 999px;
    background: rgba(28,16,16,0.12); position: relative; transition: all var(--transition);
    flex: 0 0 46px;   /* si la etiqueta es larga, el flex no debe aplastar la pastilla */
}
.form-switch-track::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: all var(--spring); box-shadow: var(--shadow-sm); }
.form-switch input:checked + .form-switch-track { background: var(--primary-grad); }
.form-switch input:checked + .form-switch-track::after { transform: translateX(20px); }

/* ============================================================
   BUSCADOR DE CLIENTES (autocompletar)
   ============================================================ */
.cpicker { position: relative; }
.cpicker-control { position: relative; }
.cpicker-input { padding-right: 42px; }
.cpicker-control > .cpicker-icon {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 13px; pointer-events: none;
}
.cpicker-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border: none; border-radius: 50%;
    background: transparent; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all var(--transition);
}
.cpicker-clear:hover { background: var(--primary-soft); color: var(--primary); }
.cpicker-clear[hidden], .cpicker-menu[hidden] { display: none; }
.cpicker.has-value .cpicker-input { font-weight: 600; }
.cpicker.has-value .cpicker-icon { display: none; }
.cpicker-menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-xl);
    max-height: 260px; overflow-y: auto; overscroll-behavior: contain;
    padding: 6px;
}
.cpicker-item {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 14px; transition: background var(--transition);
}
.cpicker-item:hover, .cpicker-item.active { background: var(--primary-soft); }
.cpicker-item.active .cpicker-name { color: var(--primary); }
.cpicker-name { font-weight: 600; color: var(--text-primary); }
.cpicker-phone { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.cpicker-hint { padding: 12px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
    animation: slideDown 0.3s var(--ease); box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--emerald-soft); color: var(--emerald); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-warning { background: var(--amber-soft); color: var(--amber); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(40,20,20,0.35); backdrop-filter: blur(10px);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal, .modal-content {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 32px;
    max-width: 600px; width: 92%; max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.3s var(--spring); box-shadow: var(--shadow-xl);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; }
.modal-close {
    cursor: pointer; color: var(--text-muted); font-size: 18px;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.modal-close:hover { background: var(--primary-soft); color: var(--primary); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon {
    width: 88px; height: 88px; border-radius: var(--radius-2xl);
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 34px; margin-bottom: 20px;
}
.empty-state-title { font-size: 19px; font-weight: 700; color: var(--text-primary); }
.empty-state-desc { font-size: 14px; color: var(--text-muted); margin-top: 8px; max-width: 400px; margin-inline: auto; }

/* ============================================================
   TABS — segmented pill (references)
   ============================================================ */
.tabs {
    display: flex; gap: 4px; padding: 5px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 999px; margin-bottom: 24px; width: fit-content;
    box-shadow: var(--shadow-sm);
}
.tab {
    padding: 8px 18px; border-radius: 999px;
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: all var(--transition);
    text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-glow); }

/* ============================================================
   SEARCH BAR / TOPBAR
   ============================================================ */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.search-bar { position: relative; max-width: 360px; flex: 1; }
.search-bar i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-bar input {
    width: 100%; padding: 12px 16px 12px 44px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 999px; color: var(--text-primary);
    font-size: 13.5px; font-family: var(--font);
    transition: all var(--transition); outline: none; box-shadow: var(--shadow-sm);
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.search-bar input::placeholder { color: var(--text-muted); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px; border-radius: 999px;
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    text-decoration: none; transition: all var(--transition); border: 1px solid transparent;
}
.pagination a:hover { color: var(--primary); background: var(--primary-soft); }
.pagination .active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-glow); }

/* ============================================================
   CALENDAR — month grid + pastel events
   ============================================================ */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-day-header { padding: 8px; text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; }
.cal-day {
    background: var(--bg-card); min-height: 120px; padding: 10px;
    border-radius: var(--radius); border: 1px solid var(--border);
    transition: all var(--transition); cursor: pointer; position: relative;
}
.cal-day:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cal-day-num { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.cal-day.today { border-color: var(--primary); }
.cal-day.today .cal-day-num { color: #fff; background: var(--primary); width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-day.other-month { opacity: 0.45; }
.cal-event {
    padding: 5px 9px; border-radius: 9px; font-size: 11.5px;
    margin-bottom: 4px; cursor: pointer; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; font-weight: 600;
    background: var(--primary-soft); color: var(--primary);
    border-left: 3px solid var(--primary);
}
.cal-event.emerald { background: var(--emerald-soft); color: var(--emerald); border-color: var(--emerald); }
.cal-event.purple { background: var(--purple-soft); color: var(--purple); border-color: var(--purple); }
.cal-event.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.cal-event.blue { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.cal-event.peach { background: var(--peach-soft); color: var(--peach); border-color: var(--peach); }

/* ============================================================
   CODE BOX
   ============================================================ */
.code-box {
    background: var(--bg-surface); border: 1px dashed var(--border);
    padding: 14px 18px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 13px; color: var(--primary);
    display: flex; justify-content: space-between; align-items: center; gap: 12px; word-break: break-all;
}

/* ============================================================
   ONBOARDING WIZARD
   ============================================================ */
.wizard-steps { display: flex; gap: 0; margin-bottom: 40px; }
.wizard-step { flex: 1; text-align: center; padding: 16px 8px; position: relative; }
.wizard-step::after { content: ''; position: absolute; top: 26px; right: -50%; width: 100%; height: 3px; background: var(--border); border-radius: 3px; }
.wizard-step:last-child::after { display: none; }
.wizard-step.active::after, .wizard-step.done::after { background: var(--primary); }
.wizard-step-number {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--bg-card); border: 2px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: var(--text-muted);
    position: relative; z-index: 1; transition: all var(--transition); box-shadow: var(--shadow-sm);
}
.wizard-step.active .wizard-step-number { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); box-shadow: var(--shadow-glow); }
.wizard-step.done .wizard-step-number { border-color: var(--primary); color: #fff; background: var(--primary-grad); }
.wizard-step-label { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; font-weight: 600; }
.wizard-step.active .wizard-step-label { color: var(--primary); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.bento { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ============================================================
   MOBILE
   ============================================================ */
.mobile-toggle { display: none; }
.mobile-overlay { display: none; }

@media (max-width: 1024px) {
    .grid-3, .grid-4, .bento { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .sidebar { top: 0; left: 0; bottom: 0; border-radius: 0; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .mobile-toggle {
        display: flex; align-items: center; justify-content: center;
        position: fixed; top: 16px; left: 16px; z-index: 101;
        background: var(--bg-card); border: 1px solid var(--border);
        border-radius: 50%; width: 44px; height: 44px;
        color: var(--primary); cursor: pointer; box-shadow: var(--shadow-md);
    }
    .mobile-overlay { position: fixed; inset: 0; background: rgba(40,20,20,0.4); z-index: 99; }
    .mobile-overlay.active { display: block; }
    .main-content { margin-left: 0; padding: 20px 16px; padding-top: 72px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4, .bento { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
    .tabs { overflow-x: auto; width: 100%; }
    .cal-grid { gap: 4px; }
    .cal-day { min-height: 80px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 24px; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page { min-height: 100vh; display: flex; background: var(--bg-deep); }
.auth-left { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-right {
    flex: 1; background: var(--primary-grad);
    display: flex; align-items: center; justify-content: center;
    padding: 60px; position: relative; overflow: hidden;
}
.auth-right::before { content: ''; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,0.10); }
.auth-right::after { content: ''; position: absolute; left: -60px; bottom: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.auth-box { max-width: 420px; width: 100%; }
.auth-logo-img { height: 36px; width: auto; margin-bottom: 24px; }
.auth-tagline { color: var(--text-secondary); margin-bottom: 36px; font-size: 15px; }
.auth-promo { position: relative; z-index: 1; max-width: 480px; color: #fff; }
.auth-promo h2 { font-size: 42px; font-weight: 800; line-height: 1.12; margin-bottom: 20px; letter-spacing: -1.2px; }
.auth-promo h2 em { font-style: normal; opacity: 0.85; }
.auth-promo p { color: rgba(255,255,255,0.9); font-size: 16px; line-height: 1.7; }
.auth-features { margin-top: 40px; display: flex; flex-direction: column; gap: 16px; }
.auth-feature { display: flex; gap: 14px; align-items: flex-start; }
.auth-feature-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.18); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.auth-feature-text h4 { font-size: 14px; font-weight: 700; color: #fff; }
.auth-feature-text p { font-size: 13px; color: rgba(255,255,255,0.8); margin-top: 2px; }
@media (max-width: 900px) { .auth-right { display: none; } }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; }
.text-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}.mb-4{margin-bottom:32px}
.gap-1{gap:8px}.gap-2{gap:16px}
.flex{display:flex}.flex-center{display:flex;align-items:center}
.flex-between{display:flex;justify-content:space-between;align-items:center}
.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.hidden{display:none!important}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton { background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card-hover) 50%, var(--bg-surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   COLOR PICKER
   ============================================================ */
.color-picker { display: flex; gap: 6px; align-items: center; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; transition: all var(--transition); }
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Theme toggle */
.theme-toggle-sidebar {
    position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all var(--transition); flex-shrink: 0;
}
.theme-toggle-sidebar:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); transform: translateY(-50%) rotate(25deg); }

.nav-collapsible { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.nav-collapsible.nav-open { overflow: visible; }

/* ============================================================
   TOKENS — DARK (warm, red-forward — not near-black)
   ============================================================ */
[data-theme="dark"] {
    --bg-deep: #17110f;
    --bg-base: #1e1613;
    --bg-surface: #241a16;
    --bg-card: #221915;
    --bg-card-hover: #2b201b;
    --bg-elevated: #2b201b;
    --bg-input: #1a1310;
    --bg-glass: rgba(34,25,21,0.7);

    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(255,82,82,0.35);
    --border-glass: rgba(255,255,255,0.08);

    --text-primary: #f6efec;
    --text-secondary: #b6a9a3;
    --text-muted: #7d6f68;
    --text-inverse: #17110f;

    --primary-soft: rgba(255,22,22,0.14);
    --primary-soft-2: rgba(255,22,22,0.22);
    --primary-glow: rgba(255,22,22,0.18);

    --emerald-soft: rgba(15,157,107,0.16);
    --purple-soft:  rgba(124,92,240,0.18);
    --blue-soft:    rgba(47,107,216,0.18);
    --amber-soft:   rgba(209,131,10,0.18);
    --red-soft:     rgba(239,68,68,0.16);
    --cyan-soft:    rgba(14,155,181,0.18);
    --rose-soft:    rgba(244,63,110,0.18);
    --peach-soft:   rgba(249,115,22,0.18);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.45);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.55);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
    --shadow-glow: 0 10px 28px rgba(255,22,22,0.30);

    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--bg-deep); }
[data-theme="dark"] .stat-icon { background: var(--primary-soft); }
[data-theme="dark"] table.rv-table tbody tr:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .badge-gray { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .form-switch-track { background: rgba(255,255,255,0.14); }

/* ============================================================
   TEMA SIDEBAR ROJO (experimental)
   Sidebar rojo, texto e iconos blancos, opción activa en blanco.
   → PARA VOLVER ATRÁS: borra TODO este bloque.
   ============================================================ */
.sidebar { background: var(--primary-grad); border-color: transparent; }
.sidebar::before { display: none; }

/* Logo y botón de tema en blanco */
.sidebar-logo-img, .sidebar-logo img { filter: brightness(0) invert(1); }
.theme-toggle-sidebar { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
.theme-toggle-sidebar:hover { background: rgba(255,255,255,0.28); border-color: #fff; color: #fff; transform: translateY(-50%) rotate(25deg); }

/* Secciones e ítems */
.nav-section-title { color: rgba(255,255,255,0.6); }
.nav-item { color: rgba(255,255,255,0.9); }
.nav-item i { opacity: 0.9; }
.nav-item:hover { background: rgba(255,255,255,0.14); color: #fff; }
.nav-item:hover i { opacity: 1; }

/* Ítem activo = blanco, texto e icono rojos */
.nav-item.active { background: #fff; color: var(--primary); box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.nav-item.active i { color: var(--primary); opacity: 1; }

/* Iconos-imagen (mascota Reservi): blancos sobre rojo, rojos cuando activo */
.sidebar-nav .nav-item img { filter: brightness(0) invert(1); }
.sidebar-nav .nav-item.active img { filter: none; }

/* Badges visibles sobre rojo */
.nav-badge { background: #fff; color: var(--primary); }
.nav-item.active .nav-badge { background: var(--primary); color: #fff; }
.nav-badge-primary { background: rgba(255,255,255,0.9); color: var(--primary); }

/* Footer */
.sidebar-footer { border-top-color: rgba(255,255,255,0.18); }
.sidebar-footer .btn-ghost { color: #fff !important; }
.sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.14) !important; color: #fff !important; }
.sidebar-user:hover { background: rgba(255,255,255,0.12); }
.sidebar-user-avatar { background: #fff; color: var(--primary); }
.sidebar-user-name { color: #fff; }
.sidebar-user-role { color: rgba(255,255,255,0.72); }
.sidebar-footer a[href="/logout"] { color: rgba(255,255,255,0.85) !important; }
.sidebar-footer a[href="/logout"]:hover { background: rgba(255,255,255,0.14); color: #fff !important; }

/* Scrollbar del menú, sutil sobre rojo */
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* ============================================================
   OPCIÓN B — SIDEBAR UNIDO AL CONTENIDO (pestaña activa fundida)
   El sidebar deja de flotar y se pega al contenido. La pestaña activa
   toma el color del lienzo (--bg-deep, que en modo oscuro es casi negro),
   fundiéndose con él, y el rojo la abraza con curvas cóncavas.
   Solo escritorio (≥769px); en móvil el menú es un cajón y no se toca.
   → PARA VOLVER ATRÁS: borra TODO este bloque (el sidebar vuelve a flotar
     con la pastilla blanca).
   ============================================================ */
@media (min-width: 769px) {
  /* Pegar el sidebar al borde y al contenido (sin flotar, sin sombra) */
  .sidebar { top: 0; left: 0; bottom: 0; border-radius: 0; border: 0; box-shadow: none; }
  .main-content { margin-left: var(--sidebar-w); }

  /* Ocultar la barra de scroll para no cortar la unión (sigue scrolleando) */
  .sidebar-nav { scrollbar-width: none; }
  .sidebar-nav::-webkit-scrollbar { width: 0; height: 0; }

  /* Pestaña activa = color del lienzo → se funde con el contenido.
     margin-right:-14px = exactamente el padding del nav → llega a ras del borde
     del sidebar, que está pegado al contenido (mismo color) = unión sin costura. */
  .sidebar-nav .nav-item.active {
    position: relative;
    background: var(--bg-deep);
    color: var(--primary);
    margin-right: -14px;
    padding-right: 24px;
    border-radius: 20px 0 0 20px;
    box-shadow: none;
    z-index: 1;
  }
  .sidebar-nav .nav-item.active i { color: var(--primary); }

  /* Curvas cóncavas: el ROJO hace un bulto convexo (hacia afuera) y la crema
     fluye a su alrededor. Arriba la crema sube hacia el borde; abajo baja.
     Se logra con radial-gradient (un cuarto de círculo rojo, resto crema),
     NO con border-radius (que dejaba un bultito hacia dentro). */
  .sidebar-nav .nav-item.active::before,
  .sidebar-nav .nav-item.active::after {
    content: ""; position: absolute; right: 0; width: 22px; height: 22px;
    pointer-events: none;
  }
  .sidebar-nav .nav-item.active::before {
    top: -22px;
    background: radial-gradient(circle 22px at top left, transparent 21px, var(--bg-deep) 22.5px);
  }
  .sidebar-nav .nav-item.active::after {
    bottom: -22px;
    background: radial-gradient(circle 22px at bottom left, transparent 21px, var(--bg-deep) 22.5px);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR DE HORARIOS (estilo Booknetic: jornada + descansos + día libre)
   ═══════════════════════════════════════════════════════════════════════════ */
.sched-week { display: flex; flex-direction: column; gap: 6px; }

.sched-day {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.sched-day:hover { border-color: var(--border-hover); }
.sched-day:has(.sched-off input:checked),
.sched-day:has(.js-mode option[value="inherit"]:checked) { background: var(--bg-surface); }

.sched-day-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sched-day-name {
  width: 88px; flex: 0 0 88px;
  font-size: 14px; font-weight: 700; color: var(--text-primary);
}
.sched-work { display: flex; align-items: center; gap: 8px; }
.sched-work-off { font-size: 13px; color: var(--text-muted); font-style: italic; }
.sched-dash { color: var(--text-muted); font-size: 13px; }

.sched-time {
  appearance: none; -webkit-appearance: none;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-input) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23a79fa6' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text-primary);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer; min-width: 90px;
}
.sched-time:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }

.sched-day-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.sched-off {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.sched-off input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.sched-mode {
  appearance: none; -webkit-appearance: none;
  padding: 7px 28px 7px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg-input) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23a79fa6' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--text-secondary); font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer;
}

.sched-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: 1px dashed var(--border-hover); border-radius: var(--radius-xs);
  background: transparent; color: var(--primary);
  font-family: var(--font); font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.sched-btn:hover { background: var(--primary-glow); border-style: solid; }
.sched-btn-ghost { border: 1px solid var(--border); color: var(--text-muted); padding: 7px 10px; }
.sched-btn-ghost:hover { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border-hover); }
.sched-btn.sched-copied { background: var(--emerald-soft); border-color: var(--emerald); color: var(--emerald); }
.sched-btn.sched-copied::after { content: 'Copiado'; font-size: 12px; }

.sched-breaks {
  display: flex; flex-direction: column; gap: 6px;
  margin: 10px 0 0 88px; padding-left: 14px;
  border-left: 2px solid var(--amber-soft);
}
.sched-break { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sched-break-label {
  font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--amber); width: 76px; flex: 0 0 76px;
}
.sched-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  font-size: 12px; cursor: pointer; transition: background .15s var(--ease);
}
.sched-del:hover { background: var(--red); color: #fff; }

.sched-warn {
  margin: 10px 0 0 88px; padding: 8px 12px;
  background: var(--amber-soft); border-radius: var(--radius-xs);
  color: var(--amber); font-size: 12.5px; font-weight: 600;
}

/* Modo avanzado: el campo de texto de toda la vida */
.sched-raw { display: none; }
.sched-advanced .sched-ui { display: none; }
.sched-advanced .sched-raw { display: block; }
.sched-advanced .sched-day::before {
  content: attr(data-label);
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.sched-adv-toggle {
  margin-top: 10px; padding: 0;
  border: none; background: none; color: var(--text-muted);
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.sched-adv-toggle:hover { color: var(--primary); }

/* El editor se adapta al ancho de SU CONTENEDOR, no al de la ventana: la misma
   semana vive en una tarjeta a pantalla completa y dentro de un modal estrecho. */
.sched-week, .sched-day { container-type: inline-size; }

/* Contenedor holgado: cada dia en una sola tira */
.sched-day-top { flex-wrap: nowrap; }
.sched-work { flex: 0 1 auto; min-width: 0; }

/* Contenedor justo: se permite que la fila se parta antes que desbordar */
@container (max-width: 660px) {
  .sched-day-top { flex-wrap: wrap; }
}

/* Contenedor estrecho (movil o modal apretado): todo apilado */
@container (max-width: 470px) {
  .sched-day-name { width: 100%; flex: 0 0 100%; }
  .sched-day-actions { margin-left: 0; width: 100%; }
  .sched-work { width: 100%; }
  .sched-time { flex: 1; min-width: 0; }
  .sched-breaks, .sched-warn { margin-left: 0; }
  .sched-break-label { width: 100%; flex: 0 0 100%; }
}

/* Sin soporte de container queries: se cae al ancho de ventana */
@supports not (container-type: inline-size) {
  @media (max-width: 640px) {
    .sched-day-top { flex-wrap: wrap; }
    .sched-day-name { width: 100%; flex: 0 0 100%; }
    .sched-day-actions { margin-left: 0; width: 100%; }
    .sched-work { width: 100%; }
    .sched-time { flex: 1; min-width: 0; }
    .sched-breaks, .sched-warn { margin-left: 0; }
    .sched-break-label { width: 100%; flex: 0 0 100%; }
  }
}
