/* Strive 2 Thrive — admin panel */
:root {
  --navy: #1d3d78; --navy-900: #0f2147; --navy-50: #f2f5fb; --navy-100: #e5ecf8;
  --gold: #f3a530; --bg: #f6f7fa; --paper: #fff; --ink: #13233f; --muted: #5d6b84;
  --line: #e3e7ef; --danger: #b42318; --ok: #1d7a4c; --radius: 12px;
  --shadow: 0 1px 2px rgb(15 33 71 / .06), 0 2px 8px rgb(15 33 71 / .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); }
a { color: var(--navy); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 1.8rem; color: var(--navy-900); }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: 1rem; }
img { max-width: 100%; display: block; }
code { background: var(--navy-50); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-900); color: #c8d2e6; padding: 1.25rem .9rem; display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; font-weight: 700; padding: 0 .4rem; }
.sidebar-brand img { background: #fff; padding: 4px; border-radius: 10px; height: 44px; width: 44px; object-fit: contain; }
.sidebar-brand span { display: grid; line-height: 1.2; }
.sidebar-brand b { font-family: "Playfair Display", Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.sidebar-brand small { color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: .15rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 8px; color: #c8d2e6; text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: rgb(255 255 255 / .07); color: #fff; }
.sidebar nav a[aria-current="page"] { background: rgb(255 255 255 / .12); color: #fff; }
.sidebar nav a .pill { margin-left: auto; }
.pill { background: var(--gold); color: var(--navy-900); font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: grid; gap: .5rem; font-size: .9rem; padding: 0 .4rem; }
.sidebar-foot a { color: #c8d2e6; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }
.sidebar-foot .who { color: #fff; font-weight: 600; border-top: 1px solid rgb(255 255 255 / .1); padding-top: .75rem; }
.linklike { background: none; border: 0; padding: 0; color: #c8d2e6; cursor: pointer; font: inherit; text-decoration: underline; }
.content { padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; max-width: 1180px; width: 100%; }
.content-head { margin-bottom: 1.25rem; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; width: 100%; order: 3; }
  .sidebar nav a span { display: inline; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 1rem; }
  .sidebar-foot .who { border: 0; padding: 0; }
}

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s; }
.tile:hover { border-color: var(--navy); }
.tile b { display: block; font-size: 1.7rem; color: var(--navy-900); font-family: "Playfair Display", Georgia, serif; }
.tile span { color: var(--muted); font-size: .9rem; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #e8f5ee; border-color: #bfe3cf; color: #135c38; }
.flash-error { background: #fdecea; border-color: #f5c5bf; color: #8a1c12; }
.flash-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-900); }
.flash-warning { background: #fef7ea; border-color: #fdeccd; color: #7a4a05; }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.05rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--navy); color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: #2a53a0; color: #fff; }
.btn-danger { color: var(--danger); border-color: #f5c5bf; background: #fff; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .4rem .75rem; font-size: .85rem; }

/* Form controls: label text (and an optional inline hint) sits on one line above the control */
label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink); min-width: 0; }
label small { font-weight: 400; font-size: .8rem; color: var(--muted); margin-left: .35rem; }
label > input, label > select, label > textarea { display: block; margin-top: .4rem; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; max-width: 100%; height: 42px; padding: 0 .75rem; border: 1px solid #cfd6e3; border-radius: 8px;
  font: inherit; font-size: .95rem; font-weight: 400; background: #fff; color: var(--ink); box-sizing: border-box;
}
textarea { height: auto; min-height: 84px; padding: .6rem .75rem; line-height: 1.5; resize: vertical; }
select { appearance: none; padding-right: 2.25rem; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d6b84' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgb(29 61 120 / .15); }
input[type=file] { display: block; width: 100%; max-width: 100%; height: 42px; padding: 3px 0; box-sizing: border-box; margin-top: .4rem; font: inherit; font-size: .85rem; font-weight: 400; color: var(--muted); }
input[type=file]::file-selector-button {
  height: 36px; margin-right: .75rem; padding: 0 .9rem; border: 1px solid #cfd6e3; border-radius: 8px; background: var(--navy-50);
  color: var(--navy); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--navy-100); }
input[type=range] { display: block; width: 100%; margin-top: .6rem; accent-color: var(--navy); }
.check { display: inline-flex; align-items: center; gap: .55rem; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); flex-shrink: 0; }
.check span { display: inline-flex; align-items: center; gap: .4rem; }
.form-grid .check, .check-cell { height: 42px; align-self: end; }
.stack { display: grid; gap: 1rem; align-content: start; }
.stack-lg { display: grid; gap: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem 1.25rem; align-items: end; }
.form-grid.tight { grid-template-columns: 1fr 1fr; gap: .75rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.row-actions form { margin: 0; }
.sticky-save { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, var(--bg) 35%); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters { display: flex; gap: .25rem; flex-wrap: wrap; }
.filters a { padding: .4rem .8rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; }
.filters a[aria-current="page"] { background: var(--navy); color: #fff; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.unread td:first-child a { font-weight: 700; }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.truncate { max-width: 420px; color: var(--muted); }
@media (max-width: 760px) { .table thead { display: none; } .table tr { display: grid; padding: .5rem 0; border-bottom: 1px solid var(--line); } .table td { border: 0; padding: .2rem .6rem; } }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: #eef0f4; color: var(--muted); }
.tag-contact { background: var(--navy-100); color: var(--navy); }
.tag-volunteer { background: #e8f5ee; color: var(--ok); }
.tag-sponsor { background: #fdeccd; color: #8a5200; }
.tag-ok { background: #e8f5ee; color: var(--ok); }

.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.5rem; margin: 0 0 1.25rem; }
.meta dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta dd { margin: .15rem 0 0; font-weight: 500; word-break: break-word; }
.message-body { background: var(--bg); border-radius: 10px; padding: 1.1rem 1.25rem; white-space: normal; line-height: 1.7; }

.thumb-cell { width: 56px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; }
.avatar-initials { background: var(--navy-100); color: var(--navy); font-weight: 700; font-size: .85rem; }

.edit-grid { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; }
@media (max-width: 860px) { .edit-grid { grid-template-columns: 1fr; } }
.crop-preview { background: var(--bg); border-radius: var(--radius); padding: 1rem; max-width: 300px; }
.person-photo-admin { position: relative; aspect-ratio: 4/5; border-radius: 12px; overflow: hidden; background: linear-gradient(150deg, var(--navy-100), #fef7ea); }
.person-photo-admin img { width: 100%; height: 100%; object-fit: cover; object-position: var(--ox) var(--oy); transform-origin: var(--ox) var(--oy); transform: scale(var(--zoom)); }
.person-photo-admin .initials { position: absolute; inset: 0; display: grid; place-items: center; font-family: "Playfair Display", serif; font-size: 3rem; color: var(--navy); }

.upload-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.gallery-card > * { min-width: 0; }
.gallery-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; display: grid; gap: .65rem; align-content: start; }
.gallery-card > img { aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; width: 100%; background: var(--bg); }
.gallery-card.is-hidden > img { opacity: .4; }
.gallery-card.is-new { border-style: dashed; border-width: 2px; }
.gallery-card .row-actions { margin-top: .25rem; }
.logo-preview { max-height: 60px; width: auto; object-fit: contain; }
.drive-list { columns: 3 220px; font-size: .85rem; padding-left: 1.2em; }
details summary { cursor: pointer; font-weight: 600; color: var(--navy); }

.social-grid { display: grid; gap: .75rem; }
.social-row { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; align-items: center; }
@media (max-width: 600px) { .social-row { grid-template-columns: 1fr; gap: .4rem; } }

/* auth pages */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: radial-gradient(60% 60% at 80% 10%, rgb(243 165 48 / .15), transparent 60%), var(--bg); }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px -24px rgb(15 33 71 / .3); padding: 2.25rem; width: 100%; max-width: 420px; }
.auth-logo { height: 48px; width: auto; margin-bottom: 1.5rem; }
.auth-card .btn-primary { justify-content: center; padding: .8rem; }
.logo-box { height: 90px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; padding: .75rem; }
.logo-box .logo-preview { max-height: 66px; max-width: 100%; }
@media (max-width: 640px) { .form-grid[style*="140px"] { grid-template-columns: 1fr !important; } .form-grid[style*="140px"] .check-cell { justify-self: start !important; } }

/* Shared inbox */
.inbox-search input { min-width: 260px; height: 38px; }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-list li + li { border-top: 1px solid var(--line); }
.inbox-list a { display: grid; grid-template-columns: 200px 1fr auto; gap: 1rem; align-items: baseline; padding: .8rem 1.25rem; text-decoration: none; color: var(--ink, inherit); }
.inbox-list a:hover { background: var(--bg); }
.inbox-list .ib-from, .inbox-list .ib-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.inbox-list li.unread .ib-from, .inbox-list li.unread .ib-subject { font-weight: 700; color: var(--navy-900); }
.inbox-list li.unread { box-shadow: inset 3px 0 0 var(--gold); }
@media (max-width: 720px) { .inbox-list a { grid-template-columns: 1fr auto; } .inbox-list .ib-text { grid-column: 1 / -1; } }
.thread { display: grid; gap: .75rem; }
.mail { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.25rem; }
.mail-mine { background: var(--navy-50); }
.mail summary { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; cursor: pointer; list-style: none; }
.mail summary::-webkit-details-marker { display: none; }
.mail-from { flex: 1; min-width: 0; }
.mail-meta { margin: .4rem 0 .75rem; overflow-wrap: anywhere; }
.mail .message-body { overflow-wrap: anywhere; }
.attachments { margin: .75rem 0 0; padding-left: 1.1rem; }
.setup-steps { display: grid; gap: .7rem; padding-left: 1.25rem; line-height: 1.55; }
.setup-steps code { display: inline-block; background: var(--bg); padding: .15rem .45rem; border-radius: 6px; font-size: .85rem; user-select: all; }
.inline-toggle { display: inline-flex; gap: .5rem; align-items: center; margin: 0; }
.linklike-dark { background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }
