/* =====================================================================
   Hierbicas · Estilos comunes de pantallas y módulos
   Se carga DESPUÉS de base.css y theme.css (diseño aprobado, sin tocar).
   Reutiliza sus variables: blanco, verde #193d29 y madera ocre.
   ===================================================================== */
:root {
    --line: #dce3dc;
    --line-strong: #b7a17b;
    --muted: #4f6b5a;
    --field-bg: #ffffff;
    --ok-bg: #edf5ee;
    --ok-text: #1d5a34;
    --error-bg: #fbeeea;
    --error-text: #8a2c17;
    --info-bg: #f7f2e7;
    --wood-image:
        repeating-radial-gradient(ellipse at 12% -160%,
            transparent 0 10px, rgba(88, 66, 36, 0.055) 11px,
            transparent 12px 24px, rgba(255, 250, 235, 0.09) 25px,
            transparent 26px 39px),
        repeating-radial-gradient(ellipse at 88% 260%,
            transparent 0 19px, rgba(88, 66, 36, 0.04) 20px,
            transparent 21px 38px),
        repeating-linear-gradient(1deg,
            transparent 0 5px, rgba(88, 66, 36, 0.025) 6px,
            transparent 7px 12px);
}

[hidden] { display: none !important; }

body { line-height: 1.45; }

/* Botón de madera genérico (misma veta que los del diseño aprobado). */
.wood-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 700;
    color: var(--color-text);
    background-color: var(--button-bg);
    background-image: var(--wood-image);
    border: 1px solid var(--button-border);
    border-radius: 7px;
    box-shadow: 0 2px 7px rgba(61, 49, 30, 0.07);
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.wood-button:hover { background-color: var(--button-bg-hover); }
.wood-button:active { transform: scale(0.98); }
.wood-button:disabled { opacity: 0.6; cursor: wait; }
.wood-button.is-small { min-height: 38px; padding: 6px 14px; font-size: 0.95rem; }
.wood-button.is-block { width: 100%; }

.text-button {
    font: inherit;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    padding: 6px 4px;
    background: none;
    border: 0;
}

/* Pantallas interiores */
.screen-lead { color: var(--muted); margin-top: -12px; margin-bottom: 22px; }
.content-card p + p { margin-top: 8px; }
.text-block { white-space: pre-line; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.contact-list { list-style: none; display: grid; gap: 10px; }
.contact-list a { text-decoration: underline; text-underline-offset: 3px; }
.contact-label { display: block; font-size: 0.85rem; color: var(--muted); }

/* Portada: enlaces externos compactos bajo el menú */
.link-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.link-grid .wood-button { width: 100%; font-size: 1.05rem; min-height: 44px; }
.link-grid .wood-button:only-child { grid-column: 1 / -1; }

/* Mensajes */
.notice {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--info-bg);
    margin-bottom: 16px;
}
.notice.is-success { background: var(--ok-bg); color: var(--ok-text); border-color: #bcd8c2; }
.notice.is-error { background: var(--error-bg); color: var(--error-text); border-color: #e6c2b8; }
.notice:empty { display: none; }

/* Formularios */
.form { width: 100%; display: grid; gap: 16px; }
.form-section {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 16px;
    display: grid;
    gap: 14px;
    background: #ffffff;
}
.form-section > legend { padding: 0 8px; font-weight: 700; font-size: 1.1rem; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    font: inherit;
    font-size: 16px;               /* evita el zoom automático en iPhone */
    font-weight: 400;
    color: var(--color-text);
    background: var(--field-bg);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.field input[readonly] { background: #f6f6f2; color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
    outline: 3px solid rgba(25, 61, 41, 0.35);
    outline-offset: 1px;
    border-color: var(--color-text);
}
.counter { font-size: 0.8rem; color: var(--muted); justify-self: end; font-weight: 400; }
.check {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    font-weight: 400;
    cursor: pointer;
}
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--color-text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions > * { flex: 1 1 180px; }

/* Historial */
.history-entry {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-top: 12px;
    overflow-wrap: anywhere;
}
.history-entry h3 { font-size: 1rem; margin-bottom: 4px; }
.history-entry details { margin-top: 8px; }
.history-entry summary { cursor: pointer; font-weight: 700; }
.history-entry dl { display: grid; gap: 6px; margin-top: 8px; font-size: 0.92rem; }
.history-entry dt { font-weight: 700; }
.history-entry dd { white-space: pre-line; color: var(--muted); }

/* Área privada */
.section-title { width: 100%; font-size: 1.1rem; margin: 6px 0 12px; }
.role-pill {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid var(--line-strong);
    background: var(--info-bg);
}
.module-card { flex-direction: column; gap: 4px; }
.module-card small { font-weight: 400; font-size: 0.85rem; }
.coming-soon { width: 100%; text-align: center; margin-bottom: 22px; }

/* Entrada / registro */
.auth-screen .form { margin-top: 4px; }
.auth-screen .auth-main-button { width: 100%; font-size: 1.35rem; }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 6px;
}
.panel-title { font-size: 1.3rem; text-align: center; }
.auth-panel { width: 100%; }
.session-card { width: 100%; text-align: center; }

.page-footer { margin-top: 30px; display: flex; justify-content: center; }

@media (max-width: 480px) {
    .form-section { padding: 16px 12px; }
}

.center { text-align: center; }
.mt-16 { margin-top: 16px; }

/* Mensajes del Módulo 01 (message-box.js genera <p class="message is-…">) */
.message {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--info-bg);
    margin-bottom: 16px;
}
.message.is-success { background: var(--ok-bg); color: var(--ok-text); border-color: #bcd8c2; }
.message.is-error { background: var(--error-bg); color: var(--error-text); border-color: #e6c2b8; }
.message.is-warning { background: #fdf6e3; color: #6b4e12; border-color: #ead9ae; }
p a:not([class]) { text-decoration: underline; text-underline-offset: 3px; }
