:root {
    --agent-primary: #4f46e5;
    --agent-primary-hover: #4338ca;
    --agent-primary-soft: #eef2ff;
    --agent-primary-border: #c7d2fe;
    --agent-success: #059669;
    --agent-success-soft: #ecfdf5;
    --agent-success-border: #a7f3d0;
    --agent-warning: #d97706;
    --agent-warning-soft: #fffbeb;
    --agent-warning-border: #fcd34d;
    --agent-danger: #dc2626;
    --agent-danger-soft: #fef2f2;
    --agent-info: #2563eb;
    --agent-info-soft: #eff6ff;
    --agent-text: #111827;
    --agent-muted: #6b7280;
    --agent-border: #e5e7eb;
    --agent-soft-border: #f1f5f9;
    --agent-surface: #ffffff;
    --agent-background: #f7f8fb;
    --agent-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --agent-shadow-strong: 0 18px 50px rgba(15, 23, 42, 0.14);
    --agent-radius: 8px;
    --agent-sidebar-width: 268px;

    --md-primary: var(--agent-primary);
    --md-primary-variant: var(--agent-primary-hover);
    --md-secondary: var(--agent-info);
    --md-surface: var(--agent-surface);
    --md-background: var(--agent-background);
    --md-error: var(--agent-danger);
    --sidebar-width: var(--agent-sidebar-width);
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    color: var(--agent-text);
}

body.agent-app {
    background: var(--agent-background);
    overflow-x: hidden;
}

.text-agent-success {
    color: var(--agent-success) !important;
}

.text-agent-warning {
    color: var(--agent-warning) !important;
}

.text-agent-danger {
    color: var(--agent-danger) !important;
}

.text-agent-info {
    color: var(--agent-info) !important;
}

.text-agent-primary {
    color: var(--agent-primary) !important;
}

.sidebar {
    width: var(--agent-sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    background: var(--agent-surface);
    border-left: 1px solid var(--agent-border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar .logo {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--agent-border);
    margin-bottom: 8px;
    position: relative;
}

.sidebar .logo img,
.mobile-logo,
.auth-brand img {
    object-fit: cover;
}

.sidebar .logo img {
    width: 40px;
    height: 40px;
    margin-left: 12px;
    border-radius: var(--agent-radius);
}

.sidebar .logo span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--agent-primary);
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    background: transparent;
    border: 0;
    color: var(--agent-muted);
    font-size: 1.45rem;
    line-height: 1;
    padding: 7px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.sidebar-close:hover {
    background: var(--agent-primary-soft);
    color: var(--agent-primary);
}

.agent-info {
    padding: 16px;
    margin: 0 14px 18px;
    border: 1px solid var(--agent-primary-border);
    border-radius: var(--agent-radius);
    background: var(--agent-primary-soft);
}

.agent-info .agent-name {
    color: var(--agent-text);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.agent-info .token-badge {
    background: var(--agent-surface);
    color: var(--agent-primary);
    border: 1px solid var(--agent-primary-border);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0 12px;
}

.nav-list--bottom {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--agent-border);
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    color: var(--agent-muted);
    text-decoration: none;
    border-radius: var(--agent-radius);
    font-weight: 500;
    font-size: 0.92rem;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--agent-primary-soft);
    color: var(--agent-primary);
}

.nav-link i {
    margin-left: 12px;
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.nav-link.text-danger {
    color: var(--agent-danger) !important;
}

.nav-link.text-danger:hover {
    background: var(--agent-danger-soft);
}

.main-content {
    margin-right: var(--agent-sidebar-width);
    padding: 28px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--agent-text);
    font-size: 1.35rem;
    font-weight: 600;
}

.page-title i {
    color: var(--agent-primary);
}

.card {
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    box-shadow: var(--agent-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--agent-border);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--agent-text);
}

.stat-card {
    padding: 22px;
    height: 100%;
    min-height: 112px;
}

.stat-card .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--agent-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon--primary {
    background: var(--agent-primary-soft);
    color: var(--agent-primary);
}

.stat-icon--success {
    background: var(--agent-success-soft);
    color: var(--agent-success);
}

.stat-icon--info {
    background: var(--agent-info-soft);
    color: var(--agent-info);
}

.stat-icon--warning {
    background: var(--agent-warning-soft);
    color: var(--agent-warning);
}

.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--agent-text);
    margin-bottom: 2px;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--agent-muted);
}

.btn {
    border-radius: 7px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--agent-primary);
    border-color: var(--agent-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--agent-primary-hover);
    border-color: var(--agent-primary-hover);
}

.btn-outline-secondary {
    color: var(--agent-muted);
    border-color: var(--agent-border);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: var(--agent-soft-border);
    color: var(--agent-text);
    border-color: var(--agent-border);
}

.form-control,
.form-select {
    border-radius: var(--agent-radius);
    border-color: var(--agent-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--agent-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--agent-border);
    color: var(--agent-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    padding: 13px 16px;
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--agent-soft-border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #fbfdff;
}

.row-clickable {
    cursor: pointer;
}

/* Customers whose user account was hard-deleted by the admin. We still show
   the row so the agent has audit context for who they activated, but it's
   visually deemphasized and not clickable. */
.row-deleted {
    background: #fafafa;
    cursor: default;
}
.row-deleted td {
    color: var(--agent-muted);
}

.table-compact-text,
.compact-copy {
    font-size: 0.875rem;
}

.badge {
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 10px;
}

.badge-agent-primary {
    background: var(--agent-primary-soft);
    color: var(--agent-primary);
}

.badge-agent-muted {
    background: #f3f4f6;
    color: var(--agent-muted);
}

.badge-agent-success {
    background: var(--agent-success-soft);
    color: var(--agent-success);
}

.badge-agent-warning {
    background: var(--agent-warning-soft);
    color: var(--agent-warning);
}

.badge-agent-info {
    background: var(--agent-info-soft);
    color: var(--agent-info);
}

.badge-agent-danger {
    background: var(--agent-danger-soft);
    color: var(--agent-danger);
}

/* Description list used on customer/device detail pages — RTL-friendly
   key/value layout with subtle separators. */
.info-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 1rem;
    row-gap: 0.65rem;
    margin: 0;
}
.info-list dt {
    color: var(--agent-muted);
    font-weight: 500;
    font-size: 0.875rem;
    align-self: center;
}
.info-list dd {
    margin: 0;
    color: #1f2937;
    font-weight: 500;
    align-self: center;
}

/* Subtitle strip used under page-title on the device detail page —
   customer name, phone, and short device id at a glance. */
.device-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--agent-muted);
    font-size: 0.875rem;
}
.device-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.device-meta__item i {
    font-size: 0.95rem;
    opacity: 0.75;
}
.device-meta__sep {
    color: #d1d5db;
}
.device-meta__id {
    background: #f3f4f6;
    color: #374151;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.5px;
}

/* Android package names — long, dotted identifiers shown in the apps table. */
.package-name {
    color: var(--agent-muted);
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    word-break: break-all;
}

/* Settings row — used on device detail to align label + control horizontally,
   stack vertically on small screens. */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}
.setting-row__label {
    flex: 1 1 auto;
    min-width: 200px;
}
.setting-row__control {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}
.setting-divider {
    margin: 0.85rem 0;
    border-color: #f1f3f4;
}
@media (max-width: 575.98px) {
    .setting-row__control {
        width: 100%;
    }
    .setting-row__control .form-select {
        flex: 1 1 auto;
    }
}

/* Toggle switch — minimal, RTL-friendly. Reuses agent-primary palette. */
.setting-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
    margin: 0;
}
.setting-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.setting-toggle__slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.2s;
    cursor: pointer;
}
.setting-toggle__slider::before {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;   /* RTL: knob starts on the right */
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.setting-toggle input:checked + .setting-toggle__slider {
    background: var(--agent-primary);
}
.setting-toggle input:checked + .setting-toggle__slider::before {
    transform: translateX(-20px); /* RTL: move knob to the left when checked */
}
.setting-toggle__state {
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 60px;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--agent-radius);
}

.alert-success {
    background: var(--agent-success-soft);
    border-color: var(--agent-success-border);
    color: #065f46;
}

.alert-danger {
    background: var(--agent-danger-soft);
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: var(--agent-warning-soft);
    border-color: var(--agent-warning-border);
    color: #92400e;
}

.alert-info {
    background: var(--agent-info-soft);
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.content-narrow {
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
}

.balance-note {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--agent-success-soft);
    border: 1px solid var(--agent-success-border);
    color: #065f46;
    border-radius: var(--agent-radius);
    padding: 12px 14px;
    margin-bottom: 24px;
    font-size: 0.92rem;
}

.customer-create-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.customer-create-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.customer-create-grid .card {
    height: 100%;
}

.customer-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.customer-form-actions .btn {
    min-width: 132px;
}

.customer-form-actions .btn-primary {
    min-width: min(360px, 100%);
    max-width: 440px;
    white-space: normal;
    line-height: 1.35;
}

.plan-option {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    text-align: start;
}

.plan-option:hover {
    border-color: var(--agent-primary-border);
    background: #fbfdff;
}

.plan-option__name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--agent-text);
}

.plan-option__body {
    flex: 1;
    display: block;
    margin: 12px 0;
}

.plan-option__feature {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--agent-muted);
    font-size: 0.86rem;
    margin-bottom: 6px;
}

.plan-option__feature i {
    color: var(--agent-primary);
}

.plan-option__price {
    padding-top: 12px;
    border-top: 1px solid var(--agent-soft-border);
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.plan-option__amount {
    color: var(--agent-primary);
    font-size: 1.45rem;
    font-weight: 800;
}

.plan-option__period {
    color: var(--agent-muted);
    font-size: 0.85rem;
}

.plan-option__warning {
    margin-top: 10px;
    color: var(--agent-danger);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-option--disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.btn-check:checked + .plan-option {
    border-color: var(--agent-primary);
    background: var(--agent-primary-soft);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

.btn-check:checked + .plan-option .plan-option__name {
    color: var(--agent-primary-hover);
}

.btn-check:disabled + .plan-option {
    pointer-events: none;
}

.btn-check:focus-visible + .plan-option {
    outline: 2px solid var(--agent-primary);
    outline-offset: 2px;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
}

.summary-strip__item {
    padding: 18px;
    text-align: center;
    background: var(--agent-surface);
}

.summary-strip__label {
    color: var(--agent-muted);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.summary-strip__value {
    font-size: 1.35rem;
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 52px 20px;
}

.empty-state i {
    color: #cbd5e1;
    font-size: 2.8rem;
    display: block;
    margin-bottom: 14px;
}

.empty-state h6 {
    color: var(--agent-muted);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--agent-muted);
    font-size: 0.9rem;
    margin-bottom: 22px;
}

.price-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.price-list__item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--agent-soft-border);
}

.price-list__item:last-child {
    border-bottom: 0;
}

/* Inviting, clickable plan cards (dashboard prices) */
.plan-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 22px 16px 18px;
    border: 1px solid var(--agent-border);
    border-radius: 14px;
    background: var(--agent-surface);
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.plan-card:hover {
    transform: translateY(-4px);
    border-color: var(--agent-primary-border);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.14);
}

.plan-card__name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--agent-text);
}

.plan-card__price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.plan-card__amount {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--agent-primary);
}

.plan-card__period {
    font-size: 0.85rem;
    color: var(--agent-muted);
}

.plan-card__devices {
    font-size: 0.82rem;
    color: var(--agent-muted);
}

.plan-card__cta {
    margin-top: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--agent-primary);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.plan-card:hover .plan-card__cta {
    opacity: 1;
    transform: translateY(0);
}

/* Recommended (מקס) — accented, slightly raised, with a ribbon */
.plan-card--recommended {
    border-color: var(--agent-primary);
    border-width: 2px;
    background: linear-gradient(180deg, var(--agent-primary-soft) 0%, var(--agent-surface) 55%);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
}

.plan-card--recommended .plan-card__cta {
    opacity: 1;
    transform: none;
}

.plan-card__ribbon {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 3px 14px;
    border-radius: 999px;
    background: var(--agent-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3);
}


.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: var(--agent-success-soft);
    color: var(--agent-success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

.detail-panel {
    background: #f8fafc;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    padding: 20px;
}

.otp-panel {
    background: var(--agent-warning-soft);
    border: 1px solid var(--agent-warning-border);
    border-radius: var(--agent-radius);
    padding: 18px;
}

.otp-code {
    background: var(--agent-surface);
    border: 1px dashed var(--agent-warning);
    border-radius: var(--agent-radius);
    padding: 14px;
    color: var(--agent-warning);
    font-size: clamp(2rem, 10vw, 3.2rem);
    font-weight: 800;
    letter-spacing: 10px;
    direction: ltr;
    text-align: center;
}

.otp-copy-btn {
    margin-bottom: 10px;
}

.otp-panel small {
    display: block;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

body.sidebar-open {
    overflow: hidden;
}

body.agent-auth-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    box-shadow: var(--agent-shadow-strong);
    padding: 40px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand img {
    width: 72px;
    height: 72px;
    border-radius: var(--agent-radius);
    margin-bottom: 16px;
    box-shadow: var(--agent-shadow);
}

.auth-brand h1 {
    margin: 0;
    color: var(--agent-text);
    font-size: 1.65rem;
    font-weight: 700;
}

.auth-brand p {
    margin: 8px 0 0;
    color: var(--agent-muted);
    font-size: 0.96rem;
}

.auth-form .form-outline {
    margin-bottom: 22px;
    text-align: right;
}

.auth-footnote {
    margin-top: 24px;
    text-align: center;
    color: var(--agent-muted);
    font-size: 0.875rem;
}

.auth-link {
    color: var(--agent-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--agent-primary-hover);
    text-decoration: underline;
}

.phone-display {
    background: #f8fafc;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    padding: 14px;
    font-size: 1.15rem;
    font-weight: 700;
    direction: ltr;
    text-align: center;
    color: var(--agent-text);
    margin-bottom: 22px;
}

.otp-input {
    letter-spacing: 8px;
    font-weight: 700;
}

@media (max-width: 991px) {
    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(100%);
        transition: transform 0.25s ease;
        box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 20px;
    }

    .customer-create-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 992px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 575px) {
    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header .btn {
        width: 100%;
    }

    .customer-form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .customer-form-actions .btn,
    .customer-form-actions .btn-primary {
        width: 100%;
        min-width: 0;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .summary-strip {
        grid-template-columns: 1fr;
    }

    .otp-code {
        letter-spacing: 6px;
    }
}

/* ==================== Partner groups ==================== */

.group-card {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.group-card:hover {
    box-shadow: var(--agent-shadow-strong);
    transform: translateY(-2px);
}

.group-card__stripe {
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 4px;
}

.group-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

/* Colour swatch radio — the native input stays focusable, the ring is drawn
   on the sibling span so keyboard users still see selection and focus. */
.color-swatch {
    position: relative;
    cursor: pointer;
    line-height: 0;
}

.color-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-swatch span[aria-hidden] {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--swatch);
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px var(--agent-border);
}

.color-swatch input:checked + span[aria-hidden] {
    box-shadow: 0 0 0 2px var(--agent-surface), 0 0 0 4px var(--swatch);
}

.color-swatch input:focus-visible + span[aria-hidden] {
    outline: 2px solid var(--agent-primary);
    outline-offset: 3px;
}

/* --- Mode choice (additive vs exact) --- */
.mode-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 12px;
}

.mode-option {
    display: block;
    cursor: pointer;
    margin: 0;
}

.mode-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-option__body {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    background: var(--agent-surface);
    height: 100%;
}

.mode-option input:checked + .mode-option__body {
    border-color: var(--agent-primary);
    background: var(--agent-primary-soft);
}

.mode-option input:focus-visible + .mode-option__body {
    outline: 2px solid var(--agent-primary);
    outline-offset: 2px;
}

.mode-option__title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.mode-option__desc {
    display: block;
    font-size: 0.85rem;
    color: var(--agent-muted);
}

/* --- App list with a three-state control per row --- */
.app-list {
    max-height: 30rem;
    overflow-y: auto;
}

.app-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--agent-soft-border);
}

.app-row[hidden] {
    display: none;
}

.app-row:last-child {
    border-bottom: 0;
}

.app-row__id {
    min-width: 0;
}

.app-row__name {
    display: block;
    font-weight: 500;
}

.app-row__pkg {
    display: block;
    font-size: 0.75rem;
    color: var(--agent-muted);
    overflow-wrap: anywhere;
}

/* State is carried by colour AND by the selected label's text, never colour
   alone — the row still reads correctly without colour perception. */
.app-row[data-state="allow"] { background: var(--agent-success-soft); }
.app-row[data-state="block"] { background: var(--agent-danger-soft); }

.segmented {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1px solid var(--agent-border);
    border-radius: var(--agent-radius);
    overflow: hidden;
    background: var(--agent-surface);
}

.segmented__opt {
    margin: 0;
    cursor: pointer;
}

.segmented__opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.segmented__opt span {
    display: block;
    padding: 5px 12px;
    font-size: 0.82rem;
    white-space: nowrap;
    color: var(--agent-muted);
    border-inline-start: 1px solid var(--agent-border);
}

.segmented__opt:first-child span {
    border-inline-start: 0;
}

.segmented__opt input:checked + span {
    color: #fff;
    background: var(--agent-muted);
}

.segmented__opt--allow input:checked + span { background: var(--agent-success); }
.segmented__opt--block input:checked + span { background: var(--agent-danger); }

.segmented__opt input:focus-visible + span {
    outline: 2px solid var(--agent-primary);
    outline-offset: -2px;
}

/* Day chips and the schedule app picker moved to schedule-picker.css — the
 * admin device screen edits the same schedules and needed the same controls,
 * and one definition beats two that drift. Loaded by this portal's base
 * template alongside this file. */


.customer-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--agent-radius);
    cursor: pointer;
    margin: 0;
}

.customer-option:hover {
    background: var(--agent-primary-soft);
}

.customer-option__name {
    font-weight: 500;
    flex: 1 1 auto;
}

.customer-option__phone {
    color: var(--agent-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 575px) {
    .app-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .segmented {
        width: 100%;
    }

    .segmented__opt {
        flex: 1 1 0;
    }

    .segmented__opt span {
        text-align: center;
    }
}
