/* ===== Admin panel ===== */
:root { --green: #14573a; --green-dark: #0b3a26; --gold: #c9a227; --bg: #f2f4f1; --line: #e1e6e1; --ink: #26302b; --muted: #6a756f; --red: #b83232; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .6em; color: var(--green-dark); }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--green-dark); color: #cfe3d8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.sidebar-brand strong { display: block; color: #fff; }
.sidebar-brand span { font-size: .78rem; opacity: .75; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a, .sidebar-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: #cfe3d8; border-radius: 9px; margin-bottom: 2px; }
.sidebar nav a i, .sidebar-foot a i { width: 18px; text-align: center; color: var(--gold); }
.sidebar nav a:hover, .sidebar-foot a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.sidebar nav a.active { background: var(--gold); color: var(--green-dark); font-weight: 600; }
.sidebar nav a.active i { color: var(--green-dark); }
.badge { margin-left: auto; background: #e74c3c; color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; }
.topbar-admin { display: flex; align-items: center; gap: 14px; background: #fff; padding: 14px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-admin h1 { margin: 0; font-size: 1.3rem; }
.topbar-admin .who { margin-left: auto; color: var(--muted); font-size: .9rem; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--green-dark); }
.content { padding: 28px; max-width: 1280px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 22px; }
.panel.narrow { max-width: 760px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: var(--ink); }
.stat-card:hover { text-decoration: none; border-color: var(--gold); }
.stat-card i { width: 50px; height: 50px; border-radius: 12px; background: var(--bg); color: var(--green); display: grid; place-items: center; font-size: 1.2rem; }
.stat-card strong { display: block; font-size: 1.7rem; line-height: 1; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.toolbar form { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.chip.active, .chip:hover { background: var(--green); color: #fff; border-color: var(--green); text-decoration: none; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: 600 .88rem system-ui, sans-serif; cursor: pointer; background: #fff; color: var(--green-dark); border-color: var(--line); }
.btn:hover { text-decoration: none; border-color: var(--green); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #efc6c6; background: #fff; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.pill { border: 0; border-radius: 20px; padding: 4px 12px; font-size: .78rem; font-weight: 600; cursor: pointer; }
.pill.on { background: #dff3e6; color: #1b6b3c; }
.pill.off { background: #eee; color: #777; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.unread td { background: #fffbea; font-weight: 600; }
.table .actions { white-space: nowrap; }
.table .actions form, .actions form { display: inline-block; margin: 0 0 0 4px; }
.actions-col { width: 1%; }
.thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; background: #ddd; }

.form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 16px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=datetime-local], .form input[type=file], .form select, .form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #cdd5ce; border-radius: 8px; font: 400 .95rem system-ui, sans-serif; background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(20, 87, 58, .25); border-color: var(--green); }
.form input:disabled { background: #f0f2ef; color: #888; }
.form small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
.form hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.form .check, .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form .check input { width: auto; margin: 0; }
.check.inline { display: flex; margin: 6px 0 8px; font-size: .85rem; font-weight: 400; }
.req { color: var(--red); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.form-actions form { margin: 0; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 6px; }
.inline-form { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 14px; align-items: end; }
.inline-form label { margin-bottom: 0; }
.current-img { display: block; margin: 6px 0; }
.current-img img { max-height: 110px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.message-body { background: var(--bg); border-radius: 10px; padding: 18px; margin: 16px 0; white-space: normal; }

.alert { padding: 11px 16px; border-radius: 9px; margin-bottom: 16px; font-size: .92rem; }
.alert-success { background: #e4f5ea; color: #1b6b3c; border: 1px solid #b9e2c6; }
.alert-error { background: #fdeaea; color: #a32a2a; border: 1px solid #f3c2c2; }
.alert-warning { background: #fff6dd; color: #7a5a00; border: 1px solid #f0dca0; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pagination a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pagination a.current { background: var(--green); color: #fff; border-color: var(--green); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.photo-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #ddd; }
.photo-card.hidden-item > img { opacity: .4; }
.photo-form { padding: 10px 12px 0; display: grid; gap: 8px; margin: 0; }
.photo-form input, .photo-form select { width: 100%; padding: 7px 9px; border: 1px solid #cdd5ce; border-radius: 7px; font: inherit; font-size: .85rem; }
.photo-form .row { display: grid; grid-template-columns: 1fr 70px; gap: 8px; }
.photo-actions { display: flex; justify-content: space-between; padding: 10px 12px 12px; }
.photo-actions form { margin: 0; }

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--green-dark), var(--green)); padding: 20px; }
.login-card { background: #fff; width: 100%; max-width: 380px; padding: 34px 30px; border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); text-align: center; }
.login-card h1 { font-size: 1.2rem; margin-bottom: 2px; }
.login-card p { color: var(--muted); margin: 0 0 18px; }
.login-card label { display: block; text-align: left; font-weight: 600; font-size: .85rem; margin-bottom: 14px; }
.login-card input { display: block; width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid #cdd5ce; border-radius: 8px; font-size: 1rem; }
.login-logo { height: 70px; margin: 0 auto 10px; object-fit: contain; }
.back-link { display: inline-block; margin-top: 16px; font-size: .85rem; color: var(--muted); }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .25s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .menu-btn { display: block; }
  .two-col, .inline-form { grid-template-columns: 1fr; }
  .content { padding: 18px 14px; }
  .topbar-admin { padding: 12px 14px; }
  .topbar-admin .who { display: none; }
}
