:root {
    --terracotta: #c1592b;
    --terracotta-dark: #9c4620;
    --sage: #7c8a6e;
    --sand: #f4efe6;
    --sand-dark: #e9e0cf;
    --ink: #2f2a24;
    --muted: #79705f;
    --accepted: #4f7a51;
    --danger: #a33a3a;
    --card-radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--sand);
    color: var(--ink);
    line-height: 1.5;
}

a { color: var(--terracotta-dark); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.site-header {
    background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
    color: #fff;
    padding: 20px 16px;
}

.site-header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.site-header h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
}

.site-header p {
    margin: 0;
    color: #f6e6da;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    padding-bottom: 2px;
}

.site-nav a:first-child { margin-left: 0; }

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

h2 {
    margin-top: 40px;
    color: var(--terracotta-dark);
    border-bottom: 2px solid var(--sand-dark);
    padding-bottom: 8px;
}

h2.no-border-top {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.1rem;
}

.travel-table tr.is-pending td {
    color: var(--muted);
    font-style: italic;
}

#trip-map {
    height: 420px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--sand-dark);
    z-index: 0;
}

ul.flw-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.flw-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--sand-dark);
}

.flw-item:last-child {
    border-bottom: none;
}

.flw-item p {
    margin: 4px 0;
}

.flw-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.on-itinerary-badge {
    background: var(--accepted);
    color: #fff;
}

.card {
    background: #fff;
    border: 1px solid var(--sand-dark);
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.birthday-note {
    font-weight: 600;
    margin-top: 0;
}

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

table.pre-days td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--sand-dark);
    vertical-align: top;
}

.pre-date { font-weight: 600; white-space: nowrap; }

.day-heading {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.day-tag {
    background: var(--sage);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 4px;
}

.day-heading h3 {
    margin: 0 0 2px;
}

table.itinerary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.itinerary-table th {
    text-align: left;
    border-bottom: 2px solid var(--sand-dark);
    padding: 6px 8px;
    font-size: 0.85rem;
    color: var(--muted);
}

.itinerary-table td {
    padding: 8px;
    border-bottom: 1px solid var(--sand-dark);
    vertical-align: top;
}

.time-cell {
    font-weight: 600;
    white-space: nowrap;
    width: 140px;
    color: var(--terracotta-dark);
}

.day-note {
    background: var(--sand);
    border-left: 3px solid var(--sage);
    padding: 10px 14px;
    border-radius: 6px;
    margin: 12px 0;
}

.suggestions {
    margin-top: 18px;
    border-top: 1px dashed var(--sand-dark);
    padding-top: 14px;
}

.suggestions h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

ul.suggestion-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.suggestion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--sand);
    margin-bottom: 6px;
}

.suggestion.is-accepted {
    background: #eaf3ea;
}

.suggestion-name { font-weight: 600; }

.badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sand-dark);
    color: var(--muted);
}

.suggestion.is-accepted .badge {
    background: var(--accepted);
    color: #fff;
}

.suggestion-actions {
    display: flex;
    gap: 10px;
}

.link-button {
    background: none;
    border: none;
    color: var(--terracotta-dark);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
}

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

.suggestion-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-form input[type=text] {
    flex: 1 1 160px;
    padding: 8px 10px;
    border: 1px solid var(--sand-dark);
    border-radius: 6px;
    font-size: 0.95rem;
}

button, .suggestion-form button {
    background: var(--terracotta);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

button:hover { background: var(--terracotta-dark); }

details {
    margin-bottom: 14px;
    border: 1px solid var(--sand-dark);
    border-radius: 8px;
    padding: 10px 14px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--terracotta-dark);
}

details ul { margin: 10px 0 4px; padding-left: 20px; }

.acceptance-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.acceptance-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--sand-dark);
}

.site-footer {
    text-align: center;
    padding: 20px;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sand), var(--sand-dark));
}

.login-card {
    background: #fff;
    padding: 32px;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.login-card h1 {
    font-size: 1.3rem;
    color: var(--terracotta-dark);
    margin-bottom: 4px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.login-card input {
    padding: 10px;
    border: 1px solid var(--sand-dark);
    border-radius: 6px;
    font-size: 1rem;
}

.json-editor {
    width: 100%;
    min-height: 60vh;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 14px;
    border: 1px solid var(--sand-dark);
    border-radius: 8px;
    background: #fdfcfa;
    color: var(--ink);
    box-sizing: border-box;
    resize: vertical;
    margin-bottom: 12px;
}

.save-success {
    color: var(--accepted);
    font-weight: 600;
}

.error { color: var(--danger); }
.notice {
    background: var(--sand);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: left;
}

@media (max-width: 600px) {
    .site-header-inner { flex-direction: column; align-items: flex-start; }
    .site-nav a { margin-left: 0; margin-right: 14px; }
    .time-cell { width: auto; }
    .itinerary-table, .itinerary-table tbody, .itinerary-table tr, .itinerary-table td {
        display: block;
        width: 100%;
    }
    .time-cell { border-bottom: none; padding-bottom: 0; }
}
