:root {
    color-scheme: light;
    --bg: #f7f8f5;
    --surface: #ffffff;
    --line: #dfe4dc;
    --text: #1e2720;
    --muted: #6b766c;
    --accent: #237c52;
    --accent-strong: #17613e;
    --danger: #a33b32;
}

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent-strong);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.honeypot-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.field-hint-inline {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-footer {
    margin-top: auto;
    padding: 10px 20px 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.app-footer a {
    color: var(--muted);
    text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus {
    color: var(--accent-strong);
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.brand-logo {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: block;
}

.userbar {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.userbar form {
    margin: 0;
}

.profile-open-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-size: 14px;
    font-weight: 650;
}

.profile-open-button img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-open-button-icon {
    min-width: 30px;
    justify-content: center;
    padding: 2px;
}

.topbar-link {
    color: var(--accent-strong);
    font-weight: 650;
    text-decoration: none;
}

.container {
    width: min(1080px, 100%);
    margin: 0 auto;
    padding: 24px 20px;
}

.auth-panel {
    width: min(420px, calc(100% - 32px));
    margin: 64px auto;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.auth-panel-wide {
    width: min(760px, calc(100% - 32px));
}

.auth-switch {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-link-row {
    margin: -6px 0 14px;
    font-size: 14px;
}

.login-remember-row {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: -4px 0 14px;
    font-size: 14px;
    font-weight: 500;
}

.login-remember-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-height: 0;
    margin: 0;
}

.auth-actions {
    gap: 8px;
}

.profile-dialog {
    width: min(720px, calc(100% - 28px));
    max-height: min(780px, calc(100vh - 28px));
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.profile-dialog::backdrop {
    background: rgb(18 28 21 / 48%);
}

.profile-dialog-panel {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.profile-dialog-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.profile-dialog-header h2 {
    margin: 0 0 2px;
    font-size: 20px;
}

.profile-dialog-header p {
    margin: 0;
}

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

.profile-stats div {
    display: grid;
    gap: 1px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf7;
}

.profile-stats strong {
    font-size: 18px;
    line-height: 1.1;
}

.profile-stats span {
    color: var(--muted);
    font-size: 12px;
}

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

.profile-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf7;
    justify-self: start;
}

.profile-tab {
    min-height: 26px;
    padding: 3px 9px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
}

.profile-tab.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--line);
}

.profile-tab-panel {
    display: grid;
    gap: 12px;
}

.profile-tab-panel[hidden] {
    display: none;
}

.profile-notes-field {
    display: grid;
    gap: 4px;
}

.profile-notes-display,
.profile-notes-editor {
    display: grid;
    gap: 8px;
}

.profile-notes-display[hidden],
.profile-notes-editor[hidden] {
    display: none;
}

.profile-notes-field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.profile-notes-field textarea {
    min-height: 260px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 400;
}

.profile-notes-markdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: start;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.profile-notes-markdown-toggle input {
    width: 13px;
    height: 13px;
    min-height: 13px;
    margin: 0;
}

.profile-notes-preview {
    min-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf7;
    font-size: 13px;
}

.profile-notes-preview h3,
.profile-notes-preview h4,
.profile-notes-preview h5,
.profile-notes-preview p,
.profile-notes-preview ul {
    margin: 0 0 8px;
}

.profile-notes-preview ul {
    padding-left: 18px;
}

.profile-grid label {
    display: grid;
    gap: 2px;
}

.profile-grid label span {
    color: var(--muted);
    font-size: 12px;
}

.profile-grid input {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 13px;
}

.profile-grid-wide {
    grid-column: span 2;
}

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

.profile-photo-preview {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    object-fit: cover;
    background: #edf1eb;
}

.profile-photo-placeholder {
    display: grid;
    place-items: center;
    color: var(--accent-strong);
    font-size: 16px;
    font-weight: 750;
}

.profile-options {
    display: grid;
    gap: 1px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.profile-options legend {
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.profile-options label {
    display: grid;
    grid-template-columns: 13px minmax(0, 1fr);
    align-items: center;
    gap: 5px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.05;
    min-height: 16px;
}

.profile-options input[type="checkbox"] {
    width: 13px;
    height: 13px;
    min-height: 13px;
    padding: 0;
    margin: 0;
    justify-self: start;
    align-self: center;
}

.profile-visibility-options {
    gap: 0;
    padding-block: 3px;
}

.profile-visibility-options label {
    min-height: 14px;
    line-height: 1;
}

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

.profile-dialog-actions button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-title-block {
    min-width: 0;
    flex: 1 1 auto;
}

.page-title-block h1 {
    font-size: clamp(24px, 3vw, 34px);
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.page-title-block p {
    margin-right: 8px;
}

.page-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 6px;
}

.search-field {
    display: grid;
    gap: 0;
    width: 138px;
    min-width: 138px;
    color: var(--muted);
    font-size: 13px;
}

.search-field input {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 13px;
}

.range-filter {
    display: flex;
    gap: 4px;
}

.range-filter input {
    width: 72px;
    min-height: 32px;
    padding: 5px 7px;
    font-size: 13px;
}

.page-actions .button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 13px;
}

.compact-button {
    min-height: 28px;
    height: 28px;
    padding: 4px 7px;
    font-size: 13px;
}

.detail-header-actions .compact-button {
    min-height: 28px;
    height: 28px;
    padding: 4px 7px;
}

.detail-header-actions {
    align-self: flex-start;
}

.detail-header-actions .icon-mail-action {
    width: 30px;
    min-width: 30px;
    padding: 5px;
}

.icon-mail-action svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-new-tour {
    min-width: 86px;
    white-space: nowrap;
}

.workbench-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.public-layout .tour-row,
.tour-row.is-readonly-content {
    grid-template-columns: 72px minmax(0, 1fr);
}

.public-detail-layout {
    display: block;
}

.tour-editor-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.tour-detail-layout {
    align-items: start;
}

.sidebar-panel,
.content-panel {
    min-width: 0;
}

.mobile-jump-link {
    display: none;
}

.legal-page {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

.legal-content {
    display: grid;
    gap: 14px;
    max-width: 760px;
}

.legal-content h2 {
    font-size: 18px;
    margin: 0;
}

.legal-content p {
    margin: 0;
}

.sidebar-panel {
    position: sticky;
    top: 16px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.sidebar-header {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 18px;
}

.sidebar-link,
.list-nav-row a {
    color: var(--text);
    text-decoration: none;
}

.sidebar-link {
    display: flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 14px;
}

.sidebar-link.is-active,
.list-nav-row.is-active {
    background: #eaf2ec;
}

.list-nav {
    display: grid;
    gap: 0;
    margin-bottom: 8px;
}

.list-nav-row {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) 20px 20px 20px;
    gap: 1px;
    align-items: center;
    border-radius: 6px;
    min-width: 0;
    white-space: nowrap;
}

.list-nav-row.is-dragging {
    opacity: 0.45;
}

.drag-handle {
    min-width: 16px;
    min-height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    font-size: 11px;
    letter-spacing: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.list-nav-row a {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    min-height: 24px;
    align-items: center;
    padding: 2px 5px;
    font-size: 14px;
    line-height: 1.25;
}

.list-nav-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-nav-row small {
    min-width: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #f1f4ef;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.list-nav-row > form {
    margin: 0;
}

.list-nav-row > form:not(.list-rename-form):not(.list-visibility-form) {
    grid-row: 1;
    grid-column: 5 / 6;
    min-width: 0;
    justify-self: center;
}

.list-nav-row > .js-list-rename-toggle {
    grid-row: 1;
    grid-column: 4 / 5;
}

.list-nav-row > .drag-handle {
    grid-row: 1;
    grid-column: 1 / 2;
}

.list-nav-row > a {
    grid-row: 1;
    grid-column: 2 / 3;
    min-width: 0;
}

.list-nav-row > .list-visibility-form {
    grid-row: 1;
    grid-column: 3 / 4;
    justify-self: stretch;
}

.icon-visibility {
    font-size: 16px;
}

.icon-visibility.is-public {
    color: var(--accent-strong);
}

.icon-visibility.is-private {
    color: var(--muted);
}

.list-rename-form {
    min-width: 0;
    max-width: 100%;
    display: grid;
    grid-column: 2 / 3;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    padding: 0;
}

.list-rename-form[hidden] {
    display: none;
}

.list-rename-form input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 24px;
    padding: 2px 5px;
    font-size: 14px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    min-width: 20px;
    max-width: 20px;
    min-height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
}

.icon-button-edit {
    font-size: 16px;
    font-weight: 700;
}

.icon-button:hover {
    color: var(--danger);
}

.icon-trash svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-danger.icon-trash {
    color: #b8322b;
}

.button-danger.icon-trash:hover,
.icon-button.icon-trash:hover {
    color: #8f241f;
}

.sidebar-panel .list-nav {
    gap: 0;
    margin-bottom: 6px;
}

.sidebar-panel .list-nav-row {
    grid-template-columns: 14px minmax(0, 1fr) 18px 18px 18px;
    gap: 0;
    min-height: 23px;
}

.sidebar-panel .list-nav-row a {
    min-height: 23px;
    padding: 1px 4px;
    font-size: 13px;
    line-height: 1.24;
}

.sidebar-panel .list-nav-row small {
    min-width: 16px;
    padding: 0 3px;
    font-size: 11px;
    line-height: 16px;
}

.sidebar-panel .drag-handle,
.sidebar-panel .icon-button {
    min-width: 18px;
    max-width: 18px;
    height: 20px;
    min-height: 20px;
    font-size: 11px;
    line-height: 1;
}

.sidebar-panel .icon-button-edit {
    font-size: 16px;
}

.sidebar-panel .icon-visibility {
    font-size: 15px;
}

.sidebar-panel .icon-trash svg {
    width: 16px;
    height: 16px;
    transform: translateY(1px);
}

.sidebar-panel .drag-handle {
    min-width: 14px;
}

.sidebar-panel .list-rename-form {
    grid-column: 2 / 3;
    padding: 0;
}

.sidebar-panel .list-rename-form input {
    min-height: 22px;
    font-size: 13px;
}

.public-layout .sidebar-panel .list-nav-row {
    grid-template-columns: minmax(0, 1fr);
}

.public-layout .sidebar-panel .list-nav-row > a {
    grid-column: 1 / -1;
}

.small {
    font-size: 14px;
}

.list-create-form {
    display: grid;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.list-create-form label {
    font-size: 13px;
}

.list-create-form input,
.list-create-form select,
.list-create-form button {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 13px;
}

.sidebar-public-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.sidebar-public-section .sidebar-header {
    margin-bottom: 8px;
}

.sidebar-panel .public-list-nav .list-nav-row,
.sidebar-panel .public-list-nav-row {
    grid-template-columns: 14px minmax(0, 1fr);
}

.sidebar-panel .public-list-nav .list-nav-row > a,
.sidebar-panel .public-list-nav-row > a {
    grid-column: 2 / -1;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.1;
}

.muted {
    color: var(--muted);
}

.form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

label {
    font-weight: 650;
}

.field-label {
    font-weight: 650;
}

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}

select {
    min-height: 44px;
}

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 9px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.button-secondary {
    background: transparent;
    color: var(--accent-strong);
}

.link-button {
    padding: 0;
    min-height: auto;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
}

.button-danger {
    border-color: #d6b5b0;
    background: #fff3f1;
    color: var(--danger);
}

.alert {
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #e1b7b1;
    border-radius: 6px;
    background: #fff3f1;
    color: var(--danger);
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-page-header {
    padding-right: 54px;
}

.admin-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-page .admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 22px 0 !important;
    font-size: 14px;
    margin-inline: -22px;
}

.admin-page .admin-table th,
.admin-page .admin-table td {
    padding: 8px 4px !important;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.admin-user-cell {
    display: grid;
    gap: 1px;
}

.admin-user-cell span {
    color: var(--muted);
    font-size: 13px;
}

.admin-table-actions {
    text-align: right;
    white-space: nowrap;
    padding-right: 0 !important;
}

.admin-page .admin-compact-button,
.admin-page .page-header .admin-compact-button,
.admin-page .form-actions .admin-compact-button,
.admin-page .admin-table-actions .button {
    min-height: 24px !important;
    height: 24px !important;
    padding: 1px 7px !important;
    font-size: 12px !important;
    line-height: 1 !important;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.admin-badge.is-active {
    background: #eff8f1;
    color: #225e36;
}

.admin-badge.is-inactive {
    background: #fff3f1;
    color: var(--danger);
}

.admin-checkbox-row {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.admin-checkbox-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    min-height: 14px;
    padding: 0;
    margin: 0;
}

.admin-settings-checkbox {
    margin: 0 0 14px;
}

.admin-danger-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    border-color: #e1b7b1;
    background: #fff8f7;
}

.admin-danger-panel h2 {
    margin: 0 0 2px;
    font-size: 18px;
}

.admin-danger-panel p,
.admin-danger-panel form {
    margin: 0;
}

.friends-page .page-header {
    align-items: flex-start;
}

.friend-section {
    margin-bottom: 14px;
    padding: 16px;
}

.friend-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.friend-section > p {
    margin: 0;
}

.friends-primary-column {
    display: grid;
    width: min(760px, 100%);
}

.friend-list {
    display: grid;
}

.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 43px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.friend-row:last-child {
    border-bottom: 0;
}

.friend-name {
    display: grid;
    min-width: 0;
    font-size: 14px;
}

.friend-name strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-name span,
.friend-status {
    color: var(--muted);
    font-size: 13px;
}

.friend-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}

.friend-actions form,
.friend-row form {
    margin: 0;
}

.friend-search-panel {
    margin-top: 2px;
}

.friend-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 420px;
    margin-bottom: 10px;
}

.friend-search-form input {
    min-height: 32px;
    height: 32px;
    padding: 5px 8px;
    font-size: 13px;
}

.friend-search-results {
    max-width: 620px;
}

.flash-stack {
    padding-bottom: 0;
}

.flash {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.flash-success {
    border-color: #b5d5bd;
    background: #eff8f1;
    color: #225e36;
}

.flash-error {
    border-color: #e1b7b1;
    background: #fff3f1;
    color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: 14px;
}

.field-hint {
    margin: -2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.register-password-row {
    align-items: start;
}

.register-password-row .form-row {
    margin-bottom: 0;
}

.register-password-row input[type="password"] {
    height: 44px;
    min-height: 44px;
}

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

.owned-shares-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.owned-shares-section .section-header {
    margin-bottom: 8px;
}

.owned-share-list {
    display: grid;
}

.owned-share-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.owned-share-row:last-child {
    border-bottom: 0;
}

.owned-share-summary {
    display: grid;
    min-width: 0;
    font-size: 14px;
}

.owned-share-summary a {
    overflow: hidden;
    color: var(--text);
    font-weight: 650;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owned-share-summary a:hover {
    color: var(--accent-strong);
}

.owned-share-summary span {
    color: var(--muted);
    font-size: 13px;
}

.list-share-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-share-list {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    flex: 1 1 420px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.row-actions form {
    margin: 0;
}

.tour-row .button,
.tour-row .button-danger {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 13px;
}

.tour-row .icon-action {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 16px;
}

.photo-actions .icon-action {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 16px;
}

.tour-row,
.empty-state {
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.tour-row.is-readonly-content {
    grid-template-columns: 72px minmax(0, 1fr);
}

.tour-row.is-dragging {
    opacity: 0.45;
}

.tour-drag-handle {
    min-width: 20px;
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    font-size: 14px;
    letter-spacing: 0;
}

.tour-drag-handle:active {
    cursor: grabbing;
}

.tour-thumb {
    display: grid;
    place-items: center;
    width: 72px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #edf1eb;
    color: var(--muted);
    text-decoration: none;
    font-weight: 800;
}

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

.tour-thumb .tour-map-thumb {
    background: #edf1eb;
}

.tour-title {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.25;
}

.tour-title a {
    color: var(--text);
    text-decoration: none;
}

.tour-title a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 9px;
    color: var(--muted);
    font-size: 13px;
}

.page-meta {
    margin-top: 10px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eaf2ec;
    color: #265d3c;
    font-size: 12px;
    font-weight: 650;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.detail-panel {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-panel.wide {
    grid-column: 1 / -1;
}

.detail-panel h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.detail-panel p {
    margin: 0;
}

.external-link-row {
    margin-top: 10px !important;
    overflow-wrap: anywhere;
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(110px, 0.45fr) 1fr;
    gap: 8px 14px;
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
}

.tour-route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
}

.tour-route-meta span {
    display: inline-flex;
    align-items: center;
}

.tour-route-meta span + span::before {
    content: "·";
    margin-right: 8px;
    color: #9aa69b;
}

.detail-list dd {
    margin: 0;
}

.sidebar-checkbox-list {
    display: grid;
    gap: 1px;
}

.sidebar-checkbox-row {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 28px;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
}

.sidebar-checkbox-row:hover {
    background: #f3f6f1;
}

.sidebar-checkbox-row input {
    width: auto;
    min-height: auto;
    margin: 0;
}

.sidebar-checkbox-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.activity-choice {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf7;
    font-size: 13px;
    font-weight: 650;
}

.activity-choice input {
    width: 13px;
    min-height: 13px;
    height: 13px;
    margin: 0;
}

.rating-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
}

.rating-star {
    display: inline-flex;
    align-items: center;
    color: #b9c0b7;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.rating-star input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rating-star:hover,
.rating-star:hover ~ .rating-star,
.rating-star:has(input:checked),
.rating-star:has(input:checked) ~ .rating-star {
    color: #d39b24;
}

.rating-star:focus-within span[aria-hidden="true"] {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.rating-display {
    display: inline-flex;
    gap: 1px;
    color: #b9c0b7;
    font-size: 14px;
    line-height: 1;
}

.rating-display .is-filled {
    color: #d39b24;
}

.sidebar-save-button {
    width: 100%;
    min-height: 28px;
    margin-top: 8px;
    padding: 4px 7px;
    font-size: 13px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-section {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form-section h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-header h2,
.section-header p {
    margin: 0;
}

.gpx-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.gpx-stats span {
    display: inline-flex;
    gap: 5px;
    align-items: baseline;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf6;
    color: var(--muted);
    font-size: 14px;
}

.gpx-stats strong {
    color: var(--text);
}

.track-data {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.tour-owner-note {
    margin: 8px 0 0;
    text-align: right;
}

.form-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.file-section {
    margin-top: 16px;
}

.upload-form {
    display: grid;
    gap: 12px;
    align-items: end;
    grid-template-columns: minmax(0, 1fr) auto;
}

.gpx-actions-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.gpx-actions-row .compact-button {
    align-self: flex-end;
    height: 28px;
    min-height: 28px;
    line-height: 1;
}

.gpx-upload-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.gpx-upload-form .form-row {
    width: 360px;
    margin: 0;
}

.gpx-upload-form input[type="file"] {
    width: 100%;
    min-height: 28px;
}

.gpx-delete-form {
    display: flex;
    align-items: flex-end;
    margin: 0;
}

.gpx-create-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
}

.gpx-create-form .form-row {
    width: 220px;
    margin: 0;
}

.gpx-create-form input {
    min-height: 28px;
    height: 28px;
    padding: 4px 7px;
    font-size: 13px;
}

.gpx-create-form label {
    font-size: 13px;
}

.gpx-editor-actions {
    display: grid;
    grid-template-columns: repeat(4, auto);
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    column-gap: 8px;
    row-gap: 6px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.gpx-editor-heading {
    max-width: 430px;
    min-width: 0;
}

.gpx-editor-heading p {
    max-width: 360px;
}

.gpx-routing-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.gpx-routing-toggle input {
    width: 13px;
    height: 13px;
    min-height: 13px;
    margin: 0;
}

.gpx-routing-profile {
    width: auto;
    min-height: 28px;
    padding: 3px 22px 3px 7px;
    font-size: 13px;
}

.gpx-reduce-tolerance {
    width: auto;
    min-height: 28px;
    padding: 3px 22px 3px 7px;
    font-size: 13px;
}

.gpx-editor-map {
    position: relative;
    height: min(68vh, 620px);
    min-height: 420px;
}

.track-point-context-menu {
    position: absolute;
    z-index: 1200;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(30, 39, 32, 0.18);
}

.track-point-context-menu button {
    min-height: 28px;
    padding: 4px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--danger);
    font-size: 13px;
    font-weight: 650;
    text-align: left;
}

.track-point-context-menu button:hover,
.track-point-context-menu button:focus {
    background: rgba(163, 59, 50, 0.1);
}

.gpx-editor-map .leaflet-interactive {
    cursor: crosshair;
}

.gpx-editor-map-stats {
    display: none;
}

.gpx-editor-map-actions {
    display: none;
}

.gpx-editor-map:fullscreen .gpx-editor-map-stats {
    position: absolute;
    z-index: 1000;
    left: 10px;
    top: 72px;
    display: flex;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #bcc8b8;
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.gpx-editor-map:fullscreen .gpx-editor-map-stats strong {
    color: var(--text);
}

.gpx-editor-map:fullscreen .gpx-editor-map-actions {
    position: absolute;
    z-index: 1000;
    left: 10px;
    top: 112px;
    display: grid;
    gap: 8px;
}

.gpx-editor-map-action-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gpx-editor-map:fullscreen .gpx-editor-map-actions .compact-button {
    min-height: 28px;
    height: 28px;
    padding: 4px 7px;
    font-size: 13px;
}

.track-edit-marker {
    display: grid;
    place-items: center;
}

.track-edit-marker span {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.track-edit-marker.is-selected span {
    width: 20px;
    height: 20px;
    background: #d39b24;
    box-shadow: 0 0 0 3px rgba(211, 155, 36, 0.24), 0 1px 5px rgba(0, 0, 0, 0.35);
}

.muted.is-error {
    color: var(--danger);
}

.route-map {
    position: relative;
    width: 100%;
    height: 420px;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #eef1ea;
}

.route-map:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
}

.map-fullscreen-button {
    position: absolute;
    z-index: 1000;
    top: 10px;
    right: 10px;
    min-height: 34px;
    padding: 6px 10px;
    border-color: #bcc8b8;
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.route-marker {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.route-marker-start {
    background: #237c52;
}

.route-arrow {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
}

.route-finish-flag {
    position: relative;
    width: 26px;
    height: 30px;
}

.route-finish-flag::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 2px;
    width: 3px;
    height: 26px;
    border-radius: 2px;
    background: #26342b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.route-finish-flag span {
    position: absolute;
    left: 6px;
    top: 3px;
    width: 18px;
    height: 12px;
    border: 1px solid #26342b;
    background:
        linear-gradient(45deg, #fff 25%, #222 25%, #222 50%, #fff 50%, #fff 75%, #222 75%),
        #fff;
    background-size: 8px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.route-arrow span {
    display: block;
    width: 24px;
    height: 24px;
    transform-origin: center;
}

.route-arrow svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-arrow svg path {
    stroke: #174c35;
    stroke-width: 2.8;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.photo-card {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.photo-card.is-cover {
    border-color: var(--accent);
}

.photo-open-link {
    display: block;
}

.photo-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #edf1eb;
}

.photo-open-link:hover img {
    opacity: 0.92;
}

.photo-card figcaption {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 13px;
}

.photo-card figcaption span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-card figcaption strong {
    color: var(--accent-strong);
}

.photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 10px;
}

.photo-actions form {
    margin: 0;
}

.photo-actions button,
.photo-actions .button {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 13px;
}

.compact {
    margin-top: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.comment-item {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8faf7;
}

.comment-item header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
}

.comment-item header strong {
    color: var(--text);
}

.comment-item header div {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-item p {
    margin: 0;
}

.comment-form {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.comment-form .form-row {
    margin-bottom: 0;
}

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

.comment-actions form {
    margin: 0;
}

.comment-edit-toggle,
.comment-delete-button {
    font-size: 13px;
}

.comment-delete-button {
    color: var(--danger);
}

.comment-edit-form {
    margin-top: 10px;
}

.comment-edit-form[hidden] {
    display: none;
}

@media (max-width: 640px) {
    .topbar,
    .page-header,
    .tour-row,
    .public-layout .tour-row,
    .tour-row.is-readonly-content {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .tour-thumb {
        width: 100%;
        max-width: 220px;
    }

    .tour-row .tour-summary {
        order: 1;
    }

    .tour-row .row-actions {
        order: 2;
    }

    .tour-row .tour-thumb {
        order: 3;
    }

    .tour-row .tour-drag-handle {
        order: 4;
    }

    .workbench-layout,
    .tour-editor-layout {
        grid-template-columns: 1fr;
    }

    .workbench-layout > .content-panel {
        order: 1;
    }

    .workbench-layout > .sidebar-panel {
        order: 2;
    }

    .tour-editor-layout .content-panel {
        order: 1;
    }

    .tour-editor-layout .sidebar-panel {
        order: 2;
    }

    .sidebar-panel {
        position: static;
    }

    .mobile-jump-link {
        display: inline-flex;
        align-items: center;
        min-height: 28px;
        padding: 3px 0;
        color: var(--accent-strong);
        font-size: 13px;
        font-weight: 650;
        text-decoration: none;
    }

    .page-actions {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .search-field {
        width: 116px;
        min-width: 116px;
    }

    .range-filter input {
        width: 66px;
    }

    .userbar {
        justify-content: space-between;
    }

    .form-two,
    .detail-grid,
    .profile-grid,
    .row-actions,
    .upload-form {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .detail-header-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .detail-header-actions .compact-button {
        width: auto;
        flex: 0 0 auto;
    }

    .tour-row .row-actions {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 5px;
    }

    .friend-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .owned-share-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .profile-grid-wide {
        grid-column: auto;
    }
}
