/* Design ported from the web department's Mobile project (Content/Site.css): dark by default, light via
   html[data-theme="light"] (key terra-theme in localStorage, applied by an inline script in index.html
   before first paint). data-bs-theme is set alongside so Bootstrap's own widgets follow the theme. */

/* The values live in the shared Terra tokens (Terra.DesignSystem tokens.css, theme via data-theme on <html>).
   These are this file's local names for them. */
:root {
    --bg-page:           var(--terra-bg-page);
    --bg-surface:        var(--terra-bg-surface);
    --bg-surface-deep:   var(--terra-bg-surface-deep);
    --bg-surface-header: var(--terra-bg-surface-header);
    --bg-raised:         var(--terra-bg-raised);
    --bg-hover:          var(--terra-bg-hover);

    --border-color:      var(--terra-border);
    --border-subtle:     var(--terra-border-subtle);

    --text-primary:      var(--terra-text-primary);
    --text-secondary:    var(--terra-text-secondary);
    --text-body:         var(--terra-text-body);
    --text-muted:        var(--terra-text-muted);
    --text-label:        var(--terra-text-label);
    --text-link:         var(--terra-text-link);

    --shadow-md:         var(--terra-shadow-md);
    --shadow-sm:         var(--terra-shadow-sm);

    --navbar-bg:         var(--terra-navbar-bg);
    --navbar-text:       var(--terra-navbar-text);
    --navbar-border:     var(--terra-navbar-border);

    --footer-bg:         var(--terra-navbar-bg);
    --footer-text:       var(--terra-navbar-text);
    --footer-btn-border: var(--terra-border-strong);
}

body,
.menu-tile, .detail-card, .doc-item, .page-back, .dark-modal,
.navbar.bg-dark, footer.bg-dark, .form-card {
    transition: background-color 0.25s ease, color 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ── Base ────────────────────────────────────────────────────────────── */
html, body {
    background-color: var(--bg-page);
    color: var(--text-body);
    font-family: var(--terra-font);
}

body { -webkit-tap-highlight-color: transparent; }

a { color: var(--text-link); }

h1:focus { outline: none; }

.body-content {
    margin-top: 15px;
    padding-left: 15px;
    padding-right: 15px;
}

@media screen and (min-width: 768px) {
    .body-content { padding: 0; }
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ── Navbar / footer ─────────────────────────────────────────────────── */
.navbar.bg-dark {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--navbar-border);
    padding-top: env(safe-area-inset-top);
}

.navbar .navbar-brand,
.navbar .btn,
.navbar .dropdown-toggle { color: var(--navbar-text); }

footer.fixed-bottom.bg-dark {
    background-color: var(--footer-bg) !important;
    border-top: 1px solid var(--navbar-border);
    padding-bottom: env(safe-area-inset-bottom);
}

.footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0;
}

.footer-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
    color: var(--footer-text);
}

.footer-user svg { flex-shrink: 0; opacity: 0.6; }
a.footer-user { color: inherit; text-decoration: none; }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 1rem; }
.profile-avatar {
    width: 84px; height: 84px; flex-shrink: 0; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-raised); border: 2px solid var(--border-color);
    color: var(--text-secondary); font-size: 1.9rem; font-weight: 700;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-head__name { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.profile-head__user { color: var(--text-muted); margin-bottom: 0.5rem; }
.profile-photo-btn { cursor: pointer; }
.profile-hint { text-align: left; margin-top: 0.35rem; font-size: 0.9rem; }

.footer-user__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--footer-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-logout {
    flex-shrink: 0;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    min-height: var(--terra-touch-min);
    border-radius: 8px;
    background: transparent !important;
    color: var(--terra-danger-text) !important;
    border: 1px solid var(--terra-danger-text) !important;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.footer-logout:hover,
.footer-logout:focus { background: rgba(220, 53, 69, 0.15) !important; color: var(--terra-danger-text) !important; }

.btn-ghost-nav {
    background: transparent;
    border: 1px solid var(--footer-btn-border);
    color: var(--navbar-text) !important;
    border-radius: 8px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-ghost-nav:hover,
.btn-ghost-nav:focus {
    background-color: var(--bg-raised);
    border-color: var(--border-color);
    color: var(--navbar-text) !important;
}

.lang-dropdown {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    min-width: 0;
}

.lang-dropdown .dropdown-item { color: var(--text-primary) !important; }

.lang-dropdown .dropdown-item:hover,
.lang-dropdown .dropdown-item:focus { background-color: var(--bg-hover) !important; }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--footer-btn-border);
    color: var(--navbar-text);
    border-radius: 8px;
    min-width: var(--terra-touch-min);
    min-height: var(--terra-touch-min);
    padding: 0.35rem 0.55rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--bg-raised);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.logo--light { display: none; }
html[data-theme="light"] .logo--dark  { display: none; }
html[data-theme="light"] .logo--light { display: block; }

/* White SVG icons -> dark in the light theme */
html[data-theme="light"] .menu-tile__icon img,
html[data-theme="light"] .page-back img,
html[data-theme="light"] .items-back img,
html[data-theme="light"] .doc-item__link img,
html[data-theme="light"] .icon-white {
    filter: invert(1) brightness(0.2);
}

/* ── Home menu tiles ─────────────────────────────────────────────────── */
.menu-page { margin: 0 auto; padding-bottom: 4.5rem; }

.menu-tile {
    display: block;
    width: 100%;
    background-color: var(--bg-surface);
    border: none;
    border-radius: 10px;
    border-left: 5px solid transparent;
    box-shadow: 0 2px 6px var(--shadow-md);
    text-align: left;
    text-decoration: none !important;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.menu-tile:active { transform: scale(0.97); box-shadow: 0 1px 5px var(--shadow-md); }

.menu-tile--orange { border-left-color: #fd7e14; }
.menu-tile--blue   { border-left-color: var(--terra-primary); }
.menu-tile--green  { border-left-color: #20c997; }

.menu-tile--disabled { opacity: 0.5; pointer-events: none; }

.menu-tile__inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.7rem;
    min-height: 56px;
}

.menu-tile__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.menu-tile__icon img { width: 32px; height: 32px; }

.menu-tile__label {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.menu-tile__badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-raised);
    border-radius: 20px;
    padding: 0.2rem 0.65rem;
}

.menu-tile__chevron {
    flex-shrink: 0;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-primary);
    opacity: 0.25;
    padding-right: 0.15rem;
}

/* ── Back link, cards, lists ─────────────────────────────────────────── */
.page-back {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    font-size: 1.15rem;
    font-weight: 600;
    box-shadow: 0 2px 6px var(--shadow-sm);
    border: none;
    width: 100%;
    text-align: left;
    transition: transform 0.1s ease;
}

.page-back:active { transform: scale(0.98); }

.detail-card {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-md);
    overflow: hidden;
}

.detail-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    background: var(--bg-surface-header);
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
}

.detail-card__title { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }

.detail-card__chip {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-raised);
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
}

.detail-list { padding: 0.2rem 0; margin: 0; }

.detail-list__row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-list__row:last-child { border-bottom: none; }

.detail-list__row dt {
    flex-shrink: 0;
    width: 6rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-list__row dd { flex: 1; margin: 0; font-size: 1.05rem; color: var(--text-secondary); word-break: break-word; }

.doc-item {
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 4px var(--shadow-sm);
}

.doc-item:last-child { margin-bottom: 0; }

.doc-item__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 1rem;
    color: var(--text-secondary) !important;
    min-height: 64px;
    background: transparent;
    border: none;
    text-align: left;
    text-decoration: none !important;
}

.doc-item__link img { flex-shrink: 0; width: 24px; height: 24px; filter: brightness(0) invert(1); }

.doc-item__name { font-size: 1rem; font-weight: 600; word-break: break-word; }

.doc-item__type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-link);
    background: rgba(110, 168, 254, 0.15);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    margin-right: 0.4rem;
    vertical-align: middle;
}

html[data-theme="light"] .doc-item__type { background: rgba(13, 110, 253, 0.1); }

.doc-item__date { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }

.doc-item--static .doc-item__link { cursor: default; }

.empty-note { text-align: center; color: var(--text-label); font-size: 1.1rem; padding: 2rem 1rem; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-card {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-md);
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Time off (laisvadieniai) list */
.timeoff-item { gap: 0.35rem; border-left: 5px solid var(--border-color); }
.timeoff-item--1 { border-left-color: var(--terra-warning); background: color-mix(in srgb, var(--terra-warning-bg) 55%, var(--bg-surface)); }
.timeoff-item--2 { border-left-color: var(--terra-success); background: color-mix(in srgb, var(--terra-success) 10%, var(--bg-surface)); }
.timeoff-item--3 { border-left-color: var(--terra-danger); background: color-mix(in srgb, var(--terra-danger) 10%, var(--bg-surface)); }
.timeoff-item__head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.timeoff-item__type { font-weight: 700; color: var(--text-primary); }
.timeoff-item__period { color: var(--text-body); }
.timeoff-status { font-size: 0.8rem; font-weight: 700; border-radius: 20px; padding: 0.15rem 0.65rem; background: var(--bg-raised); color: var(--text-secondary); }
.timeoff-status--1 { color: var(--terra-warning-text); background: rgba(255, 193, 7, 0.18); }
.timeoff-status--2 { color: var(--terra-success-text); background: rgba(25, 135, 84, 0.15); }
.timeoff-status--3 { color: var(--terra-danger-text); background: rgba(220, 53, 69, 0.14); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.form-field { display: flex; flex-direction: column; }

.field-error { font-size: 0.875rem; margin-top: 0.25rem; color: var(--terra-danger-text); }

.login-label,
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.45rem;
}

.login-input,
.form-control,
.form-select {
    background-color: var(--bg-raised);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 1.2rem;
    padding: 0.75rem 1rem;
    height: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus,
.form-control:focus,
.form-select:focus {
    background-color: var(--bg-raised);
    border-color: var(--terra-primary);
    color: var(--text-primary);
    box-shadow: var(--terra-focus-ring);
    outline: none;
}

.login-input::placeholder,
.form-control::placeholder { color: var(--text-muted); opacity: 1; }

.form-control:disabled,
.form-control[readonly] { background-color: var(--bg-surface-deep); color: var(--text-muted); opacity: 1; }

.form-check-input { width: 1.5rem; height: 1.5rem; accent-color: var(--terra-primary); background-color: var(--bg-raised); border-color: var(--border-color); }
.form-check-label { color: var(--text-secondary); font-size: 1.05rem; padding-left: 0.35rem; }

.check-row { display: flex; align-items: center; gap: 0.6rem; }

/* ── Searchable select (.combo) ──────────────────────────────────────── */
.combo { position: relative; }

.combo__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 15rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-raised);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 6px 20px var(--shadow-md);
}

.combo__option {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    text-align: left;
}

.combo__option:last-child { border-bottom: none; }
.combo__option:hover,
.combo__option:active,
.combo__option--active { background: var(--bg-hover); }
.combo__empty { padding: 0.7rem 1rem; color: var(--text-muted); font-size: 1rem; }
.combo__input-wrap { position: relative; }
.combo__input-wrap .login-input { padding-right: 2.75rem; }
.combo__chevron {
    position: absolute;
    top: 0; right: 0; height: 100%; width: 2.75rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); pointer-events: none; font-size: 0.9rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.login-btn,
.action-bar-btn {
    display: block;
    width: 100%;
    border: none;
    color: #fff;
    text-align: center;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.login-btn:disabled,
.action-bar-btn:disabled { opacity: 0.55; }

.login-btn {
    background: var(--terra-primary);
    font-size: 1.25rem;
    padding: 0.9rem;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.35);
    margin-top: 0.25rem;
}

.login-btn:hover { box-shadow: 0 6px 20px rgba(13, 110, 253, 0.5); }
.login-btn:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35); }

.login-send-btn,
.btn-soft {
    flex-shrink: 0;
    background: var(--bg-raised);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.1rem;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.login-send-btn:hover,
.login-send-btn:focus,
.btn-soft:hover,
.btn-soft:focus { background: var(--bg-hover); color: var(--text-primary); }

.btn-soft--danger { color: var(--terra-danger-text); border-color: var(--terra-danger-text); }
.btn-soft--blue { color: var(--terra-text-link); border-color: var(--terra-text-link); }

.action-bar-spacer { height: calc(5.5rem + env(safe-area-inset-bottom)); }

.action-bar-fixed {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--footer-bg);
    border-top: 1px solid var(--navbar-border);
    padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
    z-index: 5;
    transition: background-color 0.25s ease;
}

.action-bar-btn { padding: 0.9rem; font-size: 1.2rem; }
.action-bar-btn:active { transform: scale(0.98); }

.action-bar-btn--save { background: var(--terra-success); box-shadow: 0 4px 15px rgba(25, 135, 84, 0.4); }
.action-bar-btn--save:hover { box-shadow: 0 6px 20px rgba(25, 135, 84, 0.55); }
.action-bar-btn--primary { background: var(--terra-primary); box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4); }
.action-bar-btn--primary:hover { box-shadow: 0 6px 20px rgba(13, 110, 253, 0.55); }
.action-bar-btn--warn { background: #fd7e14; box-shadow: 0 4px 15px rgba(253, 126, 20, 0.4); }
.action-bar-row { display: flex; gap: 0.6rem; }
.action-bar-row .action-bar-btn { flex: 1; }
.action-bar-btn--muted { background: var(--bg-raised); color: var(--text-secondary); box-shadow: none; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-page { display: flex; justify-content: center; padding-top: 1rem; padding-bottom: 2rem; }

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: 0 4px 24px var(--shadow-md);
    overflow: hidden;
}

.login-card__header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1.5rem 1.5rem;
    background: var(--bg-surface-header);
    border-bottom: 1px solid var(--border-color);
}

.login-card__icon { color: var(--terra-primary); opacity: 0.85; }

.login-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem 0;
}

.login-method {
    border: 1.5px solid var(--border-color);
    background: var(--bg-raised);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.login-method:hover { background: var(--bg-hover); color: var(--text-primary); }
.login-method--active,
.login-method--active:hover { background: var(--terra-primary); border-color: var(--terra-primary); color: var(--terra-on-primary); }

.login-hint { color: var(--text-muted); font-size: 1rem; text-align: center; }
.login-google { display: flex; justify-content: center; min-height: 44px; }
.login-face { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.login-face video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.login-form { display: flex; flex-direction: column; gap: 1.3rem; padding: 1.5rem; }
.login-code-row { display: flex; gap: 0.65rem; align-items: stretch; }
.login-code-row .login-input { flex: 1; min-width: 0; }

/* One-time code: one box per digit */
.otp-row { display: flex; gap: 0.5rem; }
.otp-confirm { width: 100%; margin-top: 0.75rem; }
.otp-box { flex: 1; min-width: 0; width: 100%; text-align: center; font-size: 1.4rem; font-weight: 700; padding: 0.6rem 0; }

/* Scan button: an icon inside the right end of the field, so the field keeps the full width. */
.login-code-row:has(> .scan-btn) { position: relative; display: block; }
.login-code-row:has(> .scan-btn) > .login-input { width: 100%; padding-right: 3.4rem; }
.login-code-row:has(> .scan-btn) .combo__input-wrap .login-input { padding-right: 5.9rem; }
.login-code-row:has(> .scan-btn) .combo__chevron { right: 3.1rem; }
.scan-btn {
    position: absolute; top: 0; right: 0; height: 100%; width: 3.1rem;
    display: flex; align-items: center; justify-content: center;
    padding: 0; border: none; background: transparent; box-shadow: none;
    color: var(--text-muted); font-size: 0; line-height: 0;
}
.scan-btn::before {
    content: ""; width: 26px; height: 26px; background-color: currentColor;
    -webkit-mask: url("../images/scan.svg") center / contain no-repeat;
    mask: url("../images/scan.svg") center / contain no-repeat;
}
.scan-btn:hover, .scan-btn:focus { color: var(--text-primary); background: transparent; }
.scan-btn:disabled { opacity: 0.4; }

/* ── Modals (dialogs that Android also showed as dialogs) ────────────── */
.dark-modal,
.modal-content {
    background: var(--bg-surface-deep);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-body);
}

.dark-modal .modal-header,
.modal-header { border-bottom: 1px solid var(--border-subtle); padding: 1rem 1.25rem; }

.dark-modal .modal-title,
.modal-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }

.dark-modal .modal-footer,
.modal-footer { border-top: 1px solid var(--border-subtle); padding: 0.75rem 1rem; }

.modal-body { max-height: 65vh; overflow-y: auto; }
.modal-backdrop.show { opacity: 0.6; }
.btn-close { filter: invert(1) grayscale(1); }
html[data-theme="light"] .btn-close { filter: none; }

/* ── Upload card ─────────────────────────────────────────────────────── */
.upload-card {
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-sm);
    overflow: hidden;
}

.upload-card__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    background: var(--bg-surface-header);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.upload-btn-row { display: flex; border-top: 1px solid var(--border-subtle); }

.upload-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 100px;
    padding: 1rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
}

.upload-btn--camera { border-right: 1px solid var(--border-subtle); color: #0d6efd; }
.upload-btn--camera:hover { background: rgba(13, 110, 253, 0.08); }
.upload-btn--gallery { color: #20c997; }
.upload-btn--gallery:hover { background: rgba(32, 201, 151, 0.08); }

.pending-photo-list { display: flex; flex-direction: column; gap: 10px; }

.pending-photo-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
}

.pending-photo-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: var(--bg-raised);
    flex-shrink: 0;
}

.pending-photo-placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.pending-photo-fields { flex-grow: 1; min-width: 0; }
.pending-photo-remove { flex-shrink: 0; width: var(--terra-touch-min); height: var(--terra-touch-min); background-size: 1rem; }

/* ── Misc functional ─────────────────────────────────────────────────── */
.item-info { min-width: 0; }
.item-info .card-title { overflow-wrap: break-word; }

.qr-scan-overlay {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-scan-overlay video { max-width: 100%; max-height: 100%; }
.qr-scan-cancel { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); }

/* Selfie camera: the preview is mirrored like a mirror (the photo itself is not), and a round shutter sits above the cancel button */
.selfie-video { transform: scaleX(-1); }
.selfie-shutter {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: rgba(255, 255, 255, 0.35);
}
.selfie-shutter:active { background: rgba(255, 255, 255, 0.8); }
.selfie-shutter:disabled { opacity: 0.5; }

.badge-pill-soft {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 0.15rem 0.6rem;
    background: var(--bg-raised);
    color: var(--text-secondary);
}

/* Bootstrap leftovers used by pages not yet rewritten */
.card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; color: var(--text-body); }
.card-header.bg-white { background: var(--bg-surface-header) !important; border-bottom: 1px solid var(--border-color) !important; color: var(--text-primary); }
.card-title, .card-header h5 { color: var(--text-primary); }
.text-muted { color: var(--text-muted) !important; }
.list-group-item { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-color); }
.list-group-item-action:hover { background: var(--bg-hover); color: var(--text-primary); }
.alert { border-radius: 12px; }
.btn { border-radius: 10px; }
.btn-danger { background-color: var(--terra-danger); border-color: var(--terra-danger); color: #fff; }
.btn-danger:hover, .btn-danger:focus { background-color: var(--terra-danger-hover); border-color: var(--terra-danger-hover); color: #fff; }
.btn-primary { background-color: var(--terra-primary); border-color: var(--terra-primary); color: var(--terra-on-primary); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--terra-primary-hover); border-color: var(--terra-primary-hover); color: var(--terra-on-primary); }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-color); }
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-color); }
.btn-outline-primary { color: var(--terra-text-link); border-color: var(--terra-text-link); }
.btn-outline-primary:hover { background: rgba(13, 110, 253, 0.15); color: var(--text-primary); }
.badge.text-bg-light { background: var(--bg-raised) !important; color: var(--text-secondary) !important; border-color: var(--border-color) !important; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--terra-success); }
.invalid { outline: 1px solid var(--terra-danger); }
.validation-message { color: var(--terra-danger-text); }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: calc(6rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 420px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.terra-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    padding: 0.85rem 0.85rem 0.85rem 1rem;
    box-shadow: 0 4px 16px var(--shadow-md);
    pointer-events: all;
    position: relative;
    overflow: hidden;
    animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.terra-toast--primary   { border-left-color: var(--terra-primary); }
.terra-toast--success   { border-left-color: var(--terra-success); }
.terra-toast--danger    { border-left-color: var(--terra-danger); }
.terra-toast--warning   { border-left-color: var(--terra-warning); }
.terra-toast--info      { border-left-color: var(--terra-text-link); }

.terra-toast__body { flex: 1; min-width: 0; }
.terra-toast__text { display: block; font-size: 0.95rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }

.terra-toast__close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    min-width: var(--terra-touch-min);
    min-height: var(--terra-touch-min);
    margin: -0.6rem -0.6rem -0.6rem 0;
    cursor: pointer;
}

.terra-toast__close:hover { color: var(--text-primary); }

.terra-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    opacity: 0.45;
    animation: toast-progress 5s linear forwards;
}

.terra-toast--primary .terra-toast__progress { background: var(--terra-primary); }
.terra-toast--success .terra-toast__progress { background: var(--terra-success); }
.terra-toast--danger  .terra-toast__progress { background: var(--terra-danger); }
.terra-toast--warning .terra-toast__progress { background: var(--terra-warning); }
.terra-toast--info    .terra-toast__progress { background: var(--terra-text-link); }

@keyframes toast-progress { from { width: 100%; } to { width: 0%; } }

/* ── Loader ──────────────────────────────────────────────────────────── */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

html[data-theme="light"] .app-loader { background: rgba(240, 242, 245, 0.80); }

.app-loader__spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--terra-primary);
    animation: loader-spin 0.75s linear infinite;
}

@keyframes loader-spin { to { transform: rotate(360deg); } }

/* ── Blazor framework bits ───────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #212529;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 11000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred." }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--terra-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    color: var(--text-primary);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

code { color: #c02d76; }


/* ── Receiving items window (compact, phone-first) ───────────────────── */
.items-compact { margin: 0 auto; display: flex; flex-direction: column; gap: 0.5rem; }
.items-compact .form-card { padding: 0.6rem; gap: 0.5rem; border-radius: 12px; }
.items-compact .login-label { font-size: 0.8rem; margin-bottom: 0.15rem; }
.items-compact .login-input,
.items-compact .form-control { font-size: 1rem; padding: 0.5rem 0.75rem; min-height: 44px; }
.items-compact .combo__option { padding: 0.55rem 0.85rem; font-size: 1rem; }

.items-head { display: flex; align-items: center; gap: 0.5rem; }
.items-back {
    width: var(--terra-touch-min); height: var(--terra-touch-min); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color); border-radius: 10px;
    background: var(--bg-surface); padding: 0;
}
.items-title { font-size: 1.05rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.items-title__req { color: var(--text-muted); font-weight: 600; }
.items-sub { font-size: 0.85rem; line-height: 1.3; color: var(--text-muted); }
.items-sub strong { color: var(--text-primary); }

.items-selected { margin-top: 0.25rem; font-size: 0.875rem; line-height: 1.3; font-weight: 600; color: var(--terra-success-text); }

.items-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.items-row__qty { width: 92px; flex-shrink: 0; }
.items-row__measure { flex: 1; min-width: 0; }
.items-add { height: 44px; flex-shrink: 0; padding: 0 1rem; font-size: 1rem; font-weight: 700; border-radius: 10px; }

.items-checks { display: flex; gap: 0.75rem; }
.items-checks .form-check { flex: 1; display: flex; align-items: center; gap: 0.1rem; margin: 0; padding: 0; min-height: var(--terra-touch-min); }
.items-checks .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; flex-shrink: 0; float: none; }
.items-checks .form-check-label { font-size: 0.9rem; line-height: 1.2; padding-left: 0.4rem; }

.items-basket-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); padding: 0 0.1rem; }
.items-basket-title span { color: var(--text-muted); font-weight: 600; }

.basket-row {
    display: flex; align-items: center; gap: 0.25rem;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-left: 4px solid #20c997; border-radius: 10px;
    padding: 0.35rem 0.15rem 0.35rem 0.6rem;
}
.basket-row__main { flex: 1; min-width: 0; }
.basket-row__top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.basket-row__name { font-size: 0.9rem; font-weight: 700; line-height: 1.25; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.basket-row__qty { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.basket-row__meta { font-size: 0.85rem; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.basket-row__btn {
    width: var(--terra-touch-min); height: var(--terra-touch-min); flex-shrink: 0; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-muted);
}
.basket-row__btn--danger { color: var(--terra-danger-text); }

.terra-toast { white-space: pre-line; }

/* ── Operacijų fiksavimas (manufactory jobs) ─────────────────────────── */
.job-filter { display: flex; flex-direction: column; gap: 0.5rem; }
.job-filter__dates { display: flex; gap: 0.5rem; }
.job-filter__dates > div { flex: 1; min-width: 0; }
.job-filter__actions { display: flex; gap: 0.5rem; }
.job-filter__actions .btn { flex: 1; }
.job-count { font-size: 0.85rem; color: var(--text-muted); padding: 0 0.1rem; }

.job-card {
    cursor: pointer;
    display: block; width: 100%; text-align: left;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-left: 5px solid #20c997; border-radius: 10px;
    padding: 0.6rem 0.75rem; color: var(--text-secondary);
}
.job-card--started { border-left-color: #ffc107; }
.job-card--blocked { border-left-color: #6c757d; opacity: 0.6; }
.job-card__name { font-size: 0.95rem; font-weight: 700; line-height: 1.25; color: var(--text-primary); overflow-wrap: anywhere; }
.job-card__op { font-size: 0.9rem; line-height: 1.3; color: var(--text-secondary); }
.job-card__meta { font-size: 0.85rem; color: var(--text-muted); }
.defect-tick { flex: none; color: var(--bs-success, #20c997); font-weight: 700; font-size: 1.1rem; }
.job-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.35rem; }
.job-card__nums { display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; font-size: 0.82rem; color: var(--text-muted); }
.job-card__nums b { color: var(--text-primary); }
.job-card__go { flex-shrink: 0; font-weight: 700; padding: 0.35rem 0.9rem; border-radius: 8px; }

.team-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.9rem; background: var(--bg-surface); border-radius: 10px; margin-bottom: 0.5rem; }
.team-row .form-check-input { flex-shrink: 0; margin: 0; }
.team-row__name { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }

.work-stats { display: flex; flex-direction: column; gap: 0.15rem; }
.work-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); }
.work-stat:last-child { border-bottom: none; }
.work-stat__label { font-size: 0.9rem; color: var(--text-muted); }
.work-stat__value { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.work-stat__value--late { color: var(--terra-danger-text); }
.work-stat__value--ok { color: var(--terra-success-text); }
.work-stat__value--bad { color: var(--terra-danger-text); }
.work-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.work-actions .btn { padding: 0.75rem; font-size: 1.05rem; font-weight: 600; }

/* ── Pirkimo dokumentai (Frutsorta quality control) ──────────────────── */
.qc-sub { margin: -0.4rem 0.1rem 0.75rem; font-size: 0.9rem; color: var(--text-muted); overflow-wrap: anywhere; }
.qc-stack { display: flex; flex-direction: column; gap: 0.65rem; }

.qc-section { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-link); margin: 0.1rem 0 -0.3rem; }
.qc-section::after { content: ""; flex: 1; height: 1px; background: var(--border-color); }

.qc-hint { margin-top: 0.4rem; font-size: 0.82rem; color: var(--text-muted); }
.qc-hint b { color: var(--text-primary); }

.qc-unitwrap { position: relative; }
.qc-unitwrap > .form-control { padding-right: 3.4rem; }
.qc-unitwrap__unit { position: absolute; top: 0; right: 0; height: 100%; display: flex; align-items: center; padding-right: 1rem; color: var(--text-muted); font-weight: 600; pointer-events: none; }

.qc-check { display: flex; align-items: center; gap: 0.75rem; min-height: 54px; padding: 0 1rem; margin: 0; cursor: pointer;
    background: var(--bg-raised); border: 1.5px solid var(--border-color); border-radius: 10px; font-size: 1.05rem; color: var(--text-secondary); }
.qc-check .form-check-input { flex-shrink: 0; margin: 0; float: none; }

/* progress of the two-step edit */
.qc-prog { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.85rem; padding: 0 0.1rem; }
.qc-prog__bars { display: flex; gap: 0.4rem; }
.qc-prog__seg { flex: 1; height: 5px; border-radius: 3px; background: var(--border-color); }
.qc-prog__seg--on { background: var(--terra-primary); }
.qc-prog__txt { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.88rem; color: var(--text-muted); }
.qc-prog__txt b { color: var(--text-primary); }

/* segmented control (Taip / Ne, Dideli / Maži) */
.qc-seg { display: flex; gap: 4px; padding: 4px; background: var(--bg-raised); border: 1.5px solid var(--border-color); border-radius: 12px; }
.qc-seg__opt { flex: 1; min-height: 46px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 1.05rem; }
.qc-seg__opt--on { background: var(--terra-primary); color: var(--terra-on-primary); box-shadow: 0 2px 8px rgba(13, 110, 253, 0.4); }
.qc-seg__opt--yes.qc-seg__opt--on { background: var(--terra-danger); color: #fff; box-shadow: 0 2px 8px rgba(220, 53, 69, 0.35); }
.qc-seg__opt--no.qc-seg__opt--on { background: var(--terra-success); color: #fff; box-shadow: 0 2px 8px rgba(25, 135, 84, 0.4); }

/* list rows */
.qc-row { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; text-align: left; padding: 0.7rem 0.75rem 0.7rem 0.85rem; cursor: pointer;
    background: var(--bg-surface); border: 1px solid var(--border-color); border-left: 5px solid #20c997; border-radius: 10px; box-shadow: 0 1px 4px var(--shadow-sm); color: var(--text-secondary); }
.qc-row__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.qc-row__name { font-size: 1.05rem; font-weight: 700; line-height: 1.25; color: var(--text-primary); overflow-wrap: anywhere; }
.qc-row__qty { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.qc-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; }
.qc-row__client { font-size: 0.88rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.qc-chip--blue { color: var(--text-link); background: rgba(110, 168, 254, 0.15); }
html[data-theme="light"] .qc-chip--blue { background: rgba(13, 110, 253, 0.1); }
.qc-chip--red { color: var(--terra-danger-text); background: rgba(220, 53, 69, 0.14); }
.qc-chip--green { color: var(--terra-success-text); background: rgba(25, 135, 84, 0.14); }

/* hub: item facts + steps */
.qc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 0.9rem; padding: 0.9rem 1rem; margin: 0; }
.qc-fact--wide { grid-column: 1 / -1; }
.qc-fact dt { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-label); margin: 0 0 0.1rem; }
.qc-fact dd { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.qc-steps { display: flex; align-items: flex-start; justify-content: space-between; padding: 0.9rem 1rem 1rem; border-top: 1px solid var(--border-subtle); }
.qc-step { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; width: 76px; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.qc-step__dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-color); background: var(--bg-raised); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.qc-step--done { color: var(--text-primary); }
.qc-step--done .qc-step__dot { background: #20c997; border-color: #20c997; color: #0b2b22; }
.qc-step--now { color: var(--text-primary); }
.qc-step--now .qc-step__dot { border-color: #0d6efd; color: var(--text-link); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.22); }
.qc-step__line { flex: 1; height: 2px; background: var(--border-color); margin-top: 14px; }
.qc-step__line--done { background: #20c997; }

/* hub tiles: roomier than the home ones, with a "locked" state that says why */
.menu-tile--lg .menu-tile__inner { min-height: 64px; padding: 0.5rem 0.9rem; gap: 0.9rem; }
.menu-tile--lg .menu-tile__icon { width: 36px; height: 36px; }
.menu-tile--lg .menu-tile__icon img { width: 36px; height: 36px; }
.menu-tile__body { flex: 1; min-width: 0; }
.menu-tile__body .menu-tile__label { display: block; }
.menu-tile__sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.1rem; line-height: 1.3; }
.menu-tile--locked { opacity: 1; box-shadow: none; background: transparent; border: 1px dashed var(--border-color); border-left: 5px solid #6c757d; }
.menu-tile--locked .menu-tile__label { color: var(--text-muted); }
.menu-tile--locked .menu-tile__icon { color: var(--text-muted); }

/* defects */
.qc-defect { display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left; min-height: 64px; padding: 0.6rem 0.75rem 0.6rem 0.9rem; cursor: pointer;
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 1px 4px var(--shadow-sm); color: var(--text-secondary); }
.qc-defect__tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: transparent; }
.qc-defect--done .qc-defect__tick { background: #20c997; border-color: #20c997; color: #0b2b22; }
.qc-defect__text { flex: 1; min-width: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); line-height: 1.25; overflow-wrap: anywhere; }
.qc-defect__sub { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.15rem; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.qc-defect__chev { font-size: 1.6rem; line-height: 1; color: var(--text-primary); opacity: 0.3; }

/* compact windows (main info, defects, defect result): everything within one phone screen */
.form-card.qc-compact { gap: 0.7rem; padding: 0.8rem 0.9rem; }
.qc-compact .form-control { font-size: 1.05rem; padding: 0.55rem 0.9rem; }
.qc-compact .login-label { margin-bottom: 0.3rem; }
.qc-compact .qc-section { margin-bottom: -0.15rem; }
.qc-compact .qc-seg__opt { min-height: 42px; }
.qc-stack.qc-compact { gap: 0.5rem; }
.qc-compact .qc-defect { min-height: 56px; padding-top: 0.45rem; padding-bottom: 0.45rem; }

/* Notifications, activities and figures - the same flat cards as the job list */
.bell-btn { position: relative; }
.bell-badge {
    position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: #dc3545; color: #fff; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
a.theme-toggle { text-decoration: none; }

.notif-tools { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.notif-tools .btn { flex: 1; min-width: 0; padding: 0.6rem 0.4rem; font-size: 0.9rem; white-space: normal; line-height: 1.2; }

.notif-card, .act-card {
    cursor: pointer; display: block; width: 100%; text-align: left;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-left: 5px solid #6c757d; border-radius: 10px;
    padding: 0.6rem 0.75rem; color: var(--text-secondary);
}
.notif-card--unread { border-left-color: var(--terra-primary); }
.notif-card__head { display: flex; align-items: center; justify-content: space-between; font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.notif-card__text { font-size: 0.9rem; line-height: 1.3; color: var(--text-secondary); overflow-wrap: anywhere; }
.notif-card__period { font-size: 0.85rem; color: var(--text-muted); }
.notif-dismiss { background: transparent; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1; padding: 0 0.3rem; min-width: var(--terra-touch-min); min-height: var(--terra-touch-min); }
.form-card.act-actions { flex-direction: row; gap: 0.5rem; }
.act-actions .btn { min-height: 48px; }

.act-toggle { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; color: var(--text-secondary); }
.act-day { margin-top: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.act-card { display: flex; align-items: center; gap: 0.75rem; border-left-color: #20c997; }
.act-card--run { border-left-color: #ffc107; }
.act-card--done { border-left-color: #198754; opacity: 0.7; }
.act-card--off { border-left-color: #6c757d; opacity: 0.6; }
.act-card__time { font-size: 0.85rem; font-weight: 700; min-width: 4.2rem; color: var(--text-primary); }
.act-card__body { flex: 1; min-width: 0; }
.act-card__name { font-size: 0.95rem; font-weight: 700; line-height: 1.25; color: var(--text-primary); overflow-wrap: anywhere; }
.act-card__meta { font-size: 0.85rem; color: var(--text-muted); }
.act-badge { font-size: 0.78rem; font-weight: 700; white-space: nowrap; color: var(--text-muted); }
.act-badge--run { color: var(--terra-warning-text); }
.act-badge--done { color: var(--terra-success-text); }
.act-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 0.9rem; }
.act-row:last-of-type { border-bottom: none; }
.act-row strong { text-align: right; color: var(--text-primary); overflow-wrap: anywhere; }
.act-comments { white-space: pre-wrap; color: var(--text-secondary); }

.status-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 0.9rem; }
.status-tiles--pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-tile {
    --tone: #6ea8fe;
    display: flex; flex-direction: column; gap: 0.15rem; text-align: left; min-width: 0; min-height: 64px;
    padding: 0.5rem 0.6rem; border-radius: 12px; cursor: pointer;
    color: var(--text-secondary); background: color-mix(in srgb, var(--tone) 14%, var(--bg-surface));
    border: 1.5px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.status-tile__top { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; color: var(--tone); }
.status-tile__icon { display: inline-flex; }
.status-tile__count { font-size: 1.4rem; font-weight: 700; line-height: 1.1; color: var(--text-primary); }
.status-tile__label { font-size: 0.85rem; font-weight: 600; line-height: 1.15; color: var(--text-secondary); overflow-wrap: anywhere; }
.status-tile--on { background: var(--tone); border-color: var(--tone); box-shadow: 0 2px 8px color-mix(in srgb, var(--tone) 45%, transparent); }
.status-tile--on .status-tile__top, .status-tile--on .status-tile__count, .status-tile--on .status-tile__label { color: #fff; }
.status-tile--blue { --tone: #0d6efd; }
.status-tile--green { --tone: #20c997; }
.status-tile--yellow { --tone: #e0a800; }
.status-tile--grey { --tone: #8a949e; }
.status-tile--orange { --tone: #fd7e14; }
.status-tile--red { --tone: #e5484d; }
.status-tile--teal { --tone: #17a2b8; }
html[data-theme="light"] .status-tile { background: color-mix(in srgb, var(--tone) 12%, #fff); }

/* Phone: the logo shrinks so the header buttons stay on its line */
.navbar > .container { flex-wrap: nowrap; gap: 0.5rem; }
.navbar-brand { margin-right: 0; min-width: 0; flex: 0 1 auto; }
@media (max-width: 575.98px) {
    .navbar-brand .logo { width: auto; height: 30px; max-width: 100%; }
    .navbar .theme-toggle, .navbar .btn-ghost-nav { padding-left: 0.4rem; padding-right: 0.4rem; }
    .navbar .d-flex.align-items-center.gap-2 { gap: 0.35rem !important; flex-shrink: 0; }
}

/* ── Page shell: one content width everywhere ────────────────────────── */
.page-shell { max-width: 720px; margin-inline: auto; }
.page-shell:has(.page-wide) { max-width: 1200px; }
.action-bar-fixed > .container { max-width: 720px; }

/* ── Mouse and keyboard (laptop/desktop): denser sizes, hover, pointer ─ */
@media (hover: hover) and (pointer: fine) {
    .login-input,
    .form-control,
    .form-select { font-size: 1rem; padding: 0.55rem 0.85rem; }
    .login-btn,
    .action-bar-btn { font-size: 1.05rem; padding: 0.7rem; }
    .page-title { font-size: 1.35rem; }
    .page-back { font-size: 1rem; padding: 0.6rem 0.9rem; width: auto; display: inline-flex; }
    .combo__option { font-size: 1rem; }
    .detail-list__row dt { width: 10rem; }
    .detail-card__title { font-size: 1.15rem; }
    .upload-btn { min-height: 84px; }

    .menu-tile:hover { background-color: var(--bg-hover); transform: translateY(-1px); box-shadow: 0 4px 10px var(--shadow-md); }
    .page-back:hover,
    .doc-item__link:hover,
    .job-card:hover,
    .qc-row:hover,
    .qc-defect:hover,
    .notif-card:hover,
    .act-card:hover,
    .status-tile:hover { background-color: var(--bg-hover); }
    .qc-check:hover { background-color: var(--bg-hover); }
}

/* Tablet and desktop widths */
@media (min-width: 768px) {
    .menu-page > div { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem !important; }
    .body-content { margin-top: 1.25rem; padding: 0 1rem; }
    .status-tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .qc-facts { grid-template-columns: repeat(4, 1fr); }
    #toast-container { bottom: auto; top: 76px; left: auto; right: 1rem; transform: none; }
}

/* Keyboard focus on custom controls that draw their own border */
.menu-tile:focus-visible,
.job-card:focus-visible,
.qc-row:focus-visible,
.qc-defect:focus-visible,
.notif-card:focus-visible,
.act-card:focus-visible,
.status-tile:focus-visible,
.doc-item__link:focus-visible,
.page-back:focus-visible { outline: 2px solid var(--terra-text-link); outline-offset: 2px; }

/* Desktop: name and Log out live in the top bar, the bottom bar is for phones */
.navbar-user { align-items: center; color: var(--navbar-text); text-decoration: none; font-weight: 600; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar-user:hover { color: var(--navbar-text); text-decoration: underline; }
@media (min-width: 768px) {
    .tab-bar { display: none; }
}

/* Phone bottom tab bar: Menu / Scan / Profile (top bar carries these at >= 768px) */
.tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: grid; grid-template-columns: repeat(3, 1fr); align-items: end;
    background: var(--footer-bg); border-top: 1px solid var(--navbar-border);
    padding-bottom: env(safe-area-inset-bottom);
}
.tab-bar__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 6px 4px; color: var(--text-muted); text-decoration: none;
    font-size: 0.8rem; font-weight: 600;
}
.tab-bar__item.active { color: var(--terra-primary); }
.tab-bar__scan {
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; margin-top: -22px; border-radius: 50%;
    background: var(--terra-primary); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.tab-bar__item--scan.active { color: var(--terra-primary); }
@media (min-width: 768px) { .tab-bar { display: none; } }
@media (max-width: 767.98px) { .page-shell { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); } }
body:has(.action-bar-fixed) .tab-bar { display: none; }

/* Home menu: search + groups */
.menu-search { position: sticky; top: 60px; z-index: 5; padding: 0.5rem 0; background: var(--bg-page); }
.menu-group { margin-bottom: 1rem; }
.menu-group__title { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-label); margin: 0.5rem 0.25rem; }
.menu-group__tiles { display: flex; flex-direction: column; gap: 0.5rem; }
@media (min-width: 768px) { .menu-group__tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } .menu-search { top: 0; } }

/* Scanner: aiming frame, hint, torch */
.qr-scan-frame { position: absolute; width: min(70vw, 320px); aspect-ratio: 1; pointer-events: none; }
.qr-scan-frame span { position: absolute; width: 36px; height: 36px; border: 4px solid #fff; }
.qr-scan-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.qr-scan-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.qr-scan-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.qr-scan-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.qr-scan-hint { position: absolute; top: calc(env(safe-area-inset-top) + 24px); left: 16px; right: 16px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px #000; }
.qr-scan-torch { position: absolute; bottom: 24px; right: 24px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.offline-strip { position: sticky; top: 0; z-index: 1040; padding: 0.4rem 1rem; text-align: center; font-size: 0.9rem; font-weight: 600; background: var(--terra-warning); color: #1f1500; }

/* Home: resume-unfinished card */
.resume-card { display: flex; align-items: center; gap: 0.75rem; min-height: 64px; margin-bottom: 0.5rem; padding: 0.6rem 1rem; border-radius: 12px; text-decoration: none; color: var(--text-primary); background: var(--terra-primary-bg, var(--bg-surface)); border: 1.5px solid var(--terra-primary); }
.resume-card__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.resume-card__title { font-weight: 700; }
.resume-card__sub { font-size: 0.9rem; color: var(--text-muted); }
.resume-card__go { font-size: 1.8rem; color: var(--terra-primary); }

/* QuantityInput */
.qty-input { display: flex; align-items: stretch; gap: 0.5rem; }
.qty-input__field { text-align: center; font-weight: 700; flex: 1; min-width: 0; }
.qty-input__btn { flex: 0 0 var(--terra-touch-min); min-height: var(--terra-touch-min); border-radius: 10px; border: 1.5px solid var(--border-color); background: var(--bg-raised); color: var(--text-primary); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.qty-input__btn:active:not(:disabled) { transform: scale(0.96); }
.qty-input__btn:disabled { opacity: 0.5; }

/* Empty / error / loading states */
.state-empty { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); }
.state-empty--error { color: var(--terra-danger-text); }
.state-empty__text { margin: 0; font-size: 1.05rem; color: var(--text-secondary, var(--text-muted)); }
.state-skeleton { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.25rem 0; }
.state-skeleton__row { height: 72px; border-radius: 12px; background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-raised) 50%, var(--bg-surface) 75%); background-size: 200% 100%; animation: state-shimmer 1.3s linear infinite; }
@keyframes state-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .state-skeleton__row { animation: none; } }

/* Status chips (icon + text, never colour alone) - shared by My day, My month and time off */
.status-chip { display: inline-flex; align-items: center; gap: 0.35rem; height: 28px; padding: 0 0.7rem 0 0.55rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--bg-raised); color: var(--text-muted); }
.status-chip--present { background: rgba(25,135,84,0.18); color: var(--terra-success-text); }
.status-chip--late, .status-chip--pending { background: rgba(255,193,7,0.2); color: var(--terra-warning-text); }
.status-chip--absent { background: rgba(220,53,69,0.18); color: var(--terra-danger-text); }
.status-chip--leave { background: rgba(13,110,253,0.2); color: var(--terra-text-link); }
.status-chip--holiday { background: rgba(111,66,193,0.22); color: #c9aef7; }
[data-theme="light"] .status-chip--holiday { color: #432874; background: #e2d9f3; }
.day-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.day-nav .btn { min-width: var(--terra-touch-min); min-height: var(--terra-touch-min); font-size: 1.5rem; line-height: 1; }
.day-nav__date { flex: 1; text-align: center; font-weight: 700; font-size: 1.1rem; }
.day-status { display: flex; flex-direction: column; gap: 0.5rem; border-left: 5px solid var(--border-color); }
.day-status--present { border-left-color: var(--terra-success); }
.day-status--late, .day-status--pending { border-left-color: var(--terra-warning); }
.day-status--absent { border-left-color: var(--terra-danger); }
.day-status--leave { border-left-color: var(--terra-primary); }
.day-status .status-chip { align-self: flex-start; }
.day-status__line { color: var(--text-muted); }
.day-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; }
.day-total strong { font-size: 1.8rem; }
.day-row { display: flex; align-items: center; gap: 0.75rem; }
.day-row__main { flex: 1; min-width: 0; }
.day-row__name { font-weight: 600; overflow-wrap: anywhere; }
.day-row__time { color: var(--text-muted); font-size: 0.9rem; }
.day-row__hours { font-weight: 700; font-size: 1.2rem; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 1rem; }
.month-grid__head { text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); padding: 0.25rem 0; }
.month-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); text-decoration: none; }
.month-cell--blank { border: 0; background: transparent; }
.month-cell__n { font-weight: 700; font-size: 0.95rem; }
.month-cell__h { font-size: 0.72rem; color: var(--text-muted); }
.month-cell__h--code { font-weight: 700; }
.month-cell--present { background: rgba(25,135,84,0.18); }
.month-cell--leave { background-color: rgba(13,110,253,0.2); background-image: radial-gradient(currentColor 1px, transparent 1px); background-size: 6px 6px; }
.month-cell--holiday { background: rgba(111,66,193,0.22); }
.month-cell--off { background: repeating-linear-gradient(45deg, var(--bg-raised), var(--bg-raised) 4px, var(--bg-surface) 4px, var(--bg-surface) 8px); color: var(--text-muted); }
.month-cell--absent { background: rgba(220,53,69,0.16); }
.month-cell--today { outline: 2px solid var(--terra-primary); outline-offset: 1px; }
.month-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }
@media (min-width: 768px) { .month-cell { min-height: 72px; } }

.day-status, .day-total, .day-row { text-align: left; }

/* Step indicator of the receiving row windows */
.step-indicator { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.75rem; }
.step-indicator__dots { display: flex; gap: 6px; flex: 1; }
.step-indicator__dot { height: 6px; flex: 1; border-radius: 3px; background: var(--border-color); }
.step-indicator__dot--done { background: var(--terra-success); }
.step-indicator__dot--now { background: var(--terra-primary); }
.step-indicator__text { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* Inventory difference summary */
.inv-diff { display: flex; align-items: baseline; gap: 0.6rem; margin-top: 0.75rem; padding: 0.6rem 0.9rem; border-radius: 10px; border-left: 5px solid var(--border-color); background: var(--bg-raised); text-align: left; }
.inv-diff strong { font-size: 1.4rem; }
.inv-diff--more { border-left-color: var(--terra-success); }
.inv-diff--less { border-left-color: var(--terra-danger); }

.app-loader { flex-direction: column; gap: 1rem; }
.app-loader__progress { font-weight: 700; font-size: 1.25rem; color: var(--text-primary); }

.menu-page { width: 100%; }
.menu-search, .menu-search .login-input { width: 100%; max-width: none; }
@media (min-width: 768px) { .menu-group__tiles { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }

/* Readability pass (light theme first): disabled buttons keep legible text, cards stand out from the page, rows read left to right. */
.login-btn:disabled, .action-bar-btn:disabled, .login-send-btn:disabled {
    opacity: 1;
    background: var(--bg-raised) !important;
    color: var(--text-muted) !important;
    box-shadow: none;
    border: 1px solid var(--border-color) !important;
}
html[data-theme="light"] .form-card, html[data-theme="light"] .menu-tile, html[data-theme="light"] .page-back {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(33, 37, 41, 0.08);
}
html[data-theme="light"] .login-input, html[data-theme="light"] .form-control { border-color: var(--terra-border-strong); }
.day-row__main, .day-row__name, .day-row__time { text-align: left; }
.day-nav .btn:disabled { opacity: 0.45; }
.form-card.day-row, .form-card.day-total { flex-direction: row; }

/* Status tiles: every tone gets a text colour for the unselected tile and a solid colour for the selected one, each checked for
   contrast (>= 4.5:1 for the text on it). The bright tones stay for dark mode, where they read well on dark. */
.status-tile--blue   { --tone-text: #0b5ed7; --tone-solid: #0d6efd; --on-solid: #fff; }
.status-tile--green  { --tone-text: #146c43; --tone-solid: #198754; --on-solid: #fff; }
.status-tile--yellow { --tone-text: #7a5b00; --tone-solid: #ffc107; --on-solid: #1f1500; }
.status-tile--grey   { --tone-text: #4b5563; --tone-solid: #5b6472; --on-solid: #fff; }
.status-tile--orange { --tone-text: #9a4400; --tone-solid: #c2570c; --on-solid: #fff; }
.status-tile--red    { --tone-text: #b02a37; --tone-solid: #c82333; --on-solid: #fff; }
.status-tile--teal   { --tone-text: #0b6b7a; --tone-solid: #0f7a8c; --on-solid: #fff; }
html[data-theme="light"] .status-tile .status-tile__top { color: var(--tone-text, var(--tone)); }
html[data-theme="light"] .status-tile__label { color: var(--text-primary); }
.status-tile--on, html[data-theme="light"] .status-tile.status-tile--on { background: var(--tone-solid, var(--tone)); border-color: var(--tone-solid, var(--tone)); }
.status-tile--on .status-tile__top, .status-tile--on .status-tile__count, .status-tile--on .status-tile__label,
html[data-theme="light"] .status-tile--on .status-tile__top, html[data-theme="light"] .status-tile--on .status-tile__label { color: var(--on-solid, #fff); }
/* the tone border of an unselected tile also needs to be visible against the white card */
html[data-theme="light"] .status-tile:not(.status-tile--on) { border-color: color-mix(in srgb, var(--tone-text, var(--tone)) 55%, #fff); }

/* ── Assistant chat (floating panel) ─────────────────────────────────── */
.tab-bar button.tab-bar__item { background: none; border: 0; font-family: inherit; }
.chat-panel {
    position: fixed; z-index: 1055; display: flex; flex-direction: column;
    background: var(--bg-page); color: var(--text-primary);
    border: 1px solid var(--border-color); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    /* phone: fills the screen */
    inset: 0; border-radius: 0;
}
@media (min-width: 768px) {
    .chat-panel { inset: auto 1.25rem 1.25rem auto; width: 24rem; height: min(40rem, calc(100vh - 6rem)); border-radius: 14px; }
    .chat-panel--full { inset: 0; width: auto; height: auto; border-radius: 0; }
    .chat-panel--full .chat-box, .chat-panel--full .chat-compose, .chat-panel--full .chat-live { max-width: 60rem; width: 100%; margin-left: auto; margin-right: auto; }
}
@media (max-width: 767.98px) { .chat-icon-btn--desktop { display: none; } }
.chat-panel__head { display: flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border-color); background: var(--footer-bg); }
.chat-panel__title { font-size: 1.05rem; }
.chat-panel__spacer { flex: 1; }
.chat-picker { max-width: 9rem; }
.chat-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); }
.chat-icon-btn:hover:not(:disabled) { background: rgba(127, 127, 127, 0.2); }
.chat-icon-btn:disabled { opacity: 0.4; }
.chat-box { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; padding: 0.75rem; background: var(--bg-raised); }
.chat-msg { max-width: 85%; padding: 0.55rem 0.8rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-primary); }
.chat-msg--me { align-self: flex-end; background: #0d6efd; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg--bot { align-self: flex-start; border: 1px solid var(--border-subtle); border-bottom-left-radius: 4px; }
.chat-msg--wait { opacity: 0.6; font-style: italic; }
.chat-msg__author { font-size: 0.75rem; font-weight: 700; opacity: 0.7; margin-bottom: 0.15rem; }
.chat-note { margin: auto; text-align: center; opacity: 0.7; color: var(--text-primary); }
.chat-note--error { color: #dc3545; opacity: 1; }
.chat-live { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.75rem; background: rgba(13, 110, 253, 0.15); color: var(--text-primary); }
.chat-compose { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-color); }
.chat-input { resize: none; max-height: 8rem; overflow-y: auto; line-height: 1.35; }
.chat-panel__body { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-icon-btn.is-active { background: rgba(13, 110, 253, 0.25); }
.chat-aside { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem; overflow-y: auto; background: var(--bg-raised); }
.chat-newbtn { display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 0.75rem; border: 1px dashed var(--border-color); border-radius: 10px; background: transparent; color: var(--text-primary); font-weight: 600; }
.chat-newbtn:hover:not(:disabled) { background: rgba(127, 127, 127, 0.15); }
.chat-list { display: flex; flex-direction: column; gap: 0.2rem; }
.chat-item { display: flex; align-items: center; border-radius: 10px; }
.chat-item:hover { background: rgba(127, 127, 127, 0.15); }
.chat-item.is-active { background: rgba(13, 110, 253, 0.2); }
.chat-item__title { flex: 1; min-width: 0; padding: 0.6rem 0.75rem; border: 0; background: transparent; color: var(--text-primary); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item__del { flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); opacity: 0.7; }
.chat-item__del:hover:not(:disabled) { color: #dc3545; opacity: 1; background: rgba(220, 53, 69, 0.12); }
/* narrow panel: the list gives way to the conversation; full screen keeps them side by side */
.chat-panel__body.is-list-open .chat-main { display: none; }
.chat-panel--full .chat-panel__body.is-list-open .chat-main { display: flex; }
.chat-panel--full .chat-aside { flex: 0 0 16rem; border-right: 1px solid var(--border-color); }
.chat-chips, .chat-ask { display: flex; flex-wrap: wrap; gap: 0.4rem; align-self: flex-start; max-width: 92%; }
.chat-ask { flex-direction: column; align-items: flex-start; }
.chat-ask__q { color: var(--text-primary); font-weight: 600; }
.chat-chip { padding: 0.4rem 0.8rem; border: 1px solid var(--terra-primary, #0d6efd); border-radius: 999px; background: transparent; color: var(--text-primary); font-size: 0.9rem; text-align: left; }
.chat-chip:hover { background: rgba(13, 110, 253, 0.18); }
.chat-msg strong { font-weight: 700; }
