/* afjdb — modern card-based UI */

/* ========== Web Fonts (self-hosted) ========== */

/* Gudea — body text, UI elements */
@font-face {
    font-family: 'Gudea';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/gudea-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Gudea';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/gudea-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Gudea';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/gudea-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Gudea';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/gudea-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Josefin Sans — headings */
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/josefin-sans-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/josefin-sans-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/josefin-sans-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/josefin-sans-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/josefin-sans-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Josefin Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/josefin-sans-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ========== Custom Properties ========== */
:root {
    --primary: #218e90;
    --primary-hover: #1a7072;
    --primary-light: #e3f3f3;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #2d2d2d;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --success: #15803d;
    --success-hover: #166534;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Gudea', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    margin: 0;
    padding: 0;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: 'Josefin Sans', sans-serif;
    color: var(--text);
    margin-top: 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }

/* ========== Navigation ========== */
.nav {
    background: var(--primary);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 52px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.nav-brand {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
}

.nav-brand:hover {
    color: #fff;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.25rem 0;
}

.nav-links a:hover {
    color: #fff;
    text-decoration: none;
}

/* Logout button styled as nav link */
.nav-logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    padding: 0.25rem 0;
    text-decoration: none;
}

.nav-logout-btn:hover {
    color: #fff;
}

/* ========== Container ========== */
.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

/* ========== Cards ========== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease;
}

.card-link:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
}

.card-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.1rem;
    color: var(--text);
}

/* ========== Card Grid ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ========== Badges / Tags ========== */
.badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    line-height: 1.4;
    white-space: nowrap;
}

.badge-danger {
    background: #fef2f2;
    color: var(--danger);
}

.badge-success {
    background: #f0fdf4;
    color: var(--success);
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* ========== Buttons ========== */
button, .btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.5;
    transition: background 0.15s ease;
}

button:hover, .btn:hover {
    background: var(--primary-hover);
    text-decoration: none;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: var(--text-muted);
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
}

/* ========== Forms ========== */
form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text);
}

form input[type="text"],
form input[type="password"],
form input[type="email"],
form input[type="number"],
form input[type="url"],
form input[type="datetime-local"],
form textarea,
form select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s ease;
}

form input:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 142, 144, 0.12);
}

form textarea {
    min-height: 5rem;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 1rem;
}

.form-group {
    margin-bottom: 0;
}

.input-title {
    font-size: 1.5rem;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
    padding: 0.6rem 0.75rem;
}

.input-title[readonly] {
    font-size: 1.5rem;
    font-weight: 400;
    border-color: transparent;
    background: transparent;
    padding-left: 0;
}

.floating-field:has(.field-link) input[readonly] {
    color: transparent;
}

.field-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    border: 1px solid transparent;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
}

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

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin-bottom: 0.75rem;
}

.checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: normal;
    white-space: nowrap;
}

/* ========== Filter Bar ========== */
.filter-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.filter-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    margin-bottom: 0;
}

.filter-panel.open {
    max-height: 500px;
    margin-bottom: 1rem;
}

.dropdown-wrap {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 100;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--bg);
    color: var(--primary);
}

.dropdown-item-danger { color: #c0392b; }
.dropdown-item-danger:hover { background: #fdecea; color: #a93226; }

.dropdown-up .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
    padding-top: 0.75rem;
    align-items: end;
}

.filter-bar select,
.filter-bar input {
    margin-bottom: 0;
    width: 100%;
}

.filter-bar-wide {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.filter-bar-wide input[type="text"] {
    flex: 1;
    margin-bottom: 0;
}

.filter-bar-wide input[type="number"] {
    width: 120px;
    margin-bottom: 0;
}

.filter-bar button[type="submit"] {
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========== Tables ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

tr:hover {
    background: #f9fafb;
}

/* ========== Org List ========== */
.org-list {
    display: flex;
    flex-direction: column;
}

.org-list-item {
    display: block;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.org-list-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.03));
}

.org-list-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.org-list-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.org-list-diocese,
.org-list-services,
.org-list-type,
.org-list .matched-person {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.org-list-diocese,
.org-list-type {
    white-space: nowrap;
}

.org-list .matched-person {
    font-style: italic;
}

.org-list .no-results {
    padding: 1rem 0.75rem;
    color: var(--text-muted);
}

.sort-link {
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.sort-link:hover {
    color: var(--primary);
}

.sort-link.active {
    color: var(--primary);
}

.sort-arrow {
    font-size: 0.7rem;
}

/* ========== List Search Bar ========== */

/* ========== Flash Messages ========== */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.flash.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.flash.error   { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.flash.info    { background: var(--primary-light); color: var(--primary); border: 1px solid #a7d8d8; }

/* ========== Card Grid (landing pages) ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.card-link {
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card-link:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-link h2 {
    color: var(--primary);
    margin-top: 0;
    font-size: 1.1rem;
}

.card-link p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    gap: 0.4rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.pagination a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.5;
}

.pagination .ellipsis {
    border: none;
    padding: 0.4rem 0.4rem;
    color: var(--text-muted);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pagination-bar .pagination {
    margin: 0;
}

.per-page {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.per-page a, .per-page span.active {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
}

.per-page a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.per-page span.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========== Data Tables ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th, .data-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table .row-muted td {
    opacity: 0.6;
}

.data-table .actions-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.9rem;
    text-decoration: none;
}

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

.btn-link-danger {
    color: var(--danger);
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ========== Checkbox Fields ========== */
.checkbox-field {
    margin: 1rem 0;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

/* ========== Diff Styles ========== */
.diff-old { background: #fef2f2; color: var(--danger); text-decoration: line-through; }
.diff-new { background: #f0fdf4; color: var(--success); }

/* ========== Detail Sections ========== */
.detail-section {
    margin-bottom: 0;
}

.detail-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-row {
    display: flex;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--bg);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    flex: 0 0 200px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-value {
    flex: 1;
}

/* ========== Immersive Login Page ========== */
.login-page {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card-accent {
    border: none;
    border-top: 4px solid var(--primary);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.auth-branding {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-title {
    font-size: 2rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.auth-submit {
    width: 100%;
    padding: 0.65rem 1.25rem;
    margin-top: 0.5rem;
    font-size: 1rem;
}

/* ========== Error Card ========== */
.error-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 6rem;
}

.error-card {
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.error-card h1 {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.error-card p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ========== Person List ========== */
.person-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg);
}

.person-row:last-child {
    border-bottom: none;
}

.person-name {
    font-weight: 500;
}

.person-contact {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Status Indicators ========== */
.status-active { color: var(--success); font-weight: 500; }
.status-invalid { color: var(--danger); font-weight: 500; }

/* ========== Utility Classes ========== */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flex-gap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ========== Floating Labels ========== */
.floating-field {
    position: relative;
    margin-bottom: 1rem;
}

.floating-field input,
.floating-field select,
.floating-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s ease;
}

.floating-field input:focus,
.floating-field select:focus,
.floating-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33, 142, 144, 0.12);
}

.floating-field textarea {
    min-height: 5rem;
    resize: vertical;
}

.floating-field label {
    position: absolute;
    top: -0.75rem;
    left: 0.625rem;
    padding: 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: #fff;
    display: none;
    pointer-events: none;
    z-index: 1;
}

.floating-field.has-value label,
.floating-field input:not(:placeholder-shown) ~ label,
.floating-field textarea:not(:placeholder-shown) ~ label,
.floating-field select ~ label,
.floating-field:hover > label,
.floating-field input:focus ~ label,
.floating-field textarea:focus ~ label,
.floating-field select:focus ~ label {
    display: block;
}

.floating-field input::placeholder,
.floating-field textarea::placeholder {
    color: var(--text-muted);
}

/* Readonly fields — same look, no interaction cues */
.floating-field input[readonly],
.floating-field textarea[readonly],
.floating-field select[disabled] {
    background: var(--bg);
    border-color: var(--border);
    cursor: default;
    color: var(--text);
    opacity: 1; /* override browser default for disabled selects */
}

.floating-field input[readonly]:focus,
.floating-field textarea[readonly]:focus,
.floating-field select[disabled]:focus {
    box-shadow: none;
    border-color: var(--border);
}

/* Floating field inside person card — label bg matches card bg */
.person-entry .floating-field label {
    background: var(--bg);
}

/* ========== Form Sections ========== */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-family: 'Josefin Sans', sans-serif;
}

/* Two-column grid for Einordnung */
.form-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ========== Angebotsfelder Tags & Popup ========== */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    cursor: pointer;
    min-height: 2.5rem;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color 0.15s ease;
}

.tag-list:hover {
    border-color: var(--primary);
}

.tag-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.4;
}

.tag-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.popup-overlay.open {
    display: flex;
}

.popup-panel {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.popup-panel h3 {
    margin: 0 0 1rem;
    font-family: 'Josefin Sans', sans-serif;
}

.popup-panel .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.popup-panel .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

.popup-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.popup-actions .btn:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* ========== Person Entries ========== */
.person-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.person-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.person-header strong {
    color: var(--text-muted);
}

.btn-remove-person {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-remove-person:hover {
    background: var(--danger);
    color: #fff;
}

.btn-add-person {
    border: 1px dashed var(--border);
    background: none;
    color: var(--text-muted);
    padding: 0.75rem;
    width: 100%;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-add-person:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========== Proposal Review (Inline) ========== */
.has-proposal {
    border-left: 3px solid var(--primary);
    padding-left: 0.5rem;
}

.proposed-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: opacity 0.3s ease;
}

.proposed-value {
    font-weight: 600;
    color: var(--primary);
}

.proposed-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.proposal-actions {
    display: inline-flex;
    gap: 0.3rem;
    margin-left: auto;
}

.btn-accept, .btn-discard {
    border: none;
    border-radius: 50%;
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-accept {
    background: var(--success);
    color: #fff;
}

.btn-accept:hover {
    background: #15803d;
}

.btn-discard {
    background: var(--danger);
    color: #fff;
}

.btn-discard:hover {
    background: #b91c1c;
}

.btn-accept:disabled, .btn-discard:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-accept-all {
    background: var(--success);
    color: #fff;
}

.btn-accept-all:hover {
    background: #15803d;
}

.btn-discard-all {
    background: var(--danger);
    color: #fff;
}

.btn-discard-all:hover {
    background: #b91c1c;
}

.btn-accept-all:disabled, .btn-discard-all:disabled {
    opacity: 0.5;
    cursor: default;
}

.resolved-accepted .proposed-value::after {
    content: ' (angenommen)';
    font-weight: normal;
    color: var(--success);
}

.resolved-discarded .proposed-value::after {
    content: ' (verworfen)';
    font-weight: normal;
    color: var(--danger);
}

.service-diff {
    flex-direction: column;
    align-items: flex-start;
}

.service-diff-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.service-diff-list li {
    padding: 0.2rem 0;
    font-size: 0.9rem;
}

.svc-added {
    color: var(--success);
    font-weight: 600;
}

.svc-removed {
    color: var(--danger);
    font-weight: 600;
    text-decoration: line-through;
}

.svc-unchanged {
    color: var(--text-muted);
}

.svc-icon {
    display: inline-block;
    width: 1.2rem;
    font-weight: 700;
}

.service-diff .proposal-actions {
    align-self: flex-end;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-versions {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-versions:hover {
    background: var(--primary-light);
}

.versions-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.versions-panel {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.versions-panel h4 {
    margin: 0 0 1rem;
}

.version-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.3s ease;
}

.version-entry:last-of-type {
    border-bottom: none;
}

.version-value {
    font-weight: 600;
}

.version-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-close-versions {
    margin-top: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.person-notes {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========== Edit Tracker ========== */
.field-wrapper {
    position: relative;
    display: block;
}

.field-changed {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
}

.field-accepted {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
}

.field-actions {
    position: absolute;
    right: 0.5rem;
    top: 0.45rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.field-actions.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.field-actions button {
    width: auto;
    height: auto;
    padding: 0;
    background: none !important;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-muted) !important;
    opacity: 0.7;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.field-actions button:hover {
    opacity: 1;
    background: none !important;
}

.field-action-discard:hover {
    color: var(--danger) !important;
}

.field-action-accept:hover {
    color: var(--primary) !important;
}

/* Checkbox field-wrapper: inline */
input[type="checkbox"].field-changed {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

input[type="checkbox"].field-accepted {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ========== Footer ========== */
footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.autocomplete-item:hover {
    background: var(--teal);
    color: #fff;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 0;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a,
    .nav-links form,
    .nav-logout-btn {
        display: block;
        padding: 0.6rem 0;
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .nav-links form {
        margin: 0;
    }

    .nav-logout-btn {
        width: 100%;
        padding: 0;
        border-top: none;
    }

    .flex-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .flex-gap {
        flex-wrap: wrap;
    }

    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3,
    .form-grid-2x2 {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .filter-bar-wide {
        flex-direction: column;
    }

    .filter-bar-wide input[type="number"] {
        width: 100%;
    }

    .detail-row {
        flex-direction: column;
    }

    .detail-label {
        flex: none;
        margin-bottom: 0.15rem;
    }

    .person-row {
        flex-direction: column;
        gap: 0.15rem;
    }

    .auth-wrapper {
        padding: 1.5rem 1rem;
    }

    .error-wrapper {
        padding-top: 3rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1 { font-size: 1.5rem; }
}

/* Password strength indicator */
.password-strength {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0 0.75rem;
    height: 1.25rem;
}

.password-strength-bar {
    flex: 0 0 auto;
    width: 0;
    height: 6px;
    border-radius: 3px;
    transition: width 0.3s, background-color 0.3s;
    max-width: 200px;
}

.strength-weak { width: 20%; background: #d32f2f; }
.strength-fair { width: 40%; background: #f57c00; }
.strength-good { width: 60%; background: #fbc02d; }
.strength-strong { width: 80%; background: #689f38; }
.strength-excellent { width: 100%; background: #2e7d32; }

.password-strength-label {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

/* Password match feedback */
.password-match {
    font-size: 0.85rem;
    min-height: 1.25rem;
    margin: 0.125rem 0 0.5rem;
}

.match-ok { color: #2e7d32; }
.match-error { color: #d32f2f; }

.mt-1 { margin-top: 0.5rem; }
