/*
    Guest-Info builder. A calm work tool in the guest books' own colours (the viewer's green on
    off-white). Screen sizes: phone < 600px, tablet 600-959px, desktop >= 960px.
*/

@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope.woff") format("woff");
    font-weight: 400 700;
    font-display: swap;
}

:root {
    --bg: #f6f2ec;
    --surface: #fff;
    --ink: #1d2622;
    --muted: rgba(29, 38, 34, 0.66);
    --line: rgba(29, 38, 34, 0.14);
    --brand: #1f4a3c;
    --brand-hover: #173a2f;
    --on-brand: #fff;
    --brand-soft: #e5eee9;
    --danger: #b3261e;
    --danger-soft: #fbe9e7;
    --warning: #6b4e00;
    --warning-soft: #fff4d6;
    --radius: 14px;
    --radius-small: 8px;
    --shadow: 0 1px 2px rgba(29, 38, 34, 0.06), 0 4px 16px rgba(29, 38, 34, 0.06);
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --side: 16px;
}

@media (min-width: 600px) {
    :root { --side: 24px; }
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 var(--font);
}

a {
    color: var(--brand);
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 8px;
}

h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

img {
    max-width: 100%;
}

/* ---- top bar ---- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--side);
    background: var(--brand);
    color: var(--on-brand);
}

.topbar a {
    color: inherit;
    text-decoration: none;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
}

.topbar__brand img {
    border-radius: 6px;
}

.topbar__site {
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}

.topbar__space {
    flex: 1;
}

.topbar__user {
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
}

.topbar__logout {
    margin: 0;
}

.topbar .button--quiet {
    color: var(--on-brand);
    border-color: rgba(255, 255, 255, 0.45);
}

@media (max-width: 599px) {
    .topbar__user { display: none; }
    .topbar__brand span { display: none; }
}

/* ---- page ---- */

.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px var(--side) 64px;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.page-head h1 {
    margin: 0;
}

.crumbs {
    margin-bottom: 8px;
    font-size: 14px;
}

.crumbs a::before {
    content: "‹ ";
}

.crumbs a + a::before {
    content: " › ";
}

.section-title {
    margin-top: 32px;
}

/* a translation written in lower case ("mere") still starts a heading with a capital */
.section-title::first-letter, .tile__title::first-letter, h1::first-letter, h2::first-letter {
    text-transform: uppercase;
}

.hint {
    color: var(--muted);
    margin: 4px 0 12px;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.panel--narrow {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 600px) {
    .panel { padding: 28px; }
}

/* ---- messages ---- */

.notice {
    padding: 12px 16px;
    border-radius: var(--radius-small);
    background: var(--surface);
    border: 1px solid var(--line);
    margin: 0 0 12px;
}

.notice--error {
    background: var(--danger-soft);
    border-color: rgba(179, 38, 30, 0.35);
    color: #7a1a14;
}

.notice--warning {
    background: var(--warning-soft);
    border-color: rgba(107, 78, 0, 0.25);
    color: var(--warning);
}

.notice--busy {
    background: var(--brand-soft);
    border-color: rgba(31, 74, 60, 0.25);
}

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

.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-small);
    background: var(--brand);
    color: var(--on-brand);
    margin: 0 0 16px;
}

.flash--error {
    background: var(--danger);
}

.flash__close {
    margin-left: auto;
    background: none;
    border: 0;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--brand-soft);
    color: var(--brand);
    white-space: nowrap;
}

.badge--beta {
    background: #f2c14e;
    color: #1d2622;
}

.badge--busy {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge--error {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ---- forms ---- */

.field {
    display: block;
    margin-bottom: 16px;
}

.field__label {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

.field__help {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.field__error {
    display: block;
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

/* a file input behind a translated button (forms.js) */
.file-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.file-pick__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.file-pick__names {
    color: var(--muted);
    font-size: 14px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.check input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.actions--start {
    justify-content: flex-start;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--brand);
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover {
    background: var(--brand-hover);
}

.button:disabled, .button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

.button--outline, .button--quiet {
    background: transparent;
    color: var(--brand);
}

.button--outline:hover, .button--quiet:hover {
    background: var(--brand-soft);
}

.topbar .button--quiet:hover {
    background: rgba(255, 255, 255, 0.12);
}

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

.button--danger:hover {
    background: #8f1e18;
}

.button--small {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 14px;
}

/* ---- guest books ---- */

.site-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.site-list__item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

.site-list__item:hover {
    outline: 2px solid var(--brand-soft);
}

.site-list__name {
    font-weight: 700;
}

.site-list__web {
    grid-column: 1;
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-list__status {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    color: var(--muted);
    font-size: 13px;
}

/* ---- tiles (TaskID 5443931: text only, one line of explanation) ---- */

.tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .tiles { grid-template-columns: repeat(3, 1fr); }
    .tiles--small { grid-template-columns: repeat(4, 1fr); }
}

.tiles > li {
    display: flex;
}

.tile {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

a.tile:hover {
    border-color: var(--brand);
}

.tile__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    color: var(--brand);
}

.tile__count {
    padding: 0 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    font-size: 12px;
    line-height: 20px;
}

.tile__external {
    margin-left: auto;
    color: var(--muted);
}

.tile__text {
    color: var(--muted);
    font-size: 14px;
}

.tiles--small .tile {
    padding: 14px 16px;
}

.tiles--small .tile__title {
    font-size: 15px;
}

.tile--disabled {
    opacity: 0.6;
}

.tile__note {
    font-size: 13px;
    font-style: italic;
}

/* ---- restore / delete ---- */

.danger-zone {
    background: var(--surface);
    border: 1px solid rgba(179, 38, 30, 0.25);
    border-radius: var(--radius);
}

.danger-zone__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
}

.danger-zone__item + .danger-zone__item {
    border-top: 1px solid var(--line);
}

.danger-zone__item > div {
    flex: 1 1 320px;
}

.danger-zone__item h3 {
    margin: 0;
}

.danger-zone__item .hint {
    margin-bottom: 0;
}

/* ---- dialogs ---- */

.dialog {
    width: min(520px, calc(100vw - 32px));
    border: 0;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
    color: var(--ink);
}

.dialog::backdrop {
    background: rgba(29, 38, 34, 0.45);
}

/* ---- login ---- */

.login {
    margin-top: 32px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.badge--muted {
    background: rgba(29, 38, 34, 0.08);
    color: var(--muted);
}

/* ---- card list ("Edit content") ---- */

.card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.card-row {
    display: grid;
    grid-template-columns: auto 80px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-row--hidden {
    opacity: 0.6;
}

/* drag handles show only when the order can be dragged (sortable-save.js); otherwise up/down buttons */
.handle {
    color: var(--muted);
    letter-spacing: -3px;
    user-select: none;
    visibility: hidden;
}

.is-sortable .handle {
    visibility: visible;
    cursor: grab;
}

.is-sortable .move {
    display: none !important;
}

.card-row__picture {
    display: block;
    width: 80px;
    height: 55px;
    border-radius: 6px;
    background: var(--bg);
    overflow: hidden;
}

.card-row__picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-row__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.card-row__title {
    font-weight: 700;
    color: var(--brand);
}

.card-row__text {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-row__badges {
    display: flex;
    gap: 6px;
}

.card-row__tools {
    display: flex;
    gap: 6px;
    align-items: center;
}

.card-row__tools form {
    margin: 0;
    display: flex;
    gap: 2px;
}

@media (max-width: 599px) {
    .card-row {
        grid-template-columns: auto 56px 1fr;
    }
    .card-row__picture {
        width: 56px;
        height: 40px;
    }
    .card-row__tools {
        grid-column: 2 / -1;
    }
}

/* ---- card editor ---- */

.editor {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .editor {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        align-items: start;
    }
    .editor__preview {
        position: sticky;
        top: 72px;
    }
}

.editor__main {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.editor__preview-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius-small) var(--radius-small) 0 0;
    background: var(--bg);
}

.md-toolbar + textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.md-toolbar__button {
    min-width: 34px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.md-toolbar__button:hover {
    background: #fff;
    border-color: var(--line);
}

.md-toolbar__insert {
    width: auto;
    margin-left: auto;
    padding: 4px 8px;
    font-size: 14px;
}

.preview-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 20px;
    max-height: 70vh;
    overflow: auto;
}

.preview-card__title {
    font-size: 22px;
    margin-bottom: 12px;
}

.md p {
    margin: 0 0 10px;
}

.md ul, .md ol {
    padding-left: 20px;
}

/* ---- pictures ---- */

.picture {
    border: 0;
    padding: 0;
    margin: 0 0 16px;
}

.picture__current {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.picture__current img, .picture__empty {
    width: 240px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-small);
    background: var(--bg);
}

.picture__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    border: 1px dashed var(--line);
}

.picture__info {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}

.picture__change {
    margin-top: 12px;
}

.picture__change summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 12px;
}

.picture__group {
    font-size: 14px;
    margin: 12px 0 8px;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    max-height: 340px;
    overflow: auto;
    padding: 2px;
}

.picture-grid__item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.picture-grid__item input {
    position: absolute;
    top: 6px;
    left: 6px;
    accent-color: var(--brand);
}

.picture-grid__item img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 6px;
    border: 3px solid transparent;
}

.picture-grid__item input:checked + img {
    border-color: var(--brand);
}

.picture-grid__item--icon img {
    object-fit: contain;
    padding: 10px;
    background: var(--bg);
}

.picture-grid__label {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- pictures page ---- */

.upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.upload-row .field {
    flex: 1 1 280px;
    margin-bottom: 0;
}

.image-grid {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.image-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: #fff;
}

.image-tile.is-first {
    border: 2px solid var(--brand);
}

.image-tile__picture {
    position: relative;
    display: block;
}

.image-tile__picture img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.image-tile__start {
    display: none;
    position: absolute;
    left: 6px;
    top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 12px;
    font-weight: 700;
}

.is-first .image-tile__start {
    display: block;
}

.is-first .image-tile__first {
    display: none;
}

.image-tile__info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.image-tile__select input {
    width: 18px;
    height: 18px;
    accent-color: var(--danger);
}

.image-tile__tools {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.image-tile__tools form {
    margin: 0;
    display: flex;
    gap: 2px;
}

.two-columns {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .two-columns {
        grid-template-columns: 1fr 1fr;
    }
}

.logo-preview {
    display: inline-flex;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-small);
    background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.logo-preview img {
    max-height: 100px;
    max-width: 260px;
}

.logo-preview--round img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---- simple lists (links, questions, documents, menu) ---- */

.row-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.row-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.row-list__main {
    flex: 1 1 260px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.row-list__title {
    font-weight: 700;
}

.row-list__sub {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.row-list__sub {
    white-space: nowrap;
}

.row-list__tools {
    display: flex;
    gap: 6px;
    align-items: center;
}

.row-list__tools form {
    margin: 0;
}

.row-list__thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg);
}

code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 13px;
    background: rgba(29, 38, 34, 0.06);
    padding: 1px 4px;
    border-radius: 4px;
}

/* ---- settings ---- */

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
}

.gateway {
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    padding: 16px;
    margin: 8px 0 12px;
}

.gateway legend {
    font-weight: 700;
    padding: 0 6px;
}

.actions--sticky {
    position: sticky;
    bottom: 0;
    padding: 12px 0;
    background: linear-gradient(to top, var(--bg) 70%, rgba(246, 242, 236, 0));
    margin-bottom: 16px;
}

.copy-row {
    display: flex;
    gap: 8px;
}

.copy-row input {
    font-family: ui-monospace, Consolas, monospace;
}

/* ---- menu ---- */

.menu-group__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.menu-group__head h2 {
    flex: 1;
    margin: 0;
}

.row-list--flat .row-list__item {
    box-shadow: none;
    border: 1px solid var(--line);
}

.menu-price {
    font-weight: 700;
    white-space: nowrap;
}

.picture-small {
    display: block;
    width: 160px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-small);
    margin-bottom: 6px;
}

/* ---- share / ChatGPT ---- */

.qr {
    display: block;
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: #fff;
}

textarea.code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 13px;
    min-height: 0;
    white-space: pre;
    overflow-x: auto;
}

.plain-list {
    padding-left: 18px;
}

.plain-list li {
    margin-bottom: 6px;
}

.topbar__language {
    margin: 0;
}

.topbar__language select {
    width: auto;
    padding: 4px 8px;
    border-color: rgba(255, 255, 255, 0.45);
    background: transparent;
    color: var(--on-brand);
    font-size: 14px;
}

.topbar__language option {
    color: var(--ink);
}

.support-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px var(--side);
    background: #f2c14e;
    color: #1d2622;
    font-weight: 700;
}

.support-bar form {
    margin: 0;
}

.topbar__admin {
    font-weight: 700;
    opacity: 0.9;
}

/* ---- admin tables ---- */

.table-filter {
    width: min(320px, 100%);
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th, .data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--bg);
    font-size: 13px;
    white-space: nowrap;
}

.data-table__sub {
    color: var(--muted);
    font-size: 12px;
}

.data-table__tools {
    white-space: nowrap;
}

.data-table__prompt {
    max-width: 480px;
}

.data-table__prompt summary {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.confirm-input {
    width: 140px;
}

.edit-table {
    width: 100%;
    border-collapse: collapse;
}

.edit-table td {
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}

.edit-table__tools {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}

.inline-form input[type="text"] {
    flex: 1 1 180px;
    width: auto;
    padding: 6px 10px;
}

.inline-form select {
    width: auto;
    padding: 6px 8px;
}

.keep-spaces {
    white-space: pre;
    font-family: ui-monospace, Consolas, monospace;
}

.log-text {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 480px;
    overflow: auto;
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-small);
    font-size: 13px;
}

.log-entry {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
}

.log-entry summary {
    cursor: pointer;
    font-weight: 700;
}

/* ---- design page ---- */

@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond.woff") format("woff"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "ga-sans-serif"; src: url("../fonts/sans-serif.woff") format("woff"); font-display: swap; }
@font-face { font-family: "ga-serif"; src: url("../fonts/serif.woff") format("woff"); font-display: swap; }
@font-face { font-family: "ga-ibarra-real-nova"; src: url("../fonts/ibarra-real-nova.woff") format("woff"); font-display: swap; }
@font-face { font-family: "ga-square-peg"; src: url("../fonts/square-peg.woff") format("woff"); font-display: swap; }
@font-face { font-family: "ga-nunito"; src: url("../fonts/nunito.woff") format("woff"); font-display: swap; }
@font-face { font-family: "ga-pacifico"; src: url("../fonts/pacifico.woff") format("woff"); font-display: swap; }

.design {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .design {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }
    .design__preview {
        position: sticky;
        top: 72px;
    }
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    cursor: pointer;
}

.color-field input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.color-field .field__label {
    margin: 0;
    font-size: 14px;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.font-choice {
    position: relative;
    display: block;
    cursor: pointer;
}

.font-choice input {
    position: absolute;
    top: 10px;
    right: 10px;
    accent-color: var(--brand);
}

.font-choice__sample {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 36px 12px 12px;
    border: 2px solid var(--line);
    border-radius: var(--radius-small);
    min-height: 84px;
}

.font-choice input:checked + .font-choice__sample {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.font-choice__title {
    font-size: 22px;
    line-height: 1.15;
}

.font-choice__text {
    font-size: 13px;
    color: var(--muted);
}

.choice-row--field {
    border: 0;
    padding: 0;
    margin: 0 0 12px;
}

.range-field input[type="range"] {
    width: 100%;
    accent-color: var(--brand);
}

.range-field output {
    font-weight: 400;
    color: var(--muted);
    margin-left: 6px;
}

.device-switch {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.device-switch .is-active {
    background: var(--brand);
    color: var(--on-brand);
}

/* the preview imitates the guest book's start page (GuestInfoMvc site.css), scaled down */
.gb-frame {
    margin: 0 auto;
    border: 8px solid #1d2622;
    border-radius: 24px;
    overflow: hidden;
    background: #1d2622;
    transition: width 0.2s;
}

.gb-frame[data-frame="phone"] { width: min(360px, 100%); }
.gb-frame[data-frame="tablet"] { width: min(560px, 100%); }
.gb-frame[data-frame="desktop"] { width: 100%; border-radius: 12px; }

.gb-preview {
    --header-bg: #1f4a3c;
    --header-text: #fff;
    --accent: #1f4a3c;
    --on-accent: #fff;
    --surface: #f6f2ec;
    --panel-bg: #fff;
    --card-bg: #fff;
    --card-ink: #1d2622;
    --card-muted: rgba(29, 38, 34, 0.66);
    --ink: #1d2622;
    --hero-height: 420px;
    --card-gap: 24px;
    --cards-small: 1;
    --cards-medium: 3;
    --cards-large: 4;
    --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
    --body: "Manrope", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --cols: var(--cards-small);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--body);
    max-height: 70vh;
    overflow-y: auto;
}

.gb-frame[data-frame="tablet"] .gb-preview { --cols: var(--cards-medium); }
.gb-frame[data-frame="desktop"] .gb-preview { --cols: var(--cards-large); }

.gb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 6px 14px;
    background: var(--header-bg);
    color: var(--header-text);
}

.gb-preview--pinned .gb-bar {
    position: sticky;
    top: 0;
    z-index: 1;
}

.gb-bar__logo {
    max-height: 32px;
    max-width: 80px;
}

.gb-bar__title {
    font-family: var(--display);
    font-weight: var(--display-weight, 600);
    font-size: 18px;
}

.gb-hero {
    position: relative;
    height: calc(var(--hero-height) * 0.5);
    background: var(--header-bg);
    overflow: hidden;
}

.gb-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gb-hero__name {
    position: absolute;
    left: 14px;
    bottom: 12px;
    color: #fff;
    font-family: var(--display);
    font-weight: var(--display-weight, 500);
    font-size: 26px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.gb-cards {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: calc(var(--card-gap) * 0.6);
    padding: 14px;
}

.gb-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--card-ink);
    box-shadow: 0 1px 2px rgba(29, 38, 34, 0.08), 0 6px 18px rgba(29, 38, 34, 0.08);
}

.gb-card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

/* a library icon is shown whole on a tint, as the guest book does */
.gb-card--icon img {
    aspect-ratio: 16 / 10;
    object-fit: contain;
    padding: 14px;
    background: color-mix(in srgb, var(--accent) 8%, var(--card-bg));
}

.gb-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px;
}

.gb-card__title {
    font-family: var(--display);
    font-weight: var(--display-weight, 600);
    font-size: 18px;
    line-height: 1.2;
}

.gb-card__button {
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 700;
}

/* ---- design with AI ---- */

.ai-panel {
    border: 2px solid var(--brand-soft);
}

.ai-turns {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.ai-turn p {
    margin: 0;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 90%;
}

.ai-turn__you {
    margin-left: auto !important;
    background: var(--brand);
    color: var(--on-brand);
    width: fit-content;
}

.ai-turn__ai {
    margin-top: 6px !important;
    background: var(--bg);
}

.ai-turn__ai--error {
    background: var(--danger-soft);
    color: var(--danger);
}

.ai-proposal {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: var(--radius-small);
    background: var(--brand-soft);
}

.ai-proposal form {
    margin: 0;
}

.ai-ask textarea {
    min-height: 0;
}

.ai-ask__busy {
    margin-right: auto;
    color: var(--muted);
    font-size: 14px;
    align-self: center;
}

/* a whole new look: the preset buttons above the wish, one small form each */
.ai-presets {
    margin-bottom: 16px;
}

.ai-presets .actions {
    margin-top: 0;
}

.ai-presets form {
    margin: 0;
}

.ai-presets .field__help {
    margin-bottom: 0;
}

/* ---- the hidden attribute always hides ---- */

/* a class that sets display (a button, a flex row, the Markdown toolbar) would otherwise win over it */
[hidden] {
    display: none !important;
}

/* ---- "Write with AI" in the card editor (card-ai.js) ---- */

/* the panel sits inside the editor's white box: the soft border is enough, no second shadow */
.panel.card-ai {
    margin: 0 0 16px;
    padding: 16px;
    box-shadow: none;
}

.card-ai h2 {
    font-size: 17px;
}

.card-ai .field {
    margin-bottom: 10px;
}

.card-ai__quick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

/* the AI's answer, the place of a new card and the note that it is saved hidden */
.card-ai > .notice, .card-ai > .hint {
    margin: 12px 0 0;
}

.card-ai__picture {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.card-ai__picture img {
    flex: none;
    width: 120px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--radius-small);
    background: var(--bg);
}

.card-ai__picture-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    font-size: 14px;
}

/* ---- "What guests asked" under the card list ---- */

.guest-questions {
    margin-top: 24px;
    /* the page jumps here (#guest-questions): not under the top bar, which stays in view */
    scroll-margin-top: 72px;
}

.guest-questions__example {
    font-style: italic;
    overflow-wrap: anywhere;
}

/* a connected guest book whose link is switched off or whose company is closed */
.data-table__row--muted td {
    color: var(--muted);
}
