/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V4
 * Hallmark · macrostructure: Workbench · tone: technical-utilitarian · anchor hue: navy + amber
 * contrast: pass (40–41) · tokens: pass (48) · mobile: pass (34, 49–57)
 */
@import url("/tokens.css");

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

html,
body {
    min-width: 0;
    min-height: 100%;
    margin: 0;
    overflow-x: clip;
}

body {
    background: var(--color-paper);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}

.login-shell {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        linear-gradient(var(--color-brand-04) var(--rule-thin), transparent var(--rule-thin)),
        linear-gradient(90deg, var(--color-brand-04) var(--rule-thin), transparent var(--rule-thin)),
        var(--color-paper);
    background-size: 32px 32px;
}

.login-shell::before,
.login-shell::after {
    position: absolute;
    z-index: 0;
    width: 28rem;
    height: 28rem;
    border-radius: 50%;
    background: var(--color-brand-08);
    content: "";
    filter: blur(90px);
    pointer-events: none;
}

.login-shell::before {
    top: -16rem;
    left: -12rem;
}

.login-shell::after {
    right: -15rem;
    bottom: -16rem;
    background: var(--color-accent-16);
}

.page-frame {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(100% - 40px, 1280px);
    min-height: 100vh;
    margin: 0 auto;
    grid-template-rows: auto 1fr auto;
}

.site-header,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header {
    min-height: 84px;
    border-bottom: var(--rule-thin) solid var(--color-brand-08);
}

.brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border: var(--rule-thin) solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: 0 8px 24px var(--color-brand-08);
    color: var(--color-accent-dark);
}

.brand-logo-natural {
    max-height: 40px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-subtext {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-muted);
    letter-spacing: -0.01em;
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.brand-name span {
    color: var(--color-accent-dark);
}

.auth-company-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    border-bottom: var(--rule-thin) solid var(--color-line);
    margin-bottom: var(--space-4);
    gap: var(--space-3);
}

.auth-company-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.auth-company-logo-natural {
    max-height: 48px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.auth-company-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-brand) 0%, #111b2f 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--color-brand-12);
    letter-spacing: -0.02em;
}

.auth-company-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.auth-company-name {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--color-ink);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-company-sub {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 4px var(--color-brand-08);
}

.login-layout {
    display: grid;
    min-width: 0;
    align-items: center;
    gap: clamp(2rem, 4vw, 4rem);
    grid-template-columns: minmax(0, 1.4fr) minmax(430px, 0.95fr);
    padding: var(--space-12) 0;
}

.story-panel,
.auth-panel {
    min-width: 0;
}

.auth-panel {
    width: 100%;
    max-width: 500px;
    justify-self: end;
}

.eyebrow {
    margin: 0 0 var(--space-4);
    color: var(--color-brand-mid);
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.story-title {
    max-width: 690px;
    margin: 0;
    color: var(--color-ink);
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5.3vw, 4.85rem);
    font-style: normal;
    font-weight: 800;
    letter-spacing: -0.065em;
    line-height: 0.98;
    overflow-wrap: anywhere;
}

.story-title span {
    position: relative;
    z-index: 0;
    color: var(--color-brand-mid);
}

.story-title span::after {
    position: absolute;
    z-index: -1;
    right: -0.06em;
    bottom: 0.08em;
    left: -0.06em;
    height: 0.28em;
    background: var(--color-accent-soft);
    content: "";
}

.story-copy {
    max-width: 620px;
    margin: var(--space-5) 0 0;
    color: var(--color-muted);
    font-size: clamp(var(--text-base), 1.5vw, var(--text-lg));
    line-height: 1.7;
}

.feature-strip {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: var(--space-8) 0;
}

.feature-item {
    display: grid;
    min-width: 0;
    min-height: 76px;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: var(--rule-thin) solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-white-72);
    box-shadow: 0 8px 28px var(--color-brand-04);
}

.feature-item .feature-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
}

.feature-icon svg {
    width: 18px;
    height: 18px;
}

.feature-item > span:last-child,
.feature-item strong,
.feature-item > span:last-child > span {
    display: block;
    min-width: 0;
}

.feature-item strong {
    color: var(--color-ink);
    font-size: 0.6875rem;
    line-height: 1.35;
    white-space: nowrap;
}

.feature-item > span:last-child > span {
    min-height: 2.8em;
    margin-top: var(--space-1);
    color: var(--color-faint);
    font-size: 0.625rem;
    line-height: 1.4;
}

.process-card {
    position: relative;
    overflow: hidden;
    min-height: 292px;
    padding: var(--space-5);
    border: var(--rule-thin) solid var(--color-line);
    border-radius: var(--radius-lg);
    background: var(--color-white-72);
    box-shadow: 0 18px 48px var(--color-brand-08);
}

.process-card::before {
    position: absolute;
    inset: 52px 0 0;
    background:
        linear-gradient(var(--color-brand-08) var(--rule-thin), transparent var(--rule-thin)),
        linear-gradient(90deg, var(--color-brand-08) var(--rule-thin), transparent var(--rule-thin));
    background-size: 100% 62px, 112px 100%;
    content: "";
    pointer-events: none;
}

.process-heading {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-faint);
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.process-mode {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.process-mode::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    content: "";
}

.flow-stage {
    position: relative;
    display: grid;
    height: 218px;
    align-items: start;
    grid-template-columns: 64px minmax(90px, 1fr) 114px minmax(70px, 0.75fr) 114px minmax(90px, 1fr) 64px;
    padding: 28px 0 12px;
}

.flow-line {
    position: relative;
    height: 10px;
    margin-top: 65px;
    overflow: hidden;
    background: repeating-linear-gradient(90deg, var(--color-brand-light) 0 8px, transparent 8px 15px) center / 100% 2px no-repeat;
}

.flow-line::before {
    position: absolute;
    z-index: 2;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-top: var(--rule-medium) solid var(--color-brand-light);
    border-right: var(--rule-medium) solid var(--color-brand-light);
    content: "";
    transform: rotate(45deg);
}

.flow-line::after {
    position: absolute;
    top: 1px;
    left: 0;
    width: calc(100% - 8px);
    height: 8px;
    background: radial-gradient(circle at 4px 4px, var(--color-accent) 0 4px, transparent 4px);
    content: "";
    filter: drop-shadow(0 0 4px var(--color-accent));
    animation: fuel-flow var(--dur-flow) var(--ease-in-out) infinite;
}

.flow-line.flow-delay::after {
    animation-delay: -1100ms;
}

.terminal-unit,
.tank-unit {
    position: relative;
    z-index: 2;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.terminal-unit {
    padding-top: 34px;
}

.terminal-box {
    position: relative;
    width: 42px;
    height: 72px;
    border: var(--rule-medium) solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.terminal-box::before,
.terminal-box::after {
    position: absolute;
    right: 10px;
    left: 10px;
    height: 2px;
    background: var(--color-brand-light);
    content: "";
}

.terminal-box::before {
    top: 22px;
    box-shadow: 0 14px 0 var(--color-brand-light);
}

.terminal-box::after {
    top: 50px;
    right: 16px;
}

.unit-label {
    margin-top: var(--space-3);
    color: var(--color-faint);
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.tank {
    position: relative;
    width: 100px;
    height: 140px;
    overflow: hidden;
    border: var(--rule-medium) solid var(--color-brand-mid);
    border-radius: 50% / 11%;
    background: var(--color-surface);
    box-shadow: inset 0 -12px 24px var(--color-brand-04);
}

.tank::before {
    position: absolute;
    z-index: 3;
    top: -2px;
    right: -2px;
    left: -2px;
    height: 28px;
    border: var(--rule-medium) solid var(--color-brand-mid);
    border-radius: 50%;
    background: var(--color-surface);
    content: "";
}

.tank::after {
    position: absolute;
    z-index: 3;
    right: -2px;
    bottom: -2px;
    left: -2px;
    height: 28px;
    border: var(--rule-medium) solid var(--color-brand-mid);
    border-radius: 50%;
    content: "";
}

.tank-id {
    position: absolute;
    z-index: 5;
    top: 58px;
    left: 0;
    width: 100%;
    color: var(--color-ink);
    font-size: var(--text-base);
    font-weight: 800;
    text-align: center;
}

.fuel {
    position: absolute;
    z-index: 2;
    right: 5px;
    bottom: 4px;
    left: 5px;
    height: 48%;
    overflow: hidden;
    border-radius: 0 0 44% 44% / 0 0 12% 12%;
    background: linear-gradient(180deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    opacity: 0.84;
}

.fuel::before {
    position: absolute;
    top: -10px;
    left: -18%;
    width: 136%;
    height: 22px;
    border-radius: 50%;
    background: var(--color-accent-soft);
    content: "";
    animation: liquid-sway var(--dur-liquid) var(--ease-in-out) infinite;
}

.fuel-high {
    height: 70%;
}

.fuel-low {
    height: 34%;
}

.fuel-bubble {
    position: absolute;
    z-index: 4;
    bottom: 18px;
    left: 27px;
    width: 5px;
    height: 5px;
    border: var(--rule-thin) solid var(--color-accent-soft);
    border-radius: 50%;
    opacity: 0;
    animation: bubble-rise 2400ms var(--ease-out) infinite;
}

.fuel-bubble:nth-of-type(2) {
    left: 68px;
    animation-delay: -800ms;
}

.fuel-bubble:nth-of-type(3) {
    left: 48px;
    animation-delay: -1600ms;
}

@keyframes fuel-flow {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100% + 10px)); }
}

@keyframes liquid-sway {
    0%, 100% { transform: translateX(-2%); }
    50% { transform: translateX(2%); }
}

@keyframes bubble-rise {
    0% { opacity: 0; transform: translateY(0) scale(0.8); }
    20% { opacity: 0.75; }
    80% { opacity: 0.35; }
    100% { opacity: 0; transform: translateY(-52px) scale(1.25); }
}

.auth-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 3.3vw, 2.5rem);
    border: var(--rule-thin) solid var(--color-line);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: 0 24px 64px var(--color-shadow);
}

.auth-card::before {
    position: absolute;
    top: 0;
    right: 22%;
    left: 22%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    content: "";
}

.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    border-bottom: var(--rule-thin) solid var(--color-line);
    color: var(--color-faint);
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-heading {
    margin: var(--space-8) 0 0;
    color: var(--color-ink);
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 2.7vw, 2rem);
    font-style: normal;
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.15;
}

.auth-copy {
    margin: var(--space-3) 0 0;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: 1.65;
}

.status-message {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: var(--space-3);
    border: var(--rule-thin) solid var(--color-brand-light);
    border-radius: var(--radius-sm);
    background: var(--color-brand-soft);
    color: var(--color-brand);
    font-size: var(--text-xs);
}

.status-message svg {
    width: 18px;
    flex: 0 0 auto;
}

.login-form {
    display: grid;
    gap: var(--space-5);
    margin-top: var(--space-8);
}

.field-group {
    min-width: 0;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.field-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--color-text);
    font-size: var(--text-xs);
    font-weight: 800;
}

.field-row .field-label {
    margin-bottom: 0;
}

.help-text {
    color: var(--color-brand-mid);
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
}

.input-wrap {
    position: relative;
}

.field-input {
    width: 100%;
    min-height: 48px;
    padding: 0 var(--space-4);
    border: var(--rule-thin) solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    outline: var(--rule-medium) solid transparent;
    outline-offset: var(--rule-thin);
    background: var(--color-surface);
    color: var(--color-ink);
    transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.field-input::placeholder {
    color: var(--color-faint);
}

.field-input:hover {
    border-color: var(--color-brand-light);
}

.field-input:focus-visible {
    border-color: var(--color-brand-mid);
    outline-color: var(--color-brand-mid);
}

.field-input:disabled {
    cursor: not-allowed;
    background: var(--color-surface-soft);
    opacity: 0.65;
}

.field-input.has-error {
    border-color: var(--color-danger);
    background: var(--color-danger-soft);
}

.password-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: transparent;
    color: var(--color-faint);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out);
}

.password-toggle:hover {
    color: var(--color-brand-mid);
}

.password-toggle:focus-visible {
    outline: var(--rule-medium) solid var(--color-brand-mid);
    outline-offset: -4px;
}

.password-toggle:active {
    color: var(--color-brand);
}

.password-toggle svg {
    width: 19px;
    height: 19px;
}

.is-hidden {
    display: none;
}

.field-hint,
.field-error {
    min-height: 1lh;
    margin: var(--space-2) 0 0;
    font-size: 0.6875rem;
}

.field-hint {
    color: var(--color-faint);
}

.field-error {
    color: var(--color-danger);
    font-weight: 700;
}

.remember-label {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-muted);
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: 700;
    user-select: none;
}

.remember-checkbox {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--color-brand-mid);
}

.remember-checkbox:focus-visible {
    outline: var(--rule-medium) solid var(--color-brand-light);
    outline-offset: 3px;
}

.submit-button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: 0 var(--space-5);
    border: var(--rule-thin) solid var(--color-brand);
    border-radius: var(--radius-sm);
    background: var(--color-brand);
    box-shadow: 0 12px 28px var(--color-brand-18);
    color: var(--color-surface);
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.submit-button:hover {
    background: var(--color-brand-mid);
}

.submit-button:focus-visible {
    outline: 3px solid var(--color-brand-light);
    outline-offset: 3px;
}

.submit-button:active {
    transform: translateY(1px);
}

.submit-button:disabled,
.submit-button[aria-busy="true"] {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.submit-button svg {
    width: 17px;
    height: 17px;
}

.auth-note {
    margin: var(--space-6) 0 0;
    padding-top: var(--space-5);
    border-top: var(--rule-thin) solid var(--color-line);
    color: var(--color-faint);
    font-size: 0.6875rem;
    line-height: 1.6;
}

.site-footer {
    min-height: 66px;
    border-top: var(--rule-thin) solid var(--color-brand-08);
    color: var(--color-faint);
    font-size: 0.6875rem;
}

.site-footer span:last-child {
    text-align: right;
}

@media (max-width: 980px) {
    .login-layout {
        grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
        gap: var(--space-8);
    }

    .feature-strip {
        grid-template-columns: 1fr;
    }

    .feature-item:nth-child(n + 3) {
        display: none;
    }

    .flow-stage {
        grid-template-columns: 48px minmax(28px, 1fr) 92px minmax(24px, 0.7fr) 92px minmax(28px, 1fr) 48px;
    }

    .tank {
        width: 86px;
    }
}

@media (max-width: 760px) {
    .page-frame {
        width: min(100% - 32px, 560px);
    }

    .site-header {
        min-height: 72px;
    }

    .login-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-8);
        padding: var(--space-8) 0;
    }

    .story-title {
        font-size: clamp(2.35rem, 12vw, 4rem);
    }

    .story-copy {
        font-size: var(--text-base);
    }

    .feature-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-bottom: 0;
    }

    .feature-item:nth-child(n + 3) {
        display: grid;
        grid-column: 1 / -1;
    }

    .process-card {
        display: none;
    }

    .auth-panel {
        width: 100%;
    }

    .site-footer {
        flex-direction: column;
        justify-content: center;
        gap: var(--space-1);
        padding: var(--space-3) 0;
        text-align: center;
    }

    .site-footer span:last-child {
        text-align: center;
    }
}

@media (max-width: 430px) {
    .page-frame {
        width: min(100% - 24px, 400px);
    }

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    .brand-name {
        font-size: var(--text-base);
    }

    .system-status span:last-child {
        display: none;
    }

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

    .feature-item:nth-child(n + 3) {
        grid-column: auto;
    }

    .auth-card {
        padding: var(--space-6) var(--space-5);
        border-radius: var(--radius-lg);
    }

    .auth-heading {
        margin-top: var(--space-6);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}
