/* ================================================================
   CREATION SUITE — Carte de visite
   Design System v3.0 — Studio Canva-like
   ================================================================ */

/* ----------------------------------------------------------------
   FONTS
   ---------------------------------------------------------------- */
@font-face {
    font-family: 'Quickbrush';
    /* Intentional duplicate with signature-mail/fonts/ — see MEMORY for context */
    src: url('fonts/Quickbrush.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face { font-family: 'Akrobat Regular';      font-style: normal; font-weight: normal; src: local('Akrobat Regular'),      url('fonts/akrobat-webfont/Akrobat-Regular.woff') format('woff'); }
@font-face { font-family: 'Akrobat Light';         font-style: normal; font-weight: normal; src: local('Akrobat Light'),         url('fonts/akrobat-webfont/Akrobat-Light.woff') format('woff'); }
@font-face { font-family: 'Akrobat ExtraLight';    font-style: normal; font-weight: normal; src: local('Akrobat ExtraLight'),    url('fonts/akrobat-webfont/Akrobat-ExtraLight.woff') format('woff'); }
@font-face { font-family: 'Akrobat SemiBold';      font-style: normal; font-weight: normal; src: local('Akrobat SemiBold'),      url('fonts/akrobat-webfont/Akrobat-SemiBold.woff') format('woff'); }
@font-face { font-family: 'Akrobat Bold';          font-style: normal; font-weight: normal; src: local('Akrobat Bold'),          url('fonts/akrobat-webfont/Akrobat-Bold.woff') format('woff'); }
@font-face { font-family: 'Akrobat ExtraBold Regular'; font-style: normal; font-weight: normal; src: local('Akrobat ExtraBold Regular'), url('fonts/akrobat-webfont/akrobat-extrabold-webfont.woff') format('woff'); }
@font-face { font-family: 'Akrobat Black';         font-style: normal; font-weight: normal; src: local('Akrobat Black'),         url('fonts/akrobat-webfont/Akrobat-Black.woff') format('woff'); }

/* ----------------------------------------------------------------
   DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
    --cs-bg:             #f1f5f9;
    --cs-surface:        #ffffff;
    --cs-surface-2:      #f8fafc;
    --cs-border:         #e2e8f0;
    --cs-border-hover:   #cbd5e1;

    --cs-accent:         #2563eb;
    --cs-accent-dark:    #1d4ed8;
    --cs-accent-subtle:  rgba(37, 99, 235, 0.09);
    --cs-accent-glow:    rgba(37, 99, 235, 0.22);

    --cs-brand:          #201747;
    --cs-brand-mid:      #2d2260;
    --cs-brand-subtle:   rgba(32, 23, 71, 0.08);

    --cs-danger:         #ef4444;
    --cs-danger-subtle:  rgba(239, 68, 68, 0.09);
    --cs-verso:          #e5554f;

    --cs-text:           #1e293b;
    --cs-text-2:         #475569;
    --cs-text-muted:     #94a3b8;

    --cs-radius-xs:      4px;
    --cs-radius-sm:      6px;
    --cs-radius:         10px;
    --cs-radius-lg:      14px;
    --cs-radius-xl:      20px;

    --cs-shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --cs-shadow:         0 4px 12px rgba(0,0,0,0.08);
    --cs-shadow-md:      0 8px 24px rgba(0,0,0,0.10);
    --cs-shadow-lg:      0 16px 48px rgba(0,0,0,0.14);
    --cs-shadow-card:    0 12px 40px rgba(0,0,0,0.18);

    --cs-ease:           0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --cs-ease-flip:      0.65s cubic-bezier(0.4, 0, 0.2, 1);

    --cs-font:           'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --cs-sidebar-w:      340px;
}

/* ================================================================
   SHARED UTILITIES
   ================================================================ */

.h2o-pill {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 3px 9px;
    background: var(--cs-surface-2);
    color: var(--cs-text-muted);
    border: 1px solid var(--cs-border);
    white-space: nowrap;
}
.pill-recto { background: var(--cs-brand-subtle); color: var(--cs-brand); border-color: transparent; }
.pill-verso { background: rgba(229,85,79,0.1);    color: var(--cs-verso); border-color: transparent; }

.h2o-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.h2o-color-row input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}
.h2o-color-row input[type="text"] {
    width: 110px;
    flex: 0 0 110px;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 0.04em;
}
.h2o-empty-state {
    padding: 40px 20px;
    text-align: center;
    border: 2px dashed var(--cs-border);
    border-radius: var(--cs-radius);
    color: var(--cs-text-muted);
    background: var(--cs-surface-2);
    font-size: 14px;
}
.h2o-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    color: var(--cs-text);
}
.h2o-switch input { margin: 0; transform: scale(1.15); cursor: pointer; }

/* Skeleton shimmer */
@keyframes cs-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.h2o-canvas-skeleton {
    position: absolute;
    inset: 0;
    border-radius: var(--cs-radius);
    background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
    background-size: 200% 100%;
    animation: cs-shimmer 1.4s infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.h2o-canvas-skeleton.is-loading {
    opacity: 1;
}

/* ================================================================
   FRONT-END — Outil de personnalisation carte de visite
   ================================================================ */

.h2o-card-app-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    font-family: var(--cs-font);
    color: var(--cs-text);
    background: var(--cs-bg);
    padding: 24px;
    border-radius: var(--cs-radius-lg);
}

/* ---- Layout : controls-left | artboard-right ---- */
.h2o-studio-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: start;
}

/* ---- LEFT: Control panel ---- */
.h2o-studio-controls {
    display: flex;
    flex-direction: column;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-lg);
    box-shadow: var(--cs-shadow);
    overflow: hidden;
    max-height: calc(100vh - 80px);
}

.h2o-studio-header {
    padding: 16px 16px 0;
    border-bottom: 1px solid var(--cs-border);
}

/* Model switcher — pill tabs */
.h2o-front-model-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 14px;
}
.h2o-front-model-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1.5px solid var(--cs-border);
    border-radius: 999px;
    background: var(--cs-surface);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--cs-text-2);
    transition: all var(--cs-ease);
    font-family: var(--cs-font);
    white-space: nowrap;
}
.h2o-front-model-tab .h2o-lang-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: var(--cs-bg);
    color: var(--cs-text-muted);
    border-radius: 4px;
    padding: 1px 5px;
}
.h2o-front-model-tab:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent);
    box-shadow: var(--cs-shadow-sm);
}
.h2o-front-model-tab.active {
    border-color: var(--cs-accent);
    background: var(--cs-accent-subtle);
    color: var(--cs-accent);
}
.h2o-front-model-tab.active .h2o-lang-badge {
    background: var(--cs-accent);
    color: #fff;
}

/* ---- Form panel ---- */
.h2o-form-panel {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--cs-border) transparent;
}

/* Form step sections */
.h2o-form-section {
    margin-bottom: 24px;
}
.h2o-form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cs-text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--cs-border);
}
.h2o-form-section-title svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Form rows */
.h2o-field-row {
    margin-bottom: 14px;
    position: relative;
}
.h2o-field-row label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cs-text-muted);
    margin-bottom: 6px;
}
.h2o-field-row .h2o-input-wrap {
    position: relative;
}
.h2o-field-row .h2o-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--cs-text-muted);
    pointer-events: none;
    flex-shrink: 0;
}
.h2o-field-row .h2o-input-icon + input,
.h2o-field-row .h2o-input-icon + select {
    padding-left: 36px;
}
.h2o-field-row input,
.h2o-field-row select,
.h2o-field-row textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    font-size: 14px;
    font-family: var(--cs-font);
    background: var(--cs-surface);
    color: var(--cs-text);
    transition: border-color var(--cs-ease), box-shadow var(--cs-ease);
    box-sizing: border-box;
    outline: none;
}
.h2o-field-row input:focus,
.h2o-field-row select:focus,
.h2o-field-row textarea:focus {
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-subtle);
}
.h2o-field-row input:not(:placeholder-shown),
.h2o-field-row textarea:not(:placeholder-shown) {
    border-color: var(--cs-border-hover);
}
.h2o-phone2-group {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
}
.h2o-phone2-group .h2o-phone2-hidden { display: none; }

/* ---- Export bar ---- */
.h2o-export-bar {
    padding: 14px 16px;
    border-top: 1px solid var(--cs-border);
    background: var(--cs-surface-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.h2o-btn-export-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    background: var(--cs-brand);
    color: #fff;
    border: none;
    border-radius: var(--cs-radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--cs-font);
    cursor: pointer;
    transition: background var(--cs-ease), transform var(--cs-ease);
    box-shadow: var(--cs-shadow-sm);
}
.h2o-btn-export-primary:hover {
    background: var(--cs-brand-mid);
    transform: translateY(-1px);
    box-shadow: var(--cs-shadow);
}
.h2o-btn-export-primary svg { width: 16px; height: 16px; flex-shrink: 0; }
.h2o-export-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.h2o-btn-export-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    background: var(--cs-surface);
    color: var(--cs-brand);
    border: 1.5px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--cs-font);
    cursor: pointer;
    transition: all var(--cs-ease);
}
.h2o-btn-export-outline:hover {
    border-color: var(--cs-brand);
    background: var(--cs-brand-subtle);
}
.h2o-btn-export-outline svg { width: 13px; height: 13px; flex-shrink: 0; }
.h2o-btn-export-primary[disabled],
.h2o-btn-export-outline[disabled] {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none !important;
}

/* Backward compat aliases (same rules as export variants) */
.h2o-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 20px; background: var(--cs-brand); color: #fff;
    border: none; border-radius: var(--cs-radius-sm); font-size: 14px; font-weight: 700;
    font-family: var(--cs-font); cursor: pointer; transition: background var(--cs-ease);
}
.h2o-btn-primary:hover { background: var(--cs-brand-mid); }
.h2o-btn-outline {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 12px; background: var(--cs-surface); color: var(--cs-brand);
    border: 1.5px solid var(--cs-border); border-radius: var(--cs-radius-sm);
    font-size: 12px; font-weight: 600; font-family: var(--cs-font); cursor: pointer;
    transition: all var(--cs-ease);
}
.h2o-btn-outline:hover { border-color: var(--cs-brand); background: var(--cs-brand-subtle); }
.h2o-btn-primary[disabled], .h2o-btn-outline[disabled] { opacity: 0.38; cursor: not-allowed; }
.h2o-actions-bar  { padding: 14px 16px; border-top: 1px solid var(--cs-border); background: var(--cs-surface-2); display: flex; flex-direction: column; gap: 8px; }
.h2o-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Tab-hidden: used by admin side-tabs to hide inactive side stacks */
.tab-hidden { display: none !important; }

/* ---- RIGHT: Artboard ---- */
.h2o-studio-artboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Sticky artboard on scroll */
.h2o-artboard-inner {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- Card 3D Flip ---- */
.h2o-card-scene {
    perspective: 1500px;
    width: 100%;
}
.h2o-card-flipper {
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--cs-ease-flip);
}
.h2o-card-flipper.is-flipped {
    transform: rotateY(180deg);
}
.h2o-card-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.h2o-card-face--front {}
.h2o-card-face--back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.h2o-canvas-wrap {
    position: relative;
    border-radius: var(--cs-radius);
    overflow: hidden;
}
.h2o-canvas-wrap canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-card);
    background: #eee;
}

/* ---- Artboard controls bar ---- */
.h2o-artboard-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.h2o-btn-flip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: 1.5px solid var(--cs-border);
    border-radius: 999px;
    background: var(--cs-surface);
    color: var(--cs-text-2);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--cs-font);
    cursor: pointer;
    box-shadow: var(--cs-shadow-sm);
    transition: all var(--cs-ease);
}
.h2o-btn-flip:hover {
    border-color: var(--cs-accent);
    color: var(--cs-accent);
    box-shadow: var(--cs-shadow);
}
.h2o-btn-flip svg { width: 16px; height: 16px; }
.h2o-btn-flip.is-flipped {
    border-color: var(--cs-accent);
    background: var(--cs-accent-subtle);
    color: var(--cs-accent);
}
.h2o-face-indicator {
    display: flex;
    gap: 4px;
}
.h2o-face-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--cs-border);
    color: var(--cs-text-muted);
    transition: all var(--cs-ease);
    cursor: default;
}
.h2o-face-badge--recto.is-active { background: var(--cs-brand-subtle); color: var(--cs-brand); border-color: transparent; }
.h2o-face-badge--verso.is-active { background: rgba(229,85,79,0.1); color: var(--cs-verso); border-color: transparent; }

/* Model gallery — front */
.h2o-model-gallery {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.h2o-model-card-thumb {
    position: relative;
    cursor: pointer;
    border: 2.5px solid transparent;
    border-radius: var(--cs-radius-sm);
    overflow: hidden;
    transition: all var(--cs-ease);
    width: 96px;
    flex-shrink: 0;
    background: var(--cs-surface);
    box-shadow: var(--cs-shadow-sm);
}
.h2o-model-card-thumb img {
    width: 100%;
    display: block;
    aspect-ratio: 85/54;
    object-fit: cover;
    border-radius: calc(var(--cs-radius-sm) - 2px);
}
.h2o-model-card-thumb .h2o-thumb-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--cs-text-2);
    padding: 4px 6px 5px;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.h2o-model-card-thumb .h2o-thumb-lang {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}
.h2o-model-card-thumb:hover {
    border-color: var(--cs-accent);
    box-shadow: var(--cs-shadow);
    transform: translateY(-2px);
}
.h2o-model-card-thumb.selected {
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-glow);
}

/* Legacy thumbnail selectors */
.h2o-thumbnails-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.h2o-thumb { width: 72px; cursor: pointer; border: 2.5px solid transparent; opacity: 0.55; transition: opacity var(--cs-ease), border-color var(--cs-ease); border-radius: var(--cs-radius-sm); overflow: hidden; }
.h2o-thumb img { width: 100%; display: block; border-radius: 4px; }
.h2o-thumb.selected { border-color: var(--cs-brand); opacity: 1; }

/* Legacy model tab buttons */
.h2o-model-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.h2o-model-tab { border: 1px solid var(--cs-border); background: var(--cs-surface); padding: 6px 14px; border-radius: var(--cs-radius-sm); cursor: pointer; font-size: 13px; color: var(--cs-text); font-family: var(--cs-font); transition: all var(--cs-ease); }
.h2o-model-tab.active { border-color: var(--cs-brand); color: var(--cs-brand); font-weight: 600; }

/* ================================================================
   ADMIN — Constructeur de cartes
   ================================================================ */

.h2o-admin-wrap {
    font-family: var(--cs-font);
    color: var(--cs-text);
}

/* Top-level tabs */
.h2o-top-tabs { margin-top: 16px; }
.h2o-panel { display: none; margin-top: 20px; }
.h2o-panel.is-active { display: block; }

/* ---- Model thumb switcher ---- */
.h2o-tabs-header {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 0 14px;
    border-bottom: 1px solid var(--cs-border);
    margin-bottom: 20px;
    align-items: flex-end;
}
.h2o-model-thumb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border: 2px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface);
    cursor: pointer;
    width: 92px;
    transition: border-color var(--cs-ease), box-shadow var(--cs-ease), transform var(--cs-ease);
    font-size: 10px;
    font-weight: 600;
    color: var(--cs-text-2);
    line-height: 1.3;
    text-align: center;
    font-family: var(--cs-font);
}
.h2o-model-thumb-btn img {
    width: 76px;
    height: 48px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}
.h2o-model-thumb-btn:hover {
    border-color: var(--cs-accent);
    transform: translateY(-2px);
    box-shadow: var(--cs-shadow-sm);
}
.h2o-model-thumb-btn.is-active {
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 3px var(--cs-accent-glow);
    color: var(--cs-accent);
}
.h2o-thumb-placeholder {
    width: 76px;
    height: 48px;
    background: var(--cs-bg);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cs-border-hover);
    font-size: 22px;
}
.h2o-thumb-add {
    background: var(--cs-surface-2);
    color: var(--cs-text-muted);
    border-style: dashed;
    font-size: 22px;
    font-weight: 400;
    padding: 12px 6px;
    height: auto;
    min-height: 80px;
    justify-content: center;
}
.h2o-thumb-add:hover { background: var(--cs-accent-subtle); color: var(--cs-accent); border-color: var(--cs-accent); transform: none; }

/* ---- Layout Admin: sidebar | canvas ---- */
.h2o-admin-wrap .h2o-editor-ui {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.h2o-admin-wrap .h2o-sidebar {
    flex: 0 0 var(--cs-sidebar-w);
    width: var(--cs-sidebar-w);
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 20px;
    box-sizing: border-box;
    position: sticky;
    top: 32px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--cs-border) transparent;
    box-shadow: var(--cs-shadow-sm);
}
.h2o-admin-wrap .h2o-sidebar h3 {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-text-muted);
}
.h2o-admin-wrap .h2o-canvas-container {
    flex: 1 1 0;
    min-width: 0;
}

/* ---- Recto/Verso side tabs ---- */
.h2o-side-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--cs-bg);
    padding: 4px;
    border-radius: var(--cs-radius);
    border: 1px solid var(--cs-border);
    width: fit-content;
}
.h2o-side-tab {
    padding: 7px 18px;
    border-radius: var(--cs-radius-sm);
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--cs-text-muted);
    cursor: pointer;
    transition: all var(--cs-ease);
    font-family: var(--cs-font);
}
.h2o-side-tab:hover { color: var(--cs-text); }
.h2o-side-tab.is-active {
    background: var(--cs-surface);
    color: var(--cs-text);
    box-shadow: var(--cs-shadow-sm);
}
.h2o-side-tab[data-side="recto"].is-active { color: var(--cs-brand); }
.h2o-side-tab[data-side="verso"].is-active { color: var(--cs-verso); }
.h2o-side-tab:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---- Canvas visual area ---- */
.h2o-preview-stack {
    margin-bottom: 16px;
}
.h2o-canvas-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cs-text-muted);
    margin-bottom: 8px;
}
.h2o-visual-area {
    position: relative;
    border: 1.5px solid var(--cs-border);
    border-radius: var(--cs-radius);
    background: var(--cs-surface);
    max-width: 100%;
    overflow: hidden;
    min-height: 200px;
    box-shadow: var(--cs-shadow-sm);
}
.h2o-visual-inner {
    position: relative;
    width: 100%;
}
.h2o-preview-canvas {
    width: 100%;
    height: auto;
    display: block;
    background: var(--cs-bg);
}
.h2o-zones-overlay {
    position: absolute;
    inset: 0;
}
.h2o-visual-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--cs-text-2);
    font-weight: 600;
    font-size: 14px;
    background: rgba(255,255,255,0.9);
    border: 2px dashed var(--cs-border);
    border-radius: var(--cs-radius);
    pointer-events: none;
    gap: 8px;
}
.h2o-visual-placeholder::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    background: var(--cs-bg);
    border-radius: var(--cs-radius-sm);
    border: 2px solid var(--cs-border);
}

/* ---- Drag zone overlays ---- */
.h2o-zone {
    position: absolute;
    border: 1.5px dashed rgba(37,99,235,0.5);
    background: rgba(37,99,235,0.06);
    cursor: grab;
    white-space: pre-wrap;
    user-select: none;
    padding: 4px 6px;
    line-height: 1.2;
    overflow: hidden;
    word-break: break-word;
    min-height: 20px;
    border-radius: 3px;
    transition: box-shadow 0.1s;
}
.h2o-zone:hover {
    border-color: var(--cs-accent);
    background: var(--cs-accent-subtle);
    box-shadow: 0 0 0 2px var(--cs-accent-glow);
}
.h2o-zone.is-dragging {
    cursor: grabbing;
    opacity: 0.88;
    box-shadow: 0 6px 20px rgba(37,99,235,0.28);
    z-index: 200;
    border-style: solid;
}
.h2o-zone::after {
    content: attr(data-label);
    position: absolute;
    top: -19px;
    left: 0;
    font-size: 9px;
    font-weight: 700;
    color: var(--cs-accent);
    background: #fff;
    padding: 0 5px;
    border-radius: 3px;
    border: 1px solid var(--cs-accent-glow);
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.04em;
}
.h2o-zone.active {
    border-color: var(--cs-danger);
    border-style: solid;
    background: var(--cs-danger-subtle);
    border-radius: 4px;
    z-index: 100;
}
.h2o-zone.active::after { color: var(--cs-danger); border-color: rgba(239,68,68,0.2); }
.h2o-zone.h2o-zone-image {
    padding: 0;
    background-color: rgba(37,99,235,0.08);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    min-height: 40px;
}
.h2o-zone.h2o-zone-image::after { top: -22px; }
.h2o-zone.h2o-zone-qrcode {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    box-shadow: none;
}
.h2o-zone.h2o-zone-qrcode::after { top: -22px; }
.h2o-zones-overlay .h2o-zone { pointer-events: auto; }

/* ---- Snap guides ---- */
.h2o-snap-guide {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 300;
}
.h2o-snap-guide.is-active { opacity: 1; }
.h2o-snap-v {
    top: 0; bottom: 0; width: 1px;
    background: rgba(37,99,235,0.7);
    box-shadow: 0 0 4px rgba(37,99,235,0.4);
}
.h2o-snap-h {
    left: 0; right: 0; height: 1px;
    background: rgba(37,99,235,0.7);
    box-shadow: 0 0 4px rgba(37,99,235,0.4);
}

/* ---- Add zone button ---- */
.h2o-add-zone {
    margin-top: 10px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-style: dashed !important;
    border-color: var(--cs-border) !important;
    color: var(--cs-text-2) !important;
    background: var(--cs-surface-2) !important;
    border-radius: var(--cs-radius-sm) !important;
    padding: 9px !important;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--cs-ease) !important;
}
.h2o-add-zone:hover {
    border-color: var(--cs-accent) !important;
    color: var(--cs-accent) !important;
    background: var(--cs-accent-subtle) !important;
}
.h2o-add-zone[disabled] { opacity: 0.4; cursor: not-allowed !important; }

/* ---- Contextual Inspector Toolbar ---- */
.h2o-inspector-toolbar {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 10px 12px;
    margin-bottom: 14px;
    box-shadow: var(--cs-shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.h2o-inspector-toolbar .it-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-text-muted);
    width: 100%;
    margin-bottom: 2px;
}
.h2o-inspector-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}
.h2o-it-input {
    height: 30px;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-xs);
    font-size: 12px;
    padding: 0 8px;
    font-family: var(--cs-font);
    outline: none;
    transition: border-color var(--cs-ease);
    background: var(--cs-surface);
    color: var(--cs-text);
}
.h2o-it-input:focus { border-color: var(--cs-accent); box-shadow: 0 0 0 2px var(--cs-accent-subtle); }
.h2o-it-font { flex: 1; min-width: 110px; }
.h2o-it-size { width: 56px; text-align: center; }
.h2o-it-color { width: 30px; height: 30px; padding: 2px; border-radius: var(--cs-radius-xs); cursor: pointer; }
.h2o-it-align-group { display: flex; gap: 2px; }
.h2o-it-align {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-xs);
    background: var(--cs-surface);
    cursor: pointer;
    transition: all var(--cs-ease);
    padding: 0;
    font-family: var(--cs-font);
}
.h2o-it-align:hover { border-color: var(--cs-accent); background: var(--cs-accent-subtle); }
.h2o-it-align.is-active { background: var(--cs-accent); border-color: var(--cs-accent); color: #fff; }
.h2o-it-align svg { width: 12px; height: 12px; }

/* ---- Accordion ---- */
.h2o-accordion { display: flex; flex-direction: column; gap: 8px; }
.h2o-acc-item {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface);
    cursor: move;
    transition: border-color var(--cs-ease);
}
.h2o-acc-item.drag-over { border-color: var(--cs-accent); box-shadow: 0 0 0 2px var(--cs-accent-subtle); }
.h2o-acc-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px 12px 0;
}
.h2o-acc-toggle {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--cs-font);
    color: var(--cs-text);
    text-align: left;
}
.h2o-acc-toggle:hover { color: var(--cs-accent); }
.h2o-acc-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2o-acc-inline { display: flex; min-width: 180px; padding-bottom: 12px; gap: 6px; align-items: center; }
.h2o-acc-inline label { font-size: 11px; text-transform: uppercase; color: var(--cs-text-muted); letter-spacing: 0.05em; white-space: nowrap; }
.h2o-acc-inline input { width: 100%; border: 1px solid var(--cs-border); border-radius: var(--cs-radius-xs); padding: 5px 8px; font-size: 12px; font-family: var(--cs-font); }
.h2o-acc-body { padding: 0 12px 12px; }

/* ---- Form field groups (Admin) ---- */
.h2o-field-group { margin-bottom: 14px; }
.h2o-field-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cs-text-muted);
    margin-bottom: 6px;
}
.h2o-field-group input[type="text"],
.h2o-field-group input[type="number"],
.h2o-field-group input[type="url"],
.h2o-field-group select,
.h2o-field-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-xs);
    font-size: 13px;
    font-family: var(--cs-font);
    background: var(--cs-surface);
    color: var(--cs-text);
    transition: border-color var(--cs-ease);
    box-sizing: border-box;
}
.h2o-field-group input:focus,
.h2o-field-group select:focus,
.h2o-field-group textarea:focus {
    outline: none;
    border-color: var(--cs-accent);
    box-shadow: 0 0 0 2px var(--cs-accent-subtle);
}
.h2o-props-section {
    border: 1px solid var(--cs-border);
    padding: 10px 12px;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface-2);
    margin-bottom: 10px;
}
.h2o-props-section .h2o-field-group { margin-bottom: 10px; }
.h2o-props-section .h2o-field-group:last-child { margin-bottom: 0; }
.h2o-props-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.h2o-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.h2o-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.h2o-btn-group { display: flex; gap: 8px; margin: 12px 0; }

/* Admin image preview */
.h2o-zone-image-preview {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    padding: 8px;
    min-height: 70px;
    background: var(--cs-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.h2o-zone-image-preview img { max-width: 100%; height: auto; display: block; }
.h2o-zone-image-preview.is-empty { font-size: 12px; color: var(--cs-text-muted); font-style: italic; }
.h2o-zone-image-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Verso section */
#h2o-verso-section.is-hidden { display: none; }
.h2o-verso-toggle { border: 1px solid var(--cs-border); padding: 10px 12px; border-radius: var(--cs-radius-sm); background: var(--cs-surface-2); }

/* Font controls */
.zone-font-url   { display: none; }
.zone-font-preset { display: none; }
.zone-font-preset.is-visible { display: block; }
.zone-font-url.is-visible    { display: block; }

/* Gallery */
.h2o-models-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.h2o-model-card {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 16px;
    background: var(--cs-surface);
    box-shadow: var(--cs-shadow-sm);
    transition: box-shadow var(--cs-ease);
}
.h2o-model-card:hover { box-shadow: var(--cs-shadow); }
.h2o-model-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.h2o-model-card-header h4 { margin: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2o-model-card-body { display: flex; gap: 8px; margin-bottom: 8px; }
.h2o-model-thumb { flex: 1; min-height: 100px; border: 1px solid var(--cs-border); border-radius: var(--cs-radius-sm); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--cs-surface-2); }
.h2o-model-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h2o-model-meta { font-size: 12px; color: var(--cs-text-muted); margin: 0; }

/* Props hint */
.h2o-props-hint, .description {
    font-size: 11px;
    color: var(--cs-text-muted);
    margin: 4px 0 0;
    line-height: 1.5;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 780px) {
    .h2o-studio-layout {
        grid-template-columns: 1fr;
    }
    .h2o-studio-controls {
        max-height: none;
    }
    .h2o-artboard-inner {
        position: static;
    }
    .h2o-form-panel {
        overflow: visible;
        max-height: none;
    }
    .h2o-card-app-wrapper {
        padding: 12px;
    }
}

@media (max-width: 960px) {
    .h2o-admin-wrap .h2o-editor-ui {
        flex-direction: column;
    }
    .h2o-admin-wrap .h2o-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}
