/* ========================================= */
/* TOOLBAR */
/* ========================================= */

.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #f8f8f8;
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.table-container {
    overflow-y: auto;
    max-height: 80vh;
}

thead tr:first-child th {
    position: sticky;
    top: 62px;   /* height of toolbar */
    z-index: 900;
    background: #eee;
}

thead tr:nth-child th {
    position: sticky;
    top: 92px;  /* toolbar + first header row */
    z-index: 899;
    background: #eee;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    background: #f4f4f4;
}

body {
    font-family: Arial, sans-serif;
    margin: 30px;
    background: #f8f8f8;
    color: #222;
}

/* ========================================= */
/* HEADINGS */
/* ========================================= */

h1, h2, h3 {
    margin-top: 0;
}

/* ========================================= */
/* CONTAINER */
/* ========================================= */

.container {
    max-width: 1400px;
    margin: auto;
}

/* ========================================= */
/* TWO COLUMN LAYOUT */
/* ========================================= */

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.left-column,
.right-column {
    min-width: 0;
}

/* ========================================= */
/* CARDS */
/* ========================================= */

.card {
    background: #fff;
    padding: 18px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ========================================= */
/* FORMS */
/* ========================================= */

.search-form {
    margin-bottom: 0;
}

input[type="text"] {
    padding: 8px;
    width: 100%;
    max-width: 320px;
    font-size: 15px;
    box-sizing: border-box;
}

select {
    padding: 8px;
    font-size: 15px;
    max-width: 100%;
}

/* ========================================= */
/* BUTTONS */
/* ========================================= */

button,
.button {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: #eee;
    color: #222;
    text-decoration: none;
    display: inline-block;
    line-height: 1.2;
}

button:hover,
.button:hover {
    background: #ddd;
    text-decoration: none;
}

.primary-button {
    background: #0645ad;
    color: #fff;
    border-color: #0645ad;
}

.primary-button:hover {
    background: #04347f;
}

.danger-button {
    background: #7a1f1f;
    color: #fff;
    border-color: #7a1f1f;
}

.danger-button:hover {
    background: #5f1717;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Legacy compatibility */
.merge-button {
    background: #eee;
    color: #222;
    border: 1px solid #aaa;
    border-radius: 4px;
}

.merge-button:hover {
    background: #ddd;
}

.small-button {
    padding: 2px 4px;
    font-size: 10px;
    margin-left: 6px;
}

/* ========================================= */
/* TABLES */
/* ========================================= */

table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
}

th,
td {
    padding: 9px 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

th {
    background: #eee;
}

tr:hover {
    background: #f2f6ff;
}

/* ========================================= */
/* LINKS */
/* ========================================= */

a {
    color: #0645ad;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.clear-link {
    margin-left: 8px;
}

/* ========================================= */
/* TEXT */
/* ========================================= */

.meta {
    color: #666;
    margin-top: 6px;
    font-size: 14px;
}

.note {
    color: #666;
    font-size: 14px;
}

.warning {
    color: #a00000;
    font-weight: bold;
}

.id-col {
    color: #666;
    font-size: 13px;
}

.count {
    margin-bottom: 10px;
    color: #555;
}

/* ========================================= */
/* ALERTS */
/* ========================================= */

.alert {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.alert-error {
    color: #7a1f1f;
    border: 1px solid #7a1f1f;
    background: #fff4f4;
}

.alert-success {
    color: #1f6b2a;
    border: 1px solid #1f6b2a;
    background: #f2fff4;
}

/* ========================================= */
/* MERGE / SELECT CELLS */
/* ========================================= */

.merge-cell {
    white-space: nowrap;
    font-size: 14px;
}

.merge-cell label {
    display: block;
    margin-bottom: 4px;
    cursor: pointer;
}


/* ========================================= */
/* FACTS / INLINE EDIT BOXES */
/* ========================================= */

.fact-item {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.edit-fact-box {
    margin-top: 12px;
    padding: 12px;
    background: #f4f4f4;
    border-radius: 6px;
}

/* ========================================= */
/* MOBILE ONLY */
/* ========================================= */

@media (max-width: 600px) {

    .two-column-layout {
        grid-template-columns: 1fr;
    }

    body {
        margin: 15px;
    }

    .sticky-toolbar {
        position: static;
    }

}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #2c3e50;
    color: white;

    padding: 12px 20px;
    margin-bottom: 20px;

    border-radius: 8px;
}

.site-title a {
    color: white;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: bold;
}

.site-nav {
    display: flex;
    gap: 10px;
}

.site-nav .button {
    margin: 0;
}

.active-nav {
    background-color: #1abc9c !important;
}

/* ========================================= */
/* READ ONLY FORM FIELDS */
/* ========================================= */

input:disabled,
select:disabled,
textarea:disabled {
    color: #222;
    background-color: #ffffff;
    border: 1px solid #ccc;
    opacity: 1;
    cursor: default;
}

input:disabled::placeholder,
textarea:disabled::placeholder {
    color: #666;
}

/* ========================================= */
/* PHOTO STYLES */
/* ========================================= */

.photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
}

.photo-card img {
	max-width: 100%;
	max-height: 260px;
	display: block;
	margin-bottom: 8px;
	border-radius: 8px;
}

.primary-badge {
	font-weight: bold;
	color: green;
	margin-bottom: 8px;
}

.photo-actions form {
	margin-top: 6px;
}

.person-edit-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 18px;
	align-items: start;
}

.person-edit-grid p {
	margin: 0 0 8px 0;
}

.person-edit-grid input,
.person-edit-grid select {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.person-edit-full {
	grid-column: 1 / -1;
}

.date-row {
	display: flex;
	gap: 6px;
}

.date-row select {
	width: auto;
	flex: 1;
}
@media (max-width: 850px) {
    .person-edit-grid {
        grid-template-columns: 1fr;
    }

    .person-edit-full {
        grid-column: auto;
    }
}

/* ========================================= */
/* NOTE EDITOR */
/* ========================================= */

.note-editor textarea {
    width: 100%;
    min-height: 420px;
	font-family: Arial, sans-serif;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 2;
}

.note-editor input[type="text"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 18px;
}
/* ========================================= */
/* NOTE CONTENT */
/* ========================================= */


.note-full-text {
    margin-top: 12px;
    line-height: 1.1;
}

.note-full-text p {
    margin: 0 0 1em 0;
}

.note-full-text ul,
.note-full-text ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.note-full-text blockquote {
    border-left: 4px solid #ccc;
    padding-left: 12px;
    color: #666;
    margin-left: 0;
}

.note-full-text table {
    border-collapse: collapse;
    margin-bottom: 1em;
}

.note-full-text th,
.note-full-text td {
    border: 1px solid #ccc;
    padding: 6px 10px;
}

/* ========================================= */
/* NOTE CONTENT */
/* ========================================= */


.site-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.site-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.header-search {
    margin-left: auto;
}

.header-search form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search input {
    width: 250px;
}

.person-edit-full {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 1em;
}

.review-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.needs-review-row {
    background-color: #fff4f4;   /* pale yellow */
}

.needs-review-row:hover {
    background-color: #ffe4e4;
}