.admin { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: #f3f6f4; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px; padding: 22px 16px; color: #e2f5ea; background: linear-gradient(180deg, var(--green-900), var(--green-950)); overflow-y: auto; }
.admin-sidebar .brand { font-size: 1.15rem; padding: 0 10px; white-space: nowrap; }
.admin-nav { display: grid; gap: 4px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; font-weight: 600; color: rgba(226, 245, 234, .85); font-size: .95rem; }
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-nav a.active { background: linear-gradient(90deg, #146c43, #0f5132); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.admin-nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .75rem; display: grid; place-items: center; }
.sidebar-promo { margin-top: auto; text-align: center; padding: 20px 16px; border-radius: 16px; border: 1px solid rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .06); }
.sidebar-promo .icon { color: var(--accent); margin: 0 auto 10px; }
.sidebar-promo strong { display: block; color: #fff; font-size: 1.05rem; }
.sidebar-promo p { font-size: .85rem; margin: 4px 0 14px; color: rgba(226, 245, 234, .75); }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { display: flex; align-items: center; gap: 18px; padding: 18px 32px; }
.admin-topbar .page-title { flex: 1; min-width: 0; }
.admin-search { position: relative; width: min(380px, 40vw); }
.admin-search input { width: 100%; padding: 12px 16px 12px 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.admin-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-btn { position: relative; width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.topbar-btn .dot { position: absolute; top: 9px; right: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .65rem; display: grid; place-items: center; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 12px; position: relative; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--green-800); color: #fff; display: grid; place-items: center; font-weight: 800; }
.user-chip strong { display: block; color: var(--ink); line-height: 1.2; }
.user-chip small { color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; background: #fff; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 40; padding: 8px; }
.dropdown-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 700; }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; }
.dropdown-item:hover { background: #f3f6f4; }
.dropdown-item.unread { background: var(--accent-softer); }
.dropdown-item small { display: block; color: var(--muted); }
.relative { position: relative; }

.admin-content { padding: 4px 32px 40px; display: grid; gap: 22px; align-content: start; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.9rem; margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-header h2 { font-size: 1.15rem; margin: 0; }
.panel-link { color: var(--accent-deep); font-weight: 700; font-size: .9rem; display: inline-flex; gap: 4px; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat-card { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); position: relative; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { color: var(--muted); font-weight: 600; font-size: .9rem; }
.stat-value { font-size: clamp(1.3rem, 2vw, 1.75rem); color: var(--ink); line-height: 1.2; white-space: nowrap; }
.stat-trend { position: absolute; right: 16px; bottom: 16px; display: inline-flex; gap: 4px; align-items: center; font-weight: 700; font-size: .82rem; }
.stat-trend.up { color: var(--accent-deep); }
.stat-trend.down { color: var(--danger); }
.icon-chip-green { background: #dcfce7; color: #15803d; }
.icon-chip-purple { background: #ede9fe; color: #7c3aed; }
.icon-chip-blue { background: #dbeafe; color: #2563eb; }
.icon-chip-orange { background: #ffedd5; color: #ea580c; }
.icon-chip-red { background: #fee2e2; color: #dc2626; }

.dash-row { display: grid; grid-template-columns: 1.75fr 1fr; gap: 18px; }
.dash-row-3 { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr; gap: 18px; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.mini-kpi { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.mini-kpi span { color: var(--muted); font-size: .88rem; font-weight: 600; }
.mini-kpi strong { color: var(--ink); }
.chart { width: 100%; height: auto; }
.chart-grid { stroke: #edf1ee; }
.chart-label { font-size: 12px; fill: #64748b; font-family: var(--font); }
.chart-bubble { font-size: 12px; fill: #fff; font-weight: 700; font-family: var(--font); }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 190px; height: 190px; }
.donut-total { font-size: 34px; font-weight: 800; fill: var(--ink); font-family: var(--font); }
.donut-caption { font-size: 14px; fill: var(--muted); font-weight: 600; font-family: var(--font); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; flex: 1; min-width: 160px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.legend li strong { margin-left: auto; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; }

.list-rows { display: grid; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid #eef2ef; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { color: var(--ink); }
.list-row small { color: var(--muted); display: block; }
.thumb { width: 72px; height: 46px; border-radius: 8px; overflow: hidden; background: #eef4f0; flex-shrink: 0; }
.progress { height: 7px; border-radius: 999px; background: #e5ece8; overflow: hidden; min-width: 90px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); border-radius: inherit; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef2ef; }
.task-row:last-child { border-bottom: 0; }
.task-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #cbd5d0; display: grid; place-items: center; background: #fff; cursor: pointer; color: #fff; flex-shrink: 0; }
.task-check.done { background: var(--accent-deep); border-color: var(--accent-deep); }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .76rem; white-space: nowrap; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-accent { background: #d1fae5; color: #047857; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar select { width: auto; min-width: 200px; padding: 10px 12px; border: 1.5px solid #d6e0da; border-radius: 10px; background: #fff; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid #eef2ef; vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8fbf9; }
.table .num { text-align: right; white-space: nowrap; }
.table input.input { padding: 8px 10px; }
.empty-state { text-align: center; padding: 36px 16px; }
.empty-state .icon-chip { margin: 0 auto 10px; }
.empty-title { font-weight: 700; color: var(--ink); margin: 0; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; font-size: .93rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 10px 16px; border: 0; background: none; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--green-800); border-color: var(--accent-deep); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1; min-width: 160px; }
.note { padding: 12px 14px; border-radius: 12px; background: #f8fbf9; border: 1px solid #eef2ef; white-space: pre-wrap; }
.note small { display: block; color: var(--muted); margin-top: 6px; }
.message-layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
.message-item { display: block; width: 100%; text-align: left; padding: 14px; border: 0; border-bottom: 1px solid #eef2ef; background: none; cursor: pointer; }
.message-item:hover, .message-item.active { background: #f3f8f5; }
.message-item.unread strong { color: var(--green-800); }
.message-item p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.message-body { white-space: pre-wrap; background: #f8fbf9; padding: 16px; border-radius: 12px; border: 1px solid #eef2ef; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.calendar .dow { background: #f8fbf9; padding: 8px; font-weight: 700; font-size: .8rem; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.calendar .day { min-height: 108px; padding: 6px; border-right: 1px solid #eef2ef; border-bottom: 1px solid #eef2ef; background: #fff; }
.calendar .day.other { background: #fafcfb; color: #a3b1aa; }
.calendar .day.today .day-num { background: var(--accent-deep); color: #fff; }
.day-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: .85rem; }
.event { display: block; width: 100%; text-align: left; margin-top: 4px; padding: 4px 6px; border-radius: 6px; font-size: .75rem; font-weight: 600; border: 0; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.event-Requested { background: #d1fae5; color: #047857; }
.event-Confirmed { background: #dbeafe; color: #1d4ed8; }
.event-Completed { background: #f1f5f9; color: #475569; }
.event-Cancelled, .event-NoShow { background: #fee2e2; color: #b91c1c; text-decoration: line-through; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 19, 13, .45); z-index: 60; }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal-sm { width: min(420px, calc(100% - 32px)); }
.modal-lg { width: min(820px, calc(100% - 32px)); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 1.2rem; margin: 0; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.toast-host { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 80; width: min(380px, calc(100% - 40px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid var(--accent-deep); font-weight: 600; }
.toast span { flex: 1; }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-success .icon { color: var(--accent-deep); }
.admin-burger { display: none; }
.sidebar-close { display: none; }

@media (max-width: 1200px) {
    .kpis, .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-row, .dash-row-3, .detail-grid, .message-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .admin { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
    .admin.sidebar-open .admin-sidebar { transform: translateX(0); }
    .admin.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(3, 19, 13, .45); z-index: 45; }
    .admin-burger, .sidebar-close { display: inline-grid; }
    .sidebar-close { position: absolute; right: 10px; top: 18px; color: #fff; }
    .admin-topbar { padding: 14px 16px; flex-wrap: wrap; }
    .admin-search { order: 5; width: 100%; }
    .user-chip .user-meta { display: none; }
    .admin-content { padding: 4px 16px 32px; }
    .calendar .day { min-height: 70px; }
    .event { font-size: .68rem; }
}

@media (max-width: 560px) {
    .kpis, .mini-kpis { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
    .dropdown { width: calc(100vw - 32px); right: -60px; }
}
