/* Sign-in screens: login, first-run setup and connection repair.
   Built only on the tokens in dex-theme.css, so light/dark mode and any accent apply everywhere. */

/* ---- Page and background ---- */

.dx-login {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: var(--dx-bg);
    color: var(--dx-text);
}

.dx-login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.dx-login-bg__glow,
.dx-login-bg__grid,
.dx-login-bg__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.dx-login-bg__glow {
    background:
        radial-gradient(60% 46% at 50% 46%, color-mix(in srgb, var(--dx-accent) 16%, transparent), transparent 72%),
        radial-gradient(40% 40% at 85% 10%, color-mix(in srgb, var(--dx-accent-2) 10%, transparent), transparent 70%);
}

.dx-login-bg__grid {
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--dx-text) var(--dx-grid-strength), transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--dx-text) var(--dx-grid-strength), transparent) 1px, transparent 1px);
    background-size: 52px 52px;
    -webkit-mask-image: radial-gradient(ellipse 90% 85% at 50% 42%, #000 35%, transparent 100%);
    mask-image: radial-gradient(ellipse 90% 85% at 50% 42%, #000 35%, transparent 100%);
}

.dx-login-bg__canvas {
    display: block;
    opacity: .55;
}

:root[data-theme="dark"] .dx-login-bg__canvas {
    opacity: .75;
}

.dx-login__accents {
    position: fixed;
    left: 18px;
    top: 50%;
    z-index: 20;
    transform: translateY(-50%);
}

/* Ghost mode: the colour rail stays faint until the pointer or keyboard focus reaches it.
   Touch devices cannot hover, so there it stays fully visible. */
@media (hover: hover) and (pointer: fine) {
    .dx-login__accents {
        opacity: .32;
        filter: saturate(.5);
        transition: opacity .35s var(--dx-ease), filter .35s var(--dx-ease), box-shadow .35s var(--dx-ease);
    }

    .dx-login__accents:hover,
    .dx-login__accents:focus-within {
        opacity: 1;
        filter: none;
    }
}

.dx-login__main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    /* The extra top padding moves the centred stack half a 52px grid cell down. */
    padding: calc(48px + 52px) 32px 40px 80px;
}

/* ---- Clock ---- */

/* Lock-screen style clock: heavy, tight, modern. Windows shows its own lock-screen face
   (Segoe UI Variable Display); other systems fall back to Inter. */
.dx-login-clock {
    text-align: center;
    user-select: none;
    font-family: "Segoe UI Variable Display", "Segoe UI Variable Text", var(--dx-font);
    font-variant-numeric: tabular-nums;
}

.dx-login-clock__time {
    font-size: clamp(60px, 6.6vw, 88px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.035em;
    color: var(--dx-text);
}

/* Light mode: the clock takes the chosen theme colour (readable tone of the accent). */
:root[data-theme="light"] .dx-login-clock__time {
    color: var(--dx-accent-text);
}

.dx-login-clock__date {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.005em;
    color: color-mix(in srgb, var(--dx-text) 78%, transparent);
}

/* ---- Card ---- */

.dx-login-card {
    width: min(940px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border: 1px solid var(--dx-accent-line);
    border-radius: 30px;
    overflow: hidden;
    background: var(--dx-surface);
    box-shadow: var(--dx-shadow), 0 0 90px -34px var(--dx-accent);
}

.dx-login--wide .dx-login-card {
    width: min(1100px, 100%);
    grid-template-columns: minmax(260px, .72fr) minmax(0, 1.5fr);
}

.dx-login-card__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    min-height: 460px;
    padding: 40px;
    background:
        radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--dx-accent) 34%, transparent), transparent 70%),
        linear-gradient(160deg, color-mix(in srgb, var(--dx-accent) 14%, var(--dx-surface-2)), var(--dx-surface-2));
}

.dx-login-card__logo {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 6px 16px color-mix(in srgb, var(--dx-accent) 35%, transparent));
}

.dx-login-card__intro h1 {
    margin: 0 0 10px;
    font-size: clamp(24px, 2.4vw, 28px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.025em;
    color: var(--dx-text);
}

.dx-login-card__intro p {
    margin: 0;
    max-width: 34ch;
    color: var(--dx-muted);
    font-size: 15px;
    line-height: 1.55;
}

.dx-login-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--dx-muted);
    font-size: 12.5px;
}

.dx-login-card__company {
    color: var(--dx-text);
    font-size: 13px;
    font-weight: 600;
}

.dx-login-card__company small {
    display: block;
    margin-bottom: 2px;
    color: var(--dx-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dx-login-card__company + span {
    margin-top: 10px;
}

.dx-login-card__body {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 40px 40px;
    background: linear-gradient(155deg, color-mix(in srgb, var(--dx-accent) 5%, var(--dx-surface)), var(--dx-surface) 55%);
}

.dx-login-card__mode {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
}

/* ---- Sign-in form ---- */

.dx-login-form__head h2 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--dx-text);
}

.dx-login-form__head p {
    margin: 0 0 24px;
    color: var(--dx-muted);
    font-size: var(--dx-text-md);
}

.dx-login-form {
    display: flex;
    flex-direction: column;
}

.dx-field {
    display: block;
    margin-bottom: 16px;
}

.dx-field__label {
    display: block;
    margin-bottom: 7px;
    color: var(--dx-muted);
    font-size: 12.5px;
    font-weight: 600;
}

/* .login-input-wrap / .login-input are the setup form equivalents of the field control. */
.dx-field__control,
.login-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 6px 0 14px;
    border: 1px solid var(--dx-line);
    border-radius: var(--dx-radius-md);
    background: var(--dx-bg);
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.dx-field__control:hover,
.login-input-wrap:hover {
    border-color: color-mix(in srgb, var(--dx-accent) 24%, var(--dx-line));
}

.dx-field__control:focus-within,
.login-input-wrap:focus-within {
    border-color: var(--dx-accent);
    box-shadow: var(--dx-focus-ring);
}

.dx-field__icon {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--dx-muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke .2s;
}

.dx-field__control:focus-within .dx-field__icon {
    stroke: var(--dx-accent-text);
}

.dx-field__input,
.login-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 0 8px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--dx-text);
    caret-color: var(--dx-accent);
    font: 500 15px var(--dx-font);
}

.dx-field__input::placeholder,
.login-input::placeholder {
    color: color-mix(in srgb, var(--dx-muted) 70%, transparent);
    font-weight: 400;
}

.dx-field__input:-webkit-autofill,
.login-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--dx-bg) inset;
    -webkit-text-fill-color: var(--dx-text);
    caret-color: var(--dx-text);
}

.dx-field__action {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--dx-radius-sm);
    background: transparent;
    color: var(--dx-muted);
    cursor: pointer;
}

.dx-field__action:hover { color: var(--dx-text); background: var(--dx-surface-2); }
.dx-field__action:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

.dx-field__action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dx-login-form__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 22px;
}

.dx-login-status {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 16px 0 0;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--dx-danger) 32%, var(--dx-line));
    border-radius: 10px;
    background: color-mix(in srgb, var(--dx-danger) 8%, var(--dx-surface));
    color: var(--dx-danger);
    font-size: var(--dx-text-sm);
    font-weight: 500;
    line-height: 1.45;
}

.dx-login-status svg {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.dx-login-note {
    margin: 14px 0 0;
    text-align: center;
    color: var(--dx-muted);
    font-size: 12.5px;
}

/* ---- Application promotions ---- */

.dx-promos {
    width: min(940px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dx-promos__grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    animation: dxPromoEnter .45s var(--dx-ease) both;
}

@keyframes dxPromoEnter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lock-screen style info card: title at the top, content in the middle, link centred at the bottom. */
.dx-promo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 138px;
    padding: 14px 18px 12px;
    border: 1px solid color-mix(in srgb, var(--dx-text) 10%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dx-surface) 62%, transparent);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .45), inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
    color: inherit;
    text-decoration: none;
    transition: border-color .2s, transform .2s var(--dx-ease), background .2s, box-shadow .2s;
}

a.dx-promo:hover {
    border-color: var(--dx-accent-line);
    background: color-mix(in srgb, var(--dx-surface) 78%, transparent);
    transform: translateY(-2px);
}

a.dx-promo:focus-visible {
    outline: 0;
    border-color: var(--dx-accent);
    box-shadow: var(--dx-focus-ring);
}

.dx-promo__head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dx-promo__icon {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--dx-accent-soft);
    color: var(--dx-accent-text);
}

.dx-promo__icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dx-promo__heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Long module names wrap to a second line instead of being cut off. */
.dx-promo__title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--dx-text);
    font-size: 14.5px;
    font-weight: 650;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.dx-promo__code {
    color: var(--dx-accent-text);
    font-size: 11.5px;
    font-weight: 600;
}

.dx-promo__body {
    flex: 1;
    display: -webkit-box;
    overflow: hidden;
    color: var(--dx-muted);
    font-size: 13px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.dx-promo__more {
    align-self: center;
    color: var(--dx-text);
    font-size: 12.5px;
    font-weight: 600;
    opacity: .8;
    transition: color .2s, opacity .2s;
}

a.dx-promo:hover .dx-promo__more {
    color: var(--dx-accent-text);
    opacity: 1;
}

/* Empty card: same shape, no content. */
.dx-promo--empty {
    pointer-events: none;
}

.dx-promo--empty .dx-promo__icon {
    background: color-mix(in srgb, var(--dx-accent) 7%, var(--dx-surface-2));
}

.dx-promo--empty .dx-promo__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.dx-promo__placeholder {
    display: block;
    width: 70%;
    height: 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dx-muted) 16%, transparent);
}

.dx-promo__placeholder--title {
    width: 46%;
    height: 11px;
    background: color-mix(in srgb, var(--dx-muted) 24%, transparent);
}

.dx-promo__placeholder--long {
    width: 90%;
}

.dx-promo__placeholder--more {
    align-self: center;
    width: 34%;
    height: 8px;
    background: color-mix(in srgb, var(--dx-accent) 22%, transparent);
}

.dx-promos__dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dx-promos__dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dx-muted) 45%, transparent);
    cursor: pointer;
    transition: width .25s var(--dx-ease), background .25s;
}

.dx-promos__dot[aria-pressed="true"] {
    width: 20px;
    background: var(--dx-accent);
}

.dx-promos__dot:focus-visible {
    outline: 0;
    box-shadow: var(--dx-focus-ring);
}

/* ---- Setup and connection repair forms ---- */

.setup-card,
.setup-step-panel {
    display: flex;
    flex-direction: column;
}

.setup-step-panel {
    animation: dxSetupStepEnter .2s var(--dx-ease) both;
}

@keyframes dxSetupStepEnter {
    from { opacity: .2; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.setup-title {
    margin: 0 0 20px;
    padding-right: 52px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--dx-text);
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.setup-field > span:first-child {
    color: var(--dx-muted);
    font-size: 12.5px;
    font-weight: 600;
}

.setup-field--full {
    grid-column: 1 / -1;
}

.setup-field--reserved {
    opacity: .5;
    pointer-events: none;
}

.setup-field__input--code {
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

select.login-input {
    appearance: none;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--dx-muted) 50%), linear-gradient(135deg, var(--dx-muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

select.login-input option {
    background: var(--dx-surface);
    color: var(--dx-text);
}

.login-input[readonly] {
    color: var(--dx-muted);
}

.setup-user-profile-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.setup-auth-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 4px;
    border: 1px solid var(--dx-line);
    border-radius: var(--dx-radius-md);
    background: var(--dx-bg);
}

.setup-auth-option {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--dx-radius-sm);
    background: transparent;
    color: var(--dx-muted);
    font-size: var(--dx-text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.setup-auth-option:hover:not(:disabled) {
    color: var(--dx-text);
}

.setup-auth-option--active {
    border-color: var(--dx-accent-line);
    background: var(--dx-surface);
    color: var(--dx-accent-text);
    box-shadow: var(--dx-shadow-sm);
}

.setup-auth-option:focus-visible {
    outline: 0;
    box-shadow: var(--dx-focus-ring);
}

.button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.button-row--install {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Setup buttons share the .dx-button look. */
.setup-secondary-btn,
.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--dx-radius-md);
    font: 600 var(--dx-text-md)/1.2 var(--dx-font);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s var(--dx-ease), box-shadow .2s, opacity .2s, border-color .2s, color .2s;
}

.setup-secondary-btn {
    border-color: var(--dx-line);
    background: var(--dx-surface);
    color: var(--dx-text);
}

.setup-secondary-btn:hover:not(:disabled) {
    border-color: var(--dx-accent-line);
    color: var(--dx-accent-text);
}

.login-button {
    background: var(--dx-accent-gradient);
    color: var(--dx-on-accent);
    box-shadow: 0 12px 28px -12px var(--dx-accent);
}

.login-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px -12px var(--dx-accent);
}

.setup-secondary-btn:focus-visible,
.login-button:focus-visible {
    outline: 0;
    box-shadow: var(--dx-focus-ring);
}

.setup-secondary-btn:disabled,
.login-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Info boxes */
.bilgi-kutu,
.setup-existing-system,
.setup-license-capacity-warning {
    --dx-note-tone: var(--dx-info);
    display: grid;
    gap: 5px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--dx-note-tone) 34%, var(--dx-line));
    border-radius: var(--dx-radius-md);
    background: color-mix(in srgb, var(--dx-note-tone) 8%, var(--dx-surface));
    color: var(--dx-text);
    font-size: 13.5px;
    line-height: 1.5;
}

.setup-repair-error { --dx-note-tone: var(--dx-danger); }
.setup-existing-system { --dx-note-tone: var(--dx-success); }
.setup-license-capacity-warning { --dx-note-tone: var(--dx-warning); }

.setup-existing-system strong,
.setup-license-capacity-warning strong {
    color: var(--dx-note-tone);
    font-size: var(--dx-text-md);
}

.setup-existing-system small,
.setup-license-capacity-warning span {
    color: var(--dx-muted);
}

.setup-grid .setup-existing-system,
.setup-grid .setup-license-capacity-warning {
    margin-bottom: 0;
}

/* ---- Responsive ---- */

@media (max-width: 960px) {
    .dx-login-card,
    .dx-login--wide .dx-login-card {
        grid-template-columns: minmax(0, 1fr);
        max-width: 560px;
    }

    .dx-login--wide .dx-login-card {
        max-width: 720px;
    }

    /* The brand panel becomes a compact header strip above the form. */
    .dx-login-card__brand {
        min-height: 0;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 16px;
        padding: 22px 24px;
    }

    .dx-login-card__logo {
        flex: none;
        width: 48px;
        height: 48px;
    }

    .dx-login-card__intro h1 {
        margin: 0 0 2px;
        font-size: 19px;
    }

    .dx-login-card__intro p {
        font-size: 13px;
        line-height: 1.45;
    }

    .dx-login-card__meta {
        display: none;
    }

    .dx-login-card__body {
        padding: 32px 28px 28px;
    }

    .dx-login-card__mode {
        top: 16px;
        right: 16px;
    }

    .dx-promos {
        max-width: 560px;
    }

    .dx-promos__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .dx-promo {
        min-height: 120px;
    }
}

@media (max-width: 760px) {
    .dx-login__main {
        justify-content: flex-start;
        gap: 20px;
        padding: 28px 16px 96px;
    }

    .dx-login-clock__time {
        font-size: 56px;
    }

    .dx-login-clock__date {
        font-size: 15px;
    }

    /* Theme colours dock at the bottom as a horizontal bar. */
    .dx-login__accents {
        top: auto;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 50%;
        flex-direction: row;
        gap: 8px;
        padding: 8px 12px;
        transform: translateX(-50%);
    }

    .dx-accent-picker__icon {
        display: none;
    }

    .dx-login-card {
        border-radius: 24px;
    }

    .dx-login-card__brand {
        padding: 18px 20px;
    }

    .dx-login-card__intro p {
        display: none;
    }

    .dx-login-card__body {
        padding: 26px 20px 22px;
    }

    .setup-title {
        font-size: 19px;
    }

    .setup-grid,
    .setup-user-profile-row,
    .button-row,
    .button-row--install {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 380px) {
    .dx-login-form__row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Installed app: the page fills the window below the title bar (app.css draws the bar). */
@media (display-mode: window-controls-overlay) {
    .dx-login,
    .dx-login__main {
        min-height: calc(100dvh - env(titlebar-area-height, 0px));
    }
}
