:root {
    color-scheme: light;
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-strong: #e7f0ef;
    --text: #17211f;
    --muted: #667370;
    --line: #d9e2df;
    --primary: #116466;
    --primary-dark: #0b4c4d;
    --accent: #c88a32;
    --danger: #b34040;
    --shadow: 0 12px 30px rgba(17, 100, 102, 0.13);
    --contact-name-weight: 530;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    padding-bottom: 82px;
}

.is-guest .app-shell,
.is-authenticated .auth-shell {
    display: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.auth-panel {
    width: min(520px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 18px;
}

.auth-brand h1,
.auth-brand p {
    margin: 0;
}

.auth-brand h1 {
    font-size: 26px;
}

.auth-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-title-icon {
    display: grid;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid rgba(17, 100, 102, 0.22);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--primary);
}

.auth-title-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.auth-brand p {
    margin-top: 8px;
    color: var(--muted);
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 16px 0 10px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfa;
}

.auth-tabs button,
.google-button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.auth-tabs button.is-active {
    background: var(--surface);
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(17, 100, 102, 0.1);
}

.google-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    background: #fbfdfc;
    padding: 0 12px;
}

.google-button span {
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--primary-dark);
    padding: 4px 8px;
    font-size: 12px;
}

.auth-form {
    display: none;
    gap: 10px;
    margin-top: 12px;
}

.auth-form.is-active {
    display: grid;
}

.auth-form label,
.account-type-picker {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.required-mark {
    color: var(--danger);
    font-weight: 800;
}

.field-label {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
}

.field-label .required-mark {
    margin-left: 3px;
}

.auth-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 12px 13px;
    outline: none;
}

.phone-source {
    display: none;
}

.phone-composite {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px;
}

.phone-composite[hidden] {
    display: none;
}

.phone-composite input {
    width: 100%;
}

.phone-country {
    text-align: center;
    font-weight: 800;
}

.form-field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.form-icon-field {
    position: relative;
}

.form-field-icon {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    color: var(--primary-dark);
}

.form-field-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.form-icon-field > .form-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
}

.form-icon-field > input,
.form-icon-field > textarea {
    padding-left: 42px;
}

.address-row .form-icon-field > .form-field-icon {
    top: 21px;
    transform: none;
}

.contact-phone-field > .form-field-label {
    position: absolute;
}

.contact-phone-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: stretch;
}

.contact-phone-row > .form-field-icon,
.extra-phone-row > .form-field-icon {
    align-self: center;
    justify-self: center;
}

.phone-add-button {
    display: grid;
    width: 38px;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--primary-dark);
    text-decoration: none;
}

.phone-add-button:disabled,
.phone-remove-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.phone-add-button svg,
.phone-remove-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.extra-phone-list {
    display: grid;
    gap: 8px;
}

.extra-phone-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: stretch;
}

.extra-phone-row[hidden] {
    display: none;
}

.phone-remove-button {
    display: grid;
    width: 38px;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff6f5;
    color: var(--danger);
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    z-index: 2;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--primary-dark);
}

.password-toggle:hover,
.password-toggle.is-visible {
    background: var(--surface-strong);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.password-toggle::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(-38deg);
}

.password-toggle.is-visible::after {
    display: none;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-form .remember-option {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 9px;
    color: var(--text);
    cursor: pointer;
}

.auth-form .remember-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.forgot-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.forgot-form {
    display: none;
    gap: 10px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 12px;
}

.forgot-form.is-open {
    display: grid;
}

.forgot-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.forgot-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 12px 13px;
    outline: none;
}

.account-type-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 0;
    padding: 0;
}

.account-type-picker legend {
    grid-column: 1 / -1;
}

.account-type-picker label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    color: var(--text);
    white-space: nowrap;
}

.account-type-picker input {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
}

.business-fields {
    display: none;
    gap: 10px;
}

.business-fields.is-visible {
    display: grid;
}

.auth-message {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
}

.auth-message:not(:empty) {
    border: 1px solid rgba(179, 64, 64, 0.28);
    border-radius: 8px;
    background: #fff7f7;
    padding: 10px 12px;
}

.auth-message[data-type="success"] {
    border-color: rgba(17, 100, 102, 0.25);
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.top-actions {
    display: flex;
    gap: 8px;
}

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

.brand-home {
    display: grid;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    text-align: left;
    text-decoration: none;
}

.brand-home:hover h1,
.brand-home:focus-visible h1 {
    color: var(--primary);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 14px;
    background: rgba(245, 247, 246, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar h1,
.section-head h2 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: 24px;
}

.menu-toggle {
    flex: 0 0 42px;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 28;
    background: rgba(23, 33, 31, 0.34);
}

.side-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 29;
    width: min(320px, 86vw);
    transform: translateX(-100%);
    background: var(--surface);
    box-shadow: 16px 0 34px rgba(23, 33, 31, 0.18);
    padding: 18px;
    transition: transform 180ms ease;
}

.side-drawer.is-open {
    transform: translateX(0);
}

.side-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.side-drawer-head h2 {
    margin: 0;
    font-size: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.icon-button {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary);
    font-weight: 800;
}

.icon-button[hidden] {
    display: none;
}

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

.favorite-header-button.is-favorite {
    border-color: rgba(202, 138, 4, 0.45);
    background: #fef3c7;
    color: #b45309;
}

.favorite-header-button.is-favorite svg {
    fill: currentColor;
}

.notification-button {
    color: var(--primary-dark);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    min-width: 19px;
    height: 19px;
    place-items: center;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    line-height: 1;
}

.main-content {
    width: min(980px, 100%);
    margin: 0 auto;
    padding: 16px;
}

.summary-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.summary-band article,
.account-grid article,
.vehicle-row,
.timeline article,
.person-row,
.menu-list button,
.drawer-menu-list button,
.settings-list article,
.notification-list article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.notification-list article[data-notification-approval="incoming"] {
    cursor: pointer;
}

.summary-band article {
    min-height: 78px;
    padding: 13px;
}

.summary-band span,
.account-grid span,
.timeline span,
.vehicle-row span,
.person-main small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.summary-band strong,
.account-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}

.screen {
    display: none;
}

.screen.is-active {
    display: block;
}

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

.section-head h2 {
    font-size: 22px;
}

.primary-button,
.secondary-button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    font-weight: 700;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.secondary-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--primary);
}

.search-box {
    margin-bottom: 12px;
}

.favorite-contacts {
    margin-bottom: 12px;
}

.favorite-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.favorite-head h3,
.letter-heading,
.date-heading {
    margin: 0;
    color: var(--primary-dark);
    font-size: 14px;
}

.favorite-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.favorite-grid::-webkit-scrollbar {
    display: none;
}

.favorite-arrows {
    display: none;
    gap: 6px;
}

.favorite-arrows button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
}

.favorite-arrows svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.favorite-card,
.favorite-empty {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.favorite-card {
    flex: 0 0 136px;
    scroll-snap-align: start;
}

.favorite-card button {
    display: grid;
    width: 100%;
    min-height: 108px;
    align-content: center;
    justify-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 12px;
    color: var(--text);
    text-align: center;
}

.favorite-card strong,
.favorite-card small {
    display: block;
}

.favorite-card strong {
    font-weight: var(--contact-name-weight);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.favorite-card small {
    white-space: nowrap;
}

.favorite-card small,
.favorite-empty {
    color: var(--muted);
    font-size: 13px;
}

.favorite-empty {
    flex: 1 0 100%;
    grid-column: 1 / -1;
    margin: 0;
    padding: 12px;
}

.contact-sort {
    display: flex;
    gap: 8px;
    margin: 8px 0 12px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.contact-sort button {
    min-height: 38px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.contact-sort button.is-active {
    border-color: rgba(17, 100, 102, 0.22);
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.public-profile-shell {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 18px 16px 28px;
}

.public-contact-view-shell {
    display: block;
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 16px 14px 28px;
}

.is-public-profile .contact-view-toolbar-actions,
.is-public-profile [data-contact-view-share] {
    display: none !important;
}

.public-profile-top {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.secondary-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary);
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.share-wrap {
    position: relative;
}

.search-box input,
.form-grid input,
.form-grid textarea,
.form-grid select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 400;
    padding: 12px 13px;
    outline: none;
}

.list,
.timeline,
.menu-list,
.drawer-menu-list,
.settings-list,
.notification-list,
.form-grid {
    display: grid;
    gap: 10px;
}

.drawer-menu-list {
    margin-top: 14px;
}

.person-row {
    position: relative;
    overflow: hidden;
}

.contact-group {
    display: grid;
    gap: 8px;
}

.letter-heading,
.date-heading {
    padding: 2px 2px 0;
}

.person-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    transition: transform 160ms ease;
    touch-action: pan-y;
}

.person-main {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 12px;
    border: 0;
    background: transparent;
    padding: 12px;
    text-align: left;
}

.person-main > span:last-child {
    min-width: 0;
}

.person-main strong {
    display: block;
    font-weight: var(--contact-name-weight);
    line-height: 1.2;
}

.person-main small {
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 10px 0;
}

.header-actions button {
    display: grid;
    width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--primary-dark);
}

.favorite-swipe-action {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    width: 56px;
    background: var(--surface-strong);
}

.favorite-toggle {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    border: 0;
    background: var(--accent);
    color: #fff;
}

.favorite-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linejoin: round;
    stroke-width: 2;
}

.favorite-toggle.is-favorite {
    background: var(--danger);
    color: #fff;
}

.favorite-toggle.is-favorite svg {
    fill: currentColor;
}

.avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--primary-dark);
    font-weight: 800;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quick-actions {
    position: relative;
    z-index: 2;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid var(--line);
    padding: 10px 12px 12px;
    background: #f8fbfa;
    transition: transform 160ms ease;
    touch-action: pan-y;
}

.person-row.is-swiped .person-header,
.person-row.is-swiped .quick-actions {
    transform: translateX(-112px);
}

.person-row.is-favorite-swiped .person-header,
.person-row.is-favorite-swiped .quick-actions {
    transform: translateX(56px);
}

.person-row.is-open .quick-actions {
    display: grid;
}

.quick-actions button {
    display: grid;
    min-height: 46px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--primary-dark);
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, 56px);
    width: 112px;
    background: var(--surface-strong);
}

.swipe-actions button {
    display: grid;
    place-items: center;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.6);
    background: var(--primary);
    color: #fff;
}

.quick-actions button.danger-action,
.swipe-actions button.danger-action {
    color: var(--danger);
}

.swipe-actions button.danger-action {
    background: var(--danger);
    color: #fff;
}

.quick-actions svg,
.header-actions svg,
.swipe-actions svg,
.address-action-button svg,
.detail-actions svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.detail-topline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.detail-topline-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 24px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-actions {
    display: flex;
    gap: 8px;
}

.detail-actions .danger-action {
    color: var(--danger);
}

.detail-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
}

.profile-hero h1,
.profile-hero h2,
.profile-hero p {
    margin: 0;
}

.profile-hero p:last-child {
    margin-top: 6px;
    color: var(--muted);
}

.profile-avatar {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
}

.profile-photo-upload {
    display: block;
    cursor: pointer;
}

.profile-photo-upload input,
.photo-picker input[type="file"] {
    display: none;
}

.profile-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}

.profile-section h2,
.profile-section h3 {
    margin: 0;
}

.profile-section > h2 {
    margin-bottom: 12px;
}

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

.profile-info-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
}

.profile-info-list article {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 68px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 12px;
}

.profile-info-list article.has-edit {
    grid-template-columns: 36px minmax(0, 1fr) 42px;
}

.profile-info-action {
    cursor: pointer;
}

.profile-info-icon {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    color: var(--primary-dark);
    background: var(--surface-strong);
}

.profile-info-list .profile-info-icon {
    color: var(--primary-dark);
}

.profile-info-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.profile-info-content {
    min-width: 0;
}

.profile-info-edit {
    width: 38px;
    height: 38px;
    min-height: 38px;
    justify-self: end;
}

.profile-contact-manager {
    display: grid;
    gap: 10px;
}

.profile-contact-manager[hidden] {
    display: none;
}

.profile-contact-manager-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 10px;
}

.profile-contact-manager-row label {
    min-width: 0;
}

.profile-contact-manager-row select,
.profile-contact-manager-row input {
    min-height: 44px;
    width: 100%;
}

.profile-contact-manager-delete {
    width: 40px;
    height: 44px;
    min-height: 44px;
}

.modal-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.danger-icon {
    color: #b42318;
}

.danger-icon:not(:disabled):hover {
    border-color: #f3b5ae;
    background: #fff1f0;
}

.profile-info-empty {
    margin: 0;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 12px;
}

.profile-info-list span,
.profile-info-list strong {
    display: block;
}

.profile-info-list .profile-info-icon,
.profile-info-list .profile-info-content {
    display: grid;
}

.profile-info-list span {
    color: var(--muted);
    font-size: 13px;
}

.profile-info-list strong {
    margin-top: 6px;
}

.detail-hero h2,
.detail-hero p {
    margin: 0;
}

.detail-status {
    margin-top: 5px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.detail-avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.detail-metrics article,
.history-list article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 12px;
}

.detail-metrics article {
    min-width: 0;
    min-height: 54px;
    padding: 10px 10px;
}

.detail-metrics article.is-positive-balance,
.detail-metrics article.is-positive-metric {
    border-color: #b7dfc6;
    background: #edf8f1;
}

.detail-metrics article.is-negative-balance,
.detail-metrics article.is-negative-metric {
    border-color: #efc4c4;
    background: #fff0f0;
}

.detail-metrics span,
.history-list span,
.history-list small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.detail-metrics span {
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-metrics strong,
.history-list strong,
.history-list b {
    display: block;
    margin-top: 5px;
}

.detail-metrics strong {
    margin-top: 3px;
    font-size: 15px;
    line-height: 1.15;
    white-space: nowrap;
}

.history-list {
    display: grid;
    gap: 8px;
}

.history-list article {
    display: grid;
    gap: 5px;
}

.history-list article.history-row {
    position: relative;
    display: block;
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.history-card-content {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 4px;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 8px 10px;
    touch-action: pan-y;
    transition: transform 160ms ease;
}

.history-row.is-swiped .history-card-content {
    transform: translateX(-112px);
}

.history-swipe-actions {
    border-radius: 8px;
    overflow: hidden;
}

.history-list time {
    color: var(--muted);
    font-size: 11px;
}

.history-item-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.history-item-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.history-item-main strong,
.history-item-main b {
    margin-top: 0;
}

.history-item-main strong {
    font-size: 15px;
    line-height: 1.15;
}

.history-item-main p {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-main b {
    font-size: 15px;
    text-align: right;
    white-space: nowrap;
}

.history-item-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.history-item-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
}

.history-status-group {
    display: inline-flex;
    min-width: max-content;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
    word-break: keep-all;
}

.history-status-label {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
    overflow-wrap: normal;
    white-space: nowrap;
}

.history-status {
    display: inline-flex;
    width: auto;
    min-width: max-content;
    height: auto;
    align-items: center;
    justify-content: flex-end;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #7b8686;
    cursor: pointer;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    padding: 0;
    text-align: right;
    white-space: nowrap;
    word-break: keep-all;
}

.history-status:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.history-status.is-pending {
    color: #c58b00;
}

.history-status.is-approved {
    color: #18884d;
}

.history-status.is-rejected {
    color: #c33d45;
}

@media (max-width: 420px) {
    .history-status-label {
        max-width: 86px;
    }
}

.site-dialog-body p {
    white-space: pre-line;
}

.type-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    border: 0;
    padding: 0;
}

.type-picker legend {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.type-picker button {
    display: grid;
    gap: 2px;
    place-items: center;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--primary-dark);
    font-weight: 700;
    text-align: center;
}

.type-picker button small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.transaction-subtype-options {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.transaction-subtype-options[hidden] {
    display: none;
}

.transaction-subtype-options button {
    min-height: 28px;
    flex: 0 0 auto;
    min-width: 72px;
    place-items: center;
    padding: 0 9px;
    font-size: 12px;
}

.form-grid[data-mode="transaction"] .profile-custom-fields-editor {
    display: none;
}

.transaction-attachment-field {
    display: grid;
    gap: 8px;
}

.transaction-attachment-field > span,
.transaction-attachment-field small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.transaction-attachment-field small {
    font-weight: 600;
}

.transaction-attachment-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px 42px;
    gap: 8px;
    align-items: center;
}

.transaction-attachment-button {
    display: inline-grid;
    min-height: 42px;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-align: center;
}

.transaction-camera-button,
.transaction-attachment-clear {
    min-height: 42px;
}

.transaction-attachment-button svg,
.transaction-camera-button svg,
.transaction-attachment-clear svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.history-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.history-attachment-link {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--primary-dark);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.history-attachment-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.type-picker button.is-selected {
    border-color: var(--primary);
    background: var(--surface-strong);
}

.timeline article,
.vehicle-row {
    padding: 14px;
}

.timeline time {
    display: inline-flex;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--primary-dark);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
}

.timeline strong,
.vehicle-row strong {
    display: block;
    margin-bottom: 5px;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.account-grid article {
    min-height: 100px;
    padding: 14px;
}

.menu-list button,
.drawer-menu-list button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 14px;
    text-align: left;
}

.drawer-menu-list svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.settings-list article {
    padding: 13px;
}

.settings-account-card {
    cursor: pointer;
}

.settings-list span,
.settings-list small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.settings-list strong {
    display: block;
    margin-top: 5px;
}

.settings-list small {
    margin-top: 4px;
}

.settings-username-card label {
    display: grid;
    gap: 8px;
}

.settings-username-card input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 0 12px;
    color: var(--text);
    font: inherit;
}

.phone-composite.is-disabled {
    opacity: 0.72;
}

.phone-composite.is-disabled input {
    background: var(--surface-strong);
    color: var(--muted);
    cursor: not-allowed;
}

.settings-username-card small[data-status="ok"] {
    color: var(--primary-dark);
}

.settings-username-card small[data-status="error"] {
    color: #b3261e;
}

.account-settings-form {
    display: grid;
    gap: 12px;
}

.profile-settings-modal .modal-panel {
    grid-template-rows: auto minmax(0, 1fr);
}

.account-settings-modal-body {
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
}

.account-settings-form article {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 13px;
}

.account-business-fields[hidden] {
    display: none;
}

.account-settings-form article > span,
.account-field span,
.account-settings-form small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.required-mark {
    color: #b3261e;
    font: inherit;
}

.account-field {
    display: grid;
    gap: 8px;
}

.account-field input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--text);
    padding: 0 12px;
    outline: none;
}

.account-field input[readonly] {
    background: var(--surface-strong);
    color: var(--muted);
    cursor: not-allowed;
}

.account-username-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px 42px;
    gap: 6px;
    align-items: center;
}

.account-username-state {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.account-username-state[data-state="ok"] {
    color: #167a3a;
}

.account-username-state[data-state="error"] {
    color: #b3261e;
}

.account-username-edit {
    display: grid;
    width: 42px;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--primary-dark);
}

.account-username-edit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.segmented-control label {
    position: relative;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    display: grid;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--muted);
    font-weight: 700;
}

.segmented-control input:checked + span {
    border-color: rgba(17, 100, 102, 0.45);
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.account-settings-message {
    min-height: 18px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.account-settings-message[data-status="ok"],
.account-settings-form small[data-status="ok"] {
    color: var(--primary-dark);
}

.account-settings-message[data-status="error"],
.account-settings-form small[data-status="error"] {
    color: #b3261e;
}

.mobile-caller-card {
    display: grid;
    gap: 12px;
}

.mobile-caller-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.mobile-caller-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.mobile-caller-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.mobile-caller-switch {
    position: relative;
    display: inline-flex;
    width: 42px;
    height: 24px;
    align-items: center;
}

.mobile-caller-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mobile-caller-switch span {
    display: block;
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #d9e4e2;
    transition: background 0.18s ease;
}

.mobile-caller-switch span::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease;
}

.mobile-caller-switch input:checked + span {
    background: var(--primary);
}

.mobile-caller-switch input:checked + span::after {
    transform: translateX(18px);
}

.mobile-caller-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.mobile-caller-code-row strong {
    color: var(--primary-dark);
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
}

.mobile-caller-copy-button {
    display: grid;
    width: 42px;
    height: 42px;
    min-height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
}

.mobile-caller-copy-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.danger-text {
    color: var(--danger);
}

.notification-list article {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px;
}

.notification-section {
    display: grid;
    gap: 10px;
}

.notification-section + .notification-section {
    margin-top: 18px;
}

.notification-section h3 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 15px;
}

.notification-section-list {
    display: grid;
    gap: 10px;
}

.notification-list strong,
.notification-list small {
    display: block;
}

.notification-list small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.notification-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.notification-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.approval-status-icon.is-approved,
.notification-status.is-approved {
    color: #18794e;
}

.approval-status-icon.is-pending,
.notification-status.is-pending {
    color: #946200;
}

.approval-status-icon.is-rejected,
.approval-status-icon.is-disputed,
.notification-status.is-rejected,
.notification-status.is-disputed {
    color: var(--danger);
}

.notification-status {
    width: fit-content;
    border-radius: 999px;
    background: var(--surface-strong);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
}

.notification-body {
    display: grid;
    min-width: 0;
    flex: 1;
    gap: 8px;
}

.notification-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notification-actions button {
    min-height: 34px;
    border-radius: 8px;
    padding: 0 12px;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
}

.bottom-nav button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.bottom-nav svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.bottom-nav button.is-active {
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.desktop-nav-extra {
    display: none;
}

.fab-button {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 9;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(17, 100, 102, 0.18);
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 24px rgba(17, 100, 102, 0.28);
}

.fab-button.is-hidden {
    display: none;
}

.fab-button svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.transaction-fab-button {
    right: max(18px, env(safe-area-inset-right));
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    background: rgba(13, 26, 24, 0.42);
    padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
    overflow: hidden;
}

.map-modal {
    z-index: 32;
}

.site-dialog-modal {
    z-index: 44;
}

.message-options-modal {
    z-index: 43;
}

.site-dialog-panel {
    width: min(440px, 100%);
    box-shadow: var(--shadow);
}

.site-dialog-body {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.site-dialog-body p {
    margin: 0;
    white-space: pre-line;
}

.site-dialog-body textarea {
    width: 100%;
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    padding: 12px;
    resize: vertical;
}

.site-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.message-options-panel {
    width: min(420px, 100%);
    box-shadow: var(--shadow);
}

.message-options-body {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.message-options-body p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.message-options-list {
    display: grid;
    gap: 8px;
}

.message-options-list button {
    display: grid;
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-dark);
    padding: 0 12px;
    text-align: left;
    font-weight: 700;
}

.message-options-list svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.modal.is-open {
    display: flex;
}

#entry-modal[data-mode="contact"],
#entry-modal[data-mode="contact-edit"],
#entry-modal[data-mode="summary"],
#entry-modal:has(.form-grid[data-mode="contact"]),
#entry-modal:has(.form-grid[data-mode="contact-edit"]),
#entry-modal:has(.form-grid[data-mode="summary"]) {
    inset: 78px 0 64px;
    align-items: flex-start;
    background: var(--bg);
    padding: 16px;
    overflow-y: auto;
}

.modal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(520px, 100%);
    max-height: calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0 auto;
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

#entry-modal[data-mode="contact"] .modal-panel,
#entry-modal[data-mode="contact-edit"] .modal-panel,
#entry-modal[data-mode="summary"] .modal-panel,
#entry-modal:has(.form-grid[data-mode="contact"]) .modal-panel,
#entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-panel,
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-panel {
    width: min(740px, 100%);
    max-height: none;
    box-shadow: none;
}

.modal-panel > .section-head {
    margin-bottom: 0;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.modal-back-button {
    display: none;
}

#entry-modal[data-mode="contact"] .modal-panel > .section-head,
#entry-modal[data-mode="contact-edit"] .modal-panel > .section-head,
#entry-modal[data-mode="summary"] .modal-panel > .section-head,
#entry-modal:has(.form-grid[data-mode="contact"]) .modal-panel > .section-head,
#entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-panel > .section-head,
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-panel > .section-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-bottom: 0;
    background: transparent;
}

#entry-modal[data-mode="contact"] .modal-back-button,
#entry-modal[data-mode="contact-edit"] .modal-back-button,
#entry-modal[data-mode="summary"] .modal-back-button,
#entry-modal:has(.form-grid[data-mode="contact"]) .modal-back-button,
#entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-back-button,
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-back-button {
    display: inline-grid;
}

#entry-modal[data-mode="contact"] .modal-panel > .section-head > [aria-label="Kapat"],
#entry-modal[data-mode="contact-edit"] .modal-panel > .section-head > [aria-label="Kapat"],
#entry-modal[data-mode="summary"] .modal-panel > .section-head > [aria-label="Kapat"],
#entry-modal:has(.form-grid[data-mode="contact"]) .modal-panel > .section-head > [aria-label="Kapat"],
#entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-panel > .section-head > [aria-label="Kapat"],
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-panel > .section-head > [aria-label="Kapat"] {
    display: none;
}

#entry-modal[data-mode="contact"] .modal-title-actions,
#entry-modal[data-mode="contact-edit"] .modal-title-actions,
#entry-modal[data-mode="summary"] .modal-title-actions,
#entry-modal:has(.form-grid[data-mode="contact"]) .modal-title-actions,
#entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-title-actions,
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-title-actions {
    grid-column: 3;
}

#entry-modal[data-mode="summary"] #modal-title,
#entry-modal:has(.form-grid[data-mode="summary"]) #modal-title {
    visibility: hidden;
}

.modal-title-actions {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#entry-modal[data-mode="summary"] .modal-title-actions,
#entry-modal:has(.form-grid[data-mode="summary"]) .modal-title-actions {
    display: flex;
}

.modal-panel .form-grid {
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 16px;
}

.map-panel {
    width: min(720px, 100%);
}

.map-body {
    display: grid;
    gap: 10px;
    min-height: 0;
    padding: 14px 16px 16px;
}

.map-canvas {
    min-height: 340px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.map-status {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.map-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-grid .form-icon-field > input,
.form-grid .form-icon-field > textarea {
    padding-left: 42px;
}

.form-grid .form-icon-field > .phone-composite {
    grid-template-columns: 82px minmax(0, 1fr);
    padding-left: 0;
}

.form-grid .form-icon-field:has(.phone-composite) {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}

.form-grid .form-icon-field:has(.phone-composite) > .form-field-icon {
    position: static;
    align-self: center;
    justify-self: center;
    transform: none;
}

.form-grid .form-icon-field:has(.phone-composite) > .form-field-label {
    position: absolute;
}

.photo-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-fields .photo-picker {
    display: none;
}

.photo-preview {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
}

.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.contact-fields,
.generic-fields,
.transaction-fields,
.summary-fields {
    display: grid;
    gap: 10px;
}

.contact-form-section {
    display: grid;
    gap: 10px;
}

.contact-form-section h3 {
    margin: 4px 0 0;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
}

.contact-edit-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 14px;
}

.contact-edit-hero .avatar {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    font-size: 22px;
}

.contact-edit-hero span:not(.avatar) {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.contact-edit-hero strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 22px;
    font-weight: 530;
}

.contact-edit-hero small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.form-grid[data-mode="contact"] .generic-fields,
.form-grid[data-mode="contact"] .transaction-fields,
.form-grid[data-mode="contact"] .summary-fields,
.form-grid[data-mode="contact-edit"] .generic-fields,
.form-grid[data-mode="contact-edit"] .transaction-fields,
.form-grid[data-mode="contact-edit"] .summary-fields,
.form-grid[data-mode="transaction"] .contact-fields,
.form-grid[data-mode="transaction"] .generic-fields,
.form-grid[data-mode="transaction"] .summary-fields,
.form-grid[data-mode="summary"] .contact-fields,
.form-grid[data-mode="summary"] .generic-fields,
.form-grid[data-mode="summary"] .transaction-fields,
.form-grid[data-mode="generic"] .contact-fields {
    display: none;
}

.form-grid[data-mode="generic"] .transaction-fields,
.form-grid[data-mode="generic"] .summary-fields {
    display: none;
}

.form-grid[data-mode="summary"] > .primary-button {
    display: none;
}

.form-grid:not([data-kind="planner"]) .plan-schedule-field {
    display: none;
}

.address-row {
    --address-edit-height: 70px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 0;
    align-items: stretch;
}

.address-row label {
    grid-row: 1 / span 2;
    min-width: 0;
}

.address-row textarea {
    height: var(--address-edit-height);
    min-height: var(--address-edit-height);
    max-height: var(--address-edit-height);
    resize: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.address-action-button {
    display: grid;
    width: 38px;
    height: calc(var(--address-edit-height) / 2);
    min-height: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0;
    background: #fbfdfc;
    color: var(--primary-dark);
    font-weight: 700;
}

.location-button.address-action-button {
    grid-column: 2;
}

.address-search-button.address-action-button {
    grid-column: 2;
    grid-row: 1;
    border-top-right-radius: 8px;
}

.location-button.address-action-button {
    grid-row: 2;
    border-top: 0;
    border-bottom-right-radius: 8px;
}

.address-action-button svg {
    width: 18px;
    height: 18px;
}

.address-action-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.location-result {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 11px 12px;
}

.location-result[hidden] {
    display: none;
}

.location-result span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.location-result a {
    color: var(--text);
    font-weight: 400;
    text-decoration: none;
    word-break: break-word;
}

.location-result small {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    word-break: break-word;
}

.location-result small:empty {
    display: none;
}

.location-result-action {
    display: inline-grid;
    width: 24px;
    height: 24px;
    margin-left: 5px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--primary-dark);
}

.location-result-action svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.location-result-action:disabled,
.location-result-action.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.location-result-break {
    display: block;
    content: "";
    margin-top: 6px;
}

.summary-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 12px;
    color: inherit;
    text-decoration: none;
}

.contact-view-info-list .summary-card {
    cursor: pointer;
}

.contact-view-info-list .summary-card:hover {
    border-color: rgba(17, 100, 102, 0.28);
    background: #f7fbfa;
}

.summary-card[hidden],
.view-address-location-row[hidden],
.view-address-row[hidden],
.view-location-result[hidden],
.view-location-line[hidden],
.location-result-action[hidden] {
    display: none;
}

.summary-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.summary-card strong {
    display: block;
    margin-top: 5px;
    font-weight: 400;
}

.summary-card .social-value {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

.social-value-icon {
    display: inline-grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    color: var(--primary-dark);
}

.social-value-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.contact-view-info-list .summary-card > span {
    display: none;
}

.contact-view-info-list .summary-card strong {
    margin-top: 0;
}

.summary-card.has-profile-share-toggle {
    position: relative;
    padding-right: 62px;
}

.custom-field-list {
    display: grid;
    gap: 10px;
}

.custom-field-card {
    position: relative;
}

.custom-field-card .custom-field-label {
    display: block;
    margin: 0 0 5px 28px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.contact-view-info-list .custom-field-card > .custom-field-label {
    display: block;
}

.custom-field-card .social-value {
    padding-right: 42px;
}

.custom-field-card [data-social-value-text] {
    white-space: pre-line;
}

.custom-field-remove {
    position: absolute;
    right: 10px;
    top: 50%;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--danger);
    transform: translateY(-50%);
}

.custom-field-remove svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.custom-field-add-form {
    display: grid;
    grid-template-columns: minmax(104px, 0.7fr) minmax(0, 1.8fr) 42px;
    gap: 8px;
}

.custom-field-add-form.is-iban {
    grid-template-columns: minmax(92px, 0.55fr) minmax(0, 2.2fr) 42px;
}

.custom-field-add-form[hidden] {
    display: none;
}

.bank-account-editor {
    display: grid;
    gap: 10px;
}

.bank-account-editor[hidden] {
    display: none;
}

.bank-account-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr) 42px;
    gap: 8px;
}

.custom-field-add-form select,
.custom-field-add-form input,
.bank-account-add-form input {
    min-height: 42px;
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    color: var(--text);
    font: inherit;
    padding: 0 12px;
}

.custom-field-add-button {
    display: grid;
    width: 42px;
    min-width: 42px;
    padding: 0;
    place-items: center;
}

.custom-field-add-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.profile-share-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    z-index: 3;
    display: grid;
    width: 40px;
    height: 36px;
    min-height: 36px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text-muted);
    transform: translateY(-50%);
    cursor: pointer;
}

.profile-share-toggle.is-off {
    background: #fff;
    color: var(--text-muted);
    opacity: 0.68;
}

.profile-share-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.profile-share-toggle svg circle {
    fill: currentColor;
    stroke: none;
}

.contact-view-info-list .summary-card > .profile-share-toggle {
    display: grid;
}

.contact-view-info-list .address-location-card.has-profile-share-toggle {
    padding-right: 0;
}

.contact-view-info-list .address-location-card.has-profile-share-toggle .profile-share-toggle {
    position: static;
    width: 34px;
    height: 24px;
    min-height: 24px;
    border-left: 0;
    border-radius: 0;
    background: #fbfdfc;
    transform: none;
}

.social-value [data-social-value-text] {
    min-width: 0;
    color: var(--text);
    font-size: inherit;
    font-weight: 400;
    word-break: break-word;
}

.contact-view-extra-phones {
    display: grid;
    gap: 10px;
}

.contact-view-extra-phones .extra-phone-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 8px;
    align-items: center;
}

.contact-view-extra-phones a {
    color: inherit;
    text-decoration: none;
}

.extra-phone-action-row + .extra-phone-action-row {
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.extra-phone-call-link {
    min-width: 0;
}

.contact-view-extra-phones .extra-phone-call-link {
    display: flex;
    grid-column: 1;
    margin-top: 0;
}

.extra-phone-whatsapp-link {
    margin-left: 0;
}

.contact-view-extra-phones .extra-phone-whatsapp-link {
    display: inline-grid;
    grid-column: 2;
    justify-self: end;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    margin-top: 0;
    margin-left: 0;
    border-radius: 0;
}

.contact-view-extra-phones .extra-phone-whatsapp-link svg {
    width: 22px;
    height: 22px;
}

.address-location-card {
    display: grid;
    gap: 8px;
}

.contact-view-info-list .address-location-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.contact-view-info-list .address-location-card:hover {
    border-color: transparent;
    background: transparent;
}

.view-address-row {
    --address-action-gap: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: stretch;
}

[data-contact-view-address-row] {
    --address-action-gap: 0;
    --address-view-height: 78px;
    gap: 0;
}

.view-address-actions {
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--address-action-gap);
}

.address-location-card.has-profile-share-toggle [data-contact-view-address-row] {
    grid-template-columns: minmax(0, 1fr) 34px;
}

.address-location-card.has-profile-share-toggle .view-address-actions {
    grid-template-rows: 27px 24px 27px;
}

.view-address-box {
    min-height: 70px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px 13px;
}

[data-contact-view-address-row] .view-address-box {
    height: var(--address-view-height);
    min-height: var(--address-view-height);
    max-height: var(--address-view-height);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    overflow: hidden;
}

[data-contact-view-address-row] .view-address-actions {
    height: var(--address-view-height);
}

.view-address-box strong {
    margin-top: 0;
    line-height: 1.35;
    word-break: break-word;
}

.view-location-result {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 11px 12px;
}

.view-location-line {
    display: block;
    min-width: 0;
}

.view-location-line span,
.view-location-line small {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    word-break: break-word;
}

.view-location-line span {
    font-size: 16px;
}

.view-location-line + .view-location-line {
    margin-top: 6px;
}

.view-location-line .social-value {
    display: inline;
}

.view-location-line [data-social-value-text] {
    display: inline;
    color: inherit;
    font-size: inherit;
}

.view-location-line .social-value-icon {
    display: none;
}

.view-location-line .location-result-action,
.view-address-row .location-result-action {
    flex: 0 0 auto;
}

.view-address-row .location-result-action {
    width: 38px;
    height: 100%;
    min-height: 0;
    margin-left: 0;
}

.address-location-card.has-profile-share-toggle .view-address-row .location-result-action {
    width: 34px;
}

[data-contact-view-address-row] .location-result-action {
    margin-top: 0;
    border-left: 0;
    border-radius: 0;
    background: #fbfdfc;
}

[data-contact-view-address-row] .location-result-action:first-child {
    border-top-right-radius: 8px;
}

[data-contact-view-address-row] .location-result-action:last-child {
    border-bottom-right-radius: 8px;
}

.address-location-card.has-profile-share-toggle [data-contact-view-address-row] .location-result-action {
    height: 100%;
}

.address-location-card.has-profile-share-toggle [data-contact-view-address-row] .profile-share-toggle svg {
    width: 19px;
    height: 19px;
}

.view-address-location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
}

.view-address-location-row strong,
.view-address-location-row a,
.view-address-location-row > span,
.view-address-location-row small {
    min-width: 0;
}

.view-address-location-row strong,
.view-address-location-row a,
.view-address-location-row > span {
    margin-top: 0;
}

.view-address-location-row small {
    color: var(--text);
    font-weight: 400;
    line-height: 1.35;
}

.view-address-location-row .location-result-action {
    position: static;
    width: 34px;
    height: 34px;
    min-height: 34px;
}

.view-address-location-row .location-result-action svg {
    width: 16px;
    height: 16px;
}

.contact-view-head {
    display: grid;
    justify-items: center;
    text-align: center;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 0 12px 14px;
}

.contact-view-main {
    min-width: 0;
    width: 100%;
}

.contact-view-head span:not(.avatar),
.contact-view-head small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.form-grid[data-mode="summary"] .contact-view-main > span {
    display: none;
}

.contact-view-head strong {
    display: block;
    margin-top: 6px;
    color: var(--text);
    font-size: clamp(28px, 6vw, 40px);
    line-height: 1.04;
    font-weight: 530;
}

.contact-view-head .avatar {
    width: min(150px, 36vw);
    height: min(150px, 36vw);
    flex-basis: min(150px, 36vw);
    font-size: 36px;
    background: var(--surface-strong);
}

.contact-view-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.contact-view-actions .icon-button {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border-radius: 8px;
    background: var(--surface-strong);
}

.contact-view-page {
    display: grid;
    gap: 12px;
    padding-bottom: 24px;
}

.contact-view-toolbar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    align-self: stretch;
    margin-bottom: -4px;
}

.contact-view-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-view-profile {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 6px;
    border-radius: 8px;
    background: var(--surface);
    padding: 10px 16px 14px;
}

.contact-view-profile > strong {
    color: var(--text);
    font-size: clamp(26px, 5.4vw, 36px);
    line-height: 1.04;
    font-weight: 530;
}

.contact-view-company-heading {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
}

.contact-view-profile > small {
    color: var(--muted);
    font-size: 13px;
}

.contact-view-avatar {
    width: min(126px, 31vw);
    height: min(126px, 31vw);
    flex-basis: min(126px, 31vw);
    font-size: 32px;
    background: var(--surface-strong);
    margin-top: -4px;
}

.contact-view-avatar.is-profile-photo-picker {
    cursor: pointer;
}

.contact-view-info-list {
    display: grid;
    gap: 10px;
}

.contact-view-info-section {
    display: grid;
    gap: 8px;
}

.contact-view-info-section[hidden] {
    display: none;
}

.contact-view-danger-section {
    display: grid;
    margin-top: 2px;
}

.contact-view-danger-section[hidden] {
    display: none;
}

.contact-view-delete-bottom {
    width: 100%;
    justify-content: center;
    border-color: rgba(190, 18, 60, 0.28);
    background: #fff;
}

.incoming-profile-card {
    display: grid;
    gap: 12px;
    cursor: pointer;
}

.contact-view-info-list .incoming-profile-card:hover {
    border-color: rgba(17, 100, 102, 0.35);
    background: var(--surface-strong);
}

.incoming-profile-card:focus-visible {
    outline: 2px solid #0a84ff;
    outline-offset: 2px;
}

.incoming-profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.incoming-profile-summary {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.incoming-profile-modal .modal-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    max-width: 560px;
}

.incoming-profile-modal-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 12px;
}

.incoming-profile-modal-head strong {
    display: block;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.incoming-profile-modal-head small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.incoming-profile-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    font-size: 15px;
}

.incoming-profile-head strong {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.incoming-profile-head small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.incoming-profile-list {
    display: grid;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px 16px;
}

.incoming-profile-group {
    display: grid;
    gap: 8px;
}

.incoming-profile-group h3 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
}

.incoming-profile-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 76px;
    gap: 10px;
    align-items: center;
    min-height: 62px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    padding: 10px;
    font-size: 13px;
}

.incoming-profile-item-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    color: var(--primary-dark);
    background: var(--surface-strong);
}

.incoming-profile-item-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.incoming-profile-item-content {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.incoming-profile-item-content span {
    display: block;
    color: var(--muted);
}

.incoming-profile-item-content strong {
    margin: 0;
    color: var(--text);
    font-weight: 500;
    word-break: break-word;
}

.incoming-profile-add {
    width: 76px;
    min-height: 38px;
    padding: 0 10px;
}

.incoming-profile-head-action {
    justify-self: end;
}

.incoming-profile-add:disabled {
    opacity: 0.75;
    cursor: default;
}

.contact-view-info-section h3 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 700;
}

.profile-view-page {
    display: grid;
    gap: 12px;
    padding-bottom: 24px;
}

.profile-self-card {
    margin-top: 0;
    padding-top: 10px;
}

.profile-self-card .profile-photo-upload {
    cursor: pointer;
    margin-top: -2px;
}

.profile-self-card .eyebrow {
    margin: 0;
}

.profile-self-card .contact-view-avatar {
    width: min(132px, 32vw);
    height: min(132px, 32vw);
    flex-basis: min(132px, 32vw);
}

.profile-self-card > strong,
.profile-self-card [data-profile-name] {
    font-size: clamp(32px, 7vw, 42px);
}

.profile-name-row {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-name-row [data-profile-name] {
    min-width: 0;
    color: var(--text);
    line-height: 1.04;
    font-weight: 530;
    overflow-wrap: anywhere;
}

.profile-name-edit {
    width: 34px;
    height: 34px;
    min-height: 34px;
    flex: 0 0 34px;
}

.profile-name-edit svg {
    width: 17px;
    height: 17px;
}

.profile-section-compact {
    box-shadow: none;
}

.profile-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.profile-section-head .icon-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
}

.profile-edit-modal .modal-panel {
    width: min(520px, 100%);
}

.profile-contact-form {
    padding: 16px;
}

.profile-main-form {
    padding: 16px;
}

.profile-contact-editor {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    align-items: end;
    gap: 10px;
}

#profile-contact-modal[data-mode="manage"] [data-profile-contact-delete],
.profile-contact-form[data-mode="manage"] .profile-contact-editor {
    display: none;
}

.profile-contact-form[data-mode="manage"] .profile-contact-manager {
    display: grid;
}

.profile-contact-form[data-mode="single"] .profile-contact-manager {
    display: none;
}

.profile-contact-editor label {
    min-width: 0;
}

.profile-contact-editor select,
.profile-contact-editor input {
    min-height: 46px;
    width: 100%;
}

.profile-contact-type-wrap {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.profile-contact-type-icon {
    display: inline-grid;
    width: 38px;
    height: 46px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--primary-dark);
    background: var(--surface-strong);
}

.profile-contact-type-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-button.is-disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.summary-card a {
    display: inline-flex;
    margin-top: 5px;
    color: var(--primary-dark);
    font-weight: 400;
}

@media (min-width: 760px) {
    :root {
        --desktop-nav-width: 180px;
        --desktop-content-offset: calc(var(--desktop-nav-width) + 32px);
    }

    .favorite-arrows {
        display: flex;
    }

    body.is-authenticated {
        overflow: hidden;
    }

    .is-authenticated .app-shell {
        display: grid;
        grid-template-columns: var(--desktop-nav-width) minmax(0, 0.95fr) minmax(0, 1.35fr);
        grid-template-rows: auto minmax(0, 1fr);
        column-gap: 16px;
        height: 100vh;
        min-height: 100vh;
        padding: 0 8px 0 0;
        overflow: hidden;
    }

    .is-authenticated .topbar {
        grid-column: 1 / -1;
        margin: 0 -8px 0 0;
        padding: 8px 18px 7px;
        min-height: 58px;
    }

    .is-authenticated .topbar h1 {
        font-size: 21px;
        line-height: 1.05;
    }

    .is-authenticated .topbar .eyebrow {
        font-size: 10px;
        line-height: 1.1;
        margin-bottom: 2px;
    }

    .is-authenticated .menu-toggle {
        display: none;
    }

    .is-authenticated .drawer-overlay {
        display: none;
    }

    .is-authenticated .side-drawer {
        display: none;
    }

    .is-authenticated .bottom-nav {
        position: static;
        grid-column: 1;
        grid-row: 2;
        align-self: start;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        height: 100%;
        align-content: start;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.78);
        box-shadow: var(--shadow);
        padding: 10px;
    }

    .is-authenticated .bottom-nav button,
    .is-authenticated .desktop-nav-extra button {
        display: grid;
        min-height: 46px;
        grid-template-columns: 26px minmax(0, 1fr);
        align-items: center;
        gap: 6px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--muted);
        justify-content: start;
        text-align: left;
        padding: 0 12px;
        font-size: 13px;
        font-weight: 700;
    }

    .is-authenticated .bottom-nav svg,
    .is-authenticated .desktop-nav-extra svg {
        width: 19px;
        height: 19px;
        justify-self: center;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-width: 2;
    }

    .is-authenticated .desktop-nav-extra {
        display: grid;
        gap: 8px;
        margin-top: 2px;
        border-top: 1px solid rgba(217, 226, 223, 0.72);
        padding-top: 10px;
    }

    .is-authenticated .main-content {
        display: grid;
        grid-column: 2 / 4;
        grid-row: 2;
        width: 100%;
        height: 100%;
        min-width: 0;
        padding: 0;
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
        align-items: start;
        gap: 16px;
        overflow: hidden;
    }

    .is-authenticated .fab-button {
        bottom: calc(62px + env(safe-area-inset-bottom));
    }

    .is-authenticated #screen-contacts {
        grid-column: 1 / -1;
        min-width: 0;
        max-height: 100%;
        overflow-y: auto;
        padding-right: 2px;
        scrollbar-gutter: stable;
    }

    .has-desktop-contact-panel #screen-contacts {
        grid-column: auto;
        padding-bottom: 92px;
    }

    .is-authenticated .screen.is-active:not(#screen-contacts):not(#screen-contact-view):not(#screen-contact-detail) {
        grid-column: 1 / -1;
        min-width: 0;
        max-height: 100%;
        overflow-y: auto;
        scrollbar-gutter: stable;
    }

    .has-desktop-contact-panel #screen-contact-view,
    .has-desktop-contact-panel #screen-contact-detail {
        min-width: 0;
        max-height: 100%;
        overflow-y: auto;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.78);
        box-shadow: var(--shadow);
        padding: 12px;
        scrollbar-gutter: stable;
    }

    .is-authenticated .fab-button {
        right: calc(18px + env(safe-area-inset-right));
    }

    .has-desktop-contact-panel .fab-button {
        right: var(--contact-fab-right, calc((100vw - var(--desktop-content-offset)) * 0.587 + 30px));
        bottom: calc(22px + env(safe-area-inset-bottom));
    }

    .has-desktop-contact-panel .transaction-fab-button {
        right: max(18px, env(safe-area-inset-right));
    }

    .is-authenticated:not(.has-desktop-contact-panel) .fab-button {
        right: var(--contact-fab-right, calc(30px + env(safe-area-inset-right)));
        bottom: calc(22px + env(safe-area-inset-bottom));
    }

    .has-desktop-contact-panel #entry-modal[data-mode="contact"],
    .has-desktop-contact-panel #entry-modal[data-mode="contact-edit"],
    .has-desktop-contact-panel #entry-modal:has(.form-grid[data-mode="contact"]),
    .has-desktop-contact-panel #entry-modal:has(.form-grid[data-mode="contact-edit"]) {
        inset: 78px 8px 0 max(568px, calc(41.3vw + 145px));
        width: auto;
        background: var(--bg);
        padding: 16px;
    }

    .has-desktop-contact-panel #entry-modal[data-mode="contact"] .modal-panel,
    .has-desktop-contact-panel #entry-modal[data-mode="contact-edit"] .modal-panel,
    .has-desktop-contact-panel #entry-modal:has(.form-grid[data-mode="contact"]) .modal-panel,
    .has-desktop-contact-panel #entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-panel {
        width: 100%;
        height: 100%;
        max-height: none;
        margin: 0;
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
    }
}

@media (max-width: 640px) {
    .profile-contact-editor {
        grid-template-columns: 104px minmax(0, 1fr);
        gap: 8px;
    }

    .profile-contact-manager-row {
        grid-template-columns: 98px minmax(0, 1fr) 38px;
        gap: 6px;
    }

    .summary-band,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 21px;
    }

    .main-content {
        padding: 14px;
    }

    .bottom-nav button {
        font-size: 12px;
    }

    .quick-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .type-picker,
    .account-type-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .detail-metrics article {
        min-height: 52px;
        padding: 9px 8px;
    }

    .detail-metrics span {
        font-size: 11px;
    }

    .detail-metrics strong {
        font-size: 14px;
    }

    .custom-field-add-form {
        grid-template-columns: minmax(86px, 0.55fr) minmax(0, 1.8fr) 42px;
    }

    .bank-account-add-form {
        grid-template-columns: 1fr;
    }

    .bank-account-add-form .custom-field-add-button {
        width: 100%;
    }

    .modal {
        align-items: flex-end;
        padding-right: 10px;
        padding-left: 10px;
    }

    #entry-modal[data-mode="contact"],
    #entry-modal[data-mode="contact-edit"],
    #entry-modal[data-mode="summary"],
    #entry-modal:has(.form-grid[data-mode="contact"]),
    #entry-modal:has(.form-grid[data-mode="contact-edit"]),
    #entry-modal:has(.form-grid[data-mode="summary"]) {
        inset: 78px 0 64px;
        align-items: flex-start;
        padding: 12px 8px;
    }

    .modal-panel {
        max-height: calc(100vh - 18px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    #entry-modal[data-mode="contact"] .modal-panel,
    #entry-modal[data-mode="contact-edit"] .modal-panel,
    #entry-modal[data-mode="summary"] .modal-panel,
    #entry-modal:has(.form-grid[data-mode="contact"]) .modal-panel,
    #entry-modal:has(.form-grid[data-mode="contact-edit"]) .modal-panel,
    #entry-modal:has(.form-grid[data-mode="summary"]) .modal-panel {
        max-height: none;
    }

    .map-panel {
        width: 100%;
    }

    .map-canvas {
        min-height: 52vh;
    }

    .map-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
