/**
 * JEA Workflow Pages — jea.workflow.css
 *
 * Styles for Phase 21–25 workflow pages:
 *   - Rent Payment Ledger (.jea-ledger-page)
 *   - Maintenance Request Tracker (.jea-maintenance-page)
 *   - Communication Log (.jea-comms-page)
 *   - Security Deposit Ledger (.jea-deposit-page)
 *   - Tenant Rights & Compliance (.jea-rights-page)
 *
 * All colours use existing JEA CSS custom properties (--jea-*).
 * No inline styles are permitted.
 */

/* ── Shared page shell ─────────────────────────────────────────────────────── */

.jea-workflow-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.jea-workflow-page__header {
    margin-bottom: 1.75rem;
    border-bottom: 2px solid var(--jea-border, #e2e8f0);
    padding-bottom: 1rem;
}

.jea-workflow-page__breadcrumbs {
    font-size: 0.85rem;
    color: var(--jea-muted, #64748b);
    margin-bottom: 0.5rem;
}

.jea-workflow-page__breadcrumbs a {
    color: var(--jea-link, #2563eb);
    text-decoration: none;
}

.jea-workflow-page__breadcrumbs a:hover {
    text-decoration: underline;
}

.jea-workflow-page__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--jea-heading, #1e293b);
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jea-workflow-page__subtitle {
    color: var(--jea-muted, #64748b);
    margin: 0;
    font-size: 0.95rem;
}

/* ── Summary cards row ─────────────────────────────────────────────────────── */

.jea-workflow-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.jea-summary-card {
    flex: 1 1 150px;
    background: var(--jea-surface, #f8fafc);
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.jea-summary-card--alert {
    border-color: var(--jea-danger, #ef4444);
    background: #fef2f2;
}

.jea-summary-card__label {
    font-size: 0.78rem;
    color: var(--jea-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jea-summary-card__value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--jea-heading, #1e293b);
}

/* ── Workflow form block ───────────────────────────────────────────────────── */

.jea-workflow-form {
    background: var(--jea-surface, #f8fafc);
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.jea-workflow-form__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--jea-heading, #1e293b);
    margin: 0 0 1rem;
}

.jea-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.jea-form-group {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.jea-form-group--full {
    flex: 1 1 100%;
}

.jea-form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--jea-label, #475569);
}

.jea-form-label--checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.jea-form-control {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
    color: var(--jea-text, #334155);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.jea-form-control:focus {
    outline: none;
    border-color: var(--jea-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.jea-form-control {
    resize: vertical;
}

/* ── Workflow list block ───────────────────────────────────────────────────── */

.jea-workflow-list {
    margin-bottom: 2rem;
}

.jea-workflow-list__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--jea-heading, #1e293b);
    margin: 0 0 1rem;
    border-bottom: 1px solid var(--jea-border, #e2e8f0);
    padding-bottom: 0.5rem;
}

.jea-workflow-list__empty {
    color: var(--jea-muted, #64748b);
    font-style: italic;
    padding: 1rem 0;
}

/* ── Workflow table ────────────────────────────────────────────────────────── */

.jea-workflow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.jea-workflow-table th,
.jea-workflow-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--jea-border, #e2e8f0);
}

.jea-workflow-table th {
    background: var(--jea-surface, #f8fafc);
    font-weight: 600;
    color: var(--jea-label, #475569);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jea-table-row:hover td {
    background: var(--jea-row-hover, #f1f5f9);
}

.jea-table-row--alert td {
    background: #fef9ec;
}

/* ── Status badges ─────────────────────────────────────────────────────────── */

.jea-status-badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.jea-status-badge--confirmed  { background: #dcfce7; color: #15803d; }
.jea-status-badge--pending    { background: #fef9c3; color: #854d0e; }
.jea-status-badge--dispute    { background: #fee2e2; color: #b91c1c; }
.jea-status-badge--open       { background: #dbeafe; color: #1d4ed8; }
.jea-status-badge--inprogress { background: #fef3c7; color: #92400e; }
.jea-status-badge--scheduled  { background: #e0f2fe; color: #0369a1; }
.jea-status-badge--success    { background: #dcfce7; color: #15803d; }
.jea-status-badge--closed     { background: #f1f5f9; color: #64748b; }
.jea-status-badge--declined   { background: #fce7f3; color: #9d174d; }

/* ── Count badge (open count on title) ─────────────────────────────────────── */

.jea-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--jea-danger, #ef4444);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 0.4em;
}

/* ── Filter bar ────────────────────────────────────────────────────────────── */

.jea-workflow-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* ── Banner ────────────────────────────────────────────────────────────────── */

.jea-workflow-banner {
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.jea-banner--info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.jea-banner--success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.jea-banner--warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.jea-banner--danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ── Text utilities ────────────────────────────────────────────────────────── */

.jea-text-danger  { color: var(--jea-danger, #ef4444); font-weight: 600; }
.jea-text-warning { color: #d97706; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 21 — Rent Payment Ledger
   ═══════════════════════════════════════════════════════════════════════════ */

.jea-ledger-add-form { margin-bottom: 2rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 22 — Maintenance Request Tracker
   ═══════════════════════════════════════════════════════════════════════════ */

.jea-maintenance-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.jea-maintenance-item {
    background: #fff;
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.jea-maintenance-item--overdue {
    border-left: 4px solid var(--jea-danger, #ef4444);
}

.jea-maintenance-item__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.jea-maintenance-item__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    flex: 1 1 200px;
    color: var(--jea-heading, #1e293b);
}

.jea-maintenance-item__meta {
    font-size: 0.82rem;
    color: var(--jea-muted, #64748b);
    margin-bottom: 0.4rem;
}

.jea-maintenance-item__desc {
    font-size: 0.9rem;
    color: var(--jea-text, #334155);
    margin: 0.25rem 0 0;
}

/* Urgency chips */
.jea-urgency--routine   { background: #f1f5f9; color: #64748b; padding: 0.2em 0.6em; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.jea-urgency--urgent    { background: #fef3c7; color: #92400e; padding: 0.2em 0.6em; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.jea-urgency--emergency { background: #fee2e2; color: #b91c1c; padding: 0.2em 0.6em; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 23 — Communication Log
   ═══════════════════════════════════════════════════════════════════════════ */

.jea-comms-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: #1e40af;
    margin-bottom: 1.25rem;
}

.jea-comms-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.jea-comms-item {
    background: #fff;
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
}

.jea-comms-item--evidence {
    border-left: 4px solid var(--jea-primary, #2563eb);
    background: #f0f7ff;
}

.jea-comms-item__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.jea-comms-item__type-badge {
    background: var(--jea-surface, #f1f5f9);
    color: var(--jea-label, #475569);
    padding: 0.15em 0.55em;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.jea-comms-item__dir {
    font-size: 0.78rem;
    color: var(--jea-muted, #64748b);
}

.jea-comms-item__date {
    font-size: 0.78rem;
    color: var(--jea-muted, #64748b);
    margin-left: auto;
}

.jea-comms-evidence-badge {
    background: var(--jea-primary, #2563eb);
    color: #fff;
    padding: 0.15em 0.55em;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.jea-comms-item__subject {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--jea-heading, #1e293b);
    margin-bottom: 0.25rem;
}

.jea-comms-item__preview {
    font-size: 0.85rem;
    color: var(--jea-text, #334155);
    margin-bottom: 0.5rem;
    white-space: pre-line;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.jea-comms-item__actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 24 — Security Deposit Ledger
   ═══════════════════════════════════════════════════════════════════════════ */

.jea-deposit-create-form { max-width: 680px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 25 — Tenant Rights & Compliance
   ═══════════════════════════════════════════════════════════════════════════ */

.jea-rights-page__hero {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
}

.jea-rights-page__title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
}

.jea-rights-page__intro {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 0.75rem;
}

.jea-rights-page__state-badge {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 0;
}

.jea-rights-page__state-badge a {
    color: #bfdbfe;
}

.jea-rights-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--jea-heading, #1e293b);
    margin: 0 0 1rem;
    border-bottom: 2px solid var(--jea-border, #e2e8f0);
    padding-bottom: 0.5rem;
}

/* Violation list */
.jea-rights-violation-note {
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #854d0e;
    margin-bottom: 1rem;
}

.jea-rights-violation-list {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.jea-rights-violation-item {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--jea-border, #e2e8f0);
}

.jea-rights-violation-item--critical  { border-left: 5px solid #ef4444; background: #fff5f5; }
.jea-rights-violation-item--violation { border-left: 5px solid #f97316; background: #fff7ed; }
.jea-rights-violation-item--warning   { border-left: 5px solid #eab308; background: #fefce8; }

.jea-rights-violation-item__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.jea-rights-violation-item__title {
    font-size: 1rem;
    color: var(--jea-heading, #1e293b);
}

.jea-rights-violation-item__desc {
    font-size: 0.9rem;
    color: var(--jea-text, #334155);
    margin: 0 0 0.4rem;
}

.jea-rights-violation-item__meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--jea-muted, #64748b);
}

.jea-rights-detected { font-style: italic; }
.jea-rights-statute  { font-weight: 600; }

/* Rule reference */
.jea-rights-reference { margin-bottom: 2rem; }

.jea-rights-reference__intro {
    font-size: 0.9rem;
    color: var(--jea-muted, #64748b);
    margin-bottom: 1.5rem;
}

.jea-rights-category-group { margin-bottom: 2rem; }

.jea-rights-category-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--jea-heading, #1e293b);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jea-rights-category-icon { font-size: 1.1rem; }

.jea-rights-rule-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.jea-rights-rule-item {
    background: #fff;
    border: 1px solid var(--jea-border, #e2e8f0);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
}

.jea-rights-rule-item__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.jea-rights-rule-item__title {
    font-size: 0.95rem;
    color: var(--jea-heading, #1e293b);
}

.jea-rights-rule-item__desc {
    font-size: 0.87rem;
    color: var(--jea-text, #334155);
    margin: 0 0 0.35rem;
}

.jea-rights-rule-item__statute {
    display: block;
    font-size: 0.78rem;
    color: var(--jea-muted, #64748b);
    font-style: normal;
    margin-bottom: 0.2rem;
}

.jea-rights-rule-item__threshold {
    font-size: 0.78rem;
    color: var(--jea-primary, #2563eb);
    font-weight: 600;
}

/* Severity chips */
.jea-rights-severity {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.jea-rights-severity--info      { background: #dbeafe; color: #1d4ed8; }
.jea-rights-severity--warning   { background: #fef9c3; color: #854d0e; }
.jea-rights-severity--violation { background: #ffedd5; color: #c2410c; }
.jea-rights-severity--critical  { background: #fee2e2; color: #b91c1c; }

/* Disclaimer */
.jea-rights-disclaimer {
    font-size: 0.8rem;
    color: var(--jea-muted, #64748b);
    border-top: 1px solid var(--jea-border, #e2e8f0);
    padding-top: 1rem;
    margin-top: 2rem;
    font-style: italic;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .jea-workflow-page { padding: 1rem 0.75rem 2rem; }
    .jea-workflow-page__title { font-size: 1.3rem; }
    .jea-rights-page__hero { padding: 1.25rem 1.25rem; }
    .jea-rights-page__title { font-size: 1.3rem; }
    .jea-summary-card { flex: 1 1 130px; }
    .jea-form-group { flex: 1 1 100%; }
    .jea-workflow-table { font-size: 0.8rem; }
    .jea-workflow-table th, .jea-workflow-table td { padding: 0.5rem 0.5rem; }
}
