.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    transition: grid-template-columns 220ms ease;
}

.shell-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
}

.rail {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    padding: 12px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 30;
}

.rail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    min-width: 0;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.brand-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 8px 10px;
}

.brand-shell-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-logo-large {
    width: 24px;
    height: 24px;
}

.brand-copy strong,
.brand-copy span {
    display: block;
}

.brand-copy strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.brand-copy span,
.rail-section-title {
    color: var(--muted);
    font-size: 0.75rem;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rail-nav,
.rail-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rail-nav {
    min-height: 0;
}

.rail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 2px;
}

.rail-footer {
    margin-top: auto;
    position: relative;
    display: grid;
    gap: 8px;
    padding-top: 8px;
    background: var(--bg-sidebar);
    z-index: 4;
    overflow: visible;
}

.rail-profile-trigger {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-md);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.rail-profile-menu {
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 20;
}

.rail-profile-action {
    border: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    text-align: left;
}

.rail-profile-action:hover {
    background: var(--bg-hover);
}

.rail-divider {
    height: 1px;
    margin: 6px 0;
    background: var(--line);
}

.rail-divider.compact {
    width: 32px;
    margin: 2px auto;
}

.rail-lab-icons {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.rail-collapsed-shortcuts {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.rail-subsection {
    display: grid;
    gap: 8px;
}

.rail-link,
.rail-subtle-link {
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rail-link {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.rail-link:hover,
.rail-subtle-link:hover {
    background: var(--bg-hover);
}

.rail-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.rail-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 999px;
    background: var(--brand);
}

.rail-subtle-link {
    color: var(--muted);
    font-size: 0.8125rem;
}

.rail-subtle-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.rail-link:focus-visible,
.rail-subtle-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.rail-lab-icon-link {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    border-radius: var(--radius-sm);
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    box-sizing: border-box;
}

.rail-lab-icon-link:hover,
.rail-lab-icon-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border-color: rgba(0, 120, 212, 0.28);
}

.rail-lab-caption {
    font-size: 0.78rem;
    line-height: 1.2;
}

.rail-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 auto;
}

.shell-collapsed .brand {
    justify-content: center;
    padding: 0;
}

.shell-collapsed .brand-shell {
    padding: 0;
    justify-content: center;
}

.shell-collapsed .brand-logo-large {
    width: 24px;
    height: 24px;
}

.shell-collapsed .rail-link,
.shell-collapsed .rail-subtle-link {
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
}

.shell-collapsed .rail-label,
.shell-collapsed .brand-copy,
.shell-collapsed .rail-section-title {
    display: none;
}

.shell-collapsed .rail-section {
    display: grid;
    gap: 8px;
}

.shell-collapsed .rail {
    padding: 10px 8px;
    gap: 10px;
    overflow: hidden;
}

.shell-collapsed .rail-top {
    display: block;
    min-height: 0;
}

.shell-collapsed .rail-nav {
    gap: 8px;
    align-items: center;
}

.shell-collapsed .rail-footer {
    justify-items: center;
    gap: 10px;
}

.shell-collapsed .rail-profile-trigger {
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
}

.shell-collapsed .rail-profile-menu {
    width: 188px;
    padding: 6px;
    left: calc(100% + 8px);
    right: auto;
    bottom: 0;
    transform: none;
    z-index: 50;
}

.shell-collapsed .rail-profile-action {
    justify-content: flex-start;
    padding: 10px 12px;
}

.shell-collapsed .rail-profile-action span {
    display: inline;
}

.shell-collapsed .rail-link.active::before {
    left: 50%;
    top: auto;
    bottom: -6px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
}

.shell-collapsed .brand-shell {
    padding-top: 2px;
    padding-bottom: 4px;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.shell-collapsed .brand-shell-main {
    justify-content: center;
    width: 100%;
}

.shell-collapsed .rail-collapsed-shortcuts {
    gap: 8px;
}

.shell-collapsed .rail-collapsed-link {
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    border: 0;
}

.shell-collapsed .rail-collapsed-link:hover {
    background: var(--bg-hover);
}

.shell-collapsed .rail-collapsed-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.shell-collapsed .rail-collapsed-link.active::before {
    left: 50%;
    top: auto;
    bottom: -6px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
}

.rail-toggle-collapsed-top {
    width: 28px;
    height: 28px;
    margin: -2px auto 4px;
}

.workspace {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100vh;
    overflow: auto;
}

.global-bar {
    height: 55px;
    min-height: 55px;
    flex-shrink: 0;
    background: var(--bg-shell);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
}

.global-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.global-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.page-context {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.gb-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.gb-subtitle {
    color: var(--muted-2);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
}

.global-search {
    width: min(520px, 48vw);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 32px;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.global-search input {
    border: 0;
    background: transparent;
    width: 100%;
    outline: none;
}

.global-search-icon {
    color: var(--muted-2);
}

.chrome-button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    background: var(--bg-shell);
    border-radius: 50%;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
}


.lang-selector {
    position: relative;
    display: inline-flex;
}

.lang-selector-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1;
    min-height: 32px;
    transition: background 120ms ease;
}

.lang-selector-trigger:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.lang-selector-open .lang-selector-trigger {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.lang-name {
    font-size: 0.78rem;
    white-space: nowrap;
}

.lang-chevron {
    transition: transform 160ms ease;
}

.lang-selector-open .lang-chevron {
    transform: rotate(180deg);
}

.lang-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: transparent;
}

.lang-selector-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 148px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 4px;
    display: grid;
    gap: 2px;
    z-index: 200;
}

.lang-selector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8125rem;
    text-align: left;
    width: 100%;
}

.lang-selector-option:hover {
    background: var(--bg-hover);
}

.lang-selector-option.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.lang-flag {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 12px;
    flex: 0 0 18px;
    overflow: hidden;
    border: 1px solid rgba(96, 94, 92, 0.22);
    border-radius: 2px;
    box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.35);
    line-height: 1;
}

.lang-flag-es {
    background:
        linear-gradient(
            to bottom,
            #c60b1e 0 25%,
            #ffc400 25% 75%,
            #c60b1e 75% 100%
        );
}

.lang-flag-en {
    background:
        linear-gradient(#3c3b6e, #3c3b6e) left top / 44% 54% no-repeat,
        repeating-linear-gradient(
            to bottom,
            #b22234 0 1px,
            #ffffff 1px 2px
        );
}

.lang-flag-pt {
    background: #009b3a;
}

.lang-flag-pt::before {
    content: "";
    position: absolute;
    inset: 2px 4px;
    background: #ffdf00;
    transform: rotate(45deg);
}

.lang-flag-pt::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #002776;
}

.lang-flag-neutral {
    border-radius: 50%;
    background:
        radial-gradient(circle at center, transparent 0 45%, rgba(96, 94, 92, 0.72) 47% 54%, transparent 56%),
        linear-gradient(90deg, transparent 0 44%, rgba(96, 94, 92, 0.72) 45% 55%, transparent 56%),
        linear-gradient(0deg, transparent 0 44%, rgba(96, 94, 92, 0.72) 45% 55%, transparent 56%),
        #ffffff;
}

.login-lang-wrapper {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.login-scene {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(18, 117, 188, 0.12), transparent 34%),
        radial-gradient(circle at top right, rgba(31, 176, 135, 0.1), transparent 26%),
        linear-gradient(180deg, #f7fbff 0%, #f3f5f8 58%, #eef2f6 100%);
}

.login-backdrop-shape {
    position: absolute;
    border-radius: 999px;
    filter: blur(2px);
    pointer-events: none;
}

.login-backdrop-shape-blue {
    width: 320px;
    height: 320px;
    left: -92px;
    top: -84px;
    background: radial-gradient(circle, rgba(18, 117, 188, 0.18) 0%, rgba(18, 117, 188, 0.06) 58%, transparent 74%);
}

.login-backdrop-shape-green {
    width: 280px;
    height: 280px;
    right: -48px;
    top: 42px;
    background: radial-gradient(circle, rgba(31, 176, 135, 0.14) 0%, rgba(31, 176, 135, 0.04) 60%, transparent 76%);
}

.auth-card,
.panel {
    background: var(--bg-shell);
    box-shadow: var(--shadow-card);
}

.auth-card {
    width: min(100%, 460px);
    border-radius: 20px;
    padding: 28px 28px 22px;
    border: 1px solid rgba(15, 108, 189, 0.12);
}

.login-brand {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.login-brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-logo {
    width: 56px;
    height: auto;
    display: block;
    flex: 0 0 auto;
}

.login-brand-wordmark {
    font-size: 1.05rem;
    font-weight: 400;
    color: #0f6cbd;
}

.login-copy {
    display: grid;
    gap: 4px;
}

.login-copy h1,
.login-brand-wordmark,
.eyebrow {
    user-select: none;
    -webkit-user-select: none;
}

.login-submit {
    width: 100%;
    min-height: 38px;
    margin-top: 8px;
    background: #1275bc;
}

.login-submit:hover {
    background: #0f63a0;
}

.login-footer {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(96, 94, 92, 0.12);
}

.login-demo {
    font-size: 0.8rem;
    color: #605e5c;
}

.login-caption {
    font-size: 0.75rem;
    color: #6b7280;
}

.auth-copy,
.hero-copy,
.panel-header span,
.field-group label,
.eyebrow {
    color: var(--muted);
}

.dashboard,
.module-page {
    padding: 18px 22px 24px;
}

.page-head {
    margin-bottom: 12px;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

h2 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.hero-copy {
    margin-top: 8px;
    max-width: 720px;
    line-height: 1.45;
    font-size: 0.86rem;
}

.command-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 14px;
}

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

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.field-span-2 {
    grid-column: span 2;
}
