/* Admin panel styles (builds on /css/style.css tokens) */
.admin-body { background: #f1efe9; }
.small { font-size: 0.78rem; }

/* login */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #2b6a50 0%, #1f4d3a 45%, #143427 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--paper); border-radius: 20px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; box-shadow: 0 0 0 3px var(--gold-300); }
.login-logo svg { width: 100%; height: 100%; display: block; }
.login-card h1 { font-family: var(--font-display); margin: 0; text-align: center; color: var(--green-900); }
.login-card p { margin: -8px 0 6px; text-align: center; }
.back-link { text-align: center; font-size: 0.85rem; color: var(--ink-soft); text-decoration: none; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); }
label.check { flex-direction: row; align-items: center; gap: 10px; }
label.check input { width: 18px; height: 18px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="search"], select, textarea, .input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-size: 0.92rem; color: var(--ink); font-weight: 400; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(43, 106, 80, 0.15); }
textarea { resize: vertical; font-family: inherit; }
.btn-block { width: 100%; }
.form-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2bd; padding: 10px 12px; border-radius: 10px; font-size: 0.86rem; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form h3 { margin: 0; font-family: var(--font-display); color: var(--green-900); }
.form .btn { align-self: flex-start; }

/* shell */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--green-800); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18); }
.admin-topbar .brand { flex: 1; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.topbar-right .nav-link { background: transparent; cursor: pointer; font-family: inherit; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: none; background: rgba(255, 255, 255, 0.12); color: inherit; font-size: 1.2rem; display: none; align-items: center; justify-content: center; }

.admin-layout { display: flex; flex: 1; }
.sidebar { width: 240px; flex: 0 0 240px; background: var(--paper); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 62px; height: calc(100vh - 62px); }
.side-link { text-align: left; border: none; background: none; padding: 11px 12px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }
.side-link:hover { background: var(--cream); }
.side-link.active { background: var(--green-100); color: var(--green-800); }
.side-footer { margin-top: auto; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 25; }

.admin-main { flex: 1; padding: 22px 26px 40px; min-width: 0; max-width: 1200px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); margin: 0 0 4px; color: var(--green-900); font-size: 1.6rem; }
.page-head p { margin: 0; font-size: 0.88rem; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions .input { width: 220px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.notice { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 0.88rem; }
.notice.warn { background: #fff7df; border: 1px solid #f1dc9a; color: #7a5a00; }
.link-btn { background: none; border: none; color: var(--green-800); font-weight: 700; text-decoration: underline; padding: 0; font-size: inherit; }

/* outline */
.outline { padding: 10px 14px; }
.outline ul { list-style: none; margin: 0; padding: 0 0 0 26px; border-left: 2px dashed var(--line); }
.outline > ul { padding-left: 0; border-left: none; }
.outline li { margin: 4px 0; }
.outline li.collapsed > ul { display: none; }
.o-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
.o-row:hover { background: var(--cream); }
.o-toggle { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 0.7rem; color: var(--green-800); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.o-toggle.empty { visibility: hidden; }
.o-row .avatar { width: 36px; height: 36px; font-size: 0.8rem; margin: 0; border-width: 2px; }
.o-name { font-weight: 600; font-size: 0.92rem; }
.o-sub { font-size: 0.76rem; color: var(--ink-soft); }
.o-main { flex: 1; min-width: 0; cursor: pointer; }
.o-actions { display: flex; gap: 4px; opacity: 0.55; transition: opacity 0.15s; }
.o-row:hover .o-actions { opacity: 1; }
.o-btn { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 5px 9px; font-size: 0.76rem; font-weight: 600; color: var(--green-800); white-space: nowrap; }
.o-btn:hover { background: var(--green-100); }
.o-btn:disabled { opacity: 0.35; cursor: default; }
.o-btn.danger { color: var(--danger); }
.outline-empty { padding: 36px; text-align: center; color: var(--ink-soft); }

/* table */
.table-wrap { padding: 0; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-faint); font-weight: 700; background: var(--cream); }
.table tr:last-child td { border-bottom: none; }
.t-person { display: flex; align-items: center; gap: 10px; }
.t-person .avatar { width: 36px; height: 36px; font-size: 0.8rem; margin: 0; border-width: 2px; }
.t-person b { display: block; font-size: 0.92rem; }
.t-person span { font-size: 0.76rem; color: var(--ink-soft); }
.t-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.modal-card { background: var(--paper); border-radius: 18px; width: 100%; max-width: 680px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-card.small { max-width: 460px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.25rem; color: var(--green-900); }
.modal-head .icon-btn { display: inline-flex; background: var(--cream); color: var(--ink-soft); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.danger-text { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: 1 / -1; }
.photo-row { display: flex; align-items: center; gap: 16px; }
.photo-preview { width: 84px; height: 84px; font-size: 1.6rem; margin: 0; }
.photo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.file-btn { cursor: pointer; }
.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-group label { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--ink); font-size: 0.9rem; }
.radio-group input { margin-top: 3px; }

/* mobile */
@media (max-width: 860px) {
  .icon-btn { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; z-index: 26; transform: translateX(-100%); transition: transform 0.2s; padding-top: 20px; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { padding: 16px 14px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-actions .input { width: 100%; }
  .page-actions { width: 100%; }
  .topbar-right .nav-link:first-child { display: none; }
  .brand-tagline { display: none; }
  .o-actions { opacity: 1; }
  .o-btn { padding: 5px 7px; }
  .o-btn .lbl { display: none; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}

/* outline on small screens: actions drop to their own row */
@media (max-width: 640px) {
  .outline { padding: 6px 8px; }
  .outline ul { padding-left: 14px; }
  .o-row { flex-wrap: wrap; gap: 8px; }
  .o-main { flex: 1 1 140px; }
  .o-actions { flex: 1 0 100%; justify-content: flex-end; margin-top: 2px; }
  .o-row .avatar { width: 32px; height: 32px; font-size: 0.72rem; }
}

/* password reset */
.form-ok { background: #e3efe8; color: var(--green-800); border: 1px solid #c9dfd2; padding: 10px 12px; border-radius: 10px; font-size: 0.86rem; }
.link-btn.center { text-align: center; width: 100%; font-size: 0.86rem; margin-top: -4px; cursor: pointer; }

/* visitors / analytics */
.range-chips { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.range-chips .chip { padding: 7px 12px; font-size: 0.8rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile .t-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-faint); font-weight: 700; }
.tile .t-value { font-family: var(--font-display); font-size: 1.7rem; color: var(--green-800); line-height: 1.15; margin: 4px 0 2px; }
.tile .t-sub { font-size: 0.78rem; color: var(--ink-soft); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0; }
.grid-2 + .grid-3, .grid-3 + .grid-2 { margin-top: 0; }
.page-visitors .grid-2 { margin-bottom: 16px; }
#analyticsBody .grid-2 { margin-bottom: 16px; }
.chart-card h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.05rem; color: var(--green-900); }
.chart-card .small { margin: -6px 0 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 18px; position: relative; }
.bars .bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.bars .bar i { display: block; width: 100%; max-width: 28px; background: var(--green-700); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.2s; }
.bars .bar.zero i { background: var(--line); }
.bars .bar b { position: absolute; top: -18px; font-size: 0.68rem; color: var(--ink-soft); font-weight: 600; }
.bars .bar span { font-size: 0.62rem; color: var(--ink-faint); margin-top: 4px; white-space: nowrap; }
.bars .bar:hover i { background: var(--green-800); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 0.84rem; }
.hbar .h-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.hbar .h-track { height: 10px; background: var(--cream); border-radius: 5px; overflow: hidden; }
.hbar .h-track i { display: block; height: 100%; background: var(--green-700); border-radius: 5px; min-width: 2px; }
.hbar .h-val { font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; font-size: 0.8rem; }
.hbar .h-val b { color: var(--ink); }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.table-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.05rem; color: var(--green-900); }
.hbars .empty { color: var(--ink-faint); font-size: 0.84rem; }
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .bars .bar span { font-size: 0.55rem; }
  .bars .bar:nth-child(even) span { visibility: hidden; }
  .table th:nth-child(6), .table td:nth-child(6) { display: none; }
}
