/* Shared admin dashboard styles (Organizations, Accounts Receivable, Stats,
   Order Fulfillment, Test Tracker). Bootstrap 3 base. */

:root {
    --adm-blue: #2563eb;
    --adm-blue-dark: #1d4ed8;
    --adm-border: #e2e8f0;
    --adm-muted: #64748b;
    --adm-bg-soft: #f8fafc;
}

/* ---------- Toolbar / loader ---------- */
.adm-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.adm-toolbar .form-control { border-radius: 6px; }
.adm-toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.adm-toolbar-row + .adm-toolbar-row { margin-top: 10px; }
.adm-search { position: relative; flex: 1 1 280px; max-width: 480px; }
.adm-search .glyphicon-search { position: absolute; left: 10px; top: 10px; color: var(--adm-muted); }
.adm-search input { padding-left: 32px; padding-right: 30px; }
.adm-search-clear {
    position: absolute; right: 8px; top: 5px; border: 0; background: none;
    font-size: 18px; line-height: 1; color: var(--adm-muted); cursor: pointer;
}
.adm-count { color: var(--adm-muted); font-size: 13px; }
.adm-spacer { flex: 1 1 auto; }

.adm-loader { display: flex; align-items: center; gap: 10px; }
.adm-loader .progress { flex: 1 1 auto; margin: 0; height: 10px; border-radius: 5px; }
.adm-loader .progress-bar { background: var(--adm-blue); }
.adm-loader-label { font-size: 13px; color: var(--adm-muted); min-width: 90px; text-align: right; }
.adm-spin {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #cbd5e1; border-top-color: var(--adm-blue);
    animation: adm-spin 0.8s linear infinite; flex: 0 0 auto;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

.adm-banner {
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a;
    border-radius: 6px; padding: 8px 12px; font-size: 13px;
}
.adm-ar-notes { margin-bottom: 12px; }
.adm-ar-notes ul { margin: 8px 0 0; padding-left: 20px; }
.adm-ar-notes li + li { margin-top: 3px; }

/* ---------- Buttons ---------- */
.btn-adm-blue {
    background: var(--adm-blue); border: 1px solid var(--adm-blue); color: #fff;
    border-radius: 6px; font-weight: 600; padding: 6px 14px;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-adm-blue:hover, .btn-adm-blue:focus { background: var(--adm-blue-dark); border-color: var(--adm-blue-dark); color: #fff; }
.btn-adm-blue:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); outline: none; }
.btn-adm-blue.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-adm-red {
    background: #dc2626; border: 1px solid #dc2626; color: #fff; border-radius: 6px; font-weight: 600;
}
.btn-adm-red:hover, .btn-adm-red:focus { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-adm-red[disabled] { opacity: 0.45; }
.btn-adm-soft {
    border-radius: 6px; font-weight: 600; color: #1f2937; border: 1px solid transparent;
}
.btn-ar-charge { background: #fecaca; border-color: #fca5a5; }
.btn-ar-charge:hover { background: #fca5a5; }
.btn-ar-discount { background: #fed7aa; border-color: #fdba74; }
.btn-ar-discount:hover { background: #fdba74; }
.btn-ar-payment { background: #bbf7d0; border-color: #86efac; }
.btn-ar-payment:hover { background: #86efac; }
.btn-ar-view { background: #bfdbfe; border-color: #93c5fd; }
.btn-ar-view:hover { background: #93c5fd; }

/* ---------- Cards ---------- */
.adm-card {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    margin-bottom: 14px;
    overflow: hidden;
}
.adm-card.adm-managed { border-left: 3px solid var(--adm-blue); }
.adm-card-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 16px; background: var(--adm-bg-soft); border-bottom: 1px solid var(--adm-border);
}
.adm-card-title { font-size: 16px; font-weight: 700; margin: 0; color: #0f172a; }
.adm-card-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.adm-card-body { padding: 14px 16px; }
.adm-card-section { padding: 12px 16px; border-top: 1px solid var(--adm-border); }
.adm-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--adm-muted); margin: 0 0 8px;
}
.adm-subcard {
    border: 1px solid var(--adm-border); border-radius: 8px; margin: 0 0 12px;
    background: #fff;
}
.adm-subcard:last-child { margin-bottom: 0; }
.adm-subcard-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--adm-bg-soft); border-bottom: 1px solid var(--adm-border);
    border-radius: 8px 8px 0 0;
}
.adm-subcard-body { padding: 12px; }
.adm-divider { border-top: 1px dashed var(--adm-border); margin: 12px 0; }
.adm-meta { color: var(--adm-muted); font-size: 12px; }
.adm-address { white-space: pre-line; margin: 0; }
.adm-label { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 2px; }
.adm-stack > * + * { margin-top: 8px; }
.adm-stack .btn { display: block; width: 100%; }

/* ---------- Pills ---------- */
.adm-pill {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; line-height: 1.6; white-space: nowrap;
    background: #e2e8f0; color: #334155;
}
.adm-pill-wrap { white-space: normal; border-radius: 12px; font-size: 13px; padding: 4px 12px; }
.adm-pill-green { background: #dcfce7; color: #166534; }
.adm-pill-grey { background: #e5e7eb; color: #4b5563; }
.adm-pill-blue { background: #dbeafe; color: #1e40af; }
.adm-pill-orange { background: #ffedd5; color: #9a3412; }
.adm-pill-red { background: #fee2e2; color: #991b1b; }
.adm-pill-outline { background: #fff; border: 1px solid var(--adm-border); color: #475569; }

.adm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.adm-dot-green { background: #16a34a; }
.adm-dot-grey { background: #9ca3af; }

/* ---------- Tiles ---------- */
.adm-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-tile {
    flex: 1 1 90px; border: 1px solid var(--adm-border); border-radius: 8px;
    padding: 8px 10px; background: var(--adm-bg-soft); min-width: 90px;
}
.adm-tile-value { font-size: 18px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.adm-tile-label { font-size: 11px; color: var(--adm-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Users list ---------- */
.adm-user { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.adm-user:last-child { border-bottom: 0; }
.adm-user-main { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.adm-user-roles { margin-top: 3px; }
.adm-user-roles .adm-pill { margin: 0 3px 3px 0; }
.adm-user.is-impersonating { background: #eff6ff; border-radius: 6px; padding-left: 6px; padding-right: 6px; }

/* ---------- Nav pills (New / Existing) ---------- */
.adm-tabs { margin-bottom: 14px; }
.adm-tabs > li > a { border-radius: 6px; font-weight: 600; }
.adm-tabs > li.active > a, .adm-tabs > li.active > a:hover, .adm-tabs > li.active > a:focus { background: var(--adm-blue); }

.adm-empty {
    text-align: center; color: var(--adm-muted); padding: 40px 16px;
    border: 1px dashed var(--adm-border); border-radius: 10px; background: #fff;
}
.adm-highlight { box-shadow: 0 0 0 3px #86efac; transition: box-shadow 0.6s; }

.adm-group-title { font-size: 18px; font-weight: 700; margin: 22px 0 10px; color: #0f172a; }
.adm-group-title .adm-pill { vertical-align: middle; margin-left: 6px; }

/* ---------- Modals ---------- */
.adm-modal .modal-content { border-radius: 10px; overflow: hidden; }
.adm-modal-marker { height: 6px; }
.adm-modal-marker.charge { background: #f87171; }
.adm-modal-marker.discount { background: #fb923c; }
.adm-modal-marker.payment { background: #4ade80; }
.adm-modal-marker.view { background: #60a5fa; }
.adm-note { font-size: 12px; color: var(--adm-muted); margin-top: 6px; }
.adm-error { color: #b91c1c; font-size: 12px; margin-top: 6px; }

/* ---------- Stats ---------- */
.adm-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.adm-stat-card {
    background: #fff; border: 1px solid var(--adm-border); border-radius: 12px; padding: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); position: relative; min-height: 104px;
}
.adm-stat-icon {
    position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; background: #eff6ff; color: var(--adm-blue);
}
.adm-stat-value { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1.1; margin-top: 6px; }
.adm-stat-label { font-size: 12px; color: var(--adm-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.adm-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; margin-bottom: 14px; }
.adm-chart-card { background: #fff; border: 1px solid var(--adm-border); border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
.adm-chart-card h4 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.adm-chart-wrap { position: relative; height: 320px; }
.adm-chart-wrap.tall { height: 420px; }
.adm-panel-state {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.85); color: var(--adm-muted); font-size: 13px;
}
.adm-skeleton {
    display: inline-block; width: 70%; height: 26px; border-radius: 6px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 400% 100%; animation: adm-shimmer 1.2s ease infinite;
}
@keyframes adm-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.adm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; margin-top: 8px; }
.adm-legend span i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.adm-range .btn { font-weight: 600; }
.adm-range .btn.active, .adm-range .btn.active:hover, .adm-range .btn.active:focus {
    background: var(--adm-blue); border-color: var(--adm-blue); color: #fff; box-shadow: none;
}
