:root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --text: #102a43;
    --muted: #627386;
    --line: #123b66;
    --line-soft: #d8e0ea;
    --primary: #123b66;
    --primary-dark: #0b2745;
    --accent: #ed6748;
    --accent-strong: #c7672c;
    --aqua: #9fd1d1;
    --green: #6b8f45;
    --success: #2f784b;
    font-family: Montserrat, "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.auth-page {
    display: grid;
    place-items: start center;
    padding: 8px 14px 24px;
}

.auth-shell,
.app-shell {
    width: min(100%, 680px);
}

.brand {
    display: grid;
    gap: 4px;
    margin: 0 0 12px;
    text-align: center;
}

.brand-logo {
    width: min(72vw, 220px);
    max-height: 220px;
    object-fit: contain;
    justify-self: center;
}

h1,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.7rem, 9vw, 2.5rem);
    line-height: 1.05;
    font-weight: 900;
}

.brand p,
.hint,
.voice-row span,
.topbar span,
.record small,
.record span {
    color: var(--muted);
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.tabs a {
    padding: 12px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: #eef4fb;
    text-align: center;
    font-weight: 900;
}

.tabs a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.auth-secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin-top: 12px;
    padding: 12px 16px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-weight: 900;
}

.panel,
.record,
.alert,
.success,
.empty {
    border: 2px solid rgba(0, 73, 90, .22);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(16, 42, 67, .08);
}

.panel {
    display: grid;
    gap: 16px;
    padding: 18px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 900;
}

input,
textarea,
button {
    width: 100%;
    border-radius: 8px;
    font: inherit;
}

input,
textarea {
    border: 1px solid var(--line-soft);
    padding: 13px;
    background: var(--surface-strong);
    color: var(--text);
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(11, 97, 112, .16);
}

textarea {
    resize: vertical;
}

button {
    border: 0;
    padding: 14px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

button.secondary {
    border: 1px solid var(--primary);
    background: #eef4fb;
    color: var(--primary-dark);
}

button:disabled {
    opacity: .65;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
}

.check input {
    width: 20px;
    height: 20px;
}

.alert,
.success,
.empty {
    margin-bottom: 14px;
    padding: 14px;
}

.alert {
    border-color: #f1b1a0;
    background: #fff2ed;
    color: #7d2c18;
}

.success {
    border-color: #a5d9bd;
    background: #effaf4;
    color: var(--success);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 2px solid rgba(18, 59, 102, .18);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-user div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.topbar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
}

.topbar-user span {
    max-width: 52vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line-soft);
    background: #eef4fb;
    flex: 0 0 auto;
}

.avatar-empty {
    display: grid;
    place-items: center;
    color: var(--primary-dark);
    font-weight: 900;
}

.menu-toggle {
    display: inline-grid;
    place-items: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid var(--primary);
    background: #fff;
    color: var(--primary);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--primary-dark);
}

.main-menu {
    position: absolute;
    z-index: 2100;
    top: calc(100% + 8px);
    right: 14px;
    display: grid;
    width: min(260px, calc(100vw - 28px));
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(28, 52, 61, .18);
    overflow: hidden;
}

.main-menu[hidden] {
    display: none;
}

.main-menu a {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-weight: 900;
}

.main-menu a:last-child {
    border-bottom: 0;
}

.app-shell {
    margin: 0 auto;
    padding: 20px 14px 40px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-head h1 {
    margin: 0;
    font-size: 1.65rem;
}

.new-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 850;
}

.new-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.voice-row {
    display: grid;
    gap: 8px;
}

.map-panel {
    display: grid;
    gap: 8px;
}

.gps-map {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 360px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: #eef4fb;
}

.map-panel a {
    justify-self: start;
}

.leaflet-container {
    z-index: 1;
    font: inherit;
}

.address-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
}

.address-card span {
    color: var(--muted);
    font-size: .9rem;
    font-weight: 750;
}

.address-card strong {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.35;
}

.list {
    display: grid;
    gap: 12px;
}

.record {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 15px 58px 15px 15px;
}

.record-link {
    display: grid;
    gap: 6px;
}

.record time {
    color: var(--accent);
    font-weight: 850;
}

.record p {
    margin-bottom: 0;
}

.delete-record-form {
    position: absolute;
    right: 10px;
    bottom: 10px;
}

.delete-record-button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #f1b1a0;
    background: #fff2ed;
    color: #9a321b;
}

.delete-record-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.profile-photo {
    display: grid;
    place-items: center;
}

.profile-photo img,
.profile-photo span {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #eef4f4;
}

.profile-photo img {
    object-fit: cover;
}

.profile-photo span {
    display: grid;
    place-items: center;
    color: var(--primary-dark);
    font-size: 2.2rem;
    font-weight: 900;
}

.read-record {
    gap: 18px;
}

.field-view {
    display: grid;
    gap: 5px;
}

.field-view span {
    color: var(--muted);
    font-size: .9rem;
    font-weight: 750;
}

.field-view strong,
.field-view p {
    margin: 0;
    line-height: 1.35;
}

.address-parts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.readonly-map {
    width: 100%;
    min-height: 300px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.photo-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #eef4f4;
}

@media (min-width: 720px) {
    .auth-page {
        padding-top: 52px;
    }

    .panel {
        padding: 24px;
    }
}

@media (max-width: 520px) {
    .address-parts {
        grid-template-columns: 1fr;
    }
}
