:root {
    --ryb-tutorial-surface: #fffdfa;
    --ryb-tutorial-surface-soft: #f7f5f2;
    --ryb-tutorial-text: #272421;
    --ryb-tutorial-muted: #716b65;
    --ryb-tutorial-line: rgba(54, 49, 45, .14);
    --ryb-tutorial-action: #ad5f42;
    --ryb-tutorial-action-hover: #914a34;
    --ryb-tutorial-hover: #eee9e3;
    --ryb-tutorial-shadow: 0 24px 70px rgba(49, 39, 32, .16);
}

[data-theme="dark"] {
    --ryb-tutorial-surface: #1d1c1b;
    --ryb-tutorial-surface-soft: #252321;
    --ryb-tutorial-text: #f4f1ed;
    --ryb-tutorial-muted: #aaa39c;
    --ryb-tutorial-line: rgba(255, 255, 255, .12);
    --ryb-tutorial-action: #c57859;
    --ryb-tutorial-action-hover: #d48a6c;
    --ryb-tutorial-hover: #302d2a;
    --ryb-tutorial-shadow: 0 26px 80px rgba(0, 0, 0, .42);
}

.ryb-demo-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9000;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 15px;
    border: 1px solid var(--ryb-tutorial-line);
    border-radius: 999px;
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-text);
    box-shadow: 0 10px 30px rgba(49, 39, 32, .13);
    font: 700 13px/1 system-ui, sans-serif;
    letter-spacing: .01em;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.ryb-demo-launcher::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ryb-tutorial-action);
}

.ryb-demo-launcher:hover {
    border-color: color-mix(in srgb, var(--ryb-tutorial-action) 55%, transparent);
    box-shadow: 0 13px 36px rgba(49, 39, 32, .17);
    transform: translateY(-1px);
}

.ryb-demo-launcher.is-active {
    border-color: color-mix(in srgb, var(--ryb-tutorial-action) 46%, var(--ryb-tutorial-line));
}

.ryb-demo-launcher.is-active::before {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ryb-tutorial-action) 16%, transparent);
}

.ryb-demo-panel-backdrop,
.ryb-tour-blocker {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(18, 16, 14, .52);
    backdrop-filter: blur(3px);
}

.ryb-demo-panel {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 10001;
    width: min(700px, calc(100vw - 32px));
    max-height: min(780px, calc(100vh - 32px));
    padding: 28px;
    overflow: auto;
    transform: translate(-50%, -50%);
    border: 1px solid var(--ryb-tutorial-line);
    border-radius: 22px;
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-text);
    box-shadow: var(--ryb-tutorial-shadow);
    font-family: system-ui, sans-serif;
}

.ryb-demo-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.ryb-demo-panel h2,
.ryb-demo-panel p { margin: 0; }
.ryb-demo-panel h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); letter-spacing: -.035em; }
.ryb-demo-panel p { max-width: 520px; margin-top: 7px; color: var(--ryb-tutorial-muted); line-height: 1.55; }

.ryb-demo-panel-close {
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--ryb-tutorial-muted);
    font: 650 13px/1 system-ui, sans-serif;
    cursor: pointer;
}

.ryb-demo-panel-close:hover { color: var(--ryb-tutorial-action); }

.ryb-demo-tour-current {
    width: 100%;
    margin: 0 0 14px;
    padding: 14px 16px;
    border: 1px solid var(--ryb-tutorial-line);
    border-left: 3px solid var(--profile-accent, #7b746e);
    border-radius: 12px;
    background: transparent;
    color: var(--ryb-tutorial-text);
    text-align: left;
    font-weight: 720;
    cursor: pointer;
}

.ryb-demo-tour-current:hover {
    border-color: var(--profile-accent, #7b746e);
    background: var(--ryb-tutorial-hover);
}

.ryb-help-mode-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 24px;
    padding: 14px 16px;
    border: 1px solid var(--ryb-tutorial-line);
    border-radius: 12px;
    background: var(--ryb-tutorial-surface-soft);
    color: var(--ryb-tutorial-text);
    text-align: left;
    cursor: pointer;
}

.ryb-help-mode-toggle span { display: grid; gap: 4px; }
.ryb-help-mode-toggle strong { font-size: .92rem; }
.ryb-help-mode-toggle small { color: var(--ryb-tutorial-muted); font-size: .78rem; line-height: 1.35; }
.ryb-help-mode-toggle i {
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 auto;
    border: 1px solid var(--ryb-tutorial-line);
    border-radius: 999px;
    background: var(--ryb-tutorial-surface);
}

.ryb-help-mode-toggle i::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ryb-tutorial-muted);
    transition: transform .18s ease, background .18s ease;
}

.ryb-help-mode-toggle:hover { background: var(--ryb-tutorial-hover); }

.ryb-help-mode-toggle[aria-pressed="true"] i { border-color: var(--ryb-tutorial-action); }
.ryb-help-mode-toggle[aria-pressed="true"] i::after { background: var(--ryb-tutorial-action); transform: translateX(16px); }

.ryb-demo-section-title {
    margin: 2px 0 10px;
    color: var(--ryb-tutorial-muted);
    font: 760 .68rem/1 system-ui, sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.ryb-demo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ryb-demo-profile {
    --card-accent: var(--profile-accent, #7b746e);
    position: relative;
    display: grid;
    gap: 5px;
    min-height: 78px;
    padding: 15px 38px 15px 17px;
    appearance: none;
    border: 1px solid var(--ryb-tutorial-line);
    border-left: 3px solid var(--card-accent);
    border-radius: 13px;
    background: var(--ryb-tutorial-surface-soft);
    color: var(--ryb-tutorial-text);
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.ryb-demo-profile::after {
    content: '→';
    position: absolute;
    top: 50%;
    right: 15px;
    color: var(--card-accent);
    font-size: 1rem;
    transform: translateY(-50%);
}

.ryb-demo-profile:hover {
    border-color: color-mix(in srgb, var(--card-accent) 58%, var(--ryb-tutorial-line));
    background: var(--ryb-tutorial-surface);
    transform: translateY(-1px);
}

.ryb-demo-profile[data-profile="cliente_web"] { --card-accent: var(--profile-cliente-web); }
.ryb-demo-profile[data-profile="cliente_mesa"] { --card-accent: var(--profile-cliente-mesa); }
.ryb-demo-profile[data-profile="mozo"] { --card-accent: var(--profile-mozo); }
.ryb-demo-profile[data-profile="cocina"] { --card-accent: var(--profile-cocina); }
.ryb-demo-profile[data-profile="delivery"] { --card-accent: var(--profile-delivery); }
.ryb-demo-profile[data-profile="administrativo"] { --card-accent: var(--profile-administrativo); }
.ryb-demo-profile[data-profile="restaurant_owner"] { --card-accent: var(--profile-restaurant-owner); }
.ryb-demo-profile strong { color: var(--ryb-tutorial-text); font-size: .96rem; font-weight: 720; }
.ryb-demo-profile span { color: var(--ryb-tutorial-muted); font-size: .81rem; line-height: 1.4; }

.ryb-tour-blocker { z-index: 9997; background: rgba(18, 16, 14, .58); }

.ryb-tour-target {
    position: relative !important;
    z-index: 9999 !important;
    pointer-events: none !important;
    border-radius: 10px;
    box-shadow: 0 0 0 2px var(--profile-accent, #7b746e), 0 16px 48px rgba(0, 0, 0, .26) !important;
}

.ryb-tour-card {
    position: fixed;
    z-index: 10002;
    width: min(400px, calc(100vw - 28px));
    padding: 22px 22px 20px;
    border: 1px solid var(--ryb-tutorial-line);
    border-left: 4px solid var(--profile-accent, #7b746e);
    border-radius: 16px;
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-text);
    box-shadow: var(--ryb-tutorial-shadow);
    font-family: system-ui, sans-serif;
}

.ryb-tour-kicker {
    color: var(--profile-accent, #7b746e);
    font-size: .69rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.ryb-tour-card h2 { margin: 7px 0 9px; font-size: 1.22rem; letter-spacing: -.025em; }
.ryb-tour-card p { margin: 0; color: var(--ryb-tutorial-muted); line-height: 1.55; }

.ryb-tour-progress {
    height: 2px;
    margin: 20px 0 17px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--ryb-tutorial-line);
}

.ryb-tour-progress span {
    display: block;
    height: 100%;
    background: var(--ryb-tutorial-action);
    transition: width .2s ease;
}

.ryb-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ryb-tour-actions div { display: flex; gap: 8px; }
.ryb-tour-actions button {
    padding: 9px 12px;
    border: 1px solid var(--ryb-tutorial-line);
    border-radius: 9px;
    background: transparent;
    color: var(--ryb-tutorial-text);
    font-weight: 680;
    cursor: pointer;
}

.ryb-tour-actions button:first-child { border-color: transparent; color: var(--ryb-tutorial-muted); }
.ryb-tour-actions button:hover { border-color: var(--ryb-tutorial-action); color: var(--ryb-tutorial-action); }
.ryb-tour-actions .primary { border-color: var(--ryb-tutorial-action); background: var(--ryb-tutorial-action); color: #fffaf7; }
.ryb-tour-actions .primary:hover { border-color: var(--ryb-tutorial-action-hover); background: var(--ryb-tutorial-action-hover); color: #fff; }
.ryb-tour-actions button:disabled { opacity: .38; cursor: default; }
.ryb-demo-loading { opacity: .6; pointer-events: none; }

.ryb-demo-identity {
    --identity-accent: var(--profile-accent, #a65238);
    display: inline-flex;
    align-items: stretch;
    min-width: 190px;
    border: 1px solid var(--ryb-tutorial-border);
    border-left: 3px solid var(--identity-accent);
    border-radius: 9px;
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-text);
    overflow: hidden;
    box-shadow: 0 9px 28px rgba(28, 25, 22, .08);
}
.ryb-demo-identity button { display:grid; gap:1px; flex:1; padding:7px 12px; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.ryb-demo-identity small { color:var(--ryb-tutorial-muted); font-size:.63rem; line-height:1; text-transform:uppercase; letter-spacing:.1em; }
.ryb-demo-identity strong { font-size:.82rem; line-height:1.2; }
.ryb-demo-window { display:grid; align-content:center; gap:2px; padding:5px 10px; border-left:1px solid var(--ryb-tutorial-border); white-space:nowrap; }
.ryb-demo-window b { color:var(--ryb-tutorial-action); font-size:.72rem; font-variant-numeric:tabular-nums; letter-spacing:.04em; }
.ryb-demo-window small { font-size:.58rem; letter-spacing:0; text-transform:none; }
.ryb-demo-identity a { display:flex; align-items:center; padding:0 10px; border-left:1px solid var(--ryb-tutorial-border); color:var(--ryb-tutorial-muted); font-size:.68rem; text-decoration:none; }
.ryb-demo-identity a:hover { color:var(--ryb-tutorial-action); }
body > .ryb-demo-identity { position:fixed; top:12px; left:50%; z-index:28; transform:translateX(-50%); }
#demoIdentitySlot { display:flex; justify-content:center; flex:1; }
body[data-profile="cliente_web"] .ryb-demo-identity { --identity-accent:var(--profile-cliente-web); }
body[data-profile="cliente_mesa"] .ryb-demo-identity { --identity-accent:var(--profile-cliente-mesa); }
body[data-profile="mozo"] .ryb-demo-identity { --identity-accent:var(--profile-mozo); }
body[data-profile="cocina"] .ryb-demo-identity { --identity-accent:var(--profile-cocina); }
body[data-profile="delivery"] .ryb-demo-identity { --identity-accent:var(--profile-delivery); }
body[data-profile="administrativo"] .ryb-demo-identity { --identity-accent:var(--profile-administrativo); }

.ryb-context-help {
    position: fixed;
    z-index: 9500;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    aspect-ratio: 1;
    flex: 0 0 24px;
    box-sizing: border-box;
    padding: 0 !important;
    border: 1px solid var(--ryb-tutorial-action);
    border-radius: 50%;
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-action);
    box-shadow: 0 5px 16px rgba(30, 26, 23, .16);
    font: 800 12px/1 Arial, sans-serif;
    cursor: pointer;
}

.ryb-context-help:hover {
    border-color: var(--ryb-tutorial-action-hover);
    background: var(--ryb-tutorial-surface);
    color: var(--ryb-tutorial-action-hover);
    box-shadow: 0 7px 20px rgba(30, 26, 23, .22);
    transform: translateY(-1px);
}

.ryb-demo-reset-note { margin:0 0 16px; padding:10px 12px; border-left:2px solid var(--ryb-tutorial-action); background:var(--ryb-tutorial-surface-soft); color:var(--ryb-tutorial-muted); font-size:.78rem; line-height:1.45; }

.ryb-demo-launcher:focus-visible,
.ryb-demo-panel button:focus-visible,
.ryb-tour-card button:focus-visible,
.ryb-context-help:focus-visible {
    outline: 2px solid var(--ryb-tutorial-action);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .ryb-demo-launcher { right: 12px; bottom: 12px; }
    .ryb-demo-panel { width: calc(100vw - 20px); padding: 22px 18px; border-radius: 18px; }
    .ryb-demo-panel-head { gap: 14px; margin-bottom: 18px; }
    .ryb-demo-grid { grid-template-columns: 1fr; }
    #demoIdentitySlot { width:100%; order:2; }
    .ryb-demo-identity { width:100%; }
    .ryb-demo-window { margin-left:auto; }
    body > .ryb-demo-identity { top:8px; width:auto; max-width:calc(100vw - 150px); }
    .ryb-tour-card { right: 12px; left: 12px !important; width: auto; padding: 20px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .ryb-demo-launcher,
    .ryb-demo-profile,
    .ryb-tour-progress span { transition: none; }
    .ryb-demo-launcher:hover,
    .ryb-demo-profile:hover { transform: none; }
}
