/* ── Reset / base ──────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #222;
    background: #f0f0f0;
}

/* ── Top bar ───────────────────────────────────────────────────── */
.gs-topbar {
    height: 48px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.gs-topbar__left {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 8px;
    flex-shrink: 0;
}

.gs-topbar__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 4px;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.gs-topbar__back:hover {
    background: rgba(0, 0, 0, 0.06);
}

.gs-topbar__logo {
    display: flex;
    align-items: center;
    padding: 0 8px 0 0;
    margin-right: 8px;
    text-decoration: none;
    color: inherit;
}

.gs-topbar__logo-img {
    height: 50px;
    display: block;
}

.gs-topbar__logo-text {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #d00;
}

.gs-topbar__action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    border: none;
    background: none;
    cursor: pointer;
    color: #444;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1;
    transition: background 0.1s;
    white-space: nowrap;
}

.gs-topbar__action:hover {
    background: #f0f0f0;
}

.gs-topbar__action svg,
.gs-topbar__action .gs-topbar__icon {
    display: block;
    width: 18px;
    height: 18px;
    stroke: #555;
    fill: none;
    stroke-width: 1.5;
}

/* ── Sync status indicator ────────────────────────────────────── */
.gs-sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 20px;
    flex-shrink: 0;
}

.gs-sync-icon {
    display: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gs-sync-status__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    white-space: nowrap;
}

.gs-sync-status__label {
    font-size: 10px;
    color: #999;
}

.gs-sync-status__value {
    font-size: 11px;
    color: #666;
}

.gs-sync-status[data-sync="synced"] .gs-sync-icon--synced {
    display: block;
    stroke: #27ae60;
}

.gs-sync-status[data-sync="unsaved"] .gs-sync-icon--unsaved {
    display: block;
    stroke: #e67e22;
}

.gs-sync-status[data-sync="saving"] .gs-sync-icon--saving {
    display: block;
    stroke: #888;
    animation: gs-spin 1s linear infinite;
}

.gs-sync-status[data-sync="error"] .gs-sync-icon--unsaved {
    display: block;
    stroke: #c0392b;
}

@keyframes gs-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.gs-topbar__center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-order-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.gs-order-name__label {
    font-size: 10px;
    color: #aaa;
    letter-spacing: 0.02em;
    user-select: none;
}

.gs-order-name__row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gs-order-name__text {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gs-order-name__edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: #d00;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.1s;
}

.gs-order-name__edit-btn:hover {
    opacity: 1;
}

.gs-order-name__input {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    border: none;
    border-bottom: 1.5px solid #bbb;
    outline: none;
    background: transparent;
    font-family: inherit;
    width: 240px;
    display: none;
}

.gs-topbar__right {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    flex-shrink: 0;
}

.gs-topbar__right-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    border-radius: 4px;
    letter-spacing: 0.02em;
    transition: background 0.1s;
}

.gs-topbar__right-btn:hover {
    background: #f0f0f0;
}

.gs-topbar__right-btn--dark {
    background: #1a1a1a;
    color: #fff;
}

.gs-topbar__right-btn--dark:hover {
    background: #333;
}

.gs-topbar__right-btn--order {
    background: #000;
    color: #fff;
    gap: 8px;
    padding: 6px 14px;
    font-size: 14px;
    text-transform: uppercase;
}

.gs-topbar__right-btn--order:hover {
    background: #333;
}

.gs-topbar__right-btn--order:disabled {
    background: #999;
    cursor: not-allowed;
}

.gs-topbar__order-total-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    padding-right: 8px;
}

.gs-topbar__order-total {
    font-size: 18px;
    font-weight: 700;
    opacity: 0.9;
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.gs-topbar__order-total__original {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.6;
    text-decoration: line-through;
}

.gs-topbar__order-total__badge {
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    padding: 1px 4px;
}

.gs-topbar__order-vat {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.65;
}

/* ── Workspace (below top bar) ─────────────────────────────────── */
.gs-workspace {
    display: flex;
    height: calc(100vh - 48px);
    overflow: hidden;
}

/* ── Left / right panels ───────────────────────────────────────── */
.gs-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gs-panel--left {
    width: 400px;
    background: #fff;
    border-right: 1px solid #ddd;
}

.gs-panel--right {
    background: #1e1e1e;
    color: #fff;
    border-left: 1px solid #111;
}

.gs-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 44px;
    flex-shrink: 0;
    border-bottom: 1px solid #e8e8e8;
}

.gs-panel__header--selector {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 10px 0 0;
    gap: 6px;
}

.gs-panel__header-label {
    padding: 0 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #aaa;
}

.gs-panel__header-product {
    padding: 0 14px 10px;
    font-size: 15px;
    font-weight: 700;
    color: #222;
    border-bottom: 1px solid #ebebeb;
}

.gs-panel--right .gs-panel__header {
    border-bottom-color: #333;
}

.gs-panel__title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gs-panel--right .gs-panel__title {
    color: #fff;
}

.gs-panel__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #aaa;
    padding: 0;
    transition: color 0.1s;
}

.gs-panel__close:hover {
    color: #222;
}

/* Tab bar inside left panel */
.gs-panel__tabs {
    display: flex;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.gs-ptab {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #aaa;
    border-bottom: 2px solid transparent;
    transition: color 0.1s, border-color 0.1s;
}

.gs-ptab.active,
.gs-ptab:hover {
    color: #222;
    border-bottom-color: #222;
}

.gs-ptab-panel {
    display: none;
    overflow-y: auto;
    flex: 1;
}

.gs-ptab-panel.active {
    display: block;
}

/* ── Left panel footer (summary + add to cart) ───────────────── */
.gs-panel__footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid #e8e8e8;
    background: #fff;
}

.gs-order-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.gs-order-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gs-order-summary__label {
    font-size: 13px;
    color: #666;
}

.gs-order-summary__value {
    font-size: 13px;
    font-weight: 600;
    color: #222;
}

.gs-order-summary__value--total {
    font-size: 15px;
    font-weight: 700;
}

.gs-qty {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.gs-qty__btn {
    width: 32px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    line-height: 1;
    padding: 0;
}

.gs-qty__btn:hover {
    background: #e8e8e8;
}

.gs-qty__val {
    min-width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-add-to-cart {
    width: 100%;
    height: 44px;
    border: none;
    background: #222;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}

.gs-add-to-cart:hover {
    background: #444;
}

/* ── Center designer area ──────────────────────────────────────── */
.gs-designer {
    flex: 1;
    overflow-y: auto;
    background: #e8e8e8;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gs-designer dm-designer,
.gs-designer fr-designer {
    flex: 1;
    min-height: 0;
}


/* ── Home page (root index.html) ───────────────────────────────── */
.gs-home-page {
    height: 100vh;
    overflow: auto;
    background: #f7f7f7;
}

.gs-home-topbar {
    height: 48px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.gs-home-body {
    max-width: 960px;
    margin: 48px auto;
    padding: 0 24px;
}

.gs-home-body h2 {
    font-size: 18px;
    font-weight: 600;
    color: #444;
    margin: 0 0 24px;
}

.gs-home__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gs-home-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 28px 24px;
    background: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.gs-home-card:hover {
    border-color: #aaa;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.gs-home-card__title {
    font-size: 15px;
    font-weight: 700;
}

.gs-home-card__desc {
    font-size: 13px;
    color: #777;
}

/* ── Save toast ────────────────────────────────────────────────── */
.gs-save-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #1a1a1a;
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 99999;
    white-space: nowrap;
}

.gs-save-toast.gs-save-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gs-save-toast.gs-save-toast--error {
    background: #c0392b;
}

/* ── Unsaved changes modal ─────────────────────────────────────── */
.gs-unsaved-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-unsaved-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 40, 0.35);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
}

.gs-unsaved-modal__card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 32px 32px 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
}

.gs-unsaved-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.gs-unsaved-modal__text {
    font-size: 13px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.4;
}

.gs-unsaved-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.gs-unsaved-modal__btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.12s, opacity 0.12s;
}

.gs-unsaved-modal__btn--ghost {
    background: transparent;
    color: #666;
}

.gs-unsaved-modal__btn--ghost:hover {
    background: #f2f2f2;
}

.gs-unsaved-modal__btn--primary {
    background: #222;
    color: #fff;
}

.gs-unsaved-modal__btn--primary:hover {
    background: #444;
}