@import url('https://api.fontshare.com/v2/css?f[]=general-sans@300,400,500,600,700&display=swap');

:root {
  color-scheme: light;
  --ink: #1D4620;
  --muted: rgba(29, 70, 32, .68);
  --line: rgba(29, 70, 32, .15);
  --bg: #6C8F73;
  --bg-deep: #628264;
  --mint: #D8F2CD;
  --mint-light: #C5EAB6;
  --paper: #F7FBF4;
  --white: #FFFFFF;
  --red: #A93E35;
  --font: 'General Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
body.admin-page { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--ink); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; color: var(--white); font-size: 36px; line-height: 1.15; }
h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.auth-panel { width: min(100% - 32px, 440px); margin: 10vh auto; padding: 34px; border: 1px solid rgba(255,255,255,.3); background: var(--mint); box-shadow: 0 18px 48px rgba(29,70,32,.16); }
.admin-eyebrow { margin-bottom: 6px; color: #315F4B; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-panel h1 { color: var(--ink); }
.admin-form { display: grid; gap: 18px; margin-top: 26px; }
.admin-form label, .content-form label, .project-edit-form label, .gallery-edit-form label { display: grid; gap: 6px; font-weight: 600; }
.admin-form input, .content-form input, .content-form textarea, .content-form select, .project-edit-form input:not([type="checkbox"]), .project-edit-form textarea, .project-edit-form select, .gallery-edit-form input:not([type="checkbox"]) { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid rgba(29,70,32,.23); border-radius: 3px; background: var(--white); color: var(--ink); font: inherit; }
.content-form input[type="file"], .project-edit-form input[type="file"], .gallery-edit-form input[type="file"] { min-height: 44px; padding: 7px; font-size: 13px; }
.content-form textarea, .project-edit-form textarea { min-height: 94px; resize: vertical; }
.admin-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid var(--ink); border-radius: 3px; background: var(--ink); color: var(--white); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease; }
.admin-button:hover { border-color: #315F4B; background: #315F4B; }
.admin-button-quiet { min-height: 34px; padding: 5px 10px; border-color: rgba(29,70,32,.25); background: transparent; color: var(--ink); font-size: 13px; }
.admin-button-danger { min-height: 34px; padding: 5px 10px; border-color: rgba(169,62,53,.3); background: transparent; color: var(--red); font-size: 13px; }
.admin-button-danger:hover { border-color: var(--red); background: var(--red); color: var(--white); }
.notice { order: 2; padding: 12px 14px; border-left: 3px solid #315F4B; background: var(--mint); }
.notice-error { border-color: var(--red); background: #fbefed; color: #7e2c25; }
.admin-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 76px; padding: 10px clamp(18px, 5vw, 72px); border-bottom: 1px solid rgba(255,255,255,.15); background: var(--bg-deep); color: var(--white); }
.admin-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 210px; color: var(--white); font-weight: 700; line-height: 1.2; text-decoration: none; }
.admin-brand img { width: 42px; height: 42px; object-fit: contain; }
.admin-brand small { display: block; margin-top: 4px; color: rgba(255,255,255,.7); font-size: 11px; font-weight: 500; }
.admin-nav { display: flex; align-items: center; gap: 6px; }
.admin-nav a { padding: 8px 10px; border-radius: 3px; color: rgba(255,255,255,.88); font-size: 13px; text-decoration: none; }
.admin-nav a:hover { background: rgba(216,242,205,.13); color: var(--mint); }
.admin-nav a span { display: inline-grid; min-width: 20px; height: 20px; margin-left: 3px; place-items: center; border-radius: 50%; background: var(--mint); color: var(--ink); font-size: 11px; font-weight: 700; }
.admin-user, .admin-user form { display: flex; align-items: center; gap: 12px; }
.admin-user { color: rgba(255,255,255,.9); font-size: 13px; }
.site-link { color: var(--mint); font-size: 13px; text-decoration: none; }
.admin-user .admin-button-quiet { border-color: rgba(255,255,255,.35); color: var(--white); }
.admin-main { display: flex; flex-direction: column; width: min(100% - 36px, 1360px); margin: 42px auto 80px; }
.admin-main > .admin-eyebrow { order: 0; color: var(--mint); }
.admin-main > h1 { order: 1; }
.admin-stats { order: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 2px; }
.stat-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; min-height: 100px; padding: 17px 18px; border: 1px solid rgba(29,70,32,.12); border-radius: 4px; background: var(--mint); color: var(--ink); text-decoration: none; transition: background .18s ease, transform .18s ease; }
.stat-item:hover { transform: translateY(-2px); background: var(--mint-light); }
.stat-item span { align-self: center; font-size: 13px; font-weight: 600; }
.stat-item strong { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 31px; line-height: 1; }
.stat-item small { color: var(--muted); font-size: 12px; }
.admin-section { margin-top: 22px; border: 1px solid rgba(29,70,32,.13); border-radius: 5px; background: var(--paper); color: var(--ink); }
#inquiries { order: 4; }
#portfolio { order: 5; }
#chats { order: 6; }
#subscribers { order: 7; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section-title > span { color: var(--muted); font-size: 13px; }
.section-title .admin-eyebrow { margin-bottom: 4px; }
.content-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.content-form .wide-field { grid-column: 1 / -1; }
.content-form button { justify-self: start; }
.field-hint { color: var(--muted); font-size: 11px; font-weight: 400; }
.project-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 0 20px 20px; }
.project-admin-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.project-admin-image { display: block; width: 100%; aspect-ratio: 16 / 8; object-fit: cover; background: var(--mint); }
.project-image-empty { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.project-edit-form { display: grid; gap: 12px; padding: 16px; }
.check-field { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 9px !important; font-size: 13px; }
.check-field input { width: 17px; height: 17px; accent-color: var(--bg-deep); }
.project-edit-form > button { justify-self: start; }
.delete-project-form { padding: 0 16px 16px; }
.gallery-admin-group { margin: 0 20px 12px; border-top: 1px solid var(--line); }
.gallery-admin-group summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; font-weight: 650; cursor: pointer; }
.gallery-admin-group summary span { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.gallery-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 4px 0 16px; }
.gallery-admin-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--white); }
.gallery-admin-card > img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--paper); }
.gallery-edit-form { display: grid; gap: 10px; padding: 12px; }
.gallery-edit-form > button { justify-self: start; }
.gallery-delete-form { padding: 0 12px 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.inquiry-new { background: rgba(216,242,205,.35); }
.message-cell { min-width: 250px; max-width: 430px; white-space: normal; }
.muted, .status-read { color: var(--muted); }
.empty-state { margin: 0; padding: 20px; color: var(--muted); }
.chat-record-list { display: grid; gap: 10px; padding: 14px; }
.chat-record { overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.chat-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; }
.chat-record-heading > div { display: grid; gap: 3px; }
.chat-record-heading .muted { font-size: 12px; }
.chat-record-details { border-top: 1px solid var(--line); }
.chat-record-details summary { padding: 10px 15px; color: var(--green); font-size: 13px; font-weight: 600; cursor: pointer; }
.chat-transcript { display: grid; gap: 8px; padding: 8px 15px 15px; }
.chat-transcript-message { position: relative; max-width: 88%; padding: 9px 12px 21px; border-radius: 4px; background: #E4F1DE; font-size: 13px; }
.chat-transcript-visitor { justify-self: end; background: #edf3ea; }
.chat-transcript-message strong { font-size: 11px; color: var(--green); }
.chat-transcript-message p { margin: 3px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-transcript-message time { position: absolute; right: 9px; bottom: 3px; color: var(--muted); font-size: 10px; }
@media (max-width: 980px) {
  .admin-header { flex-wrap: wrap; }
  .admin-nav { order: 3; width: 100%; overflow-x: auto; }
  .admin-user { margin-left: auto; }
  .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .auth-panel { padding: 25px; }
  .admin-header { gap: 10px; padding: 10px 16px; }
  .admin-brand { min-width: 0; font-size: 13px; }
  .admin-brand img { width: 36px; height: 36px; }
  .admin-user { flex-wrap: wrap; justify-content: flex-end; gap: 7px; font-size: 11px; }
  .site-link { display: none; }
  .admin-nav { gap: 0; }
  .admin-nav a { padding: 7px 8px; white-space: nowrap; font-size: 12px; }
  .admin-main { width: min(100% - 24px, 1360px); margin-top: 30px; }
  .admin-stats { gap: 8px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-item { min-height: 88px; padding: 12px; }
  .stat-item strong { font-size: 26px; }
  .admin-section { margin-top: 14px; }
  .section-title { padding: 15px; }
  .content-form { grid-template-columns: 1fr; padding: 15px; }
  .content-form .wide-field { grid-column: auto; }
  .project-admin-grid { grid-template-columns: 1fr; padding: 0 12px 14px; }
  .gallery-admin-group { margin-right: 12px; margin-left: 12px; }
  .gallery-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery-edit-form { gap: 8px; padding: 9px; }
  .gallery-edit-form label { font-size: 12px; }
  .gallery-edit-form input[type="file"] { min-height: 38px; font-size: 11px; }
  .gallery-delete-form { padding: 0 9px 9px; }
  .chat-record-heading { align-items: flex-start; }
  th, td { padding: 11px 12px; }
}