/* mru_webapp/static/mru_webapp/style.css */

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #003366;
}

body.default-skin, html.default-skin {
    background-color: #ffffff;
    color: #003366;
}

body.default-skin, html.default-skin,
body.default-skin *,
html.default-skin * {
    color: #003366 !important;
}

body.default-skin .status-true,
html.default-skin .status-true,
body.default-skin .status-false,
html.default-skin .status-false,
body.default-skin .status-null,
html.default-skin .status-null {
    color: unset !important;
}

/* Azure login button on default-skin should remain readable on blue background */
body.default-skin .azure-login-btn,
html.default-skin .azure-login-btn {
    color: #ffffff !important;
}

body.secondary-skin, html.secondary-skin {
    background-image: url('../images/output_optimized_resized.gif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #ffd766;
}

body.secondary-skin, html.secondary-skin,
body.secondary-skin *,
html.secondary-skin * {
    color: #ffd766 !important;
}

body.secondary-skin .status-true,
html.secondary-skin .status-true {
    color: #61ff61 !important;
}

body.secondary-skin .status-false,
html.secondary-skin .status-false {
    color: #ff6060 !important;
}

body.secondary-skin .status-null,
html.secondary-skin .status-null {
    color: #e0e0a0 !important;
}

body.access-page, html.access-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.search-box {
    position: sticky;
    top: 0;
    z-index: 10;
    flex: 0 0 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 1rem;
    border-bottom: 1px solid #ccc;
}

.search-box input {
    width: 50%;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.8);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    font-weight: bold;
}

.search-box button {
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
}

.filters {
    display: none;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    background: none;
}

.filters select {
    height: 36px;
    line-height: 36px;
    padding: 0 0.5rem;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.8);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    min-width: 120px;
}

.filters select:hover {
    background-color: rgba(30, 30, 30, 0.9);
    transform: scale(1.03);
}

.filters select:focus {
    outline: none;
    border-color: rgb(255, 255, 140);
    box-shadow: 0 0 5px rgb(255, 255, 40);
}

.main-content {
    display: flex;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
}

.results-box, .details-box {
    height: 100%;
    overflow-y: auto;
    min-height: 0;
}

.results-box {
    width: 100%;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: width 0.3s;
}

.result-item.selected {
    background-color: rgb(255, 255, 140);
    color: black;
}

.result-item {
    background-color: rgba(0, 0, 0, 0.9);
    color: rgb(255, 255, 140);
    font-weight: bold;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.result-mru {
    background-color: rgba(0, 0, 0, 0.85);
    color: rgb(255, 255, 140);
    padding: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.result-mru:hover {
    background-color: rgba(50, 50, 0, 0.9);
}

.result-contract {
    background-color: rgba(255, 255, 40, 0.1);
    color: rgb(255, 255, 140);
    padding: 6px;
    margin-left: 20px;
    margin-bottom: 3px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.result-contract:hover {
    background-color: rgba(255, 255, 40, 0.25);
}

.mru-status {
    float: right;
    font-weight: bold;
    color: rgb(255, 255, 40);
}

.mru-status.status-true {
    color: rgb(0, 255, 0);
}

.mru-status.status-false {
    color: red;
}

.details-box {
    position: relative;
}

#details-content {
    background-color: rgba(0, 0, 0, 0.6);
    color: rgb(255, 255, 140);
    padding: 1rem;
    display: grid;
    grid-template-columns: 40% 50%;
    gap: 0.5rem 1rem;
    align-items: center;
}

.secondary-skin #details-content {
    background-color: rgba(0, 0, 0, 0.6);
    color: rgb(255, 255, 140);
}

.default-skin #details-content {
    background-color: #ffffff;
    color: #000080;
}

.details-header {
    grid-column: 1 / span 2;
    font-size: 2.3rem;
    font-weight: bold;
    color: rgb(255, 255, 140);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.details-box label {
    font-weight: bold;
    margin: 0;
    text-align: right;
}

.details-box input,
.details-box textarea,
.details-box select {
    width: 100%;
    padding: 0.3rem;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.9);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
    border-radius: 8px;
    font-weight: bold;
}

.details-box select:focus {
    outline: none;
    border-color: rgb(255, 255, 140);
    box-shadow: 0 0 5px rgb(255, 255, 40);
}

.details-box select {
    appearance: none;
    cursor: pointer;
}

.details-box input::placeholder,
.details-box textarea::placeholder {
    color: rgba(255, 255, 40, 0.7);
}

#details-content p {
    margin: 0.2rem 0;
}

.details-box button {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.details-top-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.details-top-buttons button {
    width: 140px;
}

#details-map-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.map-controls {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

#map {
    flex: 1;
    min-height: 300px;
    border: 1px solid #ccc;
}

.map-top-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 0.5rem;
    z-index: 1000;
}

.map-side-controls {
    position: absolute;
    top: 60px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

#map-search-input {
    background-color: rgba(0, 0, 0, 0.8);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    font-weight: bold;
}

.map-back-button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 1);
    color: rgb(255, 255, 140);
    border: none;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-weight: bold;
    cursor: pointer;
}

button {
    background-color: rgba(0, 0, 0, 1);
    color: rgb(255, 255, 140);
    border: none;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

button:hover {
    background-color: rgba(30, 30, 30, 1);
    transform: scale(1.05);
}

.fixed-button {
    background-color: rgba(0, 0, 0, 1);
    color: rgb(255, 255, 140);
    border: none;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
}

#bg-music-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #004080;
    background-color: #e0edff;
    color: #003366;
}

#bg-music-toggle.playing {
    border-color: #004080;
    background-color: #004080;
    color: #ffffff;
}

#help-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 1);
    color: rgb(255, 255, 140);
    z-index: 2000;
}

.help-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    max-width: 220px;
    z-index: 5000;
    display: none;
    pointer-events: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.default-skin .help-tooltip {
    background-color: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.secondary-skin .help-tooltip {
    background-color: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
}

.help-tooltip a {
    color: #80c0ff;
    text-decoration: underline;
}

.help-tooltip.visible {
    opacity: 1;
}

.default-skin .search-box,
.default-skin .azure-login-box,
.default-skin .register-box,
.default-skin .success-box,
.default-skin .details-box,
.default-skin .results-box,
.default-skin .modal-box,
.default-skin .access-box {
    background: #ffffff;
    border-color: #b0c4de;
    color: #003366;
}

.default-skin input,
.default-skin textarea,
.default-skin select {
    background: #ffffff;
    color: #003366;
    border: 1px solid #4682b4;
}

.default-skin button {
    background: #f0f8ff;
    color: #000080;
    border: 1px solid #4682b4;
}

.default-skin button:hover {
    background: #e6f3ff;
}

.secondary-skin .search-box,
.secondary-skin .azure-login-box,
.secondary-skin .register-box,
.secondary-skin .success-box,
.secondary-skin .modal-box,
.secondary-skin .access-box {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 40, 0.5);
    color: rgb(255, 255, 140);
}

.secondary-skin .results-box,
.secondary-skin .details-box {
    background: rgba(0, 0, 0, 0.23);
    border-color: rgba(255, 255, 40, 0.5);
    color: rgb(255, 255, 140);
}

.secondary-skin input,
.secondary-skin textarea,
.secondary-skin select {
    background: rgba(0, 0, 0, 0.8);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
}

.secondary-skin button {
    background: rgba(0, 0, 0, 0.9);
    color: rgb(255, 255, 140);
    border: 1px solid rgba(255, 255, 40, 0.5);
}

.secondary-skin button:hover {
    background: rgba(30, 30, 30, 0.9);
}

/* Map search input theme-specific styling */
.default-skin #map-search-input {
    background-color: #ffffff;
    color: #003366;
    border: 1px solid #4682b4;
}

.secondary-skin #map-search-input {
    background-color: rgba(0, 0, 0, 0.8);
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.5);
}

/* Theme-specific result styles */
.default-skin .result-item {
    background-color: #ffffff;
    color: #000080;
}

.default-skin .result-item.selected {
    background-color: #e6f3ff;
    color: #000000;
}

.default-skin .result-mru {
    background-color: #f0f8ff;
    color: #000080;
}

.default-skin .result-mru:hover {
    background-color: #e6f3ff;
}

.default-skin .result-contract {
    background-color: #f0f8ff;
    color: #000080;
}

.default-skin .result-contract:hover {
    background-color: #e6f3ff;
}

.secondary-skin .result-item {
    background-color: rgba(0, 0, 0, 0.9);
    color: rgb(255, 255, 140);
}

.secondary-skin .result-item.selected {
    background-color: rgb(255, 255, 140);
    color: black;
}

.secondary-skin .result-mru {
    background-color: rgba(0, 0, 0, 0.85);
    color: rgb(255, 255, 140);
}

.secondary-skin .result-mru:hover {
    background-color: rgba(50, 50, 0, 0.9);
}

.secondary-skin .result-contract {
    background-color: rgba(255, 255, 40, 0.1);
    color: rgb(255, 255, 140);
}

.secondary-skin .result-contract:hover {
    background-color: rgba(255, 255, 40, 0.25);
}

.confirm-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.secondary-skin .confirm-modal {
    background: rgba(0, 0, 0, 0.8);
}

.secondary-skin .confirm-content {
    background: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
}

.default-skin .confirm-modal {
    background: rgba(0, 0, 0, 0.4);
}

.default-skin .confirm-content {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.default-skin .confirm-content input,
.default-skin .confirm-content textarea,
.default-skin .confirm-content select {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.confirm-content {
    background: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
    padding: 2rem;
    border-radius: 12px;
    width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    text-align: center;
}

#changes-list {
    margin: 1rem 0;
    text-align: left;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-overlay {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
    padding: 2rem;
    border-radius: 12px;
    width: 650px;
    max-height: 70vh;
    overflow-y: auto;
}

.secondary-skin .modal-overlay {
    background: rgba(0, 0, 0, 0.85);
}

.secondary-skin .modal-box {
    background: rgba(0, 0, 0, 0.95);
    color: rgb(255, 255, 140);
}

.default-skin .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.default-skin .modal-box {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.default-skin .modal-box input,
.default-skin .modal-box textarea,
.default-skin .modal-box select {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.modal-box.small {
    width: 400px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.change-item {
    padding: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 140, 0.3);
}

.old-value {
    color: #ff8080;
}

.new-value {
    color: #80ff80;
}

.field-changed {
    border: 2px solid #80ff80 !important;
    background: rgba(0, 40, 0, 0.6) !important;
}

#change-counter {
    font-weight: bold;
    margin-top: 10px;
}

.access-box {
    background: rgba(0, 0, 0, 0.85);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    color: rgb(255, 255, 140);
    width: 400px;
    max-width: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.access-box input {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 40, 0.5);
    background-color: rgba(0, 0, 0, 0.9);
    color: rgb(255, 255, 40);
    font-weight: bold;
}

.access-box button {
    margin-top: 1rem;
    width: 100%;
    padding: 0.5rem;
    font-weight: bold;
    border-radius: 12px;
    border: none;
    background-color: rgba(0, 0, 0, 1);
    color: rgb(255, 255, 140);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.access-box button:hover {
    background-color: rgba(30, 30, 30, 1);
    transform: scale(1.05);
}

.access-box .error {
    margin-top: 0.8rem;
    color: #ff8080;
    font-weight: bold;
}

.address-grid {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 8px;
    margin-top: 15px;
}

.address-grid input {
    background: black;
    color: rgb(255, 255, 40);
    border: 1px solid rgba(255, 255, 40, 0.4);
    border-radius: 6px;
    padding: 4px;
}

.default-skin .address-grid input {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.status-true {
    color: rgb(0, 255, 0);
}

.status-false {
    color: red;
}

.status-null {
    color: gray;
}

.access-group-badge {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 40, 0.5);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgb(255, 255, 140);
}

.badge-label {
    font-weight: bold;
    color: rgb(200, 200, 100);
    font-size: 0.95rem;
}

.badge-value {
    font-weight: bold;
    font-size: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
}

.badge-value.pending {
    background: rgba(255, 200, 0, 0.15);
    color: rgb(255, 200, 0);
    border: 1px solid rgba(255, 200, 0, 0.4);
}

.badge-value.approved {
    background: rgba(0, 255, 0, 0.15);
    color: rgb(0, 255, 0);
    border: 1px solid rgba(0, 255, 0, 0.4);
}

/* Theme-specific access group badge styling */
.default-skin .access-group-badge {
    background: #f0f8ff;
    border: 1px solid #4682b4;
    color: #000080;
}

.default-skin .badge-label {
    color: #000080;
}

.default-skin .badge-value {
    background: #ffffff;
    color: #000080;
    border: 1px solid #4682b4;
}

.default-skin .badge-value.pending {
    background: #ffeccc;
    color: #ff9900;
    border: 1px solid #ff9900;
}

.default-skin .badge-value.approved {
    background: #ccffcc;
    color: #009900;
    border: 1px solid #009900;
}

.secondary-skin .access-group-badge {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 40, 0.5);
    color: rgb(255, 255, 140);
}

.secondary-skin .badge-label {
    color: rgb(200, 200, 100);
}

.secondary-skin .badge-value {
    background: rgba(0, 0, 0, 0.6);
    color: rgb(255, 255, 140);
    border: 1px solid rgba(255, 255, 40, 0.5);
}

.secondary-skin .badge-value.pending {
    background: rgba(255, 200, 0, 0.15);
    color: rgb(255, 200, 0);
    border: 1px solid rgba(255, 200, 0, 0.4);
}

.secondary-skin .badge-value.approved {
    background: rgba(0, 255, 0, 0.15);
    color: rgb(0, 255, 0);
    border: 1px solid rgba(0, 255, 0, 0.4);
}

/* Dev button theme-specific styling */
#dev-button {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 1999;
    font-size: 0.8rem;
}

.default-skin #dev-button {
    background: #ffffff !important;
    color: #000080 !important;
    border: 1px solid #4682b4 !important;
}

.default-skin #dev-button:hover {
    background: #e6f3ff !important;
}

.secondary-skin #dev-button {
    background: #000000 !important;
    color: rgb(255, 255, 140) !important;
    border: 1px solid rgba(255, 255, 40, 0.5) !important;
}

.secondary-skin #dev-button:hover {
    background: rgba(30, 30, 30, 0.9) !important;
}

/* 2026 responsive layout overrides */
:root {
    --mru-radius-sm: 12px;
    --mru-radius-md: 16px;
    --mru-radius-lg: 22px;
    --mru-space-xs: 0.35rem;
    --mru-space-sm: 0.65rem;
    --mru-space-md: 1rem;
    --mru-space-lg: 1.35rem;
    --mru-space-xl: 1.8rem;
    --mru-control-height: 2.9rem;
    --mru-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
    --mru-shadow-strong: 0 26px 56px rgba(0, 0, 0, 0.22);
}

body.default-skin {
    --mru-page-bg: linear-gradient(180deg, #edf5ff 0%, #f8fbff 100%);
    --mru-surface: rgba(255, 255, 255, 0.94);
    --mru-surface-strong: rgba(255, 255, 255, 0.98);
    --mru-surface-soft: rgba(236, 245, 255, 0.9);
    --mru-toolbar: rgba(255, 255, 255, 0.88);
    --mru-border: rgba(44, 94, 151, 0.22);
    --mru-text: #133a63;
    --mru-text-muted: #4a6787;
    --mru-accent: #1257b8;
    --mru-accent-soft: rgba(18, 87, 184, 0.12);
    --mru-button-bg: #f3f8ff;
    --mru-button-border: rgba(42, 96, 161, 0.24);
    --mru-field-bg: #ffffff;
    --mru-field-border: rgba(42, 96, 161, 0.28);
    --mru-danger: #b42318;
    --mru-success: #0e8a34;
}

body.secondary-skin {
    --mru-page-bg: rgba(0, 0, 0, 0.3);
    --mru-surface: rgba(5, 11, 20, 0.8);
    --mru-surface-strong: rgba(7, 14, 25, 0.92);
    --mru-surface-soft: rgba(255, 235, 59, 0.06);
    --mru-toolbar: rgba(7, 14, 25, 0.78);
    --mru-border: rgba(255, 236, 91, 0.24);
    --mru-text: #ffe98c;
    --mru-text-muted: #d8cb87;
    --mru-accent: #fff07a;
    --mru-accent-soft: rgba(255, 240, 122, 0.14);
    --mru-button-bg: rgba(8, 12, 20, 0.92);
    --mru-button-border: rgba(255, 236, 91, 0.32);
    --mru-field-bg: rgba(5, 11, 20, 0.9);
    --mru-field-border: rgba(255, 236, 91, 0.32);
    --mru-danger: #ff7b7b;
    --mru-success: #78ff99;
}

body.default-skin,
body.secondary-skin {
    color: var(--mru-text);
}

body.default-skin {
    background-color: var(--mru-page-bg);
}

body.secondary-skin {
    background-color: #02050a;
    background-image:
        linear-gradient(180deg, rgba(2, 5, 10, 0.32), rgba(2, 5, 10, 0.58)),
        url('../images/output_optimized_resized.gif');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.default-skin *,
body.secondary-skin * {
    color: inherit !important;
}

html,
body {
    min-height: 100%;
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
}

body:not(.access-page) {
    overflow: hidden;
}

body.access-page,
html.access-page {
    display: block;
    overflow: auto;
}

.container {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

.search-box {
    flex: 0 0 auto;
    gap: var(--mru-space-md);
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: clamp(0.95rem, 2vw, 1.15rem) clamp(4.5rem, 8vw, 6rem) 1rem;
    background: var(--mru-toolbar);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--mru-border);
}

.search-open-button {
    min-width: min(100%, 12rem);
    margin: 0;
}

.access-group-badge {
    margin: 0;
    background: var(--mru-surface-soft);
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-md);
    padding: 0.8rem 1rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.badge-label {
    color: var(--mru-text-muted) !important;
}

.badge-value {
    background: var(--mru-surface-strong);
    border: 1px solid var(--mru-border);
}

body.default-skin .badge-value.pending {
    color: #c56a00 !important;
}

body.default-skin .badge-value.approved {
    color: #08773b !important;
}

body.secondary-skin .badge-value.pending {
    color: #ffd66b !important;
}

body.secondary-skin .badge-value.approved {
    color: #79ff9e !important;
}

.main-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: var(--mru-space-lg);
    padding: var(--mru-space-lg);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.main-content.details-open {
    grid-template-columns: minmax(18rem, 0.84fr) minmax(0, 1.16fr);
}

.results-box,
.details-box {
    min-width: 0;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-lg);
    background: var(--mru-surface);
    box-shadow: var(--mru-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-box {
    padding: var(--mru-space-md);
    gap: var(--mru-space-sm);
    overflow: auto;
}

.details-box {
    padding: 0;
}

#details-form-view {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#details-form {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

.result-mru {
    padding: 0.95rem 1rem;
    margin: 0;
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-md);
    background: var(--mru-surface-strong);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.result-mru.expanded {
    background: var(--mru-accent-soft);
    border-color: var(--mru-accent);
}

.result-mru-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--mru-space-md);
}

.result-mru-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.result-mru-id {
    font-size: clamp(1rem, 1vw + 0.7rem, 1.16rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.result-mru-address {
    font-size: 0.96rem;
    color: var(--mru-text-muted) !important;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.result-mru-toggle {
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--mru-accent) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contracts-box {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    margin: -0.15rem 0 0.45rem 1rem;
    padding: 0.85rem 0 0.15rem 1rem;
    border-left: 1px dashed var(--mru-border);
}

.contracts-box.open {
    display: flex;
}

.result-contract {
    margin: 0;
    padding: 0.78rem 0.9rem;
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-sm);
    background: var(--mru-surface-soft);
    line-height: 1.4;
}

#details-form-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

#details-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: var(--mru-space-md);
    display: grid;
    grid-template-columns: minmax(12rem, 0.92fr) minmax(0, 1.55fr);
    gap: 0.9rem 1rem;
    align-items: start;
    background: transparent;
}

#details-content > * {
    min-width: 0;
}

.details-header {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0 0 0.35rem;
    justify-content: flex-start;
    font-size: clamp(1.35rem, 1.2rem + 0.9vw, 1.9rem);
}

.details-box label {
    text-align: left;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

input,
textarea,
select,
.details-box-link {
    width: 100%;
    max-width: 100%;
    min-height: var(--mru-control-height);
    padding: 0.78rem 0.92rem;
    border-radius: var(--mru-radius-sm);
    border: 1px solid var(--mru-field-border);
    background: var(--mru-field-bg);
    color: var(--mru-text) !important;
}

textarea {
    min-height: 8rem;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--mru-text-muted) !important;
}

input:focus,
textarea:focus,
select:focus,
.details-box-link:focus {
    outline: 2px solid color-mix(in srgb, var(--mru-accent) 40%, transparent);
    outline-offset: 1px;
    border-color: var(--mru-accent);
}

.details-box-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

[id^="qr-wrapper-"] {
    display: flex;
    align-items: center;
    min-height: 6rem;
    padding: 0.35rem 0;
}

.field-changed {
    border-color: var(--mru-success) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mru-success) 20%, transparent) !important;
}

.details-box {
    position: relative;
}

#details-form {
    position: relative;
    z-index: 1;
}

.floating-control-box {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    min-width: 14rem;
    min-height: 11rem;
    max-width: calc(100% - 1rem);
    max-height: calc(100% - 1rem);
    z-index: 1200;
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-lg);
    box-shadow: var(--mru-shadow-strong);
    overflow: hidden;
    backdrop-filter: blur(14px);
}

body.default-skin .floating-control-box {
    background: rgba(255, 255, 255, 0.2);
}

body.secondary-skin .floating-control-box {
    background: rgba(5, 11, 20, 0.2);
}

.floating-control-grip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--mru-border);
    background: color-mix(in srgb, var(--mru-toolbar) 60%, transparent);
    cursor: move;
    user-select: none;
    touch-action: none;
    text-align: center;
    position: relative;
    z-index: 1;
}

.floating-control-title,
.floating-control-subtitle {
    display: block;
    line-height: 1.2;
    text-align: center;
    width: 100%;
}

.floating-control-title {
    font-weight: 800;
}

.floating-control-subtitle {
    font-size: 0.78rem;
    color: var(--mru-text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.floating-control-body {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    min-height: 0;
    overflow: auto;
    position: relative;
    z-index: 1;
}

body.floating-control-active {
    user-select: none;
}

.details-top-buttons,
.map-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: var(--mru-space-sm);
    padding: var(--mru-space-md);
    width: 100%;
    min-height: 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
    margin: 0;
    position: static;
    inset: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
}

.details-top-buttons button,
.map-side-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: min(100%, 16.5rem);
    max-width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: var(--mru-radius-md);
    align-self: center;
}

.details-top-buttons button {
    flex: 0 1 auto;
    margin-inline: auto;
}

.button-label-short {
    display: none;
}

.floating-resize-handle {
    position: absolute;
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mru-accent) 62%, transparent);
    border: 1px solid var(--mru-button-border);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
    z-index: 4;
    pointer-events: auto;
}

.floating-resize-handle[data-direction="nw"] {
    top: 0.28rem;
    left: 0.28rem;
    cursor: nwse-resize;
}

.floating-resize-handle[data-direction="ne"] {
    top: 0.28rem;
    right: 0.28rem;
    cursor: nesw-resize;
}

.floating-resize-handle[data-direction="sw"] {
    bottom: 0.28rem;
    left: 0.28rem;
    cursor: nesw-resize;
}

.floating-resize-handle[data-direction="se"] {
    right: 0.28rem;
    bottom: 0.28rem;
    cursor: nwse-resize;
}

.details-map-view,
#details-map-view {
    position: relative;
    display: block;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    isolation: isolate;
}

.map-toolbar {
    min-height: 0;
    justify-content: flex-start;
}

.map-top-controls {
    display: block;
    min-width: 0;
    width: 100%;
    position: static;
    inset: auto;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    z-index: auto;
}

.map-top-controls input {
    width: 100%;
}

.map-side-controls {
    display: flex;
    flex-direction: column;
    gap: var(--mru-space-sm);
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    position: static;
    inset: auto;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    z-index: auto;
}

.map-back-button {
    position: static;
    inset: auto;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    z-index: auto;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    z-index: 1;
}

#map .leaflet-pane,
#map .leaflet-top,
#map .leaflet-bottom,
#map .leaflet-control-container {
    z-index: auto;
}

#map-controls-box {
    z-index: 1300;
}

button,
.fixed-button {
    min-height: var(--mru-control-height);
    padding: 0.72rem 1.05rem;
    border-radius: 999px;
    background: var(--mru-button-bg);
    border: 1px solid var(--mru-button-border);
    color: var(--mru-text) !important;
    font-weight: 750;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

button:hover,
.fixed-button:hover,
.result-mru:hover,
.result-contract:hover,
.azure-login-btn:hover,
.close-button:hover,
.register-buttons button:hover {
    transform: none;
}

@media (hover: hover) and (pointer: fine) {
    button:hover,
    .fixed-button:hover,
    .result-mru:hover,
    .result-contract:hover,
    .azure-login-btn:hover,
    .close-button:hover,
    .register-buttons button:hover {
        transform: translateY(-1px);
    }
}

#bg-music-toggle,
#help-toggle {
    position: fixed;
    top: 0.9rem;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    z-index: 2000;
}

#bg-music-toggle {
    left: 0.9rem;
}

#help-toggle {
    right: 0.9rem;
    line-height: 1;
}

.help-tooltip {
    max-width: min(20rem, calc(100vw - 2rem));
    border: 1px solid var(--mru-border);
    background: var(--mru-surface-strong);
    color: var(--mru-text) !important;
    box-shadow: var(--mru-shadow-strong);
}

.help-tooltip a {
    color: var(--mru-accent) !important;
}

.modal-overlay {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(8px);
}

.modal-box,
.confirm-content {
    width: min(44rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 1.5rem);
    padding: clamp(1rem, 2vw, 1.5rem);
    background: var(--mru-surface-strong);
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-lg);
    box-shadow: var(--mru-shadow-strong);
}

.modal-box.small {
    width: min(28rem, calc(100vw - 1.5rem));
}

.modal-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mru-space-sm);
    justify-content: center;
}

.modal-buttons > * {
    flex: 1 1 11rem;
}

#search-form-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--mru-space-md);
    margin-top: var(--mru-space-md);
}

#search-form-container > div {
    min-width: 0;
}

#search-form-container label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.change-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--mru-border);
    overflow-wrap: anywhere;
}

body.default-skin .old-value {
    color: #c2410c !important;
}

body.default-skin .new-value {
    color: #087443 !important;
}

body.secondary-skin .old-value {
    color: #ff9e8d !important;
}

body.secondary-skin .new-value {
    color: #92ffad !important;
}

.address-grid {
    grid-template-columns: minmax(10rem, 0.9fr) minmax(0, 1.4fr);
    gap: 0.8rem 1rem;
    align-items: center;
}

.address-grid label {
    font-weight: 700;
}

.address-error {
    margin-top: 1rem;
    color: var(--mru-danger) !important;
    overflow-wrap: anywhere;
}

.azure-login-container,
.register-container,
.registered-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2.4rem);
}

.azure-login-box,
.register-box,
.success-box,
.access-box {
    width: min(100%, 40rem);
    max-width: 100%;
    border: 1px solid var(--mru-border);
    border-radius: var(--mru-radius-lg);
    background: var(--mru-surface-strong);
    box-shadow: var(--mru-shadow-strong);
    overflow: hidden;
}

.azure-login-box h1,
.register-box h1,
.success-box h1 {
    line-height: 1.15;
}

.azure-login-btn {
    min-height: var(--mru-control-height);
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 16px 34px rgba(0, 120, 212, 0.24);
}

body.default-skin .azure-login-btn,
body.secondary-skin .azure-login-btn,
body.default-skin .register-btn-accept,
body.default-skin .register-btn-cancel,
body.default-skin .close-button,
body.secondary-skin .register-btn-accept,
body.secondary-skin .register-btn-cancel,
body.secondary-skin .close-button {
    color: #ffffff !important;
}

.error-message,
.info-box,
.info-text,
.user-info,
.approval-status {
    overflow-wrap: anywhere;
    border-radius: var(--mru-radius-sm);
}

.register-buttons {
    flex-wrap: wrap;
}

.register-buttons button {
    flex: 1 1 12rem;
}

.button-container {
    display: flex;
    justify-content: center;
}

.close-button {
    width: min(100%, 18rem);
}

#dev-button {
    position: fixed;
    bottom: 0.9rem;
    left: 0.9rem;
    z-index: 1999;
}

@media (max-width: 1080px) {
    .main-content.details-open {
        grid-template-columns: minmax(18rem, 0.92fr) minmax(0, 1.08fr);
    }

    #details-content {
        grid-template-columns: minmax(10rem, 0.88fr) minmax(0, 1.28fr);
    }
}

@media (max-width: 900px) {
    body:not(.access-page) {
        overflow: hidden;
    }

    .container {
        min-height: 100dvh;
        height: 100dvh;
        overflow: hidden;
    }

    .search-box {
        justify-content: stretch;
        align-items: stretch;
        padding-inline: 1rem;
        min-height: clamp(4.75rem, 10dvh, 6rem);
    }

    .search-open-button,
    .access-group-badge {
        width: 100%;
    }

    .main-content,
    .main-content.details-open {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr);
        overflow: hidden;
        padding: 0 1rem 1rem;
    }

    .main-content.details-open {
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .results-box,
    .details-box {
        height: 100%;
        min-height: 0;
    }

    .results-box {
        overflow: auto;
    }

    .details-box {
        overflow: hidden;
    }

    #details-content {
        grid-template-columns: 1fr;
    }

    .floating-control-box {
        top: 0.75rem !important;
        right: 0.75rem !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        min-width: 0;
        min-height: 0;
        max-width: calc(100% - 1.5rem);
        max-height: none;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        overflow: visible;
        z-index: 1300 !important;
        margin: 0;
        inset-inline-start: auto !important;
        inset-inline-end: max(0.75rem, env(safe-area-inset-right)) !important;
    }

    .floating-control-grip,
    .floating-resize-handle {
        display: none;
    }

    .floating-control-box .button-label-full {
        display: none;
    }

    .floating-control-box .button-label-short {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .floating-control-box--form {
        background: transparent;
        width: 3.45rem !important;
        max-width: 3.45rem !important;
    }

    .floating-control-box--form .details-top-buttons {
        padding: 0;
        align-items: center;
        gap: 0.55rem;
        min-height: auto;
        width: 100%;
    }

    .floating-control-box--form button {
        width: 3.45rem;
        height: 3.45rem;
        min-height: 3.45rem;
        padding: 0;
        border-radius: 50%;
        box-shadow: var(--mru-shadow);
    }

    .floating-control-box--map {
        left: auto !important;
        right: max(0.75rem, env(safe-area-inset-right)) !important;
        width: min(18rem, calc(100% - 1.5rem)) !important;
        max-width: calc(100% - 1.5rem) !important;
        border: 1px solid var(--mru-border);
        overflow: hidden;
        box-shadow: var(--mru-shadow-strong);
        backdrop-filter: blur(14px);
        z-index: 1350 !important;
    }

    body.default-skin .floating-control-box--map {
        background: rgba(255, 255, 255, 0.2);
    }

    body.secondary-skin .floating-control-box--map {
        background: rgba(5, 11, 20, 0.2);
    }

    .floating-control-box--map .map-toolbar {
        gap: 0.7rem;
        padding: 0.8rem;
        min-height: auto;
        align-items: stretch;
    }

    .floating-control-box--map .map-top-controls {
        display: block;
        width: 100%;
        padding: 0.5rem;
        border: 1px solid var(--mru-border);
        border-radius: var(--mru-radius-md);
        background: color-mix(in srgb, var(--mru-toolbar) 48%, transparent);
    }

    .floating-control-box--map .map-side-controls {
        align-items: center;
        width: 100%;
        padding: 0.2rem 0 0;
    }

    .floating-control-box--map .map-side-controls button {
        width: 3.45rem;
        height: 3.45rem;
        min-height: 3.45rem;
        padding: 0;
        border-radius: 50%;
        box-shadow: var(--mru-shadow);
    }

    .floating-control-box--map .button-label-short {
        font-size: 0.82rem;
    }

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

    .modal-buttons > * {
        flex-basis: 100%;
    }

    #search-form-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16.5px;
    }

    button,
    input,
    textarea,
    select,
    .details-box-link,
    .azure-login-btn {
        font-size: 1.03rem;
    }

    .search-box {
        gap: 0.8rem;
        padding: 0.95rem 1rem 1rem;
    }

    .main-content,
    .main-content.details-open {
        gap: 0.75rem;
        padding: 0 0.75rem 0.75rem;
    }

    .results-box,
    .details-box {
        border-radius: var(--mru-radius-md);
    }

    .result-mru,
    .result-contract {
        padding: 0.95rem;
    }

    .result-mru-header {
        flex-direction: column;
    }

    .result-mru-toggle {
        padding-left: 0;
    }

    .floating-control-box--form button,
    .floating-control-box--map .map-side-controls button {
        width: 3.65rem;
        height: 3.65rem;
        min-height: 3.65rem;
    }

    .details-header {
        font-size: clamp(1.3rem, 5vw, 1.55rem);
    }

    .modal-overlay {
        padding: 0.5rem;
    }

    .modal-box,
    .confirm-content {
        width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem);
        border-radius: var(--mru-radius-md);
    }

    .azure-login-box,
    .register-box,
    .success-box,
    .access-box {
        width: 100%;
        padding: 1.35rem;
    }

    .azure-login-btn,
    .register-buttons button,
    .close-button {
        width: 100%;
    }

    #bg-music-toggle,
    #help-toggle {
        width: 3.2rem;
        height: 3.2rem;
    }

    #dev-button {
        bottom: 0.75rem;
        left: 0.75rem;
    }
}
