/* The Terra look over app.css (Trello 17169, canvas variant A): Inter, the look's colours (look-tokens.css, linked in
   index.html), white sheets with hairlines, one accent blue, quiet top bar. Loaded after app.css; tokens only, no colours
   of its own. This first batch covers the shell, the sign-in page and the home menu; the other windows take the colours
   and the type from the tokens and are styled one by one. */

@font-face {
    font-family: 'Inter';
    src: url('../_content/Terra.DesignSystem/fonts/Inter/Inter-VariableFont.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --terra-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --bs-body-font-family: var(--terra-font);
}

/* ── Top bar: icon buttons without frames, the language button keeps its hairline ───────────────────────────── */
.navbar.bg-dark { box-shadow: none; }

.theme-toggle {
    border-color: transparent;
    color: var(--terra-text-body);
}

.theme-toggle:hover {
    background-color: var(--terra-bg-hover);
    border-color: transparent;
    color: var(--terra-text-primary);
}

.btn-ghost-nav {
    border-color: var(--terra-border);
    color: var(--terra-text-body) !important;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Field labels: sentence case in label ink (was bold uppercase) ─────────────────────────────────────────── */
.login-label,
.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--terra-text-label);
}

/* Fields are white (the surface), read-only and disabled ones keep app.css's deeper fill. */
.login-input,
.form-control,
.login-input:focus,
.form-control:focus { border-radius: var(--terra-radius-sm); background-color: var(--terra-bg-surface); }

/* ── Sign-in ───────────────────────────────────────────────────────────────────────────────────────────────── */
.login-page { padding-top: 1.5rem; }

.login-card {
    border: 1px solid var(--terra-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px var(--terra-shadow-sm);
}

.login-title {
    margin: 0;
    padding: 1.4rem 1.25rem 0.25rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--terra-text-primary);
}

/* The ways to sign in: a line of names, the chosen one underlined in the accent (as the look's tabs). */
.login-methods {
    flex-wrap: nowrap;
    gap: 1.25rem;
    margin: 0 1.25rem;
    padding: 0.5rem 0 0;
    border-bottom: 1px solid var(--terra-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.login-methods::-webkit-scrollbar { display: none; }

.login-method,
.login-method:hover {
    flex-shrink: 0;
    min-height: 44px;
    margin-bottom: -1px;
    padding: 0.5rem 0;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--terra-text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.login-method:hover { color: var(--terra-text-primary); }

.login-method--active,
.login-method--active:hover {
    background: none;
    border-color: transparent;
    border-bottom-color: var(--terra-primary);
    color: var(--terra-text-primary);
    font-weight: 600;
}

.login-form { gap: 1rem; padding: 1.25rem; }

.login-btn {
    border-radius: var(--terra-radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0;
    padding: 0.8rem;
    box-shadow: none;
}

.login-btn:hover,
.login-btn:active,
.login-google-wrap:hover .login-btn { box-shadow: none; }

/* ── Home: greeting and the user's day ─────────────────────────────────────────────────────────────────────── */
.home-hello { margin: 0.5rem 0.15rem 0.85rem; }

.home-hello__line {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--terra-text-primary);
}

.home-hello__date { font-size: 0.9rem; color: var(--terra-text-muted); }

.today-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border);
    border-radius: 12px;
    color: var(--terra-text-body);
    text-decoration: none;
}

.today-card:active { background: var(--terra-bg-hover); }

.today-card__head { display: flex; align-items: center; gap: 0.5rem; }

.today-card__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--terra-text-muted); }
.today-card__dot--good { background: var(--terra-success); }
.today-card__dot--warn { background: var(--terra-warning); }
.today-card__dot--bad { background: var(--terra-danger); }

.today-card__title {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--terra-text-muted);
}

.today-card__go { font-size: 1.5rem; line-height: 1; color: var(--terra-text-muted); }

.today-card__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.today-card__fact { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.today-card__label { font-size: 0.8rem; color: var(--terra-text-muted); }

.today-card__value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--terra-text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.today-card__unit { font-size: 0.8rem; font-weight: 500; color: var(--terra-text-muted); }
.today-card__now { font-size: 0.9rem; }
.today-card__now strong { font-weight: 600; color: var(--terra-text-primary); }

/* ── Home: unfinished work, search, groups, tiles ──────────────────────────────────────────────────────────── */
/* Unfinished work: one slim line in the warning tone, each flow a link; its tile carries a "Nebaigta" mark. */
.resume-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.55rem 0.8rem;
    background: var(--terra-warning-bg);
    border: 1px solid color-mix(in srgb, var(--terra-warning) 45%, transparent);
    border-radius: 10px;
    color: var(--terra-warning-text);
    font-size: 0.9rem;
    line-height: 1.35;
}

.resume-note__icon { flex-shrink: 0; margin-top: 0.05rem; }
.resume-note__text { min-width: 0; }

.resume-note__link {
    color: var(--terra-text-primary);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--terra-warning-text) 50%, transparent);
    text-underline-offset: 2px;
}

.menu-tile__note {
    flex-shrink: 0;
    padding: 0.15rem 0.55rem;
    border-radius: var(--terra-radius-pill, 999px);
    background: var(--terra-warning-bg);
    color: var(--terra-warning-text);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.menu-search { position: sticky; }
.menu-search .login-input { padding-left: 2.6rem; }

.menu-search::before {
    content: "";
    position: absolute;
    left: 0.85rem;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    background-color: var(--terra-text-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
    z-index: 1;
}

.menu-group__title {
    margin: 0.85rem 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--terra-text-muted);
}

/* A tile: a white row with a hairline, its colour strip kept on the left (4px, the look's tones). html[data-theme]
   outweighs app.css's light-theme outline rule. */
html[data-theme] .menu-tile:not(.menu-tile--locked) {
    border: 1px solid var(--terra-border);
    border-left: 4px solid var(--terra-border);
    border-radius: 10px;
    box-shadow: none;
}

html[data-theme] .menu-tile--green:not(.menu-tile--locked) { border-left-color: var(--terra-tile-green); }
html[data-theme] .menu-tile--orange:not(.menu-tile--locked) { border-left-color: var(--terra-tile-orange); }
html[data-theme] .menu-tile--blue:not(.menu-tile--locked) { border-left-color: var(--terra-tile-blue); }

.menu-tile:active { box-shadow: none; background-color: var(--terra-bg-hover); }

.menu-tile__inner { gap: 0.8rem; padding: 0.5rem 0.75rem; }

.menu-tile__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--terra-radius-sm);
    background: var(--terra-bg-surface-deep);
    border: 1px solid var(--terra-border);
}

.menu-tile__icon img { width: 20px; height: 20px; opacity: 0.85; }

.menu-tile__label { font-size: 1rem; font-weight: 500; letter-spacing: 0; }

.menu-tile__chevron { color: var(--terra-text-muted); opacity: 0.7; }

/* ── Bottom tab bar ────────────────────────────────────────────────────────────────────────────────────────── */
.tab-bar__item { font-size: 0.75rem; font-weight: 500; }
.tab-bar__item.active { font-weight: 600; }

/* ── Every window: title, back link, cards, lists, buttons, dialogs ────────────────────────────────────────── */
.page-title { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }

html[data-theme] .page-back {
    border: 1px solid var(--terra-border);
    border-radius: 10px;
    box-shadow: none;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Sheets: white, a hairline, a soft lift - no heavy shadow. */
html[data-theme] .form-card,
html[data-theme] .detail-card,
html[data-theme] .doc-item,
html[data-theme] .upload-card {
    border: 1px solid var(--terra-border);
    box-shadow: 0 1px 2px var(--terra-shadow-sm);
}

html[data-theme] .qc-row { box-shadow: none; }

/* Coloured strips on list cards: 4px, as the home tiles. */
.notif-card, .act-card, .job-card, .qc-row, .basket-row { border-left-width: 4px; }

.detail-card__header { background: var(--terra-bg-surface-deep); }
.detail-card__title { font-size: 1.2rem; font-weight: 600; }

.detail-card__chip {
    font-size: 0.85rem;
    color: var(--terra-text-body);
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border);
}

/* Label / value rows: labels in sentence case, values in ink. */
.detail-list__row dt {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--terra-text-label);
}

.detail-list__row dd { color: var(--terra-text-primary); }

.empty-note { font-size: 1rem; color: var(--terra-text-muted); }

/* Buttons: flat, 8px corners; the one main action filled in the accent (green for Save), the rest white with a hairline. */
.action-bar-btn,
.action-bar-btn:hover,
.action-bar-btn--save,
.action-bar-btn--save:hover,
.action-bar-btn--primary,
.action-bar-btn--primary:hover,
.action-bar-btn--warn {
    border-radius: var(--terra-radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: none;
}

.btn-soft,
.login-send-btn {
    --bs-btn-bg: var(--terra-bg-surface);
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border-strong);
    border-radius: var(--terra-radius-sm);
    color: var(--terra-text-secondary);
}

.btn-soft--danger { border-color: var(--terra-danger-text); color: var(--terra-danger-text); }
.btn-soft--blue { border-color: var(--terra-primary-line); color: var(--terra-primary-ink); }

.items-add { border-radius: var(--terra-radius-sm); }

.qc-seg__opt--on,
.qc-seg__opt--yes.qc-seg__opt--on,
.qc-seg__opt--no.qc-seg__opt--on,
.status-tile--on { box-shadow: none; }

.status-tile { border-radius: 10px; border-width: 1px; }

/* Dialogs: a white window with a hairline. */
.dark-modal,
.modal-content {
    background: var(--terra-bg-surface);
    border-radius: 12px;
    box-shadow: 0 12px 32px var(--terra-shadow-md);
}

.dark-modal .modal-title,
.modal-title { font-size: 1.15rem; font-weight: 600; }

/* ── User menu (top bar): initials open language, theme, Mano duomenys and Atsijungti, as in WebEngine ──────── */
.user-menu { position: relative; }

.user-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-height: var(--terra-touch-min);
    padding: 0 0.15rem;
    border: 0;
    background: none;
    color: var(--terra-text-body);
}

.user-menu__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--terra-primary);
    color: var(--terra-on-primary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.user-menu__trigger:focus-visible { outline: none; }
.user-menu__trigger:focus-visible .user-menu__avatar { box-shadow: var(--terra-focus-ring); }

.user-menu__backdrop { position: fixed; inset: 0; z-index: 1040; }

.user-menu__panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 1045;
    width: min(18rem, calc(100vw - 1.5rem));
    padding: 0.35rem 0;
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px var(--terra-shadow-md);
}

.user-menu__head { padding: 0.6rem 1rem 0.65rem; border-bottom: 1px solid var(--terra-border-subtle); }
.user-menu__name { font-weight: 600; color: var(--terra-text-primary); }
.user-menu__sub { font-size: 0.85rem; color: var(--terra-text-muted); }

.user-menu__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 1rem;
}

.user-menu__label { font-size: 0.9rem; color: var(--terra-text-label); }

/* Two or three choices side by side, the chosen one filled in the accent. */
.user-menu__seg {
    display: inline-flex;
    border: 1px solid var(--terra-border-strong);
    border-radius: var(--terra-radius-sm);
    overflow: hidden;
}

.user-menu__opt {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 36px;
    padding: 0 0.7rem;
    border: 0;
    background: var(--terra-bg-surface);
    color: var(--terra-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.user-menu__opt + .user-menu__opt { border-left: 1px solid var(--terra-border-strong); }
.user-menu__opt--on { background: var(--terra-primary); color: var(--terra-on-primary); }

.user-menu__sep { height: 1px; margin: 0.35rem 0; background: var(--terra-border-subtle); }

.user-menu__item {
    display: block;
    width: 100%;
    min-height: var(--terra-touch-min);
    padding: 0.65rem 1rem;
    border: 0;
    background: none;
    color: var(--terra-text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
}

.user-menu__item:hover,
.user-menu__item:focus-visible { background: var(--terra-bg-hover); color: var(--terra-text-primary); }
.user-menu__item--logout { color: var(--terra-danger-text); }
.user-menu__item--logout:hover { color: var(--terra-danger-text); }

/* ── Receiving steps as a state path (StepIndicator, as WebEngine StatePath): done ticked, the current one filled ──── */
.flow-path {
    display: flex;
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.35rem 0.65rem;
    list-style: none;
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border);
    border-radius: 12px;
}

.flow-path__step {
    position: relative;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

/* The line from the previous step: green up to the current one. */
.flow-path__step + .flow-path__step::before {
    content: "";
    position: absolute;
    top: calc(14px - 1.5px);
    right: calc(50% + 17px);
    left: calc(-50% + 17px);
    height: 3px;
    border-radius: 2px;
    background: var(--terra-border);
}

.flow-path__step.is-passed + .flow-path__step::before { background: var(--terra-success); }

.flow-path__dot {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    border: 2px solid var(--terra-border);
    border-radius: 50%;
    background: var(--terra-bg-surface);
    color: var(--terra-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.flow-path__step.is-passed .flow-path__dot {
    border-color: var(--terra-success);
    background: var(--terra-success-bg);
    color: var(--terra-success);
}

.flow-path__step.is-current .flow-path__dot {
    border-color: var(--terra-primary);
    background: var(--terra-primary);
    color: var(--terra-on-primary);
    box-shadow: 0 0 0 4px var(--terra-primary-wash);
}

.flow-path__name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--terra-text-muted);
    font-size: 0.74rem;
    font-weight: 500;
}

.flow-path__step.is-passed .flow-path__name { color: var(--terra-text-body); }
.flow-path__step.is-current .flow-path__name { color: var(--terra-text-primary); font-weight: 600; }

/* ── Operation cards: the state as a tag, done of all as a meter (ui-tag + MiniMeter) ──────────────────────────────── */
html[data-theme] .job-card--outage { background: var(--terra-bg-surface); }

.job-card { display: flex; flex-direction: column; gap: 0.4rem; }
.job-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.job-card__titles { min-width: 0; }
.job-card__name { font-weight: 600; }

.job-tag {
    flex-shrink: 0;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--terra-bg-surface-deep);
    color: var(--terra-text-body);
}

.job-tag--good { background: var(--terra-success-bg); color: var(--terra-success-text); }
.job-tag--warn { background: var(--terra-warning-bg); color: var(--terra-warning-text); }
.job-tag--bad { background: var(--terra-danger-bg); color: var(--terra-danger-text); }

.job-meter { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.1rem; }

.job-meter__head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--terra-text-muted);
}

.job-meter__head strong { color: var(--terra-text-primary); font-variant-numeric: tabular-nums; }

.job-meter__bar { height: 7px; overflow: hidden; border-radius: 999px; background: var(--terra-border); }
.job-meter__bar > span { display: block; height: 100%; border-radius: 999px; background: var(--terra-primary); }

.job-card__stop {
    padding: 0.45rem 0.6rem;
    border-radius: var(--terra-radius-sm);
    background: var(--terra-danger-bg);
    color: var(--terra-danger-text);
    font-size: 0.85rem;
    font-weight: 600;
}

.job-card__actions { display: flex; justify-content: flex-end; }
.job-card__actions .job-card__go { font-weight: 600; border-radius: var(--terra-radius-sm); }

/* ── Item info: record header with key figures (RecordHeader + RecordTile), stock rows with a meter ───────────────── */
.item-head {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem;
    background: var(--terra-bg-surface);
    border: 1px solid var(--terra-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px var(--terra-shadow-sm);
}

.item-head__top { display: flex; align-items: flex-start; gap: 0.65rem; }

.item-head__icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--terra-primary-wash);
    color: var(--terra-primary-ink);
}

.item-head__titles { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.item-head__title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; }

.item-head__name {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--terra-text-primary);
    overflow-wrap: anywhere;
}

.item-head__code {
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--terra-border);
    border-radius: 6px;
    background: var(--terra-bg-surface-deep);
    color: var(--terra-text-body);
    font-size: 0.78rem;
    font-weight: 600;
}

.item-head__sub { font-size: 0.82rem; color: var(--terra-text-muted); }

.item-head__tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }

.item-tile {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--terra-border);
    border-radius: 10px;
}

.item-tile__label { font-size: 0.75rem; font-weight: 500; color: var(--terra-text-muted); }

.item-tile__value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--terra-text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-tile__unit,
.stock-row__unit { font-size: 0.75rem; font-weight: 500; color: var(--terra-text-muted); }

.doc-item__link.stock-row { flex-direction: column; align-items: stretch; gap: 0.4rem; }
.stock-row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }

.stock-row__qty {
    font-weight: 700;
    color: var(--terra-text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stock-row__meter { display: flex; align-items: center; gap: 0.5rem; }

.stock-row__bar {
    position: relative;
    flex: 1;
    height: 7px;
    border-radius: 999px;
    background: var(--terra-border);
}

.stock-row__bar > span {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 999px;
    background: var(--terra-primary);
}

.stock-row__bar.is-low > span { background: var(--terra-warning); }

/* The minimum of the store: a mark on the bar. */
.stock-row__bar > i {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    border-radius: 1px;
    background: var(--terra-text-body);
}

.stock-row__tag {
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--terra-warning-bg);
    color: var(--terra-warning-text);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.stock-row__range { font-size: 0.75rem; color: var(--terra-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
