/* ============================================================
   zaalt.mn — brand theme (premium law-firm: deep navy · gold · cream)
   Palette: navy #14294A · gold #B08A2E · bg #F7F3EA · text #232019
   ============================================================ */

:root {
    --z-navy: #14294A;
    --z-navy-deep: #0C1B33;
    --z-navy-soft: #24406B;
    --z-gold: #B08A2E; /* antique gold — rich and warm, never lemon-bright */
    --z-gold-soft: #D4B25E;
    --z-gold-hairline: rgba(150, 116, 38, .45); /* 1px luxury card borders */
    --z-gold-text: #74590A; /* accessible gold for text on cream/tint (WCAG AA ≥4.5) */
    --z-gold-tint: #F7EDD2;
    --z-bg: #F7F3EA;
    --z-surface: #FFFDF8;
    --z-text: #232019;
    --z-muted: #665F4C;
    --z-border: #E8E0CC;
    --z-success: #2E7D5B;
    --z-success-tint: #E8F4EE;
    --z-radius: 1rem;
    /* Layered, low-alpha shadows — softer and warmer than single hard drops.
       Exactly three levels: sm (resting) · default (hover/dropdown) · lg (modal/featured). */
    --z-shadow-sm: 0 1px 2px rgba(20, 41, 74, .05), 0 2px 6px rgba(20, 41, 74, .04);
    --z-shadow: 0 4px 10px rgba(20, 41, 74, .06), 0 12px 28px rgba(20, 41, 74, .08);
    --z-shadow-lg: 0 10px 26px rgba(12, 27, 51, .22), 0 24px 60px rgba(12, 27, 51, .18);
    --z-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    /* Display voice — serif "law firm on paper" for big headings only (words, never numerals) */
    --z-serif: Georgia, "Times New Roman", "Noto Serif", serif;
    /* Motion tokens — one timing system for the whole site */
    --z-ease: cubic-bezier(.25, .46, .45, .94);
    --z-dur-fast: .16s;
    --z-dur-med: .26s;
    /* Brand-navy focus ring (forms, buttons, interactive cards) */
    --z-ring: 0 0 0 .2rem rgba(20, 41, 74, .14);

    /* Bootstrap overrides */
    --bs-primary: #14294A;
    --bs-primary-rgb: 20, 41, 74;
    --bs-body-bg: #F7F3EA;
    --bs-body-color: #232019;
    --bs-body-font-family: var(--z-font);
    --bs-link-color: #14294A;
    --bs-link-color-rgb: 20, 41, 74; /* BS 5.3 reads the -rgb var — without it links fall back to blue */
    --bs-link-hover-color: #74590A; /* dark gold — readable link hover on cream (AA) */
    --bs-link-hover-color-rgb: 116, 89, 10;
    --bs-border-radius: .75rem;
}

html, body { height: 100%; }

/* Respect users who prefer less motion — one global switch */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Shared entrance keyframes (fade + gentle 4px rise) */
@keyframes z-rise {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
body {
    display: flex;
    flex-direction: column;
    background: var(--z-bg);
    color: var(--z-text);
    font-family: var(--z-font);
    -webkit-font-smoothing: antialiased;
}
.site-main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6 { color: var(--z-navy); font-weight: 700; letter-spacing: -.01em; }
h1, h2, h3 { text-wrap: balance; }

/* Tabular figures for prices, balances, stats — numbers stay sans, aligned */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
    border-radius: .75rem;
    font-weight: 600;
    transition: background-color var(--z-dur-fast) var(--z-ease),
        border-color var(--z-dur-fast) var(--z-ease),
        color var(--z-dur-fast) var(--z-ease),
        box-shadow var(--z-dur-fast) var(--z-ease),
        transform var(--z-dur-fast) var(--z-ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--z-ring); }
.btn-navy {
    background: var(--z-navy);
    border: 1px solid var(--z-navy);
    color: #fff;
}
.btn-navy:hover, .btn-navy:focus {
    background: var(--z-navy-deep);
    border-color: var(--z-navy-deep);
    color: #fff;
}
.btn-navy:disabled { background: var(--z-navy-soft); border-color: var(--z-navy-soft); color: #fff; opacity: .8; }
.btn-gold {
    background: var(--z-gold);
    border: 1px solid var(--z-gold);
    color: var(--z-navy-deep);
}
.btn-gold:hover, .btn-gold:focus {
    background: #8A6A1C;
    border-color: #8A6A1C;
    color: #fff;
}
.btn-outline-navy {
    border: 1.5px solid var(--z-navy);
    color: var(--z-navy);
    background: transparent;
}
.btn-outline-navy:hover, .btn-outline-navy:focus {
    background: var(--z-navy);
    border-color: var(--z-navy);
    color: #fff;
}
/* Gold-outlined button (mockup's Нэвтрэх treatment) */
.btn-outline-gold {
    border: 1.5px solid var(--z-gold);
    color: var(--z-gold-text);
    background: transparent;
}
.btn-outline-gold:hover, .btn-outline-gold:focus {
    background: var(--z-gold);
    border-color: var(--z-gold);
    color: var(--z-navy-deep);
}

.form-control, .form-select {
    transition: border-color var(--z-dur-fast) var(--z-ease), box-shadow var(--z-dur-fast) var(--z-ease);
}
.form-control:focus, .form-select:focus {
    border-color: var(--z-navy-soft);
    box-shadow: var(--z-ring);
}
.form-check-input:checked { background-color: var(--z-navy); border-color: var(--z-navy); }
.form-check-input:focus { border-color: var(--z-navy-soft); box-shadow: var(--z-ring); }
/* Disabled/readonly fields stay in the warm palette — never Bootstrap grey */
.form-control:disabled, .form-control[readonly],
.form-select:disabled,
.input-group-text {
    background-color: var(--z-bg);
    color: var(--z-muted);
    border-color: var(--z-border);
}

/* Bootstrap accordion → brand (default is a blue that fights the palette).
   Spaced, individually rounded items so the open state stays neatly framed. */
.accordion-item {
    border: 1px solid var(--z-border);
    border-radius: .75rem !important; /* beat BS first/last-of-type squaring */
    overflow: hidden;
    background: var(--z-surface);
}
.accordion-item + .accordion-item { margin-top: .6rem; }
.accordion-item:not(:first-of-type) { border-top: 1px solid var(--z-border); }
.accordion-button { font-weight: 600; color: var(--z-navy); background: var(--z-surface); transition: background-color var(--z-dur-fast) var(--z-ease), color var(--z-dur-fast) var(--z-ease); }
.accordion-button:not(.collapsed) { background: var(--z-gold-tint); color: var(--z-navy); box-shadow: inset 0 -1px 0 var(--z-gold-hairline); }
.accordion-body { background: var(--z-surface); }
.accordion-button:focus { border-color: var(--z-navy-soft); box-shadow: var(--z-ring); }
.accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231F3352'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* ---------- Nav ---------- */
.site-nav {
    background: var(--z-surface);
    border-bottom: 1px solid var(--z-border);
    box-shadow: var(--z-shadow-sm);
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.brand-wordmark {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--z-navy);
    letter-spacing: -.02em;
}
.brand-dot { color: var(--z-gold); }
.site-nav .nav-link {
    position: relative;
    color: var(--z-text);
    font-weight: 600;
    padding: .5rem .9rem;
    border-radius: .6rem;
    transition: color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease);
}
.site-nav .nav-link::after {
    content: "";
    position: absolute;
    left: .9rem;
    right: .9rem;
    bottom: .2rem;
    height: 2px;
    border-radius: 2px;
    background: var(--z-gold);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--z-dur-med) var(--z-ease);
}
.site-nav .nav-link:hover { color: var(--z-navy); background: var(--z-bg); }
.site-nav .nav-link:hover::after { transform: scaleX(1); }
/* Current page: gold rule under the label (brand accent), no beige block */
.site-nav .nav-link.active { color: var(--z-navy); background: transparent; }
.site-nav .nav-link.active::after { transform: scaleX(1); }
.site-nav .nav-link:focus-visible { box-shadow: var(--z-ring); outline: none; }

.balance-badge {
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    color: var(--z-navy);
    font-size: .875rem;
    font-weight: 600;
    padding: .4rem .8rem;
    border-radius: 2rem;
    white-space: nowrap;
}
.balance-badge strong { color: var(--z-gold-text); font-weight: 800; }
/* Open dropdown parent link: gold-tint pad + gold bottom rule */
.site-nav .nav-link.show {
    color: var(--z-navy);
    background: var(--z-gold-tint);
    box-shadow: inset 0 -2px 0 var(--z-gold);
}
.site-nav .nav-link.show::after { transform: scaleX(0); }

/* User menu button — pill with a gold initial disc */
.btn-user-menu {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--z-bg);
    border: 1px solid var(--z-border);
    color: var(--z-navy);
    font-weight: 600;
    border-radius: 2rem;
    padding: .3rem .9rem .3rem .3rem;
    transition: background var(--z-dur-fast) var(--z-ease), border-color var(--z-dur-fast) var(--z-ease);
}
.btn-user-menu:hover, .btn-user-menu:focus, .btn-user-menu.show {
    border-color: var(--z-gold-soft);
    background: var(--z-gold-tint);
    color: var(--z-navy);
}
.nav-user-initial {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--z-gold);
    color: var(--z-navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--z-serif);
    font-weight: 700;
    font-size: .9rem;
}
.nav-user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown-menu { border-radius: .75rem; border-color: var(--z-border); }

/* ---------- Brand dropdown panels (Гэрээ / Лавлах / user) ---------- */
.dropdown-menu-brand {
    min-width: 15rem;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-top: 3px solid var(--z-gold);
    border-radius: .75rem;
    padding: .5rem;
    box-shadow: var(--z-shadow);
}
.dropdown-menu-brand .dropdown-item {
    border-radius: .55rem;
    padding: .6rem .75rem;
    color: var(--z-navy);
    font-weight: 600;
    font-size: .92rem;
    white-space: normal;
    transition: background var(--z-dur-fast) var(--z-ease),
        box-shadow var(--z-dur-fast) var(--z-ease),
        color var(--z-dur-fast) var(--z-ease);
}
.dropdown-menu-brand .dropdown-item:hover,
.dropdown-menu-brand .dropdown-item:focus,
.dropdown-menu-brand .dropdown-item.active,
.dropdown-menu-brand .dropdown-item:active {
    background: var(--z-gold-tint);
    color: var(--z-gold-text);
    box-shadow: inset 2px 0 0 var(--z-gold);
}
.dropdown-menu-brand .dropdown-item-danger { color: #B4232A; }
.dropdown-menu-brand .dropdown-item-danger:hover,
.dropdown-menu-brand .dropdown-item-danger:focus {
    background: #FBEDEE;
    color: #B4232A;
    box-shadow: none;
}
.dropdown-menu-brand .dropdown-divider { border-color: var(--z-border); margin: .35rem 0; }

/* Rich Лавлах rows: icon square + title + count subtitle */
.dropdown-menu-rich { min-width: 18.75rem; }
.nav-rich-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .6rem .75rem;
    border-radius: .55rem;
    text-decoration: none;
    transition: background var(--z-dur-fast) var(--z-ease), box-shadow var(--z-dur-fast) var(--z-ease);
}
.nav-rich-item:hover, .nav-rich-item:focus {
    background: var(--z-gold-tint);
    box-shadow: inset 2px 0 0 var(--z-gold);
}
.nav-rich-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--z-serif);
    font-size: 1rem;
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-hairline);
    color: var(--z-gold-text);
}
.nav-rich-icon.is-primary {
    background: var(--z-gold);
    border-color: rgba(116, 89, 10, .5);
    color: var(--z-navy-deep);
}
.nav-rich-icon-italic { font-style: italic; }
.nav-rich-body { display: flex; flex-direction: column; min-width: 0; }
.nav-rich-title { color: var(--z-navy); font-weight: 700; font-size: .92rem; }
.nav-rich-sub { color: var(--z-muted); font-size: .76rem; }
.nav-rich-item:hover .nav-rich-sub, .nav-rich-item:focus .nav-rich-sub { color: var(--z-gold-text); }

/* User menu identity header */
.nav-user-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem .75rem;
    border-bottom: 1px solid var(--z-border);
    margin-bottom: .35rem;
}
.nav-user-head-initial {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--z-gold);
    color: var(--z-navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--z-serif);
    font-weight: 700;
    font-size: 1rem;
}
.nav-user-head-body { display: flex; flex-direction: column; min-width: 0; }
.nav-user-head-name { color: var(--z-navy); font-weight: 700; font-size: .92rem; }
.nav-user-head-phone { color: var(--z-muted); font-size: .76rem; }

/* ---------- Hero ---------- */
.hero {
    /* Flat deep navy — owner's rule: no gradients on colored elements */
    background: var(--z-navy-deep);
    color: #fff;
    padding: 4.5rem 0 5rem;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "§";
    position: absolute;
    right: -1rem;
    bottom: -7rem;
    font-size: 26rem;
    line-height: 1;
    color: rgba(255, 255, 255, .045);
    font-weight: 800;
    pointer-events: none;
}
.hero h1 {
    color: #fff;
    font-family: var(--z-serif);
    font-size: clamp(2.1rem, 4.5vw, 3.1rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.15;
}
.hero .hero-sub { color: rgba(255, 255, 255, .78); font-size: 1.1rem; max-width: 620px; }
.hero-accent { color: var(--z-gold-soft); }

.hero-search {
    background: #fff;
    border-radius: 2.4rem; /* full pill — inner button echoes the same curvature */
    padding: .5rem;
    box-shadow: var(--z-shadow);
    max-width: 680px;
}
.hero-search .form-control {
    border: 0;
    font-size: 1.05rem;
    padding: .8rem 1.25rem;
    background: transparent;
}
.hero-search .form-control:focus { box-shadow: none; }
.hero-search .btn { padding: .8rem 1.6rem; border-radius: 2rem; }
.hero-hints { color: rgba(255, 255, 255, .6); font-size: .875rem; }
.hero-hints a { color: rgba(255, 255, 255, .85); text-decoration: underline dotted; }
.hero-hints a:hover { color: var(--z-gold-soft); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--z-border); border-radius: var(--z-radius); }
.value-card {
    background: var(--z-surface);
    border: 1px solid var(--z-gold-hairline); /* gold hairline — mockup material */
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
    padding: 2rem 1.75rem;
    height: 100%;
    transition: transform var(--z-dur-med) var(--z-ease), box-shadow var(--z-dur-med) var(--z-ease);
}
.value-card:hover { transform: translateY(-2px); box-shadow: var(--z-shadow); }
/* Gold medallion icon chip: flat antique-gold coin, navy glyph */
.value-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--z-gold);
    border: 1px solid rgba(116, 89, 10, .5);
    box-shadow: 0 2px 6px rgba(20, 41, 74, .14);
    color: var(--z-navy-deep);
    margin-bottom: 1rem;
}
/* One stroke-icon language inside every gold medallion (matches /contracts set) */
.value-icon svg { width: 24px; height: 24px; }

/* ---------- How it works ---------- */
/* Large serif gold display numeral (mockup's 1 / 2 / 3) */
.step-number {
    flex-shrink: 0;
    min-width: 2.4rem;
    text-align: center;
    font-family: Georgia, "Times New Roman", "Noto Serif", serif;
    font-size: 3.1rem;
    font-weight: 700;
    line-height: .92;
    color: #A67C1E; /* flat antique-gold display numeral (decorative) */
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* ---------- Pricing ---------- */
.price-card {
    background: var(--z-surface);
    border: 1px solid var(--z-gold-hairline);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
    padding: 1.5rem;
    text-align: center;
    height: 100%;
}
/* Featured plan: solid navy fill with gold border, like the mockup's "Value" card */
.price-card.featured {
    border: 1.5px solid var(--z-gold);
    background: var(--z-navy);
    box-shadow: var(--z-shadow-lg);
    position: relative;
}
.price-card .price-amount { font-size: 2rem; font-weight: 800; color: var(--z-navy); font-variant-numeric: tabular-nums; }
.price-card .price-credits { color: var(--z-muted); font-size: .9rem; }
.price-card.featured .price-amount { color: #fff; }
.price-card.featured .price-credits { color: rgba(255, 255, 255, .75); }
.price-card.featured h6,
.price-card.featured .text-muted { color: rgba(255, 255, 255, .72) !important; }
.price-card.featured .btn-outline-navy {
    border-color: var(--z-gold-soft);
    color: var(--z-gold-soft);
}
.price-card.featured .btn-outline-navy:hover,
.price-card.featured .btn-outline-navy:focus {
    background: var(--z-gold);
    border-color: var(--z-gold);
    color: var(--z-navy-deep);
}
.featured-flag {
    position: absolute;
    top: -.8rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--z-gold);
    color: var(--z-navy-deep);
    font-size: .75rem;
    font-weight: 700;
    padding: .15rem .8rem;
    border-radius: 2rem;
    white-space: nowrap; /* keep the flag on one line on narrow cards */
    box-shadow: 0 2px 6px rgba(12, 27, 51, .25);
}

/* ---------- Chat ---------- */
.chat-bubble {
    border-radius: 1.1rem;
    padding: .9rem 1.15rem;
    max-width: 85%;
    box-shadow: var(--z-shadow-sm);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-bubble-user {
    background: var(--z-navy);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: .3rem;
}
.chat-bubble-assistant {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    color: var(--z-text);
    margin-right: auto;
    border-bottom-left-radius: .3rem;
    max-width: 95%;
}

.citation-card {
    background: var(--z-gold-tint);
    border-left: 3px solid var(--z-gold);
    border-radius: .6rem;
    padding: .65rem .9rem;
    font-size: .875rem;
    margin-top: .6rem;
}
.citation-card .citation-title { font-weight: 700; color: var(--z-navy); }
.citation-card .citation-quote { color: var(--z-muted); font-style: italic; }

.tier-badge {
    background: var(--z-navy);
    color: var(--z-gold-soft);
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 2rem;
    letter-spacing: .02em;
}
.badge-success-tint {
    background: var(--z-success-tint);
    color: var(--z-success);
    font-weight: 700;
    padding: .3rem .7rem;
    border-radius: 2rem;
    font-size: .8rem;
}
/* Pending/processing — antique gold tint, never Bootstrap warning-yellow */
.badge-pending {
    background: var(--z-gold-tint);
    color: var(--z-gold-text);
    border: 1px solid var(--z-gold-soft);
    font-weight: 700;
    padding: .3rem .7rem;
    border-radius: 2rem;
    font-size: .8rem;
}
.badge-danger-tint {
    background: #FBEDEE;
    color: #B4232A;
    font-weight: 700;
    padding: .3rem .7rem;
    border-radius: 2rem;
    font-size: .8rem;
}

.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--z-muted);
    font-size: .9rem;
}
.thinking-indicator .dots span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-radius: 50%;
    background: var(--z-gold);
    animation: z-bounce 1.4s infinite var(--z-ease);
}
.thinking-indicator .dots span:nth-child(2) { animation-delay: .2s; }
.thinking-indicator .dots span:nth-child(3) { animation-delay: .4s; }
/* Soft pulse (shared with contract-review step dots) — calm, no bouncing */
@keyframes z-bounce {
    0%, 65%, 100% { transform: scale(.8); opacity: .4; }
    30% { transform: scale(1); opacity: 1; }
}

/* ---------- Disclaimer ---------- */
/* One treatment everywhere: quiet bordered cream note + (i) medallion */
.disclaimer-strip {
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    border-radius: .75rem;
    color: var(--z-muted);
    font-size: .85rem;
    padding: .7rem 1rem;
}
.strip-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: .1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--z-gold);
    color: var(--z-navy-deep);
    font-family: var(--z-serif);
    font-style: italic;
    font-weight: 700;
    font-size: .8rem;
    line-height: 1;
}

/* ---------- Sections ---------- */
/* Section header pattern: .section-head > (.eyebrow? + .section-title + .section-sub?) */
.section-head { margin-bottom: 2.5rem; }
.section-head.text-center .section-sub { margin-left: auto; margin-right: auto; }
.eyebrow {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--z-gold-text);
    margin-bottom: .5rem;
}
.eyebrow-light { color: var(--z-gold-soft); } /* eyebrow on navy bands */
.section-title {
    font-family: var(--z-serif);
    font-size: clamp(1.55rem, 2.6vw, 2.05rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    margin-bottom: .5rem;
}
.section-sub { color: var(--z-muted); max-width: 640px; }
.section-pad { padding: 4.5rem 0; }
.section-pad-lg { padding: 5.5rem 0; }
.section-alt { background: var(--z-surface); border-top: 1px solid var(--z-border); border-bottom: 1px solid var(--z-border); }

/* ---------- Page head (tier-2 header band: laws, dictionary, guides, contracts, generator, pricing) ---------- */
.page-head {
    background: var(--z-navy);
    border-bottom: 1px solid var(--z-gold-hairline);
    color: #fff;
    padding: 2.5rem 0;
}
.page-head h1 {
    color: #fff;
    font-family: var(--z-serif);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    margin-bottom: .35rem;
}
.page-head .page-head-sub { color: rgba(255, 255, 255, .78); font-size: .95rem; max-width: 760px; margin-bottom: 0; }
.page-crumbs { font-size: .8rem; color: rgba(255, 255, 255, .6); margin-bottom: .6rem; }
.page-crumbs a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.page-crumbs a:hover { color: var(--z-gold-soft); }

/* Tier-3 plain head (account pages, terms) */
.page-title {
    font-family: var(--z-serif);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0;
}

/* ---------- Data tables (.z-table on <table>) ---------- */
.z-table { width: 100%; margin-bottom: 0; color: var(--z-text); }
.z-table thead th {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--z-muted);
    border-bottom: 1px solid var(--z-border);
    padding: .55rem .75rem;
    background: transparent;
}
.z-table tbody td {
    padding: .7rem .75rem;
    font-size: .9rem;
    border-bottom: 1px solid var(--z-border);
    background: transparent;
    vertical-align: middle;
}
.z-table tbody tr:last-child td { border-bottom: 0; }
.z-table tbody tr:hover td { background: var(--z-bg); }
.z-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.z-table .amount-pos { color: var(--z-success); font-weight: 700; }
.z-table .amount-neg { color: #B4232A; font-weight: 700; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(176, 138, 46, .12);
    color: var(--z-gold-text);
    font-size: 1.9rem;
}
.empty-state .empty-state-title { font-size: 1rem; font-weight: 700; color: var(--z-navy); margin-bottom: .25rem; }
.empty-state .empty-state-sub { font-size: .875rem; color: var(--z-muted); max-width: 420px; margin: 0 auto .75rem; }
/* Links inside empty states stay on brand (never Bootstrap blue) */
.empty-state a {
    color: var(--z-navy);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--z-gold);
    text-underline-offset: 2px;
}
.empty-state a:hover { color: var(--z-gold-text); }

/* ---------- Compact list rows (laws / dictionary indexes) ---------- */
.list-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--z-border);
    color: var(--z-text);
    text-decoration: none;
    transition: background var(--z-dur-fast) var(--z-ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--z-bg); }
.list-row .list-row-title { font-size: .95rem; font-weight: 600; color: var(--z-navy); min-width: 0; }
.list-row:hover .list-row-title { color: var(--z-gold-text); }
.list-row .list-row-meta { flex-shrink: 0; font-size: .8rem; color: var(--z-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--z-navy-deep);
    border-top: 1px solid rgba(176, 138, 46, .5); /* gold hairline above deep-navy footer */
    color: rgba(255, 255, 255, .75);
    margin-top: 3rem;
    font-size: .9rem;
}
.site-footer .brand-wordmark-footer { color: #fff; font-size: 1.1rem; }
.footer-heading {
    color: var(--z-gold-soft);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .8rem;
}
.footer-links li { margin-bottom: .45rem; }
.footer-links a { color: rgba(255, 255, 255, .75); text-decoration: none; }
.footer-links a:hover { color: var(--z-gold-soft); }
.footer-disclaimer { font-size: .82rem; line-height: 1.55; color: rgba(255, 255, 255, .6); }
.footer-disclaimer strong { color: rgba(255, 255, 255, .85); }
.footer-trust { font-size: .78rem; color: rgba(255, 255, 255, .55); }
.footer-divider { border-color: rgba(255, 255, 255, .12); margin: 1.5rem 0 1rem; }
.footer-bottom { font-size: .8rem; color: rgba(255, 255, 255, .5); }

/* ---------- Login modal ---------- */
.login-modal { border-radius: var(--z-radius); border: 0; box-shadow: var(--z-shadow); }
.otp-input { letter-spacing: .5em; font-weight: 700; }
@media (min-width: 576px) {
    .modal-sm-plus { max-width: 400px; }
}

/* ---------- Toasts ---------- */
.z-toast {
    background: var(--z-navy-deep);
    color: #fff;
    border-radius: .75rem;
    box-shadow: var(--z-shadow);
    border: 0;
    border-left: 3px solid var(--z-gold);
}
.z-toast.show { animation: z-toast-in var(--z-dur-med) var(--z-ease); }
@keyframes z-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.z-toast.z-toast-error { background: #7A2E2E; }
.z-toast.z-toast-success { background: var(--z-navy-deep); border-left-color: #3E6B4F; }

/* ---------- Chat page (/ask) — app frame ----------
   The page itself NEVER scrolls: body is locked to the viewport and only
   the messages pane (and the sidebar list) scroll internally. Composer +
   disclaimer stay pinned at the bottom, nav stays at the top. */
body.chat-app {
    height: 100vh;
    height: 100dvh; /* dvh: correct under the iOS keyboard / collapsing URL bar */
    overflow: hidden;
}
body.chat-app .site-main {
    flex: 1 1 auto;
    min-height: 0; /* let the chat shell shrink inside the flex column */
    display: flex;
    flex-direction: column;
}
body.chat-app .chat-page { flex: 1 1 auto; min-height: 0; display: flex; }
.chat-shell {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background: var(--z-bg);
}
.chat-sidebar {
    --bs-offcanvas-width: 300px;
    background: var(--z-surface);
    border-right: 1px solid var(--z-border);
}
@media (min-width: 992px) {
    .chat-sidebar {
        width: 284px;
        flex-shrink: 0;
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0; /* sidebar list scrolls independently */
    }
}
.chat-sidebar .sidebar-head { padding: 1rem; border-bottom: 1px solid var(--z-border); }
.chat-sidebar .sidebar-label {
    padding: .8rem 1rem .3rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--z-muted);
}
.chat-list { flex: 1 1 auto; overflow-y: auto; padding: .35rem .5rem 1rem; }
.chat-list-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: .6rem;
    padding: .55rem .7rem;
    color: var(--z-text);
    transition: background var(--z-dur-fast) var(--z-ease);
}
.chat-list-item:hover { background: var(--z-bg); }
.chat-list-item.active { background: var(--z-gold-tint); }
.chat-list-item .chat-item-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--z-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-list-item .chat-item-date { font-size: .72rem; color: var(--z-muted); }

.chat-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .9rem;
    background: var(--z-surface);
    border-bottom: 1px solid var(--z-border);
}
.chat-toolbar-title { font-weight: 700; color: var(--z-navy); font-size: .95rem; }

.chat-messages-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative; /* anchors the "new reply" pill above the composer */
    display: flex;
    flex-direction: column;
}
.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain; /* pane scroll never chains to the page */
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem 1.1rem;
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    .chat-messages { scroll-behavior: auto; }
}
.chat-messages-inner {
    max-width: 960px; /* roomier conversation column on desktop */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* Message entrance: gentle fade + 4px rise, one per bubble */
.chat-messages-inner > * { animation: z-rise var(--z-dur-med) var(--z-ease) both; }

/* "↓ Шинэ хариулт" pill — appears when a reply lands while scrolled up */
.scroll-latest-pill {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 5;
    background: var(--z-navy);
    color: #fff;
    border: 0;
    border-radius: 2rem;
    font-size: .85rem;
    font-weight: 600;
    padding: .45rem 1.1rem;
    box-shadow: var(--z-shadow);
    cursor: pointer;
    animation: z-rise var(--z-dur-med) var(--z-ease) both;
    transition: background var(--z-dur-fast) var(--z-ease), transform var(--z-dur-fast) var(--z-ease);
}
.scroll-latest-pill:hover { background: var(--z-navy-deep); transform: translateX(-50%) translateY(-1px); }
.scroll-latest-pill:focus-visible { outline: none; box-shadow: var(--z-ring), var(--z-shadow); }
.chat-bubble-assistant { white-space: normal; }
.md-body p { margin-bottom: .65rem; }
.md-body ul, .md-body ol { padding-left: 1.35rem; margin-bottom: .65rem; }
.md-body li { margin-bottom: .25rem; }
.md-body > :last-child { margin-bottom: 0; }
.md-body .md-heading { color: var(--z-navy); margin-top: .35rem; }

.chat-welcome { padding: 3rem 1rem 1rem; }
.chat-welcome-mark { font-size: 2.6rem; margin-bottom: .5rem; }
.sample-chip {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 2rem;
    padding: .45rem 1rem;
    font-size: .875rem;
    color: var(--z-navy);
    box-shadow: var(--z-shadow-sm);
    transition: border-color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease), transform var(--z-dur-fast) var(--z-ease);
}
.sample-chip:hover { border-color: var(--z-gold); background: var(--z-gold-tint); transform: translateY(-1px); }

.citations-details summary {
    cursor: pointer;
    font-size: .875rem;
    font-weight: 700;
    color: var(--z-navy);
    list-style: none;
}
.citations-details summary::-webkit-details-marker { display: none; }
.citations-details summary::after { content: " ▾"; color: var(--z-muted); font-weight: 400; }
.citations-details[open] summary::after { content: " ▴"; }

.msg-actions { display: flex; align-items: center; gap: .4rem; }
.msg-actions-label { font-size: .78rem; color: var(--z-muted); margin-right: .2rem; }
.feedback-btn {
    background: transparent;
    border: 1px solid var(--z-border);
    border-radius: .55rem;
    padding: .1rem .55rem;
    font-size: .9rem;
    line-height: 1.5;
    transition: background var(--z-dur-fast) var(--z-ease), border-color var(--z-dur-fast) var(--z-ease);
}
.feedback-btn:hover { background: var(--z-bg); }
.feedback-btn.active { background: var(--z-gold-tint); border-color: var(--z-gold); }

.msg-disclaimer {
    font-size: .75rem;
    color: var(--z-muted);
    border-top: 1px dashed var(--z-border);
    margin-top: .8rem;
    padding-top: .55rem;
}
.thinking-elapsed { color: var(--z-muted); font-variant-numeric: tabular-nums; }

.chat-notice {
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    border-radius: var(--z-radius);
    padding: .9rem 1.15rem;
    font-size: .95rem;
    color: var(--z-text);
    max-width: 95%;
    margin-right: auto;
}

.chat-composer {
    flex-shrink: 0;
    border-top: 1px solid var(--z-border);
    background: var(--z-surface);
    padding: .8rem 1.1rem;
    padding-bottom: max(.8rem, env(safe-area-inset-bottom)); /* iOS home bar */
}
.chat-composer-inner { max-width: 960px; margin: 0 auto; }
.composer-box {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    background: var(--z-bg);
    border: 1px solid var(--z-border);
    border-radius: 1.6rem; /* pill at one row; inner send button is circular */
    padding: .35rem .35rem .35rem 1.05rem;
}
/* Brand focus: navy border + soft antique-gold ring (no cool blue glow) */
.composer-box:focus-within {
    border-color: var(--z-navy);
    box-shadow: 0 0 0 .18rem rgba(176, 138, 46, .28);
}
.composer-box textarea {
    flex: 1;
    border: 0;
    background: transparent;
    resize: none;
    max-height: 200px;
    padding: .5rem 0;
    font-size: 1rem;
    color: var(--z-text);
}
.composer-box textarea:focus { outline: none; }
.composer-send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* matches the pill input it sits in */
}
.composer-hint { font-size: .74rem; color: var(--z-muted); margin-top: .4rem; text-align: center; }

@media (max-width: 575.98px) {
    .chat-messages { padding: 1rem .65rem; }
    .chat-composer { padding-left: .65rem; padding-right: .65rem; }
    .chat-notice { max-width: 100%; }
    .chat-welcome { padding: 2rem .5rem .5rem; }
}

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
    #navAuthArea { padding: .75rem 0 .25rem; border-top: 1px solid var(--z-border); margin-top: .5rem; }
}
@media (max-width: 575.98px) {
    .hero { padding: 3rem 0 3.5rem; }
    .hero-search { flex-direction: column; border-radius: 1.25rem; }
    .hero-search .btn { width: 100%; border-radius: .9rem; }
    .chat-bubble { max-width: 95%; }
    .section-pad { padding: 3rem 0; }
    .section-pad-lg { padding: 3.5rem 0; }
    .section-head { margin-bottom: 2rem; }
    .page-head { padding: 2rem 0; }
}

/* ============ Guides page (/guides) ============ */
.guide-card { color: var(--z-text); display: flex; flex-direction: column; border: 1px solid var(--z-gold-hairline) !important; /* !important: markup carries .border-0 */ }
.guide-card h2 { color: var(--z-navy); }
.guide-card .guide-card-cta { color: var(--z-gold-text); }
.guide-card:hover h2 { color: var(--z-gold-text); }

/* ============ Legal-term tooltips (tooltips.js — .term-tip) ============ */
/* Quiet by default (thin, low-alpha dotted) so definition-heavy articles
   don't turn into noise; full gold cue arrives on hover/focus. */
.term-tip {
    border-bottom: 1px dotted rgba(150, 116, 38, .34); /* quiet: discoverable without shredding the text */
    cursor: help;
    border-radius: 2px;
}
.term-tip:hover,
.term-tip:focus-visible { border-bottom-color: var(--z-gold); }
.term-tip:hover,
.term-tip:focus-visible {
    background: var(--z-gold-tint);
    outline: none;
}
.term-tip-card {
    position: absolute;
    z-index: 1090;
    max-width: 320px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-top: 3px solid var(--z-gold);
    border-radius: var(--z-radius);
    box-shadow: 0 12px 32px rgba(15, 25, 40, .18);
    padding: .8rem .95rem .7rem;
    font-size: .84rem;
    line-height: 1.55;
    color: var(--z-text);
}
.term-tip-card strong {
    display: block;
    color: var(--z-navy);
    font-size: .88rem;
    margin-bottom: .3rem;
}
.term-tip-card .term-tip-def { margin-bottom: .5rem; }
.term-tip-card .term-tip-link {
    font-weight: 700;
    font-size: .8rem;
    color: var(--z-gold-text);
    text-decoration: none;
}
.term-tip-card .term-tip-link:hover { text-decoration: underline; }
@media (max-width: 575.98px) {
    .term-tip-card { max-width: calc(100vw - 24px); }
}

/* ============ Contract review (/contracts, /contracts/{id}) ============ */
.cz-price-badge {
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    color: var(--z-navy);
    font-size: .9rem;
    font-weight: 700;
    padding: .5rem 1.1rem;
    border-radius: 2rem;
}
.upload-zone {
    border: 2px dashed var(--z-border);
    border-radius: var(--z-radius);
    background: var(--z-surface);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease);
}
.upload-zone:hover, .upload-zone:focus-visible, .upload-zone.dragover {
    border-color: var(--z-gold);
    background: var(--z-gold-tint);
    outline: none;
}
.upload-zone .upload-icon { font-size: 2.4rem; margin-bottom: .5rem; }

.cz-progress-bar { background: var(--z-gold); }

.cz-steps { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.cz-step { display: flex; align-items: center; gap: .55rem; color: var(--z-muted); }
.cz-step-dot {
    width: 30px; height: 30px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--z-bg);
    border: 1.5px solid var(--z-border);
    font-weight: 700; font-size: .85rem;
}
.cz-step.active { color: var(--z-navy); font-weight: 600; }
.cz-step.active .cz-step-dot { background: var(--z-gold-tint); border-color: var(--z-gold); color: var(--z-navy); }
.cz-step.done { color: var(--z-success); }
.cz-step.done .cz-step-dot { background: var(--z-success-tint); border-color: var(--z-success); color: var(--z-success); }
.cz-step .dots span {
    display: inline-block; width: 6px; height: 6px; margin-left: 2px;
    border-radius: 50%; background: var(--z-gold);
    animation: z-bounce 1.2s infinite ease-in-out;
}
.cz-step .dots span:nth-child(2) { animation-delay: .18s; }
.cz-step .dots span:nth-child(3) { animation-delay: .36s; }

.cz-badge-processing { background: var(--z-gold-tint); color: var(--z-gold-text); border: 1px solid var(--z-gold-soft); }
.cz-badge-failed { background: #FBEDEE; color: #B4232A; }

/* --- report page --- */
.cz-type-badge { background: var(--z-navy); color: var(--z-gold-soft); font-weight: 700; padding: .35rem .8rem; border-radius: 2rem; }
.risk-card { border-left: 4px solid var(--z-border); }
.risk-card.risk-high { border-left-color: #B4232A; background: #FDF6F6; }
.risk-card.risk-medium { border-left-color: #B87A00; background: #FFFBF2; }
.risk-card.risk-low { border-left-color: var(--z-muted); }
.risk-badge { font-weight: 700; font-size: .72rem; padding: .3rem .65rem; border-radius: 2rem; }
.risk-badge.risk-high-badge { background: #FBEDEE; color: #B4232A; }
.risk-badge.risk-medium-badge { background: #FFF3D6; color: #8A5C00; }
.risk-badge.risk-low-badge { background: var(--z-bg); color: var(--z-muted); }

.cz-list { padding-left: 0; list-style: none; }
.cz-list li { padding-left: 1.6rem; position: relative; margin-bottom: .5rem; }
.cz-list li:last-child { margin-bottom: 0; }
.cz-list-good li::before { content: "✓"; position: absolute; left: 0; color: var(--z-success); font-weight: 800; }
.cz-list-warn li::before { content: "!"; position: absolute; left: .25rem; color: #B87A00; font-weight: 800; }

.cz-suggest-table td { vertical-align: top; }
.cz-suggested { color: var(--z-success); font-weight: 500; }

.cz-verdict {
    background: var(--z-surface);
    border: 2px solid var(--z-navy);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
}
.cz-verdict h2 { color: var(--z-navy); letter-spacing: .05em; font-size: .85rem; }

/* --- print --- */
@media print {
    .site-nav, .site-footer, .no-print, #toastArea, .btn { display: none !important; }
    body { background: #fff; }
    .section-pad { padding: 0; }
    .card, .report-card, .cz-verdict, .citation-card { box-shadow: none !important; break-inside: avoid; }
    .risk-card.risk-high, .risk-card.risk-medium { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Contract generator (/generator) ---------- */
.gen-type-card {
    background: var(--z-surface);
    border: 1px solid var(--z-gold-hairline);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
    padding: 1.5rem;
    height: 100%;
    cursor: pointer;
    transition: transform var(--z-dur-med) var(--z-ease), box-shadow var(--z-dur-med) var(--z-ease), border-color var(--z-dur-med) var(--z-ease);
}
.gen-type-card:hover { transform: translateY(-2px); box-shadow: var(--z-shadow); border-color: var(--z-gold-soft); }
.gen-type-icon { font-size: 2rem; margin-bottom: .75rem; }

.gen-form-card {
    background: var(--z-surface);
    border: 1px solid var(--z-gold-hairline);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
    padding: 1.75rem;
}
.gen-progress { display: flex; align-items: center; justify-content: center; }
.gen-dot {
    width: .75rem; height: .75rem; border-radius: 50%;
    background: var(--z-border); flex-shrink: 0;
    transition: background var(--z-dur-med) var(--z-ease), transform var(--z-dur-med) var(--z-ease);
}
.gen-dot.active { background: var(--z-gold); transform: scale(1.25); }
.gen-dot.done { background: var(--z-navy); }
.gen-dot-line { flex: 0 0 2.25rem; height: 2px; background: var(--z-border); margin: 0 .3rem; }

.gen-notice {
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    border-radius: .75rem;
    padding: .9rem 1.1rem;
    font-size: .95rem;
}
.gen-review-group { color: var(--z-navy); margin-top: 1rem; }
.gen-recent .list-group-item { border-color: var(--z-border); }

/* Formal document view (/generator/{id}) */
.z-doc {
    background: #fff;
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-sm);
    padding: 3rem clamp(1.25rem, 6vw, 4rem);
    font-family: Georgia, "Times New Roman", serif;
    color: var(--z-text);
    line-height: 1.65;
}
.z-doc-meta { text-align: right; color: #55503F; margin-bottom: 2rem; }
.z-doc-title {
    text-align: center;
    font-size: 1.45rem;
    letter-spacing: .04em;
    margin-bottom: 2rem;
    font-family: inherit;
}
.z-doc-heading {
    font-size: 1.02rem;
    font-weight: 700;
    color: #1D180D;
    margin: 1.4rem 0 .4rem;
    font-family: inherit;
}
.z-doc-text { text-align: justify; text-indent: 2rem; margin-bottom: 0; }
.z-doc-signatures { margin-top: 3rem; }
.z-doc-sign-title { font-weight: 700; margin-bottom: 1rem; }
.z-doc-sign-block p { margin-bottom: .35rem; }
.z-doc-sign-line { margin-top: 2rem; }
.z-doc-footnote {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--z-border);
    font-size: .8rem;
    color: var(--z-muted);
}

@media print {
    .site-nav, .site-footer, .toast-container, .no-print, #loginModal { display: none !important; }
    body { background: #fff; }
    .site-main { padding: 0; }
    .section-pad { padding: 0; }
    .z-doc {
        border: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        font-size: 12pt;
    }
    .z-doc-footnote { color: #555; }
}

/* ============ Guide view (/guides, /guides/{slug}) — Алхам заавар ============ */
.guide-area-badge {
    display: inline-block;
    background: var(--z-gold-tint);
    border: 1px solid var(--z-gold-soft);
    color: var(--z-navy);
    font-size: .72rem;
    font-weight: 700;
    padding: .22rem .55rem;
    border-radius: .5rem;
    white-space: nowrap;
    align-self: flex-start;
}
.gv-header { background: var(--z-navy); border-bottom: 1px solid var(--z-gold-hairline); padding: 2rem 0 1.6rem; }
.gv-header h1 { color: #fff; font-family: var(--z-serif); letter-spacing: 0; font-size: 1.5rem; line-height: 1.4; margin-bottom: .4rem; }
.gv-header .gv-summary { color: rgba(255,255,255,.78); font-size: .9rem; max-width: 760px; }
.gv-crumbs { font-size: .8rem; color: rgba(255,255,255,.6); margin-bottom: .6rem; }
.gv-crumbs a { color: rgba(255,255,255,.85); text-decoration: none; }
.gv-crumbs a:hover { color: var(--z-gold-soft); }

.gv-sidebar {
    position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto;
    background: var(--z-surface); border: 1px solid var(--z-border);
    border-radius: var(--z-radius); padding: 1rem 1.1rem;
}
.gv-sidebar .toc-title { font-size: .78rem; font-weight: 800; text-transform: uppercase; color: var(--z-muted); letter-spacing: .04em; }
.gv-progress-wrap { height: 8px; background: var(--z-bg); border: 1px solid var(--z-border); border-radius: 99px; overflow: hidden; }
.gv-progress-bar { height: 100%; background: var(--z-gold); border-radius: 99px; transition: width var(--z-dur-med) var(--z-ease); }
.gv-step-list { list-style: none; margin: 0; padding: 0; }
.gv-step-list li + li { margin-top: .15rem; }
.gv-step-link {
    display: flex; align-items: flex-start; gap: .55rem;
    padding: .35rem .4rem; border-radius: .5rem;
    color: var(--z-text); font-size: .84rem; text-decoration: none; line-height: 1.35;
}
.gv-step-link:hover { background: var(--z-bg); color: var(--z-navy); }
.gv-step-dot {
    flex-shrink: 0; width: 1.35rem; height: 1.35rem; margin-top: .05rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--z-border); border-radius: 50%;
    background: var(--z-surface); color: var(--z-muted);
    font-size: .72rem; font-weight: 700;
}
.gv-step-link.done .gv-step-dot { background: var(--z-success); border-color: var(--z-success); color: #fff; }
.gv-step-link.done .gv-step-name { color: var(--z-muted); text-decoration: line-through; text-decoration-thickness: 1px; }

.gv-guest-note {
    background: var(--z-gold-tint); border: 1px solid var(--z-gold-soft);
    border-radius: var(--z-radius); padding: .7rem 1rem; font-size: .86rem; color: var(--z-text);
}
.gv-guest-note a { color: var(--z-navy); font-weight: 700; }

.gv-step {
    background: var(--z-surface); border: 1px solid var(--z-gold-hairline);
    border-radius: var(--z-radius); padding: 1.2rem 1.35rem; margin-bottom: 1rem;
    scroll-margin-top: 90px;
}
.gv-step-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: .6rem; }
.gv-step-kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--z-muted); }
.gv-step-title { font-size: 1.02rem; color: var(--z-navy); margin: .1rem 0 0; }
.gv-check {
    flex-shrink: 0; width: 1.9rem; height: 1.9rem; margin-top: .1rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--z-border); border-radius: .55rem;
    background: var(--z-surface); color: transparent;
    font-size: .95rem; font-weight: 800; line-height: 1;
    cursor: pointer; transition: border-color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease), color var(--z-dur-fast) var(--z-ease);
}
.gv-check:hover { border-color: var(--z-success); color: var(--z-success); }
.gv-step.done .gv-check { background: var(--z-success); border-color: var(--z-success); color: #fff; }
.gv-step.done .gv-step-title { color: var(--z-muted); }
.gv-step.done { border-color: var(--z-success); border-left: 4px solid var(--z-success); }
.gv-step-body { font-size: .92rem; line-height: 1.75; color: var(--z-text); }
.gv-step-body p { margin-bottom: .7rem; }
.gv-step-body ul { padding-left: 1.25rem; margin-bottom: .7rem; }
.gv-step-body li { margin-bottom: .25rem; }
.gv-step-body strong { color: var(--z-navy); }
.gv-step-foot { margin-top: .4rem; }

@media (max-width: 991.98px) {
    .gv-side-col { order: 2; }
    .gv-sidebar { position: static; max-height: none; }
}

@media print {
    .site-nav, .site-footer, footer, .no-print, .toast-container, .modal { display: none !important; }
    .gv-header { background: #fff !important; padding: 0 0 1rem; }
    .gv-header h1 { color: #000; }
    .gv-header .gv-summary { color: #444; }
    .gv-step { border: 1px solid #ccc; break-inside: avoid; margin-bottom: .8rem; }
    .gv-step-title { color: #000; }
    .disclaimer-strip { border: 1px solid #ccc; }
    body { background: #fff; }
}

/* ============================================================
   Legal document sheet (legalinfo.mn style)
   Shared by /laws/{id} (law_view.twig) and the chat article modal.
   Serif document body on a white "paper" panel; the rest of the
   site stays sans (--z-font).
   ============================================================ */
.legal-doc {
    --ld-serif: Georgia, "Times New Roman", "Noto Serif", serif;
    background: #fff;
    border: 1px solid var(--z-border);
    border-radius: .4rem;
    box-shadow: var(--z-shadow-sm);
    padding: 2.75rem 3rem 3.25rem;
    font-family: var(--ld-serif);
    color: var(--z-text); /* warm ink — matches the site palette */
}
@media (max-width: 575.98px) {
    .legal-doc { padding: 1.6rem 1.1rem 2rem; }
}

.legal-doc .ld-masthead {
    text-align: center;
    font-family: var(--ld-serif);
    font-size: .95rem;
    font-weight: 700;
    font-variant: small-caps;
    text-transform: uppercase;
    letter-spacing: .24em;
    color: var(--z-navy);
}
.legal-doc .ld-masthead::after {
    content: "";
    display: block;
    width: 52px;
    border-bottom: 2px solid var(--z-gold);
    margin: .65rem auto 0;
}
.legal-doc .ld-dateline {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.1rem;
    font-size: .82rem;
    font-style: italic;
    color: var(--z-muted);
}
.legal-doc .ld-title {
    font-family: var(--ld-serif);
    text-align: center;
    text-transform: uppercase;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .05em;
    line-height: 1.6;
    color: #1D180D; /* warm near-black */
    max-width: 36rem;
    margin: 2rem auto 0;
}
.legal-doc .ld-title-note {
    display: block;
    font-size: .85rem;
    letter-spacing: .08em;
    color: var(--z-muted);
    margin-top: .25rem;
}
.legal-doc .ld-intro { margin-top: 1.6rem; }

.legal-doc .ld-chapter {
    text-align: center;
    margin: 2.9rem 0 1.5rem;
    scroll-margin-top: 90px;
}
.legal-doc .ld-chapter-no {
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #1D180D; /* warm near-black */
}
.legal-doc .ld-chapter-name {
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #1D180D; /* warm near-black */
    margin-top: .35rem;
}

.legal-doc .ld-article { margin-bottom: .4rem; scroll-margin-top: 90px; }
.legal-doc .ld-article-h {
    font-family: var(--ld-serif);
    font-size: 1rem;
    font-weight: 700;
    color: var(--z-navy);
    letter-spacing: 0;
    margin: 1.7rem 0 .55rem;
}
.legal-doc .ld-line {
    margin: 0 0 .5rem;
    font-size: .95rem;
    line-height: 1.85;
    /* left-aligned: justify produced rivers in narrow indented clauses (no mn hyphenation) */
    text-align: left;
    overflow-wrap: break-word;
}
.legal-doc .ld-l1 { padding-left: 2.4rem; }
.legal-doc .ld-l2 { padding-left: 4rem; }
.legal-doc .ld-amend,
.legal-doc .ld-amend-inline {
    color: var(--z-muted);
    font-style: italic;
    font-size: .875rem;
}
.legal-doc p.ld-amend { padding-left: 2.4rem; }

/* Subtle status badges inside the document */
.legal-doc .ld-badge {
    display: inline-block;
    font-family: var(--z-font);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #A33;
    background: #FBEFEF;
    border: 1px solid #EBD3D3;
    border-radius: .45rem;
    padding: .08rem .45rem;
    vertical-align: .15em;
    margin-left: .45rem;
}
.legal-doc .ld-article.repealed .ld-line { color: #A69F8C; } /* warm gray */

/* ============================================================
   Chat: clickable law citations + article modal
   ============================================================ */
.citation-card.citation-clickable {
    cursor: pointer;
    transition: background var(--z-dur-fast) var(--z-ease), border-color var(--z-dur-fast) var(--z-ease),
        box-shadow var(--z-dur-fast) var(--z-ease), transform var(--z-dur-fast) var(--z-ease);
}
.citation-card.citation-clickable:hover,
.citation-card.citation-clickable:focus-visible {
    background: #F1E3BA;
    border-left-color: var(--z-navy);
    box-shadow: var(--z-shadow-sm);
    transform: translateY(-1px);
    outline: none;
}
.citation-card.citation-clickable:focus-visible { box-shadow: var(--z-ring); }
.citation-card .citation-hint {
    display: block;
    margin-top: .35rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--z-gold-text);
}

.law-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: rgba(12, 27, 51, .58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: z-fade var(--z-dur-med) var(--z-ease) both;
}
@keyframes z-fade { from { opacity: 0; } to { opacity: 1; } }
.law-modal {
    background: var(--z-bg);
    border-radius: .9rem;
    box-shadow: var(--z-shadow-lg);
    width: min(840px, 100%);
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: z-modal-in var(--z-dur-med) var(--z-ease) both;
}
@keyframes z-modal-in {
    from { opacity: 0; transform: scale(.97) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.law-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1.15rem;
    background: var(--z-navy);
    color: #fff;
    flex-shrink: 0;
}
.law-modal-head .lm-law-title {
    font-size: .88rem;
    font-weight: 700;
    line-height: 1.35;
}
.law-modal-close {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .85);
    font-size: 1.6rem;
    line-height: 1;
    padding: 0 .2rem;
    cursor: pointer;
}
.law-modal-close:hover { color: #fff; }
.law-modal-body {
    overflow-y: auto;
    padding: 1.25rem;
    -webkit-overflow-scrolling: touch;
}
.law-modal-body .legal-doc { padding: 2rem 2.25rem 2.4rem; }
@media (max-width: 575.98px) {
    .law-modal-body { padding: .75rem; }
    .law-modal-body .legal-doc { padding: 1.4rem 1rem 1.8rem; }
}
.law-modal-body .lm-loading {
    text-align: center;
    color: var(--z-muted);
    padding: 3rem 1rem;
    font-size: .9rem;
}
.law-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem 1.15rem;
    border-top: 1px solid var(--z-border);
    background: var(--z-surface);
    flex-shrink: 0;
}
.law-modal-foot .lm-nav-btn {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: .6rem;
    color: var(--z-navy);
    font-weight: 600;
    font-size: .85rem;
    padding: .35rem .8rem;
    cursor: pointer;
    transition: border-color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease);
}
.law-modal-foot .lm-nav-btn:hover:not(:disabled) { border-color: var(--z-gold); background: var(--z-gold-tint); }
.law-modal-foot .lm-nav-btn:disabled { opacity: .4; cursor: default; }
.law-modal-foot .lm-full-link {
    font-size: .85rem;
    font-weight: 700;
    color: var(--z-navy);
    text-decoration: none;
    transition: color var(--z-dur-fast) var(--z-ease);
}
.law-modal-foot .lm-full-link:hover { color: var(--z-gold-text); }
/* Trust cue inside the legal-doc sheets: where the text comes from */
.legal-doc .ld-source {
    margin-top: 2rem;
    padding-top: .8rem;
    border-top: 1px dashed var(--z-border);
    font-family: var(--z-font);
    font-size: .75rem;
    color: var(--z-muted);
    text-align: center;
}

/* Full-screen sheet on phones */
@media (max-width: 575.98px) {
    .law-modal-backdrop { padding: 0; align-items: stretch; }
    .law-modal {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}

@media print {
    .law-modal-backdrop { display: none !important; }
}

/* Modal document: slightly smaller title, tighter spacing than the full page */
.law-modal .legal-doc .ld-title.lm-doc-title { font-size: 1.02rem; margin-top: 1.4rem; }
.law-modal .legal-doc .ld-chapter { margin: 1.8rem 0 .9rem; }

/* Guard against flex min-content overflow on narrow screens */
.law-modal { min-width: 0; }
.law-modal-head .lm-law-title { min-width: 0; overflow-wrap: break-word; }
@media (max-width: 575.98px) {
    .law-modal-foot { flex-wrap: wrap; }
    .law-modal-foot .lm-full-link { order: 3; width: 100%; text-align: center; }
}

/* ============================================================
   Structured chat answers (blocks) — P11
   ============================================================ */

/* Summary lead */
.ab-summary {
    font-size: 1.04rem;
    font-weight: 650;
    color: var(--z-navy);
    line-height: 1.6;
    padding-bottom: .7rem;
    margin-bottom: .8rem;
    border-bottom: 1px solid var(--z-border);
}

.ab-block-title {
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--z-navy);
    margin: .9rem 0 .5rem;
}

/* Steps — numbered cards in the spirit of the /guides step pages */
.ab-steps { margin: .8rem 0; }
.ab-step {
    background: var(--z-bg);
    border: 1px solid var(--z-border);
    border-radius: .85rem;
    padding: .85rem 1rem;
    margin-bottom: .55rem;
    transition: transform var(--z-dur-fast) var(--z-ease), box-shadow var(--z-dur-fast) var(--z-ease);
}
.ab-step:hover { transform: translateY(-1px); box-shadow: var(--z-shadow-sm); }
.ab-step:last-child { margin-bottom: 0; }
.ab-step-head { display: flex; align-items: flex-start; gap: .7rem; }
.ab-step-num {
    flex-shrink: 0;
    width: 1.8rem;
    height: 1.8rem;
    margin-top: .1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--z-navy);
    color: var(--z-gold-soft);
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
}
.ab-step-kicker {
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--z-muted);
}
.ab-step-title { font-weight: 700; color: var(--z-navy); font-size: .95rem; margin-top: .05rem; }
.ab-step-body { margin-top: .55rem; font-size: .9rem; line-height: 1.7; }
.ab-step-body.md-body p { margin-bottom: .5rem; }

/* Pros / cons — green ✓ vs red ✗, stacks on mobile */
.ab-proscons { margin: .8rem 0; }
.ab-pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.ab-pc-col { border-radius: .85rem; padding: .75rem .9rem; border: 1px solid var(--z-border); }
.ab-pc-col.ab-pros { background: var(--z-success-tint); border-color: #CBE5D8; }
.ab-pc-col.ab-cons { background: #FBEDEB; border-color: #EDCFC9; }
.ab-pc-head { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .45rem; }
.ab-pros .ab-pc-head { color: var(--z-success); }
.ab-cons .ab-pc-head { color: #A5372A; }
.ab-pc-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.ab-pc-list li { display: flex; gap: .45rem; align-items: flex-start; margin-bottom: .35rem; line-height: 1.55; }
.ab-pc-list li:last-child { margin-bottom: 0; }
.ab-pc-mark { flex-shrink: 0; font-weight: 800; line-height: 1.55; }
.ab-pros .ab-pc-mark { color: var(--z-success); }
.ab-cons .ab-pc-mark { color: #A5372A; }
@media (max-width: 575.98px) {
    .ab-pc-grid { grid-template-columns: 1fr; }
}

/* Law refs — reuse the clickable citation-card treatment */
.ab-lawrefs { margin: .8rem 0 .2rem; }
.ab-lawrefs .citation-card { margin-top: .5rem; }
.ab-lawrefs .citation-card:first-of-type { margin-top: 0; }

/* Note / footnote */
.ab-note {
    font-size: .8rem;
    color: var(--z-muted);
    border-top: 1px dashed var(--z-border);
    margin-top: .9rem;
    padding-top: .55rem;
}

/* Serious-case warning — its own amber card AFTER the answer bubble */
.chat-warning-card {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    background: #FCF0CD; /* deepened so it still reads on the cream page bg */
    border: 1px solid #E4CB83;
    border-left: 4px solid #D9A62E;
    border-radius: var(--z-radius);
    padding: .85rem 1.05rem;
    max-width: 95%;
    margin-right: auto;
    box-shadow: var(--z-shadow-sm);
    color: #6E5512;
    font-size: .92rem;
    line-height: 1.6;
}
.chat-warning-card .cw-icon { font-size: 1.1rem; line-height: 1.4; flex-shrink: 0; }
.chat-warning-card .cw-body p { margin: 0; }
.chat-warning-card .cw-body p + p { margin-top: .4rem; }

/* Guide chip — links the matched step-by-step guide */
.guide-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    align-self: flex-start;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 2rem;
    padding: .5rem 1.05rem;
    font-size: .875rem;
    color: var(--z-navy);
    text-decoration: none;
    box-shadow: var(--z-shadow-sm);
    max-width: 95%;
    transition: border-color var(--z-dur-fast) var(--z-ease), background var(--z-dur-fast) var(--z-ease), transform var(--z-dur-fast) var(--z-ease);
}
.guide-chip:hover { border-color: var(--z-gold); background: var(--z-gold-tint); color: var(--z-navy); transform: translateY(-1px); }
.guide-chip .gc-arrow { color: var(--z-gold-text); font-weight: 700; }

/* Static disclaimer under the composer — always visible, not dismissible */
.chat-static-disclaimer {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: .45rem;
    background: #FBF3DC; /* deepened so it still reads on the warm surface */
    border: 1px solid #E7D6A6;
    border-radius: .7rem;
    color: #6E5A1A;
    font-size: .78rem;
    line-height: 1.5;
    padding: .5rem .85rem;
    margin-top: .55rem;
    text-align: center;
}
.chat-static-disclaimer .csd-icon { line-height: 1.5; }
.composer-hint.d-md-block { margin-top: .35rem; }
