/* =====================================================================
   Assistra - design system
   ===================================================================== */
:root {
    --zd-nav: #252c3b;
    --zd-nav-2: #2f3747;
    --zd-nav-active: #3b4558;
    --zd-nav-text: #e7eaf0;
    --zd-nav-muted: #a9b1c2;
    --zd-blue: #1a73e8;
    --zd-blue-dark: #1560c4;
    --zd-blue-soft: #e8f1fd;
    --zd-red: #e0434b;
    --zd-red-soft: #fdecec;
    --zd-green: #20a456;
    --zd-green-soft: #e6f6ec;
    --zd-orange: #f08b1d;
    --zd-orange-soft: #fff3e3;
    --zd-bg: #f3f5f8;
    --zd-card: #ffffff;
    --zd-border: #e3e6eb;
    --zd-border-2: #d1d6de;
    --zd-text: #1f2329;
    --zd-text-2: #4a5160;
    --zd-muted: #7b8494;
    --zd-row-hover: #f6f8fb;
    --zd-radius: 4px;
    --zd-shadow: 0 2px 10px rgba(20, 30, 50, .12);
    --zd-shadow-lg: 0 8px 28px rgba(20, 30, 50, .18);
    --zd-topbar-h: 48px;
    --zd-rail-w: 70px;
    --zd-font: "Lato", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--zd-font);
    font-size: 13px;
    color: var(--zd-text);
    background: var(--zd-bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--zd-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--zd-muted); }
.nowrap { white-space: nowrap; }
.text-red { color: var(--zd-red); }
.text-green { color: var(--zd-green); }
.mt-0 { margin-top: 0 !important; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; } .flex-1 { flex: 1; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 16px; border-radius: var(--zd-radius);
    border: 1px solid var(--zd-border-2); background: #fff; color: var(--zd-text);
    font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: #f6f7f9; }
.btn-primary { background: var(--zd-blue); border-color: var(--zd-blue); color: #fff; }
.btn-primary:hover { background: var(--zd-blue-dark); }
.btn-outline { border-color: var(--zd-blue); color: var(--zd-blue); background: #fff; }
.btn-outline:hover { background: var(--zd-blue-soft); }
.btn-danger { background: var(--zd-red); border-color: var(--zd-red); color: #fff; }
.btn-danger:hover { background: #c7333b; }
.btn-red-cta { background: #e42527; border-color: #e42527; color: #fff; text-transform: uppercase; letter-spacing: .5px; height: 44px; font-weight: 700; }
.btn-red-cta:hover { background: #c81d1f; }
.btn-link { border: 0; background: none; color: var(--zd-blue); padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline; background: none; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 32px; padding: 0; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-btn .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255,255,255,.35); padding: 0 8px; }

/* ---------- avatar ---------- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 50%;
    background: #fff; border: 1px solid var(--zd-border-2); color: var(--zd-text);
    font-size: 12px; font-weight: 600; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }
.avatar-xl { width: 96px; height: 96px; font-size: 28px; }
.chip-agent { display: inline-flex; align-items: center; gap: 6px; }

/* =====================================================================
   Agent shell
   ===================================================================== */
.zd-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.zd-topbar {
    height: var(--zd-topbar-h); flex-shrink: 0; display: flex; align-items: center;
    background: var(--zd-nav); color: var(--zd-nav-text); padding: 0 12px 0 0; position: relative; z-index: 50;
}
.zd-logo { width: var(--zd-rail-w); height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; }
.zd-logo img { max-width: 34px; max-height: 30px; }
.zd-logo:has(.zd-logo-full) { width: auto; padding: 0 14px 0 16px; }
.zd-logo img.zd-logo-full { height: 34px; width: auto; max-width: none; max-height: none; }
.zd-modules { display: flex; height: 100%; overflow-x: auto; scrollbar-width: none; }
.zd-modules a {
    display: flex; align-items: center; height: 100%; padding: 0 12px; color: var(--zd-nav-text);
    font-size: 14px; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none;
}
.zd-modules a:hover { color: #fff; background: var(--zd-nav-2); text-decoration: none; }
.zd-modules a.active { color: #fff; border-bottom-color: #fff; }
.zd-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; height: 100%; }
.zd-dept-switch {
    background: none; border: 0; color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 4px; cursor: pointer; margin-right: 6px;
}
.zd-dept-switch:hover { background: var(--zd-nav-2); }
.zd-create { display: inline-flex; margin-right: 6px; }
.zd-create .btn { height: 30px; background: var(--zd-blue); border-color: var(--zd-blue); color: #fff; font-size: 18px; padding: 0 10px; }
.zd-create .btn:last-child { font-size: 12px; padding: 0 6px; }
.zd-icon-btn {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; position: relative;
    color: var(--zd-nav-text); font-size: 17px; border-radius: 4px; background: none; border: 0; cursor: pointer; text-decoration: none !important;
}
.zd-icon-btn:hover { background: var(--zd-nav-2); color: #fff; }
.zd-icon-btn .badge { position: absolute; top: 4px; right: 3px; background: var(--zd-red); color: #fff; font-size: 9px; border-radius: 8px; min-width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.zd-me { position: relative; margin: 0 6px; }
.zd-me .avatar { width: 30px; height: 30px; font-size: 11px; background: #fff; color: var(--zd-text); border: 2px solid #fff; cursor: pointer; }
.zd-me .presence { position: absolute; bottom: 0; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--zd-green); border: 2px solid var(--zd-nav); }

.zd-body { flex: 1; display: flex; min-height: 0; }
.zd-rail {
    width: var(--zd-rail-w); flex-shrink: 0; background: var(--zd-nav); color: var(--zd-nav-text);
    display: flex; flex-direction: column; padding-top: 4px; overflow-y: auto;
}
.zd-rail a {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; color: var(--zd-nav-text);
    font-size: 11px; font-weight: 600; text-align: center; line-height: 1.15; text-decoration: none; border-left: 3px solid transparent;
}
.zd-rail a i { font-size: 17px; }
.zd-rail a:hover { background: var(--zd-nav-2); }
.zd-rail a.active { background: var(--zd-nav-active); border-left-color: #fff; color: #fff; }
.zd-rail .rail-bottom { margin-top: auto; padding: 12px 0; text-align: center; color: var(--zd-nav-muted); font-size: 16px; }
.zd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.zd-scroll { flex: 1; overflow: auto; }

/* ---------- dropdown menu ---------- */
.dd { position: relative; display: inline-block; }
.dd-menu {
    position: absolute; top: calc(100% + 4px); right: 0; min-width: 220px; background: #fff; color: var(--zd-text);
    border: 1px solid #eceef2; border-radius: 6px; box-shadow: 0 6px 24px rgba(23, 33, 54, .14), 0 1px 3px rgba(23, 33, 54, .08);
    padding: 8px 0; display: none; z-index: 200; max-height: 420px; overflow-y: auto;
}
.dd-menu.left { left: 0; right: auto; }
.dd.open > .dd-menu { display: block; }
.dd-menu .dd-head { padding: 8px 14px 6px; font-size: 11px; font-weight: 700; color: var(--zd-muted); text-transform: uppercase; letter-spacing: .4px; }
.dd-menu .dd-item, .dd-menu form button.dd-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 18px; color: var(--zd-text); font-size: 13.5px; line-height: 1.35;
    background: none; border: 0; text-align: left; cursor: pointer; text-decoration: none;
}
.dd-menu .dd-item:hover { background: #f1f4f8; text-decoration: none; }
.dd-menu .dd-item .hint { margin-left: auto; color: #b3b9c4; font-size: 11px; }
.dd-menu .dd-item.selected { color: var(--zd-blue); font-weight: 600; }
.dd-menu .dd-sep { height: 1px; background: var(--zd-border); margin: 6px 0; }
.dd-menu .dd-search { padding: 4px 10px 8px; }
.dd-menu .dd-search input { width: 100%; height: 30px; border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 0 8px; font-size: 12px; }
.dd-profile { min-width: 280px; }
.dd-profile .dd-profile-head { display: flex; gap: 12px; padding: 12px 14px; align-items: center; }

/* =====================================================================
   Setup area
   ===================================================================== */
.setup { display: flex; height: 100%; }
.setup-nav { position: relative;
    width: 220px; flex-shrink: 0; background: var(--zd-nav); color: var(--zd-nav-text); overflow-y: auto; padding-bottom: 24px;
    scrollbar-width: thin; scrollbar-color: #4a5468 transparent;
}
.setup-nav::-webkit-scrollbar { width: 6px; }
.setup-nav::-webkit-scrollbar-thumb { background: #4a5468; border-radius: 3px; }
.setup-nav .sn-head { position: sticky; top: 0; z-index: 2; background: var(--zd-nav); }
.setup-nav .sn-search { padding: 12px 16px 0; }
.setup-nav .sn-search input {
    width: 100%; height: 30px; border: 0; border-bottom: 1px solid #4a5468; border-radius: 0; padding: 0 6px 0 22px; font-size: 12px; color: #fff; outline: none;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11'/%3E%3C/svg%3E") no-repeat 2px center;
}
.setup-nav .sn-search input::placeholder { color: var(--zd-nav-muted); }
.setup-nav .sn-search input:focus { border-bottom-color: #8fa0bb; }
.setup-nav .sn-title { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 11px 18px; font-size: 15px; font-weight: 600; color: #fff; background: var(--zd-nav-2); border-left: 3px solid #fff; }
.setup-nav .sn-section { display: inline-block; padding: 16px 20px 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; color: #fff; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; }
.setup-nav a.sn-item { display: flex; align-items: center; margin: 0 10px; padding: 7px 10px; border-radius: 3px; color: var(--zd-nav-text); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.setup-nav a.sn-item:hover { background: var(--zd-nav-2); color: #fff; }
.setup-nav a.sn-item.open { background: var(--zd-nav-active); color: #fff; }
.setup-nav a.sn-item.active { color: #5aa9ff; font-weight: 700; background: none; }
.setup-nav a.sn-item.active:hover { background: var(--zd-nav-2); }
.setup-nav a.sn-item .chev { margin-left: auto; font-size: 11px; color: var(--zd-nav-text); -webkit-text-stroke: .3px; }
.setup-nav .sn-sub a.sn-item { padding-left: 20px; }
.setup-content { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.setup-page { padding: 0 24px 90px; }

/* page header */
.page-head {
    display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--zd-border);
    position: sticky; top: 0; z-index: 10;
}
.page-head .crumbs { font-size: 15px; color: var(--zd-text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-head .crumbs a { color: var(--zd-text-2); }
.page-head .crumbs .sep { color: #b9bfca; }
.page-head .crumbs .current { color: var(--zd-text); font-weight: 600; }
.page-head .back { color: var(--zd-text); font-size: 16px; display: inline-flex; }
.page-head .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.page-head .search-box input { height: 32px; width: 220px; border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 0 10px; font-size: 13px; }

/* info banner */
.banner {
    display: flex; align-items: center; gap: 24px; background: #fff; border: 1px solid var(--zd-border); border-radius: var(--zd-radius);
    padding: 18px 24px; margin: 20px 0;
}
.banner .b-text { flex: 1; }
.banner .b-title { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 8px; }
.banner .b-desc { color: var(--zd-text-2); line-height: 1.6; max-width: 900px; }
.banner .b-art { width: 150px; flex-shrink: 0; }

/* cards & forms */
.card { background: var(--zd-card); border: 1px solid var(--zd-border); border-radius: var(--zd-radius); margin-top: 20px; }
.card-head { padding: 16px 24px 4px; }
.card-head h3 { font-size: 15px; }
.card-head p { margin: 6px 0 0; color: var(--zd-muted); }
.card-body { padding: 12px 24px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; row-gap: 6px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; align-items: flex-start; gap: 16px; padding: 8px 0; min-height: 44px; }
.field > label, .field > .label {
    width: 190px; flex-shrink: 0; text-align: right; padding-top: 8px; color: var(--zd-text-2); font-size: 13px;
}
.field.stack { flex-direction: column; gap: 6px; }
.field.stack > label { width: auto; text-align: left; padding-top: 0; }
.field > label.req, .field > .label.req, label.req { color: var(--zd-red); }
label.req::after, .label.req::after { content: " *"; }
.field .control { flex: 1; min-width: 0; }
.input, .select, .textarea {
    width: 100%; border: 0; border-bottom: 1px solid var(--zd-border-2); background: transparent; padding: 7px 2px; font-size: 13px;
    color: var(--zd-text); font-family: inherit; outline: none; border-radius: 0;
}
.input:focus, .select:focus, .textarea:focus { border-bottom-color: var(--zd-blue); }
.input::placeholder, .textarea::placeholder { color: #a9b0bc; }
.select { appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%237b8494' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 4px center; padding-right: 22px; cursor: pointer; }
.select[multiple] { background: #fff; border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 4px; min-height: 110px; }
.textarea { border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 8px; min-height: 80px; resize: vertical; }
.input-box { border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 0 10px; height: 34px; }
.input-box:focus { border-color: var(--zd-blue); }
.field-error, .field-validation-error { display: block; color: var(--zd-red); font-size: 12px; margin-top: 4px; }
.input-validation-error { border-bottom-color: var(--zd-red) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.help { color: var(--zd-muted); font-size: 12px; margin-top: 4px; }
.radio-row, .check-row { display: flex; flex-wrap: wrap; gap: 18px; padding-top: 7px; }
.radio-row label, .check-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--zd-text); }
input[type=radio], input[type=checkbox] { accent-color: var(--zd-blue); width: 15px; height: 15px; margin: 0; }
.points {
    background: #fdf8ec; border: 1px solid #f2e3bf; border-radius: var(--zd-radius); padding: 14px 18px; margin-top: 16px; color: var(--zd-text-2); line-height: 1.6;
}
.points b { display: inline-block; margin-bottom: 4px; text-decoration: underline; color: var(--zd-text); }
.points ul { margin: 0; padding-left: 18px; }

.form-footer {
    position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--zd-border); padding: 12px 24px;
    display: flex; gap: 10px; z-index: 5; margin: 24px -24px 0;
}
.form-footer.center { justify-content: center; }

/* upload */
.logo-upload { display: flex; align-items: center; gap: 18px; }
.logo-circle {
    width: 84px; height: 84px; border-radius: 50%; border: 1px dashed var(--zd-border-2); display: flex; align-items: center; justify-content: center;
    overflow: hidden; background: #fafbfc; color: var(--zd-muted); font-size: 22px; flex-shrink: 0;
}
.logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.logo-square { border-radius: 6px; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #c3c9d3; border-radius: 18px; cursor: pointer; transition: .15s; }
.switch .slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .slider { background: var(--zd-green); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:disabled + .slider { opacity: .55; cursor: not-allowed; }

/* tables */
.table-card { background: #fff; border: 1px solid var(--zd-border); border-radius: var(--zd-radius); margin-top: 16px; overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
    text-align: left; font-size: 11px; font-weight: 700; color: var(--zd-muted); text-transform: uppercase; letter-spacing: .4px;
    padding: 12px 16px; border-bottom: 1px solid var(--zd-border); white-space: nowrap; background: #fafbfc;
}
table.grid td { padding: 11px 16px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--zd-row-hover); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid .row-actions { visibility: hidden; display: inline-flex; gap: 4px; }
table.grid tr:hover .row-actions { visibility: visible; }
.badge-primary { background: var(--zd-blue-soft); color: var(--zd-blue); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; letter-spacing: .4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 3px; font-size: 12px; border: 1px solid var(--zd-border-2); background: #fff; }
.pill-green { color: var(--zd-green); border-color: #a9dfbd; background: var(--zd-green-soft); }
.pill-red { color: var(--zd-red); border-color: #f2b8bb; background: var(--zd-red-soft); }
.pill-orange { color: var(--zd-orange); border-color: #f6d0a4; background: var(--zd-orange-soft); }
.pill-grey { color: var(--zd-muted); }

/* tabs */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--zd-border); margin-top: 16px; }
.tabs a, .tabs button {
    padding: 10px 2px; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--zd-text-2);
    border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; text-decoration: none;
}
.tabs a.active, .tabs button.active { color: var(--zd-text); border-bottom-color: var(--zd-blue); }

/* empty state */
.empty { text-align: center; padding: 56px 20px; color: var(--zd-text-2); }
.empty .e-art { width: 150px; margin: 0 auto 14px; }
.empty h4 { font-size: 15px; color: var(--zd-text); margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; max-width: 460px; line-height: 1.6; }

/* detail key/values */
.kv { display: grid; grid-template-columns: 200px 1fr; row-gap: 14px; column-gap: 24px; }
.kv .k { color: var(--zd-muted); text-align: right; }
.kv .v { color: var(--zd-text); word-break: break-word; }

/* role tree */
.tree { list-style: none; margin: 0; padding-left: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 26px; border-left: 1px dashed #c9ced7; margin-left: 9px; }
.tree li { position: relative; padding: 5px 0; }
.tree .node { display: inline-flex; align-items: center; gap: 6px; }
.tree .toggle { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #aeb5c1; background: #fff; font-size: 11px; line-height: 1; cursor: pointer; border-radius: 2px; color: var(--zd-text-2); }
.tree .toggle.leaf { visibility: hidden; }
.tree li.collapsed > ul { display: none; }
.tree .node a { font-size: 13px; }
.tree .node .count { color: var(--zd-muted); font-size: 12px; }

/* profile permission editor */
.perm-wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.perm-card { background: #fff; border: 1px solid var(--zd-border); border-radius: var(--zd-radius); }
.perm-card h4 { font-size: 14px; padding: 14px 18px; border-bottom: 1px solid var(--zd-border); }
.perm-row { display: flex; align-items: flex-start; gap: 14px; padding: 12px 18px; border-bottom: 1px solid #f0f2f5; }
.perm-row:last-child { border-bottom: 0; }
.perm-row .pr-name { width: 150px; font-weight: 600; padding-top: 1px; display: flex; gap: 10px; align-items: center; }
.perm-row .pr-opts { flex: 1; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--zd-text-2); }
.perm-row .pr-opts label { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; }
.perm-row.disabled .pr-opts { opacity: .45; pointer-events: none; }
.perm-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-bottom: 1px solid #f0f2f5; }
.perm-toggle:last-child { border-bottom: 0; }
.perm-toggle .select { width: 190px; font-size: 12px; padding: 4px 22px 4px 2px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 22, 36, .45); display: none; align-items: flex-start; justify-content: center; z-index: 500; padding-top: 70px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 6px; box-shadow: var(--zd-shadow-lg); width: 620px; max-width: calc(100vw - 32px); max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--zd-border); }
.modal-head h3 { font-size: 16px; }
.modal-head .close { margin-left: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--zd-muted); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--zd-border); display: flex; gap: 10px; justify-content: flex-end; }

/* toast */
.toast {
    position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 900; min-width: 280px; max-width: 560px;
    padding: 10px 18px; border-radius: 4px; box-shadow: var(--zd-shadow-lg); color: #fff; background: #2e7d32; font-size: 13px;
    display: flex; gap: 10px; align-items: center;
}
.toast.error { background: var(--zd-red); }
.toast.info { background: #37474f; }
.alert { padding: 10px 14px; border-radius: 4px; margin: 12px 0; font-size: 13px; }
.alert-error { background: var(--zd-red-soft); color: #a61b22; border: 1px solid #f3c2c5; }
.alert-info { background: var(--zd-blue-soft); color: #1d4f91; border: 1px solid #c5dbfa; }
.alert-success { background: var(--zd-green-soft); color: #17693a; border: 1px solid #b5e2c6; }

/* pager */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px 4px; color: var(--zd-text-2); }
.pager a, .pager span.disabled { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 1px solid var(--zd-border-2); border-radius: 3px; background: #fff; color: var(--zd-text); }
.pager span.disabled { opacity: .4; }

/* module placeholder */
.module-placeholder { height: 100%; display: flex; align-items: center; justify-content: center; }
.module-placeholder .box { text-align: center; max-width: 520px; }
.module-placeholder h2 { font-size: 20px; margin: 16px 0 8px; }
.module-placeholder p { color: var(--zd-text-2); line-height: 1.6; }

/* =====================================================================
   Accounts (sign in / sign up)
   ===================================================================== */
.acc-page { min-height: 100vh; background: #f4f6fa; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.acc-card { background: #fff; width: 100%; max-width: 920px; min-height: 520px; border-radius: 6px; box-shadow: 0 2px 30px rgba(0,0,0,.08); display: flex; overflow: hidden; }
.acc-left { flex: 1; padding: 46px 52px; display: flex; flex-direction: column; }
.acc-right { width: 400px; border-left: 1px solid #eef0f4; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; background: #fff; }
.acc-right h3 { font-size: 18px; margin: 18px 0 8px; }
.acc-right p { color: var(--zd-text-2); line-height: 1.6; margin: 0 0 18px; }
.acc-brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: #222; margin-bottom: 34px; }
.acc-brand .brand-logo { height: 48px; width: auto; display: block; }
.acc-brand .brand-logo-white { display: none; }
.signup-quote .acc-brand .brand-logo-color { display: none; }
.signup-quote .acc-brand .brand-logo-white { display: block; }
.signup-quote .acc-brand { color: #fff; }
.signup-points { list-style: none; padding: 0; margin: 0; line-height: 2.2; font-size: 15px; }
.signup-points i { margin-right: 10px; opacity: .85; }
.acc-left h1 { font-size: 24px; font-weight: 600; }
.acc-left .sub { color: var(--zd-text-2); margin: 6px 0 26px; font-size: 15px; }
.acc-input { width: 100%; height: 44px; border: 1px solid #d8dce3; border-radius: 4px; padding: 0 14px; font-size: 15px; outline: none; font-family: inherit; }
.acc-input:focus { border-color: var(--zd-blue); }
.acc-field { margin-bottom: 16px; position: relative; }
.acc-field .eye { position: absolute; right: 12px; top: 12px; color: var(--zd-muted); cursor: pointer; background: none; border: 0; font-size: 16px; }
.acc-btn { width: 100%; height: 44px; background: var(--zd-blue); color: #fff; border: 0; border-radius: 4px; font-size: 15px; font-weight: 600; cursor: pointer; }
.acc-btn:hover { background: var(--zd-blue-dark); }
.acc-links { display: flex; justify-content: space-between; margin: -4px 0 18px; font-size: 13px; }
.acc-chip { display: inline-flex; align-items: center; gap: 10px; border: 1px solid #e1e4ea; border-radius: 20px; padding: 6px 14px; margin-bottom: 18px; font-size: 14px; }
.acc-foot { text-align: center; color: var(--zd-muted); font-size: 12px; margin-top: 18px; }
.acc-dots { display: flex; gap: 6px; margin-top: 18px; }
.acc-dots span { width: 7px; height: 7px; border-radius: 50%; background: #d4d8df; }
.acc-dots span.on { background: var(--zd-blue); }

.signup-page { min-height: 100vh; display: flex; background: #fff; }
.signup-quote { width: 360px; flex-shrink: 0; background: linear-gradient(160deg, #0a2e24 0%, #0b4a37 55%, #0e7a56 100%); color: #fff; padding: 46px 38px; display: flex; flex-direction: column; }
.signup-quote .q-mark { font-size: 54px; line-height: 1; opacity: .5; font-family: Georgia, serif; }
.signup-quote blockquote { margin: 10px 0 28px; font-size: 17px; line-height: 1.7; }
.signup-quote .who { font-weight: 800; letter-spacing: .6px; }
.signup-quote .role { opacity: .8; margin-top: 4px; }
.signup-main { flex: 1; display: flex; flex-direction: column; padding: 26px 46px; }
.signup-top { display: flex; justify-content: flex-end; gap: 8px; color: var(--zd-text-2); font-size: 13px; }
.signup-top a { font-weight: 700; }
.signup-form { width: 100%; max-width: 440px; margin: 40px auto 0; }
.signup-form h1 { font-size: 26px; font-weight: 600; margin-bottom: 26px; line-height: 1.35; }
.phone-row { display: flex; gap: 8px; }
.phone-row select { width: 120px; height: 44px; border: 1px solid #d8dce3; border-radius: 4px; padding: 0 8px; font-size: 14px; background: #fff; }
.signup-info { color: var(--zd-text-2); font-size: 13px; margin: 2px 0 14px; line-height: 1.6; }
.terms { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--zd-text-2); margin-bottom: 18px; }
.oauth { display: flex; gap: 10px; margin-top: 18px; }
.oauth a { flex: 1; height: 40px; border: 1px solid #d8dce3; border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--zd-text); font-weight: 600; }
.divider-or { display: flex; align-items: center; gap: 12px; color: var(--zd-muted); margin: 20px 0 6px; font-size: 12px; }
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: #e4e7ec; }
.signup-foot { margin-top: auto; text-align: center; color: var(--zd-muted); font-size: 12px; padding-top: 30px; }

.portal-list { list-style: none; padding: 0; margin: 0; }
.portal-list li a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--zd-border); border-radius: 6px; margin-bottom: 10px; color: var(--zd-text); text-decoration: none; }
.portal-list li a:hover { border-color: var(--zd-blue); background: var(--zd-blue-soft); }
.portal-list .p-name { font-weight: 700; font-size: 15px; }
.portal-list .p-url { color: var(--zd-muted); font-size: 12px; }

@media (max-width: 900px) {
    .acc-right, .signup-quote { display: none; }
    .acc-left { padding: 32px 24px; }
    .form-grid { grid-template-columns: 1fr; }
    .field > label, .field > .label { width: 130px; }
    .perm-wrap { grid-template-columns: 1fr; }
    .setup-nav { width: 200px; }
}

/* sign-in: sample accounts panel (DemoAccounts:Enabled) */
.acc-samples { justify-content: flex-start; align-items: stretch; text-align: left; overflow-y: auto; max-height: 640px; }
.acc-samples h3 { margin-top: 6px; }
.acc-samples p { font-size: 13px; margin-bottom: 12px; }
.acc-samples .sample { display: flex; align-items: center; gap: 10px; border: 1px solid #e6e9ef; border-radius: 5px; padding: 10px 12px; margin-bottom: 8px; }
.acc-samples .sample .who { flex: 1; min-width: 0; font-size: 13px; }
.acc-samples .sample .tag { font-size: 11px; color: var(--zd-text-2); background: #eef2f8; border-radius: 10px; padding: 1px 7px; margin-left: 4px; }
.acc-samples .sample .cred { color: var(--zd-text-2); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-samples .sample code { background: #f4f6f9; padding: 0 4px; border-radius: 3px; color: var(--zd-text); }


/* =====================================================================
   Assistra dropdowns (wwwroot/js/zd-select.js): trigger + white card list
   ===================================================================== */
.zs-native { display: none !important; }
.zs-trigger {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; cursor: pointer; text-align: left;
    font: inherit; color: var(--zd-text); background: transparent; border: 0; padding: 0; outline: none;
}
.zs-trigger .zs-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zs-trigger .zs-caret { flex-shrink: 0; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #6b7384; transition: transform .15s; }
.zs-trigger.zs-open .zs-caret { transform: rotate(180deg); }
.zs-trigger:disabled { cursor: default; opacity: .6; }
.zs-trigger:disabled .zs-caret { display: none; }
.zs-trigger.zs-placeholder .zs-text { color: #8a92a1; }

/* form fields: underline like Zoho (Agent ▾ / Ticket Charge Type ▾) */
.zs-trigger.select { display: flex; width: 100%; background-image: none; padding: 7px 2px; border-bottom: 1px solid var(--zd-border-2); }
.zs-trigger.select.zs-open, .zs-trigger.select:focus { border-bottom-color: var(--zd-blue); }
.field .zs-trigger.select .zs-text { font-weight: 600; }
.field .zs-trigger.select.zs-placeholder .zs-text { font-weight: 400; }

/* chips / filters (Last 24 Hours ▾) */
.zs-trigger.an-chip { height: 28px; padding: 0 10px; border: 1px solid var(--zd-border-2); border-radius: 3px; background: #fff; font-size: 12.5px; }
.zs-trigger.an-chip:hover, .zs-trigger.an-chip.zs-open { border-color: #9fb5d6; }
label.an-chip .zs-trigger { font-size: 12.5px; }

/* contexts that style selects by tag */
.status-pill:has(.zs-trigger)::after { display: none; }
.status-pill .zs-trigger { border: 1px solid var(--zd-border-2); border-radius: 3px; background: #fff; padding: 3px 8px 3px 10px; font-size: 12px; }
.status-pill.overdue .zs-trigger { color: var(--zd-red); border-color: #f2b8bb; background: var(--zd-red-soft); }
.status-pill.st-hold .zs-trigger { color: var(--zd-orange); border-color: #f6d0a4; background: var(--zd-orange-soft); }
.status-pill.st-closed .zs-trigger { color: var(--zd-green); border-color: #a9dfbd; background: var(--zd-green-soft); }
.prop .zs-trigger { display: flex; width: 100%; padding: 3px 0; font-size: 13px; font-weight: 600; border-bottom: 1px solid transparent; }
.prop .zs-trigger:hover, .prop .zs-trigger.zs-open { border-bottom-color: var(--zd-border-2); }
.prop .zs-trigger .zs-caret { opacity: 0; }
.prop .zs-trigger:hover .zs-caret, .prop .zs-trigger.zs-open .zs-caret { opacity: 1; }
.inline-edit .zs-trigger { flex: 1; height: 28px; border: 1px solid var(--zd-border-2); border-radius: 3px; padding: 0 8px; font-size: 13px; background: #fff; }
.filter-panel .zs-trigger { display: flex; width: 100%; height: 30px; border-radius: 3px; border: 1px solid rgba(255,255,255,.15); background: #1d2330; color: #fff; padding: 0 8px; font-size: 12px; }
.filter-panel .zs-trigger .zs-caret, .sr-filter .zs-trigger .zs-caret { border-top-color: #c5cbd6; }
.sr-filter .zs-trigger { display: flex; width: 100%; border-bottom: 1px solid #5a6375; color: #fff; font-weight: 700; padding: 4px 0; font-size: 13px; }
.phone-row .zs-trigger { width: 120px; height: 44px; border: 1px solid #d8dce3; border-radius: 4px; padding: 0 10px; font-size: 14px; background: #fff; }
.perm-toggle .zs-trigger.select { width: 190px; font-size: 12px; padding: 4px 2px; }

/* the open list: white card, soft shadow, roomy items (as in Zoho) */
.zs-menu {
    position: fixed; z-index: 1000; background: #fff; color: var(--zd-text); border: 1px solid #eceef2; border-radius: 6px;
    box-shadow: 0 6px 24px rgba(23, 33, 54, .14), 0 1px 3px rgba(23, 33, 54, .08); padding: 8px 0; display: flex; flex-direction: column;
    max-height: 340px; outline: none; font-size: 13.5px;
}
.zs-search { padding: 2px 10px 8px; }
.zs-search input { width: 100%; height: 32px; border: 1px solid var(--zd-border-2); border-radius: 4px; padding: 0 10px; font-size: 13px; outline: none; font-family: inherit; }
.zs-search input:focus { border-color: var(--zd-blue); }
.zs-list { overflow-y: auto; min-height: 0; }
.zs-group { padding: 10px 18px 4px; font-size: 11px; font-weight: 700; color: var(--zd-muted); text-transform: uppercase; letter-spacing: .4px; }
.zs-item { padding: 9px 18px; cursor: pointer; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zs-item.active { background: #f1f4f8; }
.zs-item.selected { color: var(--zd-blue); font-weight: 600; }
.zs-item.disabled { color: #b3b9c4; cursor: default; }
.zs-trigger.an-chip.zs-placeholder .zs-text, .sr-filter .zs-trigger.zs-placeholder .zs-text, .filter-panel .zs-trigger.zs-placeholder .zs-text { color: inherit; }
/* selected item: dark text, light highlight, blue check on the right (as in Zoho) */
.zs-item { position: relative; padding-right: 40px; }
.zs-item.selected { color: var(--zd-text); font-weight: 500; background: #eef3fb; }
.zs-item.selected::after { content: ""; position: absolute; right: 16px; top: 50%; width: 10px; height: 5px; border-left: 2px solid var(--zd-blue); border-bottom: 2px solid var(--zd-blue); transform: translateY(-70%) rotate(-45deg); }
.zs-item.selected.active { background: #e6eef9; }
.dd-menu .dd-item.selected { color: var(--zd-text); font-weight: 500; background: #eef3fb; }
