:root {
    color-scheme: light;
    font-family: Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
    letter-spacing: 0;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.concept-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.concept-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
}

.concept-nav a[aria-current="page"] { pointer-events: none; }

.app-header {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; font-weight: 900; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1; text-transform: uppercase; }
.brand p { margin: 5px 0 0; font-size: 10px; font-weight: 700; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.primary-action, .secondary-action, #logo-toggle-btn {
    min-height: 38px;
    border: 0;
    padding: 0 15px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.settings-wrap { position: relative; }
.settings-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    border: 1px solid currentColor;
    padding: 0 13px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.settings-button svg, .icon-button svg { width: 16px; height: 16px; }
.settings-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 100;
    width: min(310px, calc(100vw - 24px));
    padding: 14px;
    background: #fff;
    color: #172126;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    box-shadow: 0 18px 48px rgba(24, 34, 39, .2);
}
.settings-popover[hidden] { display: none; }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.settings-heading strong, .settings-heading span { display: block; }
.settings-heading strong { font-size: 13px; }
.settings-heading span { margin-top: 3px; color: #68777d; font-size: 11px; }
.icon-button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; color: inherit; }
.theme-options { display: grid; gap: 7px; }
.theme-option {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 62px;
    padding: 8px;
    border: 1px solid #d8dfe2;
    border-radius: 4px;
    background: #fff;
    color: #172126;
    text-align: left;
}
.theme-option:hover { border-color: #8a989e; }
.theme-option[aria-pressed="true"] { border: 2px solid #d83227; padding: 7px; }
.theme-option strong, .theme-option small { display: block; }
.theme-option strong { font-size: 12px; }
.theme-option small { margin-top: 3px; color: #6b797f; font-size: 10px; }
.theme-check { width: 16px; height: 16px; opacity: 0; }
.theme-option[aria-pressed="true"] .theme-check { opacity: 1; color: #d83227; }
.theme-swatch { display: grid; grid-template-columns: 15px 1fr 13px; width: 54px; height: 42px; overflow: hidden; border: 1px solid #9ca7ab; border-radius: 2px; }
.studio-swatch span:nth-child(1), .studio-swatch span:nth-child(3) { background: #fff; }
.studio-swatch span:nth-child(2) { background: #e9edef; }
.workbench-swatch span:nth-child(1), .workbench-swatch span:nth-child(3) { background: #252923; }
.workbench-swatch span:nth-child(2) { background: #3a3d36; }
.catalogue-swatch span:nth-child(1) { background: #fff; }
.catalogue-swatch span:nth-child(2) { background: #e7e3d8; }
.catalogue-swatch span:nth-child(3) { background: #f2f0e9; }

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 16px;
}

.panel-title h2, .field-label {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.count-pill { padding: 4px 7px; font-size: 10px; font-weight: 800; }

.search-wrap { position: relative; padding: 12px; }
.search-wrap::before {
    content: "";
    position: absolute;
    left: 25px;
    top: 50%;
    width: 7px;
    height: 7px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translateY(-65%);
    opacity: .55;
}
.search-wrap::after {
    content: "";
    position: absolute;
    left: 34px;
    top: 51%;
    width: 6px;
    height: 2px;
    background: currentColor;
    transform: rotate(45deg);
    opacity: .55;
}

#sign-search {
    width: 100%;
    height: 42px;
    border: 0;
    padding: 0 12px 0 38px;
    outline: none;
    font-size: 12px;
    font-weight: 700;
}

.library-panel, .editor-panel, .preview-panel { min-width: 0; min-height: 0; overflow: hidden; }
.library-panel { display: flex; flex-direction: column; }
#category-list { flex: 1; overflow: auto; }

.preview-panel { position: relative; display: flex; flex-direction: column; }
.preview-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 28px; }
.preview-meta { position: absolute; top: 14px; left: 16px; z-index: 2; font-size: 10px; font-weight: 800; text-transform: uppercase; }

#capture-area.paper-preview {
    width: min(34vw, calc(68vh * .707));
    max-width: 430px;
    aspect-ratio: 1 / 1.414;
    flex: none;
    overflow: hidden;
    background: #fff;
}

#capture-area.paper-preview.landscape {
    width: min(48vw, calc(64vh * 1.414));
    max-width: 700px;
    aspect-ratio: 1.414 / 1;
}

#sign-svg-container, #sign-svg-container svg, #category-list svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
}

#sign-text-display {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.editor-panel { display: flex; flex-direction: column; overflow-y: auto; }
.editor-section { padding: 18px; }
.field-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.clear-btn { width: 30px; height: 30px; border: 0; background: transparent; font-size: 18px; }

#sign-text-input {
    width: 100%;
    min-height: 102px;
    resize: vertical;
    padding: 12px;
    outline: none;
    font-weight: 650;
    line-height: 1.4;
}

.field-foot { display: flex; justify-content: flex-end; margin-top: 6px; font-size: 10px; font-weight: 700; }
#alignment-buttons { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.align-btn { display: grid; place-items: center; min-height: 38px; border: 0; }
.align-btn svg { width: 17px; height: 17px; }
.logo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-export { margin-top: auto; padding: 18px; }
#generate-pdf-btn { width: 100%; min-height: 50px; border: 0; font-weight: 850; text-transform: uppercase; }

/* Concept 1: rugged site workstation */
.workbench { background: #20231f; color: #f6f4eb; }
.workbench .app-header { height: 72px; background: #111310; border-bottom: 1px solid #454a40; }
.workbench .brand-mark { background: #f2c500; color: #111310; clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 8px; }
.workbench .brand p { color: #a4aa9c; }
.workbench .concept-nav { background: #272b25; padding: 4px; }
.workbench .concept-nav a { color: #aeb4a7; }
.workbench .concept-nav a[aria-current="page"] { background: #f2c500; color: #111310; }
.workbench .primary-action { background: #f2c500; color: #111310; }
.workbench .workspace { height: calc(100vh - 72px); display: grid; grid-template-columns: 310px minmax(430px, 1fr) 310px; }
.workbench .library-panel { background: #292d27; border-right: 1px solid #454a40; }
.workbench .editor-panel { background: #242722; border-left: 1px solid #454a40; }
.workbench .panel-title, .workbench .editor-section { border-bottom: 1px solid #454a40; }
.workbench .count-pill { background: #3a3f37; color: #d5d8d0; }
.workbench #sign-search, .workbench #sign-text-input { background: #171916; color: #fff; border: 1px solid #4b5047; }
.workbench #sign-search:focus, .workbench #sign-text-input:focus { border-color: #f2c500; }
.workbench #category-list > div.sticky { background: #1b1e1a !important; color: #f2c500; border-color: #454a40 !important; box-shadow: none; }
.workbench .sign-picker-button { border: 1px solid #4b5047 !important; background: #f4f3ee !important; }
.workbench .sign-picker-button:hover { border-color: #f2c500 !important; transform: none !important; }
.workbench .sign-picker-button.ring-2 { outline: 3px solid #f2c500; background: #fff !important; }
.workbench .preview-panel { background: #3a3d36; background-image: linear-gradient(#41453d 1px, transparent 1px), linear-gradient(90deg, #41453d 1px, transparent 1px); background-size: 24px 24px; }
.workbench .preview-meta { color: #f2c500; }
.workbench #capture-area { box-shadow: 0 18px 50px rgba(0,0,0,.42); }
.workbench .field-label { color: #c8ccc2; }
.workbench .align-btn { background: #171916; color: #f4f3ee; border-right: 1px solid #454a40; }
.workbench .align-btn.bg-terracotta { background: #f2c500 !important; color: #111310; }
.workbench #logo-toggle-btn { background: #3b4038; color: #fff; border: 1px solid #5a6055; }
.workbench #generate-pdf-btn { background: #f2c500; color: #111310; }

/* Concept 2: clean technical studio */
.studio { background: #f3f5f6; color: #172126; }
.studio .app-header { height: 76px; background: #fff; border-bottom: 1px solid #d8dfe2; }
.studio .brand-mark { background: #d83227; color: #fff; border-radius: 4px; }
.studio .brand p { color: #6c7b82; }
.studio .concept-nav a { color: #607078; border-bottom: 2px solid transparent; }
.studio .concept-nav a[aria-current="page"] { color: #172126; border-color: #d83227; }
.studio .primary-action { background: #d83227; color: #fff; border-radius: 4px; }
.studio .workspace { height: calc(100vh - 76px); display: grid; grid-template-columns: 310px minmax(440px, 1fr) 320px; grid-template-areas: "library preview editor"; }
.studio .library-panel { grid-area: library; background: #fff; border-right: 1px solid #d8dfe2; }
.studio .editor-panel { grid-area: editor; background: #fff; border-left: 1px solid #d8dfe2; }
.studio .editor-export { padding-top: 12px; }
.studio .preview-panel { grid-area: preview; background: #e9edef; }
.studio .panel-title { border-bottom: 1px solid #e4e9eb; }
.studio .count-pill { background: #edf1f2; color: #526168; border-radius: 3px; }
.studio #sign-search { background: #f3f5f6; border: 1px solid #d8dfe2; border-radius: 4px; }
.studio #category-list > div.sticky { background: #f7f9f9 !important; border-color: #d8dfe2 !important; box-shadow: none; }
.studio #category-list > .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.studio .sign-picker-button { border: 1px solid #d8dfe2 !important; border-radius: 3px; }
.studio .sign-picker-button:hover { border-color: #d83227 !important; transform: none !important; }
.studio .sign-picker-button.ring-2 { outline: 2px solid #d83227; box-shadow: none !important; background: #fff !important; }
.studio .preview-meta { color: #6a777d; }
.studio #capture-area { box-shadow: 0 16px 45px rgba(30,42,48,.16); }
.studio .editor-section { border-bottom: 1px solid #e4e9eb; }
.studio #sign-text-input { border: 1px solid #ccd5d9; border-radius: 4px; }
.studio .align-btn { background: #f2f5f6; color: #243238; border-right: 1px solid #d7dfe2; }
.studio .align-btn.bg-terracotta { background: #d83227 !important; color: #fff; }
.studio #logo-toggle-btn { background: #fff; color: #243238; border: 1px solid #ccd5d9; border-radius: 4px; }
.studio #generate-pdf-btn { background: #172126; color: #fff; border-radius: 4px; }

/* Concept 3: visual sign catalogue */
.catalogue { background: #f2f0e9; color: #161616; }
.catalogue .app-header { height: 66px; background: #f2f0e9; border-bottom: 3px solid #161616; }
.catalogue .brand-mark { background: #176a4d; color: #fff; }
.catalogue .brand p { color: #176a4d; }
.catalogue .concept-nav { border: 2px solid #161616; }
.catalogue .concept-nav a + a { border-left: 2px solid #161616; }
.catalogue .concept-nav a[aria-current="page"] { background: #176a4d; color: #fff; }
.catalogue .primary-action { background: #161616; color: #fff; border: 2px solid #161616; }
.catalogue .workspace { height: calc(100vh - 66px); display: grid; grid-template-columns: 280px minmax(520px, 1fr) 360px; grid-template-areas: "editor library preview"; }
.catalogue .editor-panel { grid-area: editor; background: #f2f0e9; border-right: 2px solid #161616; }
.catalogue .library-panel { grid-area: library; background: #fff; border-right: 2px solid #161616; }
.catalogue .preview-panel { grid-area: preview; background: #e7e3d8; }
.catalogue .panel-title, .catalogue .editor-section { border-bottom: 2px solid #161616; }
.catalogue .count-pill { background: #f2c500; border: 1px solid #161616; }
.catalogue #sign-search { background: #fff; border: 2px solid #161616; }
.catalogue #category-list > div.sticky { background: #f2c500 !important; border-color: #161616 !important; box-shadow: none; }
.catalogue #category-list > .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.catalogue .sign-picker-button { border: 2px solid #161616 !important; background: #fff !important; padding: 6px !important; }
.catalogue .sign-picker-button:hover { background: #f2f0e9 !important; transform: translateY(-2px) !important; }
.catalogue .sign-picker-button.ring-2 { outline: 4px solid #176a4d; box-shadow: none !important; }
.catalogue .preview-meta { background: #161616; color: #fff; padding: 5px 8px; }
.catalogue .preview-stage { padding: 48px 24px 24px; }
.catalogue #capture-area.paper-preview { width: min(100%, 310px); }
.catalogue #capture-area.paper-preview.landscape { width: min(100%, 320px); }
.catalogue #capture-area { box-shadow: 8px 8px 0 #161616; border: 2px solid #161616; }
.catalogue #sign-text-input { border: 2px solid #161616; background: #fff; }
.catalogue .align-btn { background: #fff; border: 2px solid #161616; border-right: 0; }
.catalogue .align-btn:last-child { border-right: 2px solid #161616; }
.catalogue .align-btn.bg-terracotta { background: #176a4d !important; color: #fff; }
.catalogue #logo-toggle-btn { background: #fff; border: 2px solid #161616; color: #161616; }
.catalogue #generate-pdf-btn { background: #176a4d; color: #fff; border: 2px solid #161616; }

/* The production app keeps the Technical Studio workspace arrangement for every theme. */
.theme-shell .workspace {
    grid-template-columns: 310px minmax(440px, 1fr) 320px;
    grid-template-areas: "library preview editor";
}
.theme-shell .library-panel { grid-area: library; }
.theme-shell .preview-panel { grid-area: preview; }
.theme-shell .editor-panel { grid-area: editor; }
.theme-shell.catalogue .library-panel { border-right: 2px solid #161616; }
.theme-shell.catalogue .editor-panel { border-right: 0; border-left: 2px solid #161616; }
.theme-shell.catalogue #category-list > .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.theme-shell.catalogue .preview-stage { padding: 28px; }
.theme-shell.catalogue #capture-area.paper-preview {
    width: min(34vw, calc(68vh * .707));
    max-width: 430px;
}
.theme-shell.catalogue #capture-area.paper-preview.landscape {
    width: min(48vw, calc(64vh * 1.414));
    max-width: 700px;
}
.workbench .settings-button { color: #f4f3ee; border-color: #555c51; }
.workbench .settings-popover { border-color: #454a40; }
.catalogue .settings-button { border: 2px solid #161616; background: #fff; color: #161616; }
.catalogue .settings-popover { border: 2px solid #161616; border-radius: 0; box-shadow: 6px 6px 0 #161616; }
.catalogue .theme-option { border: 2px solid #161616; border-radius: 0; }
.catalogue .theme-option[aria-pressed="true"] { border-color: #176a4d; outline: 2px solid #176a4d; }
.catalogue .theme-option[aria-pressed="true"] .theme-check { color: #176a4d; }

@media (max-width: 1000px) {
    body { overflow: auto; }
    .app-header { flex-wrap: wrap; gap: 8px; padding-block: 10px; }
    .header-actions { width: 100%; justify-content: space-between; }
    .workbench .workspace, .catalogue .workspace, .studio .workspace {
        height: auto;
        min-height: calc(100vh - 110px);
        display: flex;
        flex-direction: column;
    }
    .preview-panel { min-height: 620px; order: -1; }
    .library-panel { min-height: 520px; }
    .editor-panel { min-height: 420px; }
    .studio .editor-panel { display: flex; }
    #capture-area.paper-preview { width: min(80vw, 390px); }
}

@media (max-width: 600px) {
    .app-header { align-items: flex-start; }
    .workbench .app-header, .studio .app-header, .catalogue .app-header { height: auto; }
    .brand { width: 100%; }
    .header-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .concept-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .concept-nav a { justify-content: center; min-width: 0; padding: 0 4px; font-size: 9px; }
    .header-actions .primary-action { width: 100%; }
    .settings-wrap, .settings-button { width: 100%; }
    .settings-popover { position: fixed; top: 12px; right: 12px; }
    .preview-panel { min-height: 570px; }
    .preview-stage { padding-inline: 16px; }
    .catalogue #capture-area.paper-preview { width: min(78vw, 300px); }
}
