/* Admin console: sidebar shell, stat cards, bar charts, tables and forms. Also the site-wide notice banner and the maintenance page. */

/* Site notice banner (set from admin settings) */
.site-notice { font-size: .9rem; padding-block: .55rem; border-bottom: 1px solid var(--line); }
.site-notice .container { display: flex; align-items: center; gap: .5rem; }
.site-notice svg { flex: none; }
.site-notice--info { background: var(--accent-soft); color: var(--accent-2); }
.site-notice--warn { background: #fff4d6; color: #7a4b00; }
.site-notice--success { background: #e3f6ea; color: #13623a; }
html[data-theme="dark"] .site-notice--info { background: #13284a; color: #b9d3ff; }
html[data-theme="dark"] .site-notice--warn { background: #3a2c0c; color: #ffd98a; }
html[data-theme="dark"] .site-notice--success { background: #0f3221; color: #9be3b9; }

/* Maintenance page */
.maint-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); color: var(--ink); font-family: var(--f-body); margin: 0; padding: 1.5rem; }
.maint { max-width: 460px; text-align: center; display: grid; justify-items: center; gap: .6rem; background: var(--surface); padding: 2.2rem 1.8rem; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.maint h1 { font-family: var(--f-display); font-size: 1.5rem; margin: .4rem 0 0; }
.maint p { color: var(--ink-2); line-height: 1.7; margin: 0; }
.maint-brand { font-family: var(--f-display); font-size: 1.1rem; color: var(--pine); }
.maint-link { margin-top: .6rem; font-size: .88rem; color: var(--accent); }

/* Shell */
.admin-body .site-footer { margin-top: 0; }
.adm { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; width: min(100% - 2rem, 1360px); margin: 1.25rem auto 3rem; align-items: start; }
.adm-side { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; display: grid; gap: .3rem; box-shadow: var(--shadow); }
.adm-brand { display: flex; align-items: center; gap: .6rem; padding: .4rem .4rem .8rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.adm-brand b { display: block; font-family: var(--f-display); font-size: 1rem; }
.adm-brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--pine); color: #fff; flex: none; }
.adm-role { display: inline-block; font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .05rem .5rem; margin-top: .15rem; }
.adm-nav { display: grid; gap: 2px; }
.adm-link { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-size: .93rem; font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.adm-link:hover { background: var(--bg); color: var(--ink); }
.adm-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.adm-link svg { flex: none; }
.adm-out { margin-top: .4rem; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding-top: .75rem; }
.adm-main { min-width: 0; display: grid; gap: 1.1rem; align-content: start; }
.adm-main > .flash-wrap { padding: 0; }

.adm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.adm-h1 { font-family: var(--f-display); font-size: clamp(1.35rem, 2.2vw, 1.75rem); margin: 0; display: flex; align-items: center; gap: .5rem; }
.adm-head p { margin: .25rem 0 0; }
.adm-h2 { font-family: var(--f-display); font-size: 1.02rem; margin: 0 0 .7rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.adm-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.adm-card { padding: 1.1rem 1.2rem; min-width: 0; }

/* Stat cards */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.adm-stat { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic label" "n n" "sub sub"; gap: .25rem .55rem; align-items: center; padding: 1rem 1.05rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s, border-color .15s; }
a.adm-stat:hover { transform: translateY(-2px); border-color: var(--accent); }
.adm-stat-ic { grid-area: ic; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.adm-stat-label { grid-area: label; font-size: .86rem; color: var(--ink-2); font-weight: 500; }
.adm-stat-n { grid-area: n; font-family: var(--f-display); font-size: 1.8rem; line-height: 1.1; margin-top: .25rem; justify-self: start; }
.adm-stat-sub { grid-area: sub; display: flex; flex-wrap: wrap; gap: .15rem .7rem; font-size: .78rem; color: var(--muted); }

.adm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.adm-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.adm-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: .3rem; }
.adm-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.adm-bar i { display: block; width: 100%; height: max(3px, var(--h)); background: linear-gradient(180deg, var(--accent), var(--pine-2)); border-radius: 4px 4px 2px 2px; }
.adm-bars-axis { display: flex; justify-content: space-between; margin-top: .35rem; }
.adm-list { list-style: none; margin: 0; padding: 0; display: grid; }
.adm-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; min-width: 0; }
.adm-list li:last-child { border-bottom: 0; }
.adm-list li > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-list a { color: inherit; text-decoration: none; }
.adm-list a:hover b { color: var(--accent); }
.adm-err { color: var(--danger); }

/* Status pills */
.adm-pill { display: inline-flex; align-items: center; font-size: .74rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; white-space: nowrap; background: var(--bg-2); color: var(--ink-2); }
.adm-pill--ok { background: #e3f6ea; color: #13623a; }
.adm-pill--off { background: #fdecec; color: var(--danger); }
.adm-pill--warn { background: #fff4d6; color: #7a4b00; }
.adm-pill--info { background: var(--accent-soft); color: var(--accent); }
html[data-theme="dark"] .adm-pill--ok { background: #0f3221; color: #9be3b9; }
html[data-theme="dark"] .adm-pill--off { background: #3a1414; color: #ffb4ac; }
html[data-theme="dark"] .adm-pill--warn { background: #3a2c0c; color: #ffd98a; }

/* Filters, tabs, tables */
.adm-filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.adm-filter input, .adm-filter select { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; min-width: 0; }
.adm-filter input[type="search"] { flex: 1 1 200px; }
.adm-tabs { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs .chip { flex: none; text-decoration: none; }
.adm-tabs .chip small { opacity: .7; margin-inline-start: .25rem; }
.adm-table-wrap { overflow-x: auto; padding: 0; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.adm-table th { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; background: var(--bg); }
.adm-table th, .adm-table td { padding: .65rem .8rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.adm-table .adm-who { display: flex; align-items: center; gap: .6rem; min-width: 180px; }
.adm-table .adm-who b { display: block; }
.adm-table .adm-who a { color: inherit; text-decoration: none; }
.adm-table .adm-who a:hover b { color: var(--accent); }
.adm-table .adm-text { max-width: 380px; min-width: 200px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.adm-row-acts { display: flex; gap: .3rem; flex-wrap: nowrap; justify-content: flex-end; }
.adm-act { display: inline; margin: 0; }
.adm-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.adm-logo-ph { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #fff; font-weight: 700; font-size: .8rem; flex: none; background: var(--pine-2); }
.adm-pager { display: flex; justify-content: center; align-items: center; gap: .8rem; }
.adm-empty { text-align: center; color: var(--muted); padding: 2rem 1rem !important; }

/* Forms */
.adm-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.adm-form { display: grid; gap: .9rem; }
.adm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.adm-fields .wide { grid-column: 1 / -1; }
.adm-form textarea.input { min-height: 110px; resize: vertical; }
.adm-check { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; cursor: pointer; }
.adm-check input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--accent); flex: none; }
.adm-check small { display: block; color: var(--muted); font-size: .8rem; }
.adm-side-card { display: grid; gap: .7rem; }
.adm-kv { display: grid; grid-template-columns: 1fr auto; gap: .35rem .8rem; font-size: .88rem; margin: 0; }
.adm-kv dt { color: var(--ink-2); }
.adm-kv dd { margin: 0; font-weight: 600; }
.adm-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.adm-danger .adm-h2 { color: var(--danger); }
.adm-btns { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Roles matrix */
.adm-matrix th, .adm-matrix td { text-align: center; }
.adm-matrix th:first-child, .adm-matrix td:first-child { text-align: start; }
.adm-matrix input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Phone and tablet: the sidebar becomes a scrolling strip above the content */
@media (max-width: 900px) {
  .adm { grid-template-columns: minmax(0, 1fr); gap: .9rem; width: min(100% - 1.5rem, 1360px); margin-top: .75rem; }
  .adm-side { position: static; padding: .5rem; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; gap: .25rem; }
  .adm-side::-webkit-scrollbar { display: none; }
  .adm-brand { border: 0; margin: 0; padding: 0 .3rem 0 0; flex: none; }
  .adm-brand > span:last-child { display: none; }
  .adm-brand-mark { width: 32px; height: 32px; }
  .adm-nav { display: flex; gap: .25rem; }
  .adm-link { flex: none; padding: .5rem .7rem; white-space: nowrap; font-size: .87rem; }
  .adm-out { margin: 0; border: 0; padding-top: .5rem; }
  .adm-grid2, .adm-grid3, .adm-form-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .adm-stat { padding: .8rem; }
  .adm-stat-n { font-size: 1.5rem; }
  .adm-fields { grid-template-columns: minmax(0, 1fr); }
  .adm-table .adm-hide-m { display: none; }
  .adm-table td { overflow-wrap: anywhere; }
  .adm-row-acts { flex-direction: column; align-items: stretch; }
}
