/* App layout. Colours and typography come from the RVM.UI tokens (rvm-ui.css); only structure here. */
body { margin: 0; font-family: var(--rvm-font-family, system-ui, sans-serif); }
h1 { margin: 0; }

.shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.top {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--rvm-border, #e5e7eb);
}
.top-user { display: flex; align-items: center; gap: 12px; }
.top-user form { margin: 0; }
.menu { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-right: 1px solid var(--rvm-border, #e5e7eb); }
.menu a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: inherit; }
.menu a.active { background: var(--rvm-accent-50, #eef2ff); font-weight: 600; }
.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 24px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; gap: 16px;
    padding: 32px; border-radius: 16px;
    border: 1px solid var(--rvm-border, #e5e7eb);
}
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; font-weight: 500; }
.field input { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rvm-border, #d1d5db); font: inherit; }
.login-error { margin: 0; color: #b42318; }
.validation-message { color: #b42318; font-size: 0.875rem; }

/* Forms inside modals and cards */
.form { display: flex; flex-direction: column; gap: 16px; min-width: min(420px, 80vw); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pre-line { white-space: pre-line; margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 16px 0 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
/* Client lists: the kit truncates title and subtitle on one line; on a phone the client must read them whole. */
.wrap-items .rvm-list-item__titulo, .wrap-items .rvm-list-item__subtitulo { white-space: normal; overflow: visible; text-overflow: clip; }
/* Task conversation */
.thread { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.thread-item { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--rvm-border, #e5e7eb); }
.thread-item--team { background: var(--rvm-accent-50, #f5f3ff); }
.thread-item p { margin: 8px 0 0; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.attachments { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.attachments a { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; max-width: 160px; overflow-wrap: anywhere; }
.attachments img { width: 160px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rvm-border, #e5e7eb); }
.thread-new { min-width: 0; }
/* Forge issue text (sanitized Markdown) */
.issue-text { margin-top: 12px; overflow-wrap: anywhere; line-height: 1.5; }
.issue-text pre, .issue-text code { white-space: pre-wrap; font-size: 0.8125rem; }
.issue-text table { border-collapse: collapse; display: block; overflow-x: auto; }
.issue-text th, .issue-text td { border: 1px solid var(--rvm-border, #e5e7eb); padding: 4px 8px; }
.issue-text { max-width: 70ch; }
.issue-text h3 { font-size: 1.125rem; margin: 20px 0 8px; }
.issue-text h4, .issue-text h5, .issue-text h6 { font-size: 1rem; margin: 16px 0 8px; }
.issue-text a { color: var(--rvm-accent-ink, #5128a6); text-decoration: underline; padding-block: 4px; }
/* Contract editor */
.contract-form { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: end; }
.rule-block { padding: 12px 16px; border: 1px solid var(--rvm-border, #e5e7eb); border-radius: 12px; margin-bottom: 12px; }
.rule-body { margin: 12px 0 0 8px; padding-left: 16px; border-left: 3px solid var(--rvm-accent-50, #eef2ff); display: flex; flex-direction: column; gap: 16px; }
.rule-options { display: flex; flex-direction: column; gap: 12px; }
.rule-block .rvm-switch, .rule-options .rvm-switch { min-height: 32px; }
.hash { overflow-wrap: anywhere; word-break: break-all; }
/* Page titles wrap instead of being cut ("Contrato mensal com participa…"). */
.rvm-page-header__titulo { white-space: normal; overflow: visible; text-overflow: clip; }
/* Kit field border is #EBEBEB (1.2:1) — an empty field looks like blank space. 3:1 here until RVM.UI fixes the token. */
.rvm-field__box { box-shadow: inset 0 0 0 1px #868686; }
.rules { margin: 12px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.decision-actions { margin-top: 16px; flex-wrap: wrap; }
.thread-empty { margin-bottom: 24px; }

/* Touch targets (client opens on the phone): 44px for the back link and the menu items. */
.back-link { display: inline-flex; align-items: center; min-height: 44px; }
.menu a { display: flex; align-items: center; min-height: 44px; }
/* Blazor moves focus to the h1 on navigation: no outline for that programmatic focus, keep it for keyboard. */
h1:focus:not(:focus-visible) { outline: none; }
.invite-link { display: block; margin-top: 8px; word-break: break-all; font-size: 0.8125rem; }

@media (max-width: 720px) {
    /* iOS Safari zooms into any field under 16px on focus — the client lands in a zoomed modal. (Kit default: 14px.) */
    .rvm-field__input { font-size: 16px; }
    .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
    .content { padding: 16px; }
    .menu { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--rvm-border, #e5e7eb); }
}
.milestone-acceptance { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.vesting-table tr.is-today td { font-weight: 700; }
.rule-title { font-size: 1rem; font-weight: 600; margin: 0; }
.after-list { margin-top: 12px; }
.quote { display: flex; flex-direction: column; gap: 4px; }
.pay-box { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid #e3e3e3; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
