:root {
    --brand: #1f5f8b;
    --brand-dark: #163f5c;
    --bg: #eef2f5;
    --line: #d7dee4;
    --err: #c0392b;
    --ok: #1e7e4f;
    --warn: #8a6d00;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #1d2733;
    background: var(--bg);
    line-height: 1.45;
}
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    background: var(--brand); color: #fff;
    padding: .75rem 1rem;
}
.topbar a.link { color: #fff; text-decoration: underline; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.card {
    max-width: 920px; margin: 1.25rem auto; padding: 1.25rem 1.5rem;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.card.narrow { max-width: 420px; margin-top: 8vh; }
h1 { font-size: 1.4rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.1rem; }
.muted { color: #5b6b7a; }
.small { font-size: .85rem; }

label { display: block; font-weight: 600; margin: .6rem 0 .25rem; font-size: .92rem; }
input[type=text], input[type=password], select, textarea {
    width: 100%; padding: .55rem .6rem; font-size: 1rem;
    border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,95,139,.15);
}
input:disabled, select:disabled, textarea:disabled { background: #f3f5f7; color: #54606c; }
textarea { resize: vertical; }

.btn {
    display: inline-block; background: var(--brand); color: #fff;
    border: 0; border-radius: 8px; padding: .7rem 1.4rem;
    font-size: 1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }

fieldset { border: 1px solid var(--line); border-radius: 9px; margin: 1.1rem 0; padding: .4rem 1rem 1rem; }
legend { font-weight: 700; color: var(--brand-dark); padding: 0 .4rem; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1.25rem; }
.field { display: flex; flex-direction: column; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); }
.err { color: var(--err); font-size: .82rem; margin-top: .2rem; }
.actions { margin-top: 1.2rem; }

.notice { padding: .75rem 1rem; border-radius: 8px; margin: .8rem 0; }
.notice.error { background: #fdecea; color: var(--err); border: 1px solid #f3b7af; }
.notice.success { background: #e7f6ee; color: var(--ok); border: 1px solid #aadcc1; }
.notice.warn { background: #fff6db; color: var(--warn); border: 1px solid #ecd98a; }

table.diff { width: 100%; border-collapse: collapse; margin: .6rem 0 1rem; }
table.diff th, table.diff td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; font-size: .92rem; vertical-align: top; }
table.diff th { background: #f3f6f8; }
table.diff td.old { color: #7a4a4a; }
table.diff td.new { color: #1e5f3a; font-weight: 600; }

@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .card { margin: .5rem; padding: 1rem; border-radius: 8px; }
    .card.narrow { margin-top: 4vh; }
}

/* ----- Member photo upload ----- */
.photo-section { padding: .2rem 0 .1rem; }

.photo-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: .55rem;
}
.photo-wrap img {
    display: block;
    max-width: 300px;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--line);
    transition: opacity .22s ease;
}
.photo-wrap.photo-marked img { opacity: .28; }

/* × button — sits inside the image, top-right corner */
.photo-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #c0392b;
    color: #fff;
    border: 2px solid rgba(255,255,255,.8);
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    transition: background .15s;
}
.photo-delete-btn:hover { background: #922b21; }

/* Deletion ribbon — slides in at the bottom of the photo */
.photo-delete-ribbon {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(192,57,43,.86);
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    text-align: center;
    padding: 5px 6px;
    border-radius: 0 0 5px 5px;
    pointer-events: none;
    user-select: none;
}
.photo-wrap.photo-marked .photo-delete-ribbon { display: block; }

/* Buttons row beneath the photo */
.photo-actions {
    display: flex;
    gap: .55rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}

/* Small button variant */
.btn-sm { padding: .38rem .8rem; font-size: .88rem; border-radius: 6px; cursor: pointer; }
label.btn, label.btn-sm { display: inline-block; margin: 0; }

/* Outlined / ghost button variant */
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--brand);
    color: var(--brand);
}
.btn-outline:hover { background: rgba(31,95,139,.08); }

.photo-hint { margin: .4rem 0 0; font-size: .82rem; }
.mem-no-field { max-width: 180px; margin-bottom: .9rem; }
.field-hint { font-weight: 400; font-size: .76rem; color: #7a8a96; margin-left: .3rem; letter-spacing: .01em; }
.photo-err  { color: var(--err); margin: .4rem 0 0; font-size: .88rem; }
.photo-size-warn { padding: .4rem .75rem; font-size: .85rem; margin: .4rem 0 0; }
