:root {
    --navy: #143b5e;
    --teal: #1f8a8a;
    --bg: #f4f6f8;
    --text: #21303b;
    --border: #d8e0e6;
    --danger: #a32626;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--navy);
    color: #fff;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.logo { height: 42px; width: auto; }
.company-name { font-size: 1.25rem; font-weight: 600; }
.main-nav { display: flex; gap: 1.25rem; margin-left: 1rem; }
.main-nav a { color: #cfe6e6; text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: #fff; }
.logout-form { margin-left: auto; margin-bottom: 0; }
.logout-link {
    background: var(--teal); color: #fff; border: none;
    padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-size: 0.95rem;
}
.logout-link:hover { background: #166f6f; }

/* Content */
.content { max-width: 1000px; margin: 2rem auto; padding: 0 1.5rem; }
h1 { color: var(--navy); }
h2 { color: var(--navy); margin-top: 2rem; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; margin: 0; background: #fff; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
th { background: #eef3f6; color: var(--navy); }
tbody tr:nth-child(even) { background: #fafcfd; }
tbody tr:hover { background: #eef7f7; }
td a { color: var(--teal); text-decoration: none; }
td a:hover { text-decoration: underline; }
tr[onclick] { cursor: pointer; }
.actions-col { white-space: nowrap; }
.actions-col a { margin-right: 0.75rem; }

/* Search form */
.search-form { margin: 1rem 0; display: flex; gap: 0.5rem; max-width: 480px; }
.search-form input[type="text"] { flex: 1; }

/* Forms */
form p { margin: 0.75rem 0; }
.model-form { max-width: 560px; margin: 0.75rem auto; }
/* Centered action pages (add / edit / delete) */
.form-heading { text-align: center; }
.confirm-text { text-align: center; max-width: 560px; margin-left: auto; margin-right: auto; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
input[type="text"], input[type="date"], input[type="password"],
input[type="file"], textarea, select {
    width: 100%; max-width: 480px; padding: 0.5rem;
    border: 1px solid var(--border); border-radius: 4px; font-size: 1rem;
}
textarea { min-height: 120px; }
button, .btn-primary {
    display: inline-block;
    background: var(--teal); color: #fff; border: none;
    padding: 0.55rem 1.2rem; border-radius: 4px; cursor: pointer;
    font-size: 1rem; line-height: 1.2; font-family: inherit; text-decoration: none;
}
button:hover, .btn-primary:hover { background: #166f6f; }
.btn-danger {
    display: inline-block;
    background: var(--danger); color: #fff; border: none;
    padding: 0.55rem 1.2rem; border-radius: 4px; cursor: pointer;
    font-size: 1rem; line-height: 1.2; font-family: inherit; text-decoration: none;
}
.btn-danger:hover { background: #861f1f; }
.btn-cancel {
    display: inline-block;
    background: #d9534f; color: #fff; border: none;
    padding: 0.55rem 1.2rem; border-radius: 4px; cursor: pointer;
    font-size: 1rem; line-height: 1.2; font-family: inherit; text-decoration: none;
}
.btn-cancel:hover { background: #c9302c; }
.btn-secondary {
    display: inline-block;
    background: #6b7c87; color: #fff; border: none;
    padding: 0.55rem 1.2rem; border-radius: 4px; cursor: pointer;
    font-size: 1rem; line-height: 1.2; font-family: inherit; text-decoration: none;
}
.btn-secondary:hover { background: #566570; }
.delete-form { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }
.detail-actions { margin-top: 1.5rem; display: flex; align-items: center; gap: 1.25rem; }

/* Definition lists for detail pages */
.detail-list {
    display: grid; grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.5rem; background: #fff; padding: 1.25rem;
    border: 1px solid var(--border); border-radius: 6px; max-width: 640px;
}
.detail-list dt { font-weight: 600; color: var(--navy); }
.detail-list dd { margin: 0; }
.pdf-link { font-size: 1.05rem; color: var(--teal); text-decoration: none; }
.pdf-link:hover { text-decoration: underline; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: 0.6rem 0.9rem; border-radius: 4px; margin-bottom: 0.5rem; }
.message.error { background: #f8e3e3; color: var(--danger); border: 1px solid #e0b4b4; }

/* Home */
.home-hero { text-align: center; }
.hero-image { max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 1rem; }

/* Footer */
.site-footer {
    text-align: center; padding: 1rem; color: #5a6b76;
    border-top: 1px solid var(--border); margin-top: 3rem;
}

/* Login page */
.login-page { display: flex; flex-direction: column; min-height: 100vh; justify-content: center; align-items: center; }
.login-card {
    background: #fff; padding: 2rem 2.5rem; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08); text-align: center; max-width: 380px; width: 100%;
}
.login-logo { height: 60px; margin-bottom: 0.5rem; }
.login-card h1 { font-size: 1.2rem; }
.login-card form p { text-align: left; }
.form-error { color: var(--danger); }

/* Responsive: tablets and phones */
@media (max-width: 768px) {
    .site-header { gap: 0.6rem 1rem; padding: 0.75rem 1rem; }
    /* Keep brand + Log Out on the top row; drop the nav to its own full-width row */
    .main-nav { order: 3; flex-basis: 100%; margin-left: 0; flex-wrap: wrap; gap: 1rem; }
    .content { padding: 0 1rem; }
    /* Let button groups wrap instead of overflowing */
    .detail-actions, .delete-form { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .company-name { font-size: 1.1rem; }
    /* Stack date-of-birth style detail rows so long values don't overflow */
    .detail-list { grid-template-columns: 1fr; gap: 0.15rem 0; }
    .detail-list dt { margin-top: 0.5rem; }
    .detail-list dd { overflow-wrap: anywhere; }
}
