/* Ditesol admin dashboard */
[hidden] { display: none !important; }
body.admin { background: var(--bg); min-height: 100vh; }
.admin-wrap { width: min(1400px, 100% - 2rem); margin-inline: auto; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.login-card { width: min(400px, 100%); display: grid; gap: 0.9rem; text-align: left; }
.login-card h1 { font-size: 1.6rem; margin: 0; }
.login-card p { margin: 0; }
.auth-link { text-align: center; font-size: 0.9rem; font-weight: 600; }
.form-alert.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.form-alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.admin-nav { display: flex; gap: 0.3rem; }
.admin-nav button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 0.95rem; padding: 0.5rem 0.9rem; border-radius: 8px; cursor: pointer; color: var(--muted); }
.admin-nav button.active { background: var(--bg); color: var(--navy); }
.team-table td { vertical-align: middle; }
.team-table .actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }
.team-table tbody tr { cursor: default; }
.team-table tr.inactive td { color: var(--muted); }
.account-card { max-width: 560px; display: grid; gap: 0.9rem; }
.account-card h2, .account-card h3 { margin: 0; }
.account-card .d-grid { margin: 0; }
@media (max-width: 760px) { .admin-bar { flex-wrap: wrap; height: auto; padding: 0.6rem 0; gap: 0.5rem; } .admin-nav { order: 3; width: 100%; } }

.admin-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-bar { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.admin-user { display: flex; align-items: center; gap: 0.8rem; font-weight: 600; font-size: 0.9rem; }
main.admin-wrap { padding: 1.5rem 0 3rem; display: grid; gap: 1.25rem; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; border-top: 4px solid var(--c, var(--navy)); }
.stat .label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat .value { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.stat .sub { font-size: 0.85rem; color: var(--muted); }
.stat.hotspot { --c: var(--teal); }
.stat.fiber { --c: var(--orange); }
.stat.contact { --c: #6366f1; }
.stat.new { --c: var(--green); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; box-shadow: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tabs button { border: 1.5px solid var(--line); background: var(--white); padding: 0.45rem 0.9rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; color: var(--ink); }
.tabs button.active { background: var(--navy); border-color: var(--navy); color: var(--white); }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.filters select, .filters input { width: auto; padding: 0.45rem 0.7rem; font-size: 0.9rem; }
.filters input { min-width: 240px; }

.table-card { padding: 0; box-shadow: none; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.req-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.req-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: #fafbfd; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.req-table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.req-table tbody tr { cursor: pointer; }
.req-table tbody tr:hover { background: #f8fafc; }
.req-table .ref { font-family: ui-monospace, Consolas, monospace; font-weight: 700; white-space: nowrap; }
.req-table .summary { color: var(--muted); max-width: 320px; }
.req-table .empty { text-align: center; color: var(--muted); padding: 3rem 1rem; cursor: default; }
.nowrap { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1rem; font-size: 0.9rem; }

.type-chip { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 6px; white-space: nowrap; }
.type-chip.hotspot { background: #e6f6f4; color: #0b7a70; }
.type-chip.fiber { background: #fff1e8; color: #c2410c; }
.type-chip.contact { background: #eef2ff; color: #4338ca; }
.status { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; background: #e2e8f0; color: #334155; }
.status.s-new { background: #dbeafe; color: #1e40af; }
.status.s-contacted, .status.s-in_progress, .status.s-coverage_check { background: #fef3c7; color: #92400e; }
.status.s-survey_scheduled, .status.s-installation_scheduled, .status.s-survey_done, .status.s-approved, .status.s-installing { background: #ede9fe; color: #5b21b6; }
.status.s-live, .status.s-installed, .status.s-resolved { background: #dcfce7; color: #166534; }
.status.s-declined { background: #fee2e2; color: #991b1b; }
.status.s-closed { background: #e2e8f0; color: #475569; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(11, 37, 69, 0.4); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--white); z-index: 50; box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0.2rem 0; font-size: 1.4rem; }
.d-ref { font-family: ui-monospace, Consolas, monospace; font-weight: 800; color: var(--muted); }
.drawer-body { padding: 1.25rem 1.5rem 2rem; overflow-y: auto; }
.d-actions { margin-bottom: 1.25rem; }
.d-grid { display: grid; grid-template-columns: 150px 1fr; gap: 0.5rem 1rem; margin: 0 0 1.5rem; font-size: 0.92rem; }
.d-grid dt { color: var(--muted); font-weight: 600; }
.d-grid dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.d-update { box-shadow: none; background: #fafbfd; margin-bottom: 1.5rem; }
.d-update h3 { margin-top: 0; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem 1.1rem; font-size: 0.9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 0.4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); }
.timeline .meta { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 560px) { .d-grid { grid-template-columns: 1fr; } .d-grid dt { margin-top: 0.4rem; } .filters input { min-width: 0; flex: 1; } }
