/*
 * Application-level layout fallback.
 * Keeps the CakePHP screens usable when the Enigma/Tailwind bundle is missing
 * or partially unavailable in the deployed webroot.
 */
:root {
    --shin-bg: #f4f7fb;
    --shin-panel: #ffffff;
    --shin-border: rgba(15, 23, 42, 0.12);
    --shin-muted: #64748b;
    --shin-text: #0f172a;
    --shin-primary: #123852;
    --shin-primary-strong: #0f2f46;
    --shin-primary-soft: #e8f1f7;
}

html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    background: var(--shin-bg);
    color: var(--shin-text);
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    max-width: 100%;
    vertical-align: middle;
}

.enigma {
    min-height: 100vh;
    background: var(--shin-bg);
}

.shin-enigma-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 320px !important;
    background: var(--shin-primary);
    color: #e8f1f7;
    z-index: 50;
}

.side-menu__content {
    width: 320px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.side-menu__content > div:first-child {
    width: 100% !important;
    padding-left: 2.75rem !important;
    padding-right: 1.75rem !important;
}

.side-menu__content > div:first-child > a {
    align-items: center;
    min-width: 0;
}

.side-menu__content > div:first-child > a > div {
    margin-left: 0.75rem;
    min-width: 0;
    white-space: nowrap;
}

.side-menu__content > div:first-child > a > img[style*="display: none"] + div {
    margin-left: 0 !important;
}

.side-menu ul,
.side-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.side-menu .scrollable {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem 1.25rem 1.5rem 1.75rem;
}

.side-menu__group-label {
    margin: 0.75rem 0 0.5rem;
    color: rgba(232, 241, 247, 0.55);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.side-menu__link {
    display: flex;
    align-items: center;
    min-height: 2.65rem;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.55rem;
    color: rgba(232, 241, 247, 0.82);
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}

.side-menu__link:hover,
.side-menu__link--active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.side-menu__link__icon,
[data-lucide] {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

[data-lucide]:empty {
    display: none;
}

main .inline-flex:has(> [data-lucide]:empty),
main span:has(> [data-lucide]:empty) {
    display: none;
}

.side-menu__link__title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.shin-enigma-topbar {
    position: fixed;
    top: 0.75rem;
    left: 352px !important;
    right: 1rem;
    min-height: 76px;
    height: auto !important;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--shin-border);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    color: var(--shin-text);
}

.shin-enigma-topbar > * {
    min-width: 0;
}

.shin-enigma-content {
    min-height: 100vh;
    margin-left: 320px !important;
    padding: 7rem 2rem 2.5rem !important;
}

.shin-enigma-content > .relative,
.shin-enigma-content > div {
    max-width: 1240px;
    margin: 0 auto;
}

.box,
.content-card,
.content,
.view.content {
    border: 1px solid var(--shin-border);
    border-radius: 0.75rem;
    background: var(--shin-panel);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.box {
    overflow: hidden;
}

.btn,
button.btn,
a.btn,
input[type="submit"].btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.5rem;
    max-width: 100%;
    padding: 0.55rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    text-decoration: none;
}

.btn svg,
.btn [data-lucide] {
    flex: 0 0 auto;
}

.btn-primary,
.btn-success {
    background: var(--shin-primary);
    border-color: var(--shin-primary);
    color: #ffffff;
}

.btn-primary:hover,
.btn-success:hover {
    background: var(--shin-primary-strong);
    color: #ffffff;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-secondary {
    background: #ffffff;
    border-color: var(--shin-border);
    color: var(--shin-primary);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-secondary:hover {
    background: var(--shin-primary-soft);
    color: var(--shin-primary);
}

.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #111827;
}

.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.btn-sm {
    min-height: 2rem;
    padding: 0.38rem 0.7rem;
    font-size: 0.78rem;
}

.form-select,
select,
input[type="text"],
input[type="search"],
input[type="email"],
textarea {
    width: 100%;
    min-height: 2.5rem;
    border: 1px solid var(--shin-border);
    border-radius: 0.5rem;
    background: #ffffff;
    padding: 0.55rem 0.75rem;
    color: var(--shin-text);
    line-height: 1.4;
}

textarea {
    min-height: 5rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
}

pre,
code {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.intro-y {
    margin-top: 1.25rem;
}

.grid {
    display: grid;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.block {
    display: block;
}

.hidden {
    display: none;
}

.items-center {
    align-items: center;
}

.items-end {
    align-items: flex-end;
}

.items-start {
    align-items: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-start {
    justify-content: flex-start;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-col {
    flex-direction: column;
}

.flex-none {
    flex: none;
}

.min-w-0 {
    min-width: 0;
}

.h-full {
    height: 100%;
}

.h-4,
.w-4 {
    width: 1rem;
    height: 1rem;
}

.h-5,
.w-5 {
    width: 1.25rem;
    height: 1.25rem;
}

.h-7,
.w-7 {
    width: 1.75rem;
    height: 1.75rem;
}

.h-9 {
    height: 2.25rem;
}

.h-10,
.w-10 {
    width: 2.5rem;
    height: 2.5rem;
}

.gap-1\.5 {
    gap: 0.375rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-5 {
    gap: 1.25rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid-cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

.grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.col-span-12 {
    grid-column: span 12 / span 12;
}

.w-full {
    width: 100%;
}

.max-w-3xl {
    max-width: 48rem;
}

.mr-auto {
    margin-right: auto;
}

.ml-auto {
    margin-left: auto;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-5 {
    margin-top: 1.25rem;
}

.mt-6,
.mt-8 {
    margin-top: 1.5rem;
}

.mb-3,
.mb-4 {
    margin-bottom: 1rem;
}

.mr-1 {
    margin-right: 0.25rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mr-4 {
    margin-right: 1rem;
}

.ml-3 {
    margin-left: 0.75rem;
}

.ml-4 {
    margin-left: 1rem;
}

.p-0 {
    padding: 0;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-5 {
    padding: 1.25rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-5 {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.pt-5 {
    padding-top: 1.25rem;
}

#chat-history {
    padding-top: 1.25rem;
}

#chat-history .msg-ai:first-child,
#chat-history > .msg-ai:first-child {
    margin-top: 0.25rem;
}

.project-wizard-panel {
    padding: 1.5rem;
}

.project-wizard-progress-wrap {
    overflow-x: auto;
    padding: 0.25rem 0.25rem 0.75rem;
}

.wizard-progress {
    display: flex;
    align-items: stretch;
    min-width: 860px;
}

.wizard-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 9rem;
    min-height: 4.25rem;
    padding: 0.75rem;
    border: 1px solid var(--shin-border);
    border-radius: 0.75rem;
    background: #ffffff;
}

.wizard-step.is-active {
    border-color: var(--shin-primary);
    background: var(--shin-primary-soft);
    box-shadow: 0 10px 22px rgba(18, 56, 82, 0.12);
}

.wizard-step.is-done {
    border-color: rgba(15, 118, 110, 0.35);
    background: rgba(15, 118, 110, 0.07);
}

.wizard-step-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border-radius: 9999px;
    background: #e2e8f0;
    color: var(--shin-muted);
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
}

.wizard-step.is-active .wizard-step-marker {
    background: var(--shin-primary);
    color: #ffffff;
}

.wizard-step.is-done .wizard-step-marker {
    background: #0f766e;
    color: #ffffff;
}

.wizard-step-copy {
    min-width: 0;
}

.wizard-step-kicker {
    color: var(--shin-muted);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.wizard-step-label {
    margin-top: 0.2rem;
    color: var(--shin-text);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.wizard-step.is-active .wizard-step-kicker,
.wizard-step.is-active .wizard-step-label {
    color: var(--shin-primary);
}

.wizard-step-connector {
    align-self: center;
    width: 1.25rem;
    height: 2px;
    flex: 0 0 1.25rem;
    margin: 0 0.35rem;
    border-radius: 9999px;
    background: #cbd5e1;
}

.wizard-step-connector.is-done {
    background: #0f766e;
}

.project-wizard-content {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.tab-btn {
    margin-bottom: 0.5rem;
}

.tab-btn:last-child {
    margin-right: 0;
}

.border-b:has(.tab-btn),
.tabs {
    padding-bottom: 0.75rem;
}

.project-input-fields {
    row-gap: 1.5rem;
}

.project-input-field {
    margin: 0.25rem 0;
    padding: 1.25rem !important;
}

.project-input-field label {
    margin-bottom: 0.4rem;
}

.project-input-field textarea,
.project-input-field select {
    margin-top: 0.9rem;
}

.min-h-0 {
    min-height: 0;
}

.border,
.border-b,
.border-t {
    border-color: var(--shin-border);
}

.border {
    border-style: solid;
    border-width: 1px;
}

.border-b {
    border-bottom-style: solid;
    border-bottom-width: 1px;
}

.border-t {
    border-top-style: solid;
    border-top-width: 1px;
}

.rounded,
.rounded-lg,
.rounded-xl,
.rounded-2xl {
    border-radius: 0.65rem;
}

.rounded-full {
    border-radius: 9999px;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 1.25;
}

.leading-relaxed {
    line-height: 1.65;
}

.font-medium,
.font-semibold {
    font-weight: 700;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.text-slate-400,
.text-slate-500,
.text-slate-600,
.text-slate-700,
.text-slate-800 {
    color: var(--shin-muted);
}

.text-primary {
    color: var(--shin-primary);
}

.text-white {
    color: #ffffff;
}

.bg-primary {
    background: var(--shin-primary);
}

.bg-primary\/10,
.hover\:bg-primary\/5:hover {
    background: var(--shin-primary-soft);
}

.hover\:border-primary:hover {
    border-color: var(--shin-primary);
}

.bg-slate-50,
.bg-slate-100 {
    background: #f8fafc;
}

.bg-slate-900 {
    background: #0f172a;
}

.break-all {
    word-break: break-all;
}

.break-words,
.whitespace-pre-wrap {
    overflow-wrap: anywhere;
}

.whitespace-pre-wrap {
    white-space: pre-wrap;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-x-auto {
    overflow-x: auto;
}

@media (min-width: 768px) {
    .md\:col-span-4 {
        grid-column: span 4 / span 4;
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .md\:w-auto {
        width: auto;
    }
}

@media (min-width: 1024px) {
    .lg\:flex-row {
        flex-direction: row;
    }

    .lg\:items-center {
        align-items: center;
    }

    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lg\:col-span-2 {
        grid-column: span 2 / span 2;
    }

    .lg\:col-span-4 {
        grid-column: span 4 / span 4;
    }

    .lg\:col-span-6 {
        grid-column: span 6 / span 6;
    }
}

@media (min-width: 1280px) {
    .xl\:col-span-4 {
        grid-column: span 4 / span 4;
    }

    .xl\:col-span-8 {
        grid-column: span 8 / span 8;
    }

    .xl\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .xl\:grid-cols-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .xl\:flex {
        display: flex;
    }
}

@media (max-width: 1279px) {
    .shin-enigma-sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        width: 100% !important;
        height: 100vh;
        transform: translateX(-100%);
        visibility: hidden;
        pointer-events: none;
    }

    .side-menu__content {
        width: 320px;
        height: 100vh;
    }

    .side-menu .scrollable {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.75rem;
    }

    .side-menu__group-label {
        width: 100%;
        margin-top: 0;
    }

    .shin-enigma-topbar {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 0.75rem 1rem 0;
    }

    .shin-enigma-content {
        margin-left: 0 !important;
        padding: 1rem 1rem 1.5rem !important;
    }

    .shin-mobile-nav {
        position: static !important;
        margin: 0.5rem 1rem 0;
    }

    .shin-mobile-nav.is-collapsed {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .project-wizard-panel {
        padding: 1rem;
    }

    .wizard-progress {
        min-width: 760px;
    }

    .wizard-step {
        width: 7.75rem;
        padding: 0.65rem;
    }

    .shin-enigma-topbar {
        align-items: flex-start;
        flex-direction: column;
        min-height: auto;
    }

    .shin-enigma-content {
        padding-top: 0.75rem !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .btn,
    button.btn,
    a.btn {
        width: 100%;
    }
}
