:root {
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
    color: #1a2a3a;
    background: #f4f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: #0b3d6e;
    color: #fff;
}

.app-header a {
    color: #fff;
    text-decoration: none;
}

.app-header a:hover {
    text-decoration: underline;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
    opacity: 0.92;
}

.brand-logo {
    display: block;
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    line-height: 1;
}

.app-body {
    display: flex;
    flex: 1;
    align-items: stretch;
}

.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    padding: 1rem 0;
}

.app-main {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    min-width: 0;
}

.nav-menu {
    padding: 0 0.75rem;
}

.nav-menu-title {
    margin: 0 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.nav-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu-list li {
    margin-bottom: 0.15rem;
}

.nav-link {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: #1e3a5f;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: #eef4fa;
    text-decoration: none;
}

.nav-link.active {
    background: #0b3d6e;
    color: #fff;
}

.login-page {
    max-width: 360px;
    margin: 3rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #c5d0dc;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-primary {
    width: 100%;
    padding: 0.6rem 1rem;
    background: #0b3d6e;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: wait;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.panel {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.success-message {
    color: #0d7a3e;
    margin-bottom: 1rem;
}

.btn-secondary {
    padding: 0.6rem 1rem;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 0.5rem;
}

.form-actions {
    margin-top: 1rem;
}

.module-checkboxes {
    margin: 1rem 0;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 4px;
}

.nav-menu-title--section {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.nav-menu-section {
    margin-bottom: 0.35rem;
}

.nav-menu-section > summary {
    list-style: none;
}

.nav-menu-section > summary::-webkit-details-marker {
    display: none;
}

.nav-menu-section-toggle {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: #0b3d6e;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.nav-menu-section-toggle:hover {
    background: #eef4fa;
}

.nav-menu-section-toggle::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s ease;
}

.nav-menu-section[open] > .nav-menu-section-toggle::before {
    transform: rotate(90deg);
}

.nav-menu-list--sub {
    margin: 0.15rem 0 0.5rem 0.5rem;
    padding-left: 0.25rem;
    border-left: 2px solid #e2e8f0;
}

.nav-menu-list--sub .nav-link {
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.4rem 0.65rem;
}

.nav-link--external::after {
    content: " ↗";
    font-size: 0.75em;
    opacity: 0.7;
}

.seaman-page-header {
    margin-bottom: 1.25rem;
}

.seaman-page-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0b175c;
}

.seaman-page-subtitle {
    margin: 0.25rem 0 0;
}

.seaman-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem 1.25rem;
    max-width: 1100px;
}

@media (max-width: 900px) {
    .seaman-form-grid {
        grid-template-columns: 1fr;
    }
}

.seaman-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.seaman-form-field--address {
    grid-row: span 2;
}

.seaman-form-field--country-residence {
    grid-column: 2 / span 2;
}

@media (max-width: 900px) {
    .seaman-form-field--address,
    .seaman-form-field--country-residence {
        grid-row: auto;
        grid-column: auto;
    }
}

.seaman-label {
    font-weight: 700;
    font-size: 0.8rem;
    color: #0b175c;
}

.seaman-form-field .form-control {
    width: 100%;
    max-width: 100%;
    font-size: 0.9rem;
}

.seaman-form-field textarea.form-control {
    min-height: 4.5rem;
    resize: vertical;
}

.seaman-wife-section {
    margin-top: 1rem;
    max-width: 1100px;
}

.seaman-subtitle {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: #0b175c;
}

.seaman-required-hint {
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
}

.required-star {
    color: #c00;
}

.seaman-submit-btn {
    width: auto;
    min-width: 160px;
}

.seaman-cancel-link {
    display: inline-block;
    padding: 0.6rem 1rem;
    margin-left: 0.5rem;
    color: #fff;
    background: #6c757d;
    border-radius: 4px;
    text-decoration: none;
    font-size: 1rem;
}

.seaman-cancel-link:hover {
    background: #5a6268;
    color: #fff;
    text-decoration: none;
}

.seaman-select-layout {
    display: grid;
    grid-template-columns: minmax(320px, 400px) 1fr;
    gap: 1.5rem;
    align-items: start;
    max-width: 1100px;
}

@media (max-width: 800px) {
    .seaman-select-layout {
        grid-template-columns: 1fr;
    }
}

.seaman-select-filters h2,
.seaman-select-results h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #0b175c;
}

.seaman-filter-group-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 1rem;
    color: #0b175c;
}

.seaman-filter-group-title:first-of-type {
    margin-top: 0;
}

.seaman-filter-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.seaman-filter-input {
    max-width: 265px;
}

.seaman-filter-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.seaman-results-list {
    width: 100%;
    max-width: 320px;
    min-height: 360px;
    font-size: 0.9rem;
    border: 1px solid #c5d0dc;
    border-radius: 4px;
    padding: 0.25rem;
}

.seaman-results-list option.seaman-result--local {
    color: #013adf;
    background-color: #fafafa;
}

.seaman-results-count {
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.seaman-select-go {
    margin-top: 0.75rem;
}

.seaman-go-btn {
    width: auto;
    min-width: 120px;
}

/* Seaman edit — profile header */
.seaman-edit-summary {
    margin-bottom: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 1px 3px rgba(11, 61, 110, 0.06);
    overflow: hidden;
    max-width: 1200px;
}

.seaman-edit-summary__body {
    display: grid;
    grid-template-columns: 112px 1fr minmax(168px, 200px);
    gap: 1.25rem 1.5rem;
    padding: 1.25rem 1.5rem 1rem;
    align-items: start;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 48%);
}

@media (max-width: 1024px) {
    .seaman-edit-summary__body {
        grid-template-columns: 100px 1fr;
    }

    .seaman-edit-summary__actions {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.seaman-edit-summary__photo-wrap {
    position: relative;
    width: 112px;
    margin-bottom: 2.5rem;
}

.seaman-edit-summary__photo {
    display: block;
    width: 112px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.seaman-edit-summary__photo--placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: #94a3b8;
    text-align: center;
}

.seaman-edit-summary__photo-icon {
    width: 2.5rem;
    height: 2.5rem;
    opacity: 0.45;
}

.seaman-edit-summary__photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.seaman-edit-summary__photo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    font-size: 0.75rem;
    font-weight: 600;
    color: #0b3d6e;
}

.seaman-edit-summary__photo-error {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2.4rem;
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.2;
    color: #b91c1c;
}

.seaman-edit-summary__photo-btn {
    position: absolute;
    right: 6px;
    bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #0b3d6e;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    line-height: 0;
}

.seaman-edit-summary__photo-btn:hover {
    background: #e8f0f8;
}

.seaman-edit-summary__main {
    min-width: 0;
}

.seaman-edit-summary__identity {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.85rem;
}

.seaman-edit-summary__name {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0b3d6e;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.seaman-edit-summary__id-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0b3d6e;
    background: #e8f0f8;
    border-radius: 999px;
}

.seaman-edit-summary__status-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 720px) {
    .seaman-edit-summary__status-row {
        grid-template-columns: 1fr;
    }
}

.seaman-edit-summary__status {
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-width: 0;
}

.seaman-edit-summary__status-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.seaman-edit-summary__status-value {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #1e3a5f;
    line-height: 1.35;
}

.seaman-edit-summary__status-value.is-on {
    color: #047857;
}

.seaman-edit-summary__status-value.is-off {
    color: #b91c1c;
}

.seaman-edit-summary__status-value.is-muted {
    color: #64748b;
    font-style: italic;
}

.seaman-edit-summary__meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem 1rem;
}

@media (max-width: 900px) {
    .seaman-edit-summary__meta {
        grid-template-columns: 1fr 1fr;
    }
}

.seaman-edit-summary__meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.seaman-edit-summary__meta-item--compact {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.seaman-edit-summary__meta-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.seaman-edit-summary__meta-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e3a5f;
}

.seaman-edit-summary__select {
    width: 100%;
    font-size: 0.8125rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
}

.seaman-edit-summary__checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #0b3d6e;
}

.seaman-edit-summary__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.seaman-edit-summary__action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.seaman-edit-summary__action-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0b3d6e;
}

.seaman-edit-summary__action-btn.is-active {
    background: #0b3d6e;
    border-color: #0b3d6e;
    color: #fff;
}

.seaman-edit-summary__action-btn.is-active .seaman-edit-summary__action-svg {
    color: #fff;
    opacity: 1;
}

.seaman-edit-summary__action-btn--admin .seaman-edit-summary__action-svg {
    color: #2563eb;
}

.seaman-edit-summary__action-btn--cert .seaman-edit-summary__action-svg {
    color: #059669;
}

.seaman-edit-summary__action-btn--exp .seaman-edit-summary__action-svg {
    color: #d97706;
}

.seaman-edit-summary__action-btn--back {
    margin-top: 0.25rem;
    border-style: dashed;
    color: #475569;
}

.seaman-edit-summary__action-btn--back:hover {
    border-color: #0b3d6e;
    color: #0b3d6e;
    background: #f0f7ff;
}

.seaman-edit-summary__action-btn--back .seaman-edit-summary__action-svg {
    color: #0b3d6e;
}

.seaman-edit-summary__action-svg {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    opacity: 1;
}

.seaman-edit-summary__action-btn span {
    flex: 1;
    min-width: 0;
}

.seaman-edit-summary__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.seaman-edit-summary__tab {
    margin: 0;
    padding: 0.7rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.seaman-edit-summary__tab:hover {
    color: #0b3d6e;
    background: #f8fafc;
}

.seaman-edit-summary__tab.is-active {
    color: #0b3d6e;
    border-bottom-color: #0b3d6e;
    background: transparent;
}

.seaman-edit-panel {
    margin-top: 0;
    max-width: 1200px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 4px rgba(11, 61, 110, 0.04);
}

.seaman-edit-panel.panel {
    padding: 1.25rem 1.5rem;
}

.seaman-edit-tab-placeholder {
    margin: 0;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.seaman-edit-tab-placeholder strong {
    color: #0b3d6e;
}

.page-access-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .page-access-layout {
        grid-template-columns: 1fr;
    }
}

.page-access-group-title {
    font-size: 0.85rem;
    color: #64748b;
    margin: 1rem 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.page-access-page-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-access-page-btn {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.page-access-page-btn:hover {
    border-color: #0b3d6e;
}

.page-access-page-btn.active {
    border-color: #0b3d6e;
    background: #eef4fa;
}

.page-access-page-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.page-access-page-route {
    font-size: 0.75rem;
    color: #64748b;
}

.page-access-badge {
    font-size: 0.7rem;
    align-self: flex-start;
    background: #0b3d6e;
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.page-access-badge--module {
    background: #94a3b8;
}

.grant-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
}

.grant-grid--users {
    max-height: 280px;
}

.page-access-editor h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
}

.text-muted {
    color: #5a6b7d;
}

.validation-message {
    color: #b00020;
    margin-bottom: 1rem;
}

.module-list {
    padding-left: 1.25rem;
}

.db-status-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.db-status-table th,
.db-status-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e8eef4;
    text-align: left;
}

.db-status-table th {
    background: #e8eef4;
}

.db-status-table .ok {
    color: #0d7a3e;
    font-weight: 600;
}

.db-status-table .error {
    color: #b00020;
    font-weight: 600;
}

#blazor-error-ui {
    background: #b00020;
    color: #fff;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 0.75rem;
}
