/* Admin panel — builds on app.css tokens */
.admin-header{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:68px;padding:10px 28px;background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:saturate(1.6) blur(14px);-webkit-backdrop-filter:saturate(1.6) blur(14px);border-bottom:1px solid var(--line);flex-wrap:wrap}
.admin-brand{display:flex;align-items:center;gap:10px;font-size:15px;letter-spacing:-.02em}
.admin-brand svg{width:38px;height:38px;padding:8px;border-radius:12px;background:var(--hero);color:#fff;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.admin-brand svg .brandmark-check{stroke:#9ff0cc}
.admin-brand b{font-weight:800}
.admin-brand span{padding:3px 8px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:10.5px;font-weight:800;letter-spacing:.12em}
.admin-header .headeractions{flex-wrap:wrap;justify-content:flex-end}
.admin-content{width:100%;max-width:1520px;margin:0 auto;padding:28px 28px 48px}
.admin-content>.heading .outline{min-height:42px}

/* Summary cards */
.admin-content .stats{grid-template-columns:repeat(5,minmax(0,1fr)) minmax(0,1.6fr);gap:14px;margin-bottom:10px}
.admin-content .stats article{flex-direction:row;align-items:center;gap:14px;padding:18px}
.admin-content .stats article>div{min-width:0}
.admin-content .stats small{display:block;font-size:12.5px;font-weight:600;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-content .stats h2{font-size:24px;margin-top:2px}
.admin-content .stat-icon{width:40px;height:40px;border-radius:12px;font-size:16px;font-weight:800}
.volume-card{background:var(--hero)!important;border-color:transparent!important;color:#fff}
.volume-card small{color:rgba(255,255,255,.78)!important}
.volume-card h2{color:#fff}
.volume-breakdown{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:6px;font-size:12px;font-weight:600;color:rgba(255,255,255,.82)}
.table-footnote{margin:0 0 18px;font-size:12.5px}

/* Users table + detail */
.admin-layout{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(360px,1fr);gap:16px;align-items:start}
.admin-users,.admin-detail,.mail-settings{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-sm);min-width:0}
.admin-table-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:18px 20px 10px;flex-wrap:wrap}
.admin-table-heading h2{font-size:16px}
.admin-table-heading input{width:min(280px,100%)!important;margin:0!important;min-height:40px!important;font-size:13.5px!important;background:var(--surface-2)!important}
.admin-users>.table-footnote{padding:0 20px;margin-bottom:10px}
.admin-table-scroll{overflow-x:auto;border-top:1px solid var(--line)}
.users-table{width:100%;border-collapse:collapse;font-size:13px}
.users-table th{position:sticky;top:0;padding:11px 14px;background:var(--surface-2);color:var(--muted);font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;text-align:left;white-space:nowrap;border-bottom:1px solid var(--line)}
.users-table td{padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:middle;white-space:nowrap}
.users-table td:first-child{white-space:normal;min-width:180px}
.users-table td b{display:block;font-size:13.5px}
.users-table td small{display:block;color:var(--muted)}
.users-table tr:hover td{background:var(--surface-2)}
.users-table tr.selected td{background:var(--brand-soft)}
.table-money{font-weight:700}
.table-actions{display:flex;gap:6px;align-items:center}
.table-actions form{margin:0}
.table-actions .outline,.table-actions .primary,.table-actions .detail-delete{min-height:32px;padding:0 10px;font-size:12px;border-radius:9px}
.user-status{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:11.5px;font-weight:700}
.user-status::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.status-active{background:var(--pos-soft);color:var(--pos)}
.status-inactive{background:var(--neg-soft);color:var(--neg)}

.admin-detail{position:sticky;top:84px;max-height:calc(100dvh - 100px);overflow-y:auto;padding:20px;scrollbar-width:thin}
.admin-detail h3{margin:22px 0 10px;font-size:13px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.admin-detail-heading{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.admin-detail-heading h2{font-size:20px}
.admin-detail-heading .outline{min-height:36px;font-size:12.5px;padding:0 12px}
.user-status-form{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 10px;padding:12px 14px;border-radius:var(--r-sm);background:var(--surface-2);border:1px solid var(--line)}
.user-status-form button{min-height:38px;font-size:13px}
.admin-customer-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px}
.admin-customer-grid article{display:flex;flex-direction:column;gap:2px;padding:14px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface-2)}
.admin-customer-grid small{color:var(--muted)}
.admin-customer-grid strong{margin:6px 0 2px;font-size:16px;font-variant-numeric:tabular-nums}
.admin-customer-grid strong small{display:block;font-size:11px;font-weight:600}
.admin-entry{border:1px solid var(--line);border-radius:var(--r-sm);margin-bottom:8px;background:var(--surface);overflow:hidden}
.admin-entry summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;cursor:pointer;list-style:none}
.admin-entry summary::-webkit-details-marker{display:none}
.admin-entry summary:hover{background:var(--surface-2)}
.admin-entry summary span{display:flex;flex-direction:column;min-width:0}
.admin-entry summary small{color:var(--muted)}
.admin-entry summary strong{font-variant-numeric:tabular-nums;flex:none}
.admin-entry[open] summary{border-bottom:1px solid var(--line)}
.admin-note{padding:12px 14px;font-size:13.5px;color:var(--ink-2);white-space:pre-wrap;word-break:break-word}
.admin-entry a{display:block;padding:0 14px 14px}
.admin-bill{display:block;max-height:260px;margin-bottom:6px;border-radius:var(--r-xs);border:1px solid var(--line)}
.admin-pagination{display:flex;justify-content:space-between;gap:10px;margin-top:14px}
.admin-detail .welcome{min-height:420px}

/* Settings forms */
.mail-settings{max-width:620px;margin:0 auto;padding:28px}
.mail-settings h2{font-size:21px}
.mail-settings>p.muted{margin:4px 0 18px}
.mail-status{margin-bottom:20px}
.smtp-summary{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 18px}
.smtp-summary span{padding:8px 12px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line);font-size:12.5px;color:var(--muted)}
.smtp-summary b{color:var(--ink)}
.test-mail-form{margin:10px 0 16px}
.mail-settings label small{display:block;margin-top:6px}

@media (max-width:1280px){
 .admin-content .stats{grid-template-columns:repeat(3,minmax(0,1fr))}
 .admin-layout{grid-template-columns:1fr}
 .admin-detail{position:static;max-height:none}
}
@media (max-width:720px){
 .admin-header{padding:10px 16px;gap:10px}
 .admin-header .headeractions{width:100%;justify-content:flex-start;gap:8px}
 .admin-header .headeractions .outline{min-height:36px;font-size:12px;padding:0 10px}
 .admin-content{padding:18px 16px 32px}
 .admin-content>.heading{flex-direction:column;align-items:flex-start}
 .admin-content .stats{grid-template-columns:1fr 1fr;gap:10px}
 .admin-content .stats article{padding:14px;gap:10px}
 .admin-content .stats h2{font-size:20px}
 .admin-content .stat-icon{width:34px;height:34px}
 .volume-card{grid-column:1/-1}
 .admin-detail,.mail-settings{padding:18px}
 .user-status-form{flex-direction:column;align-items:stretch}
 /* table becomes stacked cards */
 .users-table thead{display:none}
 .users-table,.users-table tbody,.users-table tr,.users-table td{display:block;width:100%}
 .users-table tr{padding:12px 16px;border-bottom:1px solid var(--line)}
 .users-table td{display:flex;justify-content:space-between;gap:12px;padding:4px 0;border:0;white-space:normal}
 .users-table td:first-child{display:block;margin-bottom:6px}
 .users-table td:nth-child(2)::before{content:"Created"}
 .users-table td:nth-child(3)::before{content:"Updated"}
 .users-table td:nth-child(4)::before{content:"Customers"}
 .users-table td:nth-child(5)::before{content:"Entries"}
 .users-table td:nth-child(6)::before{content:"Total"}
 .users-table td:nth-child(7)::before{content:"Status"}
 .users-table td::before{color:var(--muted);font-size:12px;font-weight:600}
 .users-table td:last-child{margin-top:8px}
 .users-table tr:hover td{background:none}
}

/* Mobile/tablet: header keeps language + theme; navigation and logout move to the bottom bar */
@media (max-width:1024px){
 .admin-header .headeractions>a.outline,.admin-header .headeractions>form{display:none}
 .admin-header .headeractions{width:auto}
 .admin-content{padding-bottom:calc(32px + var(--bottom-nav) + var(--safe-b))}
 .admin-bottom-nav span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;padding:0 2px}
 .admin-bottom-nav button{color:var(--neg)}
}
@media (max-width:420px){
 .admin-header .language-control span{display:none}
 .admin-header .theme-switch button{padding:0 9px}
}
