.mediation-container {
    width: 100%; 
    max-width: 1200px;
    margin: 0 auto; 
    padding: 20px 15px 80px 15px; /* Add extra bottom padding for scrolling */
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
}

.mediation-status {
    background: #f1f1f1;
    border-radius: 5px;
    font-size: 1rem;
    margin: 16px auto;
    text-align: center;
    font-weight: bold;
    padding: 12px 18px;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mediation-card {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
    align-content: space-evenly;
    margin: 0 auto;
}

.mediation-card h2 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 20px;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mediation-container h1 {
    font-size: 2rem;
    color: #102a4d;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mediation-container p {
    font-size: 1rem;
    margin-bottom: 20px;
    color: black;
}

.mediation-table {
    width: 100%; 
    max-width: 1200px;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    table-layout: auto;
}

.mediation-table th {
    background-color: #007bff;
    color: white;
    padding: 12px;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.mediation-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mediation-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.mediation-table tr:hover {
    background-color: #e0e0e0;
    transition: 0.3s;
}

.accept-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: #1c7030;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
  }
  
  .accept-btn:hover {
    text-decoration: underline;
  }  

  .view-link {
    color: #102a4d;
    text-decoration: none;
    font-weight: bold;
}

  .view-link:hover {
      text-decoration: underline;
  } 

  .complete-link {
    color: #c0392b;
    text-decoration: none;
    font-weight: bold;
}

  .complete-link:hover {
      text-decoration: underline;
  } 

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.pagination-link {
    padding: 8px 16px;
    background-color: #102a4d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.pagination-link:hover {
    background-color: #0d2340;
}

.page-info {
    font-weight: bold;
    color: #555;
}

@media (max-width: 768px) {
    .mediation-container {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .mediation-container h1 {
        font-size: 1.5rem;
        padding: 0;
        margin-bottom: 20px;
    }

    .mediation-container h2 {
        font-size: 1.3rem;
        padding: 0;
        margin: 30px 0 20px 0;
    }

    .mediation-table {
        width: 100%;
        margin: 0 auto;
        box-shadow: none;
        background: transparent;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding: 0 15px;
        box-sizing: border-box;
    }
    
    .mediation-table thead {
        display: none;
    }
    
    .mediation-table tbody {
        display: flex;
        flex-direction: row;
        gap: 15px;
        width: max-content;
        padding-bottom: 10px;
        margin: 0 auto;
    }
    
    .mediation-table tr {
        display: flex;
        flex-direction: column;
        min-width: 280px;
        max-width: 320px;
        flex-shrink: 0;
        margin-bottom: 0;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 15px;
        box-sizing: border-box;
        scroll-snap-align: start;
    }
    
    .mediation-table td {
        display: block;
        width: 100%;
        padding: 6px 0;
        text-align: left;
        border: none;
        position: relative;
        box-sizing: border-box;
        word-wrap: break-word;
    }
    
    .mediation-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #102a4d;
        display: block;
        margin-bottom: 4px;
        font-size: 0.85rem;
    }
    
    .mediation-table td:last-child {
        border-top: 1px solid #eee;
        text-align: center;
        padding-top: 15px;
        margin-top: 10px;
    }

    .mediation-table td:last-child::before {
        display: none;
    }

    .mediation-table .view-link,
    .mediation-table .accept-btn,
    .mediation-table .complete-link {
        display: inline-block;
        background-color: #102a4d;
        color: white;
        padding: 12px 24px;
        border-radius: 5px;
        text-decoration: none;
        font-weight: bold;
        width: auto;
        min-width: 200px;
    }

    .mediation-table .view-link:hover,
    .mediation-table .accept-btn:hover,
    .mediation-table .complete-link:hover {
        background-color: #0d2340;
        text-decoration: none;
    }

    .mediation-status {
        font-size: 1rem;
        padding: 15px;
        margin: 20px 0;
    }
}

/* Tablet/iPad size - wrap cards */
@media (min-width: 769px) and (max-width: 1024px) {
    .mediation-table {
        overflow: visible;
    }

    .mediation-table thead {
        display: none;
    }

    .mediation-table tbody {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        width: 100%;
    }

    .mediation-table tr {
        display: flex;
        flex-direction: column;
        width: calc(50% - 10px);
        min-width: 280px;
        max-width: 350px;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 15px;
        box-sizing: border-box;
    }

    .mediation-table td {
        display: block;
        width: 100%;
        padding: 6px 0;
        text-align: left;
        border: none;
        word-wrap: break-word;
    }

    .mediation-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #102a4d;
        display: block;
        margin-bottom: 4px;
        font-size: 0.85rem;
    }

    .mediation-table td:last-child {
        border-top: 1px solid #eee;
        text-align: center;
        padding-top: 15px;
        margin-top: 10px;
    }

    .mediation-table td:last-child::before {
        display: none;
    }

    .mediation-table .view-link,
    .mediation-table .accept-btn,
    .mediation-table .complete-link {
        display: inline-block;
        background-color: #102a4d;
        color: white;
        padding: 12px 24px;
        border-radius: 5px;
        text-decoration: none;
        font-weight: bold;
    }
}

.signature-status {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 10px 0;
    color: #475569;
}

.signature-form-inline {
    margin-top: 15px;
}

.form-group-inline {
    margin-bottom: 15px;
}

.sig-label-small {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f2a49;
    margin-bottom: 6px;
}

.sig-input-small {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.sig-input-small:focus {
    outline: none;
    border-color: #3b82f6;
}

.sig-hint-small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 0.85rem;
}

.form-actions-inline {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.btn-link-small {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-link-small:hover {
    text-decoration: underline;
}

.btn-sign-small {
    padding: 10px 20px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sign-small:hover {
    background: #059669;
    transform: translateY(-1px);
}
.conversation-cta--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.conversation-cta--success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* =================================================================
   Landlord messages board: toolbar, filter bar, grouped card list
   ================================================================= */

.mediation-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 16px 0 24px;
}

.mediation-board {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    text-align: left;
}

/* Force [hidden] over class `display` rules so the Stimulus controller's
   filter/pagination toggling wins inside the board. */
.mediation-board [hidden] {
    display: none !important;
}

/* --- Filter bar --- */
.mediation-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 24px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    border: 1px solid #c7d2e0;
    background: #fff;
    color: #102a4d;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.filter-chip:hover {
    background: #eef3fa;
}

.filter-chip.is-active {
    background: #102a4d;
    border-color: #102a4d;
    color: #fff;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.filter-search {
    position: relative;
    flex: 1 1 280px;
    min-width: 200px;
}

.filter-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a98aa;
    pointer-events: none;
}

.filter-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid #c7d2e0;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.filter-search input:focus,
.filter-date input:focus {
    outline: none;
    border-color: #102a4d;
    box-shadow: 0 0 0 2px rgba(16, 42, 77, 0.12);
}

/* Keeps the date range and sort button together on one row. */
.filter-date-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 12px;
}

.filter-dates {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 8px;
}

.filter-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5a6b7f;
}

.filter-date input {
    padding: 8px 10px;
    border: 1px solid #c7d2e0;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.filter-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid #c7d2e0;
    border-radius: 8px;
    background: #fff;
    color: #102a4d;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.filter-sort:hover {
    background: #eef3fa;
}

.filter-sort.is-active {
    border-color: #102a4d;
}

.filter-sort i {
    color: #5a6b7f;
}

.filter-clear {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #102a4d;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 6px 4px;
    font-family: inherit;
}

.filter-clear:hover {
    color: #c0392b;
}

/* --- Grouped list (default view) --- */
.mediation-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mediation-group__title {
    font-size: 1.15rem;
    color: #102a4d;
    margin: 8px 0 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #e3e9f2;
}

.mediation-empty {
    text-align: center;
    color: #5a6b7f;
    font-weight: 600;
    padding: 24px;
}

/* --- Mediation card --- */
.mediation-card-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fff;
    border: 1px solid #e3e9f2;
    border-left: 5px solid #c7d2e0;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mediation-card-item--active {
    border-left-color: #1c7030;
}

.mediation-card-item--pending {
    border-left-color: #d99100;
}

.mediation-card-item--needs_assignment {
    border-left-color: #d99100;
}

.mediation-card-item--past {
    border-left-color: #8a98aa;
}

.mediation-card-item__main {
    flex: 1 1 280px;
    min-width: 0;
}

.mediation-card-item__header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mediation-card-item__name {
    font-size: 1.1rem;
    color: #102a4d;
    margin: 0;
}

.mediation-card-item__meta {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    color: #5a6b7f;
    font-size: 0.9rem;
}

.mediation-card-item__meta li {
    margin-bottom: 2px;
    word-break: break-word;
}

.mediation-card-item__meta i {
    color: #8a98aa;
    width: 16px;
    text-align: center;
}

.mediation-card-item__substatus {
    margin: 10px 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #344b66;
}

.mediation-card-item--pending .mediation-card-item__substatus {
    color: #9a6700;
}

.mediation-card-item__created {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #6b7a8d;
}

/* --- Status badge --- */
.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-badge--active {
    background: #e3f5e9;
    color: #1c7030;
}

.status-badge--pending {
    background: #fdf2dc;
    color: #9a6700;
}

.status-badge--past {
    background: #eef0f3;
    color: #5a6b7f;
}

/* --- Card actions --- */
.mediation-card-item__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
    min-width: 160px;
}

.mediation-card-item__actions form {
    margin: 0;
}

.card-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    transition: background-color 0.15s, color 0.15s;
}

.card-btn--primary {
    background: #102a4d;
    color: #fff;
}

.card-btn--primary:hover {
    background: #0d2340;
}

.card-btn--secondary {
    background: #eef3fa;
    color: #102a4d;
    border-color: #c7d2e0;
}

.card-btn--secondary:hover {
    background: #dfe8f5;
}

.card-btn--ghost {
    background: transparent;
    color: #c0392b;
    border-color: #e0b4ae;
}

.card-btn--ghost:hover {
    background: #fbeae8;
}

.card-btn--feedback {
    background: #c0392b;
    color: #fff;
}

.card-btn--feedback:hover {
    background: #a52f23;
}

.card-status-note {
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a6b7f;
}

.card-status-note--success {
    color: #1c7030;
}

.mediation-card-item__opened-date {
    font-size: 0.78rem;
    color: #6b7a8d;
    font-weight: 500;
}



.mediation-card-item__mediator-status {
    font-weight: 600;
    margin-top: 2px;
}

.mediation-card-item__mediator-status--assigned {
    color: #1c7030;
}

.mediation-card-item__mediator-status--pending {
    color: #9a6700;
}

@media (max-width: 600px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search,
    .filter-date-controls {
        width: 100%;
        /* Column layout reads flex-basis as height; reset to content. */
        flex: 0 0 auto;
    }

    /* Let the date range + sort button wrap below the search row. */
    .filter-date-controls {
        flex-wrap: wrap;
    }

    .filter-dates {
        flex: 1 1 auto;
    }

    .filter-date {
        flex: 1;
        min-width: 0;
    }

    .filter-date input {
        width: 100%;
    }

    .filter-clear {
        margin-left: 0;
        align-self: flex-start;
    }

    .mediation-card-item {
        flex-direction: column;
        align-items: stretch;
    }

    .mediation-card-item__main {
        /* Column layout reads flex-basis as height; collapse to content. */
        flex: 0 0 auto;
    }

    .mediation-card-item__actions {
        width: 100%;
    }
}

/* --- Board pagination --- */
.mediation-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
}

.mediation-pagination .pagination-link {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.mediation-pagination .pagination-link:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mediation-pagination .pagination-link:disabled:hover {
    background-color: #102a4d;
}

/* Numbered page buttons (windowed with "…") */
.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pagination-page {
    min-width: 38px;
    padding: 8px 10px;
    border: 1px solid #c7d2e0;
    background: #fff;
    color: #102a4d;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.pagination-page:hover {
    background: #eef3fa;
}

.pagination-page.is-active {
    background: #102a4d;
    border-color: #102a4d;
    color: #fff;
    cursor: default;
}

.pagination-ellipsis {
    padding: 0 2px;
    color: #8a98aa;
    font-weight: 700;
    user-select: none;
}
