/**
 * Agreed — layout and components. Calm, single column, phone first.
 */

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--topbar-height);
    background: linear-gradient(90deg, var(--topbar-bg-from), var(--topbar-bg-to));
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.topbar__inner {
    max-width: 960px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; }
.brand .material-icons { font-size: 22px; color: #9cc3ec; }
.topbar__company {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
}
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 0.25rem; }
.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 36px;
    padding: 0 0.6rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.topbar-btn.is-active { background: rgba(255, 255, 255, 0.16); }
.lang-switch { display: inline-flex; align-items: center; font-size: 0.85rem; }
.lang-switch a { color: rgba(255, 255, 255, 0.7); padding: 0 0.3rem; }
.lang-switch a.is-active { color: #fff; font-weight: 600; }

.menu { position: relative; }
.menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--color-bg-elevated);
    color: var(--color-text);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 0.35rem;
}
.menu__panel[hidden] { display: none; }
.menu__meta { padding: 0.5rem 0.65rem; font-size: 0.85rem; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border-soft); margin-bottom: 0.25rem; }
.menu__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.menu__item:hover { background: var(--color-bg-hover); text-decoration: none; }

/* Page */
.page {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}
.page--wide { max-width: 960px; }
.page__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.page__title { margin: 0; font-size: 1.35rem; font-weight: 600; }
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); font-size: 0.85rem; }

.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.1rem;
}
.card + .card { margin-top: 1rem; }
.card__title { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--color-bg-hover); text-decoration: none; }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-contrast); }
.btn--primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn--success { background: var(--color-success); border-color: var(--color-success); color: #06210f; }
[data-theme="light"] .btn--success { color: #fff; }
.btn--success:hover { filter: brightness(0.95); background: var(--color-success); }
.btn--ghost { border-color: transparent; color: var(--color-primary); }
.btn--small { min-height: 32px; padding: 0 0.65rem; font-size: 0.875rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.field { margin-bottom: 0.9rem; }
.field label, .label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-label);
    margin-bottom: 0.3rem;
}
.input, select.input, textarea.input {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg-input);
    color: var(--color-text);
    font: inherit;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--color-primary); outline-offset: 0; border-color: var(--color-primary); }
.row { display: flex; gap: 0.6rem; }
.row > * { flex: 1; }
.row > .row__narrow { flex: 0 0 110px; }
.hint { font-size: 0.8rem; color: var(--color-text-faint); margin-top: 0.25rem; }
.hint--error { color: var(--color-danger); font-weight: 600; }
.segmented { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 0.5rem; }
.segmented label { position: relative; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 0.35rem 0.75rem; font-weight: 500; font-size: 0.85rem; color: var(--color-text-muted); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { background: var(--color-primary); color: var(--color-primary-contrast); }
.segmented input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: -2px; }

/* Flash */
.flash {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.flash--success { background: var(--tint-success); border-color: var(--color-success); }
.flash--error { background: var(--tint-danger); border-color: var(--color-danger); }
.flash--info { background: var(--tint-primary); border-color: var(--color-primary); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge--draft { background: var(--tint-muted); color: var(--color-text-muted); }
.badge--waiting { background: var(--tint-primary); color: var(--color-primary); }
.badge--changed { background: var(--tint-warning); color: var(--color-warning); }
.badge--agreed { background: var(--tint-success); color: var(--color-success); }
.badge--plan { background: var(--tint-primary); color: var(--color-primary); }

/* Filters */
.filters { display: flex; gap: 0.35rem; overflow-x: auto; margin-bottom: 0.9rem; padding-bottom: 2px; }
.filters a {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--color-border-soft);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}
.filters a:hover { text-decoration: none; background: var(--color-bg-hover); }
.filters a.is-active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-contrast); }

/* Agreement list */
.list { list-style: none; margin: 0; padding: 0; }
.list__item + .list__item { margin-top: 0.5rem; }
.list__link {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    color: var(--color-text);
}
.list__link:hover { text-decoration: none; border-color: var(--color-primary); }
.list__party { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__price { text-align: right; font-variant-numeric: tabular-nums; }
.list__meta { font-size: 0.85rem; color: var(--color-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
}
.empty .material-icons { font-size: 40px; color: var(--color-text-faint); display: block; margin: 0 auto 0.5rem; }
.empty p { margin: 0 0 1rem; }

/* Agreement page */
.agreement__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.agreement__parties { font-size: 0.9rem; color: var(--color-text-muted); }
.banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    font-weight: 600;
}
.banner--agreed { background: var(--tint-success); color: var(--color-success); border: 1px solid var(--color-success); }
.banner--info { background: var(--tint-primary); color: var(--color-text); border: 1px solid var(--color-border-soft); font-weight: 500; }
.term {
    padding: 1rem 0;
    border-top: 1px solid var(--color-border-soft);
}
.agreement__head + .term { border-top: 0; padding-top: 0.25rem; }
.term__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.term__label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-faint); }
.term__value { font-size: 1.15rem; margin-top: 0.2rem; white-space: pre-wrap; word-break: break-word; }
.term__value--empty { color: var(--color-text-faint); font-style: italic; font-size: 1rem; }
.term__form { margin-top: 0.6rem; }
.term__form[hidden] { display: none; }
.history { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.history li { font-size: 0.85rem; color: var(--color-text-faint); margin-top: 0.2rem; }
.history del { color: var(--color-text-muted); text-decoration-color: var(--color-danger); text-decoration-thickness: 2px; white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.timeline li { padding: 0.35rem 0; border-top: 1px solid var(--color-border-soft); color: var(--color-text-muted); }
.timeline li:first-child { border-top: 0; }
.deal {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-success);
    margin: 0 0 1rem;
}

/* Auth + landing */
.auth { max-width: 420px; margin: 3rem auto; padding: 0 1rem; }
.auth .card { padding: 1.5rem; }
.auth__title { margin: 0 0 0.35rem; font-size: 1.35rem; }
.landing { max-width: 720px; margin: 0 auto; padding: 4rem 1rem 3rem; text-align: center; }
.landing h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.15; margin: 0 0 0.75rem; }
.landing__sub { font-size: 1.2rem; color: var(--color-text-muted); margin: 0 0 2rem; }
.landing__ctas { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.landing__demo { margin: 3rem auto 0; max-width: 420px; text-align: left; }
.landing__pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; text-align: left; }
.landing__pricing ul { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--color-text-muted); }
.price-tag { font-size: 1.5rem; font-weight: 700; }

.footer { text-align: center; font-size: 0.8rem; color: var(--color-text-faint); padding: 2rem 1rem; }

@media (max-width: 560px) {
    .topbar__company { display: none; }
    .topbar-btn__label { display: none; }
    .page { padding-top: 1rem; }
    .landing { padding-top: 2.5rem; }
    .landing__pricing { grid-template-columns: 1fr; }
    .term__value { font-size: 1.05rem; }
    .actions .btn { flex: 1; }
}
