/* Styles lifted from the original inline template, plus the layout needed for
   the multi-page shell, entity cards and the generic CRUD tables. */

* { box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f7f7f7;
    color: #333;
}

h1 { color: #333; }
h2 { margin-top: 0; }

a { color: #0056b3; }

/* --- top bar / navigation ------------------------------------------------ */
.topbar {
    background: #1f2d3d;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.brand {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

.nav a {
    color: #cfd8e3;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
}

.nav a:hover { background: #2c3e50; color: #fff; }
.nav a.active { background: #007bff; color: #fff; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.whoami { font-size: 14px; color: #e6edf5; white-space: nowrap; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #6c757d;
    color: #fff;
}

.badge.role-superadmin { background: #7048e8; }
.badge.role-admin { background: #0b7285; }
.badge.role-editor { background: #2b8a3e; }
.badge.role-viewer { background: #6c757d; }

.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 20px;
}

/* --- generic blocks ------------------------------------------------------ */
.section {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

input, button, select, textarea {
    margin: 5px 0;
    padding: 8px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="checkbox"] { margin: 0 6px 0 0; }

button {
    background: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 8px 14px;
}

button:hover { background: #0056b3; }
button.danger { background: #dc3545; }
button.danger:hover { background: #a71d2a; }
button.secondary { background: #6c757d; }
button.secondary:hover { background: #545b62; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    word-break: break-word;
    max-width: 300px;
}

th { background: #f4f4f4; }

.table-wrap { overflow-x: auto; }

.msg-error { color: #b00020; margin: 6px 0; }
.msg-success { color: #2b8a3e; margin: 6px 0; }
.msg-note { color: #555; margin: 6px 0; font-size: 13px; }

/* --- login -------------------------------------------------------------- */
#login-section {
    max-width: 420px;
    margin: 80px auto;
    padding: 28px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

#login-section input,
#login-section button { width: 100%; }

/* --- dashboard cards ---------------------------------------------------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.card-icon {
    font-size: 22px;
    color: #007bff;
    width: 34px;
    text-align: center;
}

.card-body { flex: 1; }
.card-label { font-weight: 700; color: #1f2d3d; }
.card-count { font-size: 24px; font-weight: 700; color: #0b7285; line-height: 1.2; }
.card-desc { font-size: 12px; color: #777; }
.card-chevron { color: #bbb; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 16px;
    text-decoration: none;
    font-size: 13px;
    background: #fff;
}

/* --- forms -------------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.form-field { display: flex; flex-direction: column; }
.form-field label { font-size: 12px; color: #555; margin-bottom: 2px; }
.form-field input, .form-field select, .form-field textarea { margin: 0; width: 100%; }
.form-field textarea { min-height: 60px; }

.form-actions { margin-top: 12px; }
.checkbox { display: flex; align-items: center; font-size: 14px; }

/* --- reference picker (searchable dropdown) ----------------------------- */
.combo { position: relative; display: flex; align-items: center; width: 100%; }

.combo-input { flex: 1; padding-right: 26px; }
.combo-input.combo-invalid { border-color: #b00020; background: #fff5f6; }

.combo-clear {
    position: absolute;
    right: 4px;
    padding: 0 6px;
    font-size: 16px;
    line-height: 1;
    color: #777;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.combo-clear:hover { color: #000; }

.combo-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.combo-option { padding: 6px 10px; font-size: 14px; cursor: pointer; }
.combo-option:hover, .combo-option.combo-active { background: #eef4ff; }
.combo-empty { padding: 6px 10px; color: #777; font-size: 13px; }

/* --- map ---------------------------------------------------------------- */
#trip-map {
    height: 420px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 10px;
}

.trip-employees { margin-top: 15px; }
.trip-link { color: #0056b3; text-decoration: underline; }

.sequence-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0b7285;
    color: #fff;
    border: 2px solid #fff;
    text-align: center;
    line-height: 18px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.start-end-badge {
    font-size: 14px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    border: 2px solid #fff;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.start-badge { background: #2b8a3e; }
.end-badge { background: #c92a2a; }

/* --- evidence lightbox -------------------------------------------------- */
.ev-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: zoom-out;
}

.ev-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    border: 2px solid #fff;
    border-radius: 6px;
}

.thumb {
    height: 48px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: zoom-in;
}

@media (max-width: 768px) {
    .container { padding: 10px; }
    .section { padding: 12px; }
    #trip-map { height: 320px; }
    th, td { max-width: 160px; }
}

/* --- product branding --------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; letter-spacing: 0.5px; }
.brand-tagline { font-size: 10px; color: #9fb0c4; letter-spacing: 0.3px; }

.login-brand { text-align: center; margin-bottom: 18px; }
.login-name { font-size: 30px; font-weight: 700; letter-spacing: 2px; color: #1f2d3d; }
.login-tagline { font-size: 12px; color: #6c757d; margin-top: 2px; }

.page-subtitle { color: #6c757d; font-size: 13px; margin-top: -8px; }

/* --- attention panel ----------------------------------------------------- */
.alert-section { border-color: #f0c36d; background: #fffbf0; }
.alert-section h2 { color: #8a5a00; }
.alert-list { margin: 0; padding-left: 20px; }
.alert-list li { margin: 6px 0; }
.alert-list ul { margin-top: 4px; }

@media (max-width: 900px) {
    .brand-tagline { display: none; }
}
