:root {
    color-scheme: light;
    --canvas: #f4f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-strong: #eef3f8;
    --ink: #10233f;
    --ink-soft: #31435f;
    --muted: #697a91;
    --line: #dce4ed;
    --line-strong: #cbd6e2;
    --navy: #102a43;
    --navy-deep: #081c2f;
    --blue: #2463eb;
    --blue-dark: #1d4ed8;
    --teal: #0e7c66;
    --teal-soft: #e7f7f3;
    --green: #12805c;
    --green-soft: #e9f8f0;
    --amber: #9a6200;
    --amber-soft: #fff6dc;
    --red: #b42318;
    --red-soft: #fff0ee;
    --info: #175cd3;
    --info-soft: #eff6ff;
    --sidebar-width: 276px;
    --radius-sm: 10px;
    --radius: 15px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 8px rgba(15, 35, 63, .05);
    --shadow: 0 14px 38px rgba(15, 35, 63, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
svg.icon { width: 20px; height: 20px; flex: 0 0 20px; }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(36, 99, 235, .24);
    outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.9rem, 3vw, 2.55rem); line-height: 1.1; letter-spacing: -.035em; }
h2 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -.015em; }
h3 { font-size: 1.05rem; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }

.eyebrow {
    display: inline-block;
    margin-bottom: .45rem;
    color: var(--teal);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.muted { color: var(--muted); }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.button,
button {
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    padding: .65rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--ink);
    background: var(--surface-strong);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.button:hover,
button:hover { transform: translateY(-1px); }
.button:active,
button:active { transform: translateY(0); }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 7px 18px rgba(36, 99, 235, .22); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { background: var(--navy); color: #fff; }
.button-secondary:hover { background: var(--navy-deep); }
.button-tertiary { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); }
.button-tertiary:hover { background: var(--surface-muted); }
.button-danger-soft { color: var(--red); background: var(--red-soft); border: 1px solid #f3c8c4; }
.button-success-soft { color: var(--green); background: var(--green-soft); border: 1px solid #c3ead7; }
.button-compact { min-height: 36px; padding: .45rem .75rem; font-size: .88rem; }
.button-wide { width: 100%; }
.icon-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    margin-top: .45rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: .7rem .8rem;
    color: var(--ink);
    background: var(--surface);
}
textarea { min-height: 110px; resize: vertical; }
input[type="color"] { padding: .25rem; min-height: 46px; }
input[type="file"] { padding: .55rem; }
label { display: block; color: var(--ink-soft); font-size: .9rem; font-weight: 720; }
.field-help { margin: -.25rem 0 .5rem; color: var(--muted); font-size: .82rem; }
.stack-form { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; padding-top: .35rem; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    color: #eaf2f8;
    background:
        radial-gradient(circle at 20% 10%, rgba(26, 121, 104, .28), transparent 28%),
        linear-gradient(180deg, #102a43 0%, #091e31 100%);
    border-right: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 10px 0 35px rgba(8, 28, 47, .08);
}
.sidebar-brand {
    min-height: 78px;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
}
.sidebar-brand > a { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-emblem {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #23a47d, #2463eb);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 9px 22px rgba(0, 0, 0, .18);
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .02em;
}
.brand-copy { min-width: 0; display: grid; }
.brand-copy strong { font-size: 1.02rem; }
.brand-copy small { color: #9eb4c8; font-size: .74rem; }
.sidebar-close { display: none; margin-left: auto; color: #fff; border-color: rgba(255, 255, 255, .13); background: rgba(255, 255, 255, .06); font-size: 1.5rem; }

.workspace-chip {
    margin: 1rem 1rem .5rem;
    padding: .85rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: rgba(255, 255, 255, .065);
}
.workspace-avatar,
.profile-mini-avatar,
.entity-avatar,
.profile-avatar {
    display: inline-grid;
    place-items: center;
    border-radius: 11px;
    color: var(--navy);
    background: #d8f5eb;
    font-weight: 850;
}
.workspace-avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.workspace-chip > div { min-width: 0; display: grid; }
.workspace-chip small { color: #8faabd; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.workspace-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: .9rem; }
.workspace-chip span:last-child { color: #a7bdce; font-size: .75rem; }

.sidebar-nav { padding: .7rem .75rem; overflow-y: auto; }
.nav-label { display: block; margin: .45rem .65rem .65rem; color: #7693aa; font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.nav-link {
    min-height: 45px;
    margin: .18rem 0;
    padding: .65rem .75rem;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #bfd0dd;
    text-decoration: none;
    font-weight: 680;
    transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .07); transform: translateX(2px); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(34, 164, 125, .23), rgba(36, 99, 235, .13)); box-shadow: inset 3px 0 #27bd8f; }
.nav-link .icon { width: 21px; height: 21px; }

.sidebar-footer { margin-top: auto; padding: .9rem 1rem 1rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.profile-link { display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; align-items: center; gap: .7rem; color: #fff; text-decoration: none; padding: .25rem 0 .75rem; }
.profile-mini-avatar { width: 38px; height: 38px; background: #dfe9f5; font-size: .78rem; }
.profile-link > span:nth-child(2) { min-width: 0; display: grid; }
.profile-link strong, .profile-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-link strong { font-size: .86rem; }
.profile-link small { color: #8faabd; font-size: .72rem; }
.profile-link .icon { width: 16px; color: #7796ad; }
.sidebar-signout { width: 100%; min-height: 38px; justify-content: flex-start; color: #bdd0dd; background: rgba(255, 255, 255, .05); }
.sidebar-signout:hover { color: #fff; background: rgba(255, 255, 255, .09); }

.main-wrap { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.menu-button { display: none; }
.topbar-title { display: grid; min-width: 150px; }
.topbar-title strong { font-size: 1rem; }
.topbar-kicker { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.organization-switcher { margin-left: auto; display: flex; align-items: center; }
.organization-switcher label { position: relative; min-width: min(360px, 34vw); }
.organization-switcher label > .icon:first-child { position: absolute; z-index: 1; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.organization-switcher label > .icon:last-child { position: absolute; z-index: 1; right: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.organization-switcher select { margin: 0; padding-left: 2.5rem; padding-right: 2.4rem; appearance: none; font-weight: 700; background: var(--surface-muted); }
.switch-fallback { margin-left: .5rem; min-height: 42px; }
.js .switch-fallback { display: none; }
.topbar-profile { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; padding-left: .25rem; }
.topbar-profile > span:last-child { display: grid; max-width: 180px; }
.topbar-profile strong, .topbar-profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-profile strong { font-size: .84rem; }
.topbar-profile small { color: var(--muted); font-size: .7rem; }

.content-wrap { width: min(1500px, 100%); padding: 2rem clamp(1.25rem, 3vw, 2.8rem) 1rem; }
.page-heading { margin-bottom: 1.6rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; }
.page-heading h1 { margin-bottom: .45rem; }
.page-heading p { max-width: 760px; margin: 0; color: var(--muted); font-size: .98rem; }
.page-heading-actions { flex: 0 0 auto; display: flex; gap: .7rem; }
.page-footer { margin-top: 2.5rem; padding: 1rem 0; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .75rem; }

.workspace-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    padding: clamp(1.35rem, 3vw, 2.2rem);
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    color: #fff;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 88% 25%, rgba(64, 185, 147, .35), transparent 25%),
        radial-gradient(circle at 75% 110%, rgba(70, 114, 241, .4), transparent 35%),
        linear-gradient(125deg, #102a43 0%, #123b52 58%, #0a6d5a 130%);
    box-shadow: var(--shadow);
}
.workspace-hero::after { content: ""; position: absolute; right: -40px; top: -70px; width: 240px; height: 240px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 0 0 35px rgba(255, 255, 255, .025), 0 0 0 70px rgba(255, 255, 255, .02); }
.workspace-hero > * { position: relative; z-index: 1; }
.workspace-hero .eyebrow { color: #9be1cc; }
.workspace-hero h1 { margin-bottom: .7rem; color: #fff; font-size: clamp(2rem, 4vw, 3rem); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.type-pill { min-height: 30px; padding: .28rem .7rem; display: inline-flex; align-items: center; gap: .4rem; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: .78rem; font-weight: 750; }
.type-pill .icon { width: 15px; height: 15px; }
.muted-id { color: #a9c2d1; font-family: ui-monospace, monospace; font-size: .72rem; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; max-width: 430px; }
.workspace-hero .button-primary { background: #fff; color: var(--navy); box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.workspace-hero .button-secondary { color: #fff; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); }
.workspace-hero .button-tertiary { color: #fff; background: transparent; border-color: rgba(255, 255, 255, .2); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.metric-card { padding: 1.1rem; display: flex; align-items: center; gap: .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: #edf3ff; }
.metric-card > div { min-width: 0; display: grid; }
.metric-card > div > span { color: var(--muted); font-size: .76rem; font-weight: 700; }
.metric-card strong { margin: .05rem 0; font-size: 1.45rem; line-height: 1.15; }
.metric-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .7rem; }

.section-block { margin: 2rem 0; }
.section-heading { margin-bottom: 1rem; display: flex; justify-content: space-between; gap: 1rem; }
.section-heading h2 { margin-bottom: .3rem; font-size: 1.35rem; }
.section-heading p { margin: 0; color: var(--muted); }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.service-grid-large { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.service-card {
    position: relative;
    overflow: hidden;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.service-card::after { content: ""; position: absolute; right: -45px; top: -50px; width: 140px; height: 140px; border-radius: 50%; background: var(--service-glow, #eef3ff); opacity: .8; }
.service-card > * { position: relative; z-index: 1; }
.service-whatsapp { --service-accent: #087f5b; --service-glow: #e1f7ef; }
.service-mail { --service-accent: #2463eb; --service-glow: #e6edff; }
.service-generic { --service-accent: var(--navy); --service-glow: #e9eef4; }
.service-card-top { margin-bottom: 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.service-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: var(--service-accent); box-shadow: 0 10px 22px color-mix(in srgb, var(--service-accent) 25%, transparent); }
.service-icon .icon { width: 27px; height: 27px; }
.service-card h2, .service-card h3 { margin-bottom: .45rem; }
.service-card p { min-height: 3rem; color: var(--muted); }
.service-card .text-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--service-accent); font-weight: 800; text-decoration: none; }
.text-link .icon { width: 16px; height: 16px; }
.service-facts { margin: 1rem 0; border-top: 1px solid var(--line); }
.service-facts > div { padding: .7rem 0; display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.service-facts dt { color: var(--muted); }
.service-facts dd { margin: 0; text-align: right; font-weight: 700; }
.service-note { color: var(--muted); font-size: .82rem; }
.service-card-action { min-height: 44px; display: flex; align-items: flex-end; }

.panel,
.action-panel,
.empty-state,
.secret-panel,
.profile-card {
    margin-bottom: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.panel { overflow: visible; }
.panel-heading { padding: 1.2rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; }
.panel-heading .eyebrow { margin-bottom: .25rem; }
.action-panel { padding: 1.3rem; box-shadow: var(--shadow); }
.action-panel-heading { margin-bottom: 1.2rem; display: flex; justify-content: space-between; gap: 1rem; }
.action-panel-heading h2 { margin-bottom: .35rem; }
.action-panel-heading p { margin: 0; color: var(--muted); }
.empty-state { padding: 3.2rem 1.5rem; text-align: center; }
.empty-state h2 { margin: 1rem 0 .35rem; }
.empty-state p { max-width: 480px; margin: 0 auto; color: var(--muted); }
.empty-icon { width: 62px; height: 62px; margin: 0 auto; display: grid; place-items: center; color: var(--blue); border-radius: 18px; background: #edf3ff; }
.empty-icon .icon { width: 31px; height: 31px; }
.compact-empty { padding: 2rem 1.25rem; color: var(--muted); text-align: center; }

.table-toolbar { min-height: 54px; padding: .8rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.table-toolbar strong { color: var(--ink); }
.toolbar-note { text-align: right; }
.table-wrap { overflow-x: auto; border-radius: inherit; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: .95rem 1.1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { color: var(--muted); background: var(--surface-muted); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table .align-right { text-align: right; }
.entity-cell { display: flex; align-items: center; gap: .75rem; min-width: 220px; }
.entity-avatar { width: 40px; height: 40px; flex: 0 0 40px; background: #e4ecf5; font-size: .75rem; }
.entity-avatar-user { background: #dff5ec; color: #0d694f; }
.entity-cell > div { min-width: 0; display: grid; }
.entity-cell strong, .entity-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-cell small { color: var(--muted); font-family: ui-monospace, monospace; font-size: .68rem; }
.type-label { font-weight: 720; }
.table-placeholder { color: #a4b0bd; }

.row-action { position: relative; display: inline-block; text-align: left; }
.row-action > summary { list-style: none; }
.row-action > summary::-webkit-details-marker { display: none; }
.row-action-menu { position: absolute; z-index: 15; right: 0; top: calc(100% + .4rem); min-width: 260px; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.row-action-menu-wide { width: min(480px, 80vw); }
.row-action-menu form + form { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.row-action-menu label { margin-bottom: .6rem; }

.status-badge { min-height: 27px; padding: .25rem .62rem; display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-success { color: var(--green); background: var(--green-soft); }
.status-neutral { color: #526579; background: #edf1f5; }
.status-info { color: var(--info); background: var(--info-soft); }
.status-warning { color: var(--amber); background: var(--amber-soft); }
.status-danger { color: var(--red); background: var(--red-soft); }
.workspace-hero .status-success { color: #b7f0d7; background: rgba(22, 128, 92, .35); }
.role-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.role-pill, .behavior-pill, .count-pill { padding: .24rem .55rem; border-radius: 999px; color: #2c4b6b; background: #eef3f8; font-size: .7rem; font-weight: 780; }
.count-pill { font-size: .76rem; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin-bottom: .8rem; }
.choice-card { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); cursor: pointer; }
.choice-card input { width: 16px; height: 16px; min-height: 0; margin: .15rem 0 0; flex: 0 0 16px; }
.choice-card span { display: grid; }
.choice-card strong { font-size: .78rem; }
.choice-card small { color: var(--muted); font-size: .68rem; }

.timeline { padding: .35rem 1.25rem 1.25rem; }
.timeline-item { position: relative; padding: .9rem 0 .9rem 2.8rem; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 42px; bottom: -8px; width: 1px; background: var(--line); }
.timeline-icon { position: absolute; left: 0; top: .85rem; width: 35px; height: 35px; display: grid; place-items: center; color: var(--blue); border: 1px solid #dbe6fc; border-radius: 10px; background: #f1f5ff; }
.timeline-icon .icon { width: 18px; height: 18px; }
.timeline-item p { margin: .15rem 0; color: var(--muted); font-size: .83rem; }
.timeline-item time { color: #8a98a9; font-size: .72rem; }

.limit-panel { overflow: visible; }
.limit-list { padding: 0 1.25rem; }
.limit-row { min-height: 92px; display: grid; grid-template-columns: minmax(240px, 1.6fr) minmax(120px, .65fr) minmax(120px, .65fr) minmax(90px, auto); align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.limit-row:last-child { border-bottom: 0; }
.limit-copy { min-width: 0; display: grid; gap: .25rem; }
.limit-title { display: flex; align-items: center; gap: .5rem; }
.limit-copy code { color: var(--muted); font-size: .7rem; }
.limit-value { display: grid; }
.limit-value span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.limit-value strong { font-size: .88rem; }
.limit-action { text-align: right; }
.limit-editor { position: relative; display: inline-block; text-align: left; }
.limit-editor > summary { list-style: none; }
.limit-editor > summary::-webkit-details-marker { display: none; }
.limit-editor > form { position: absolute; z-index: 10; right: 0; top: calc(100% + .4rem); width: min(330px, 80vw); padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.limit-editor .pool-form { top: calc(100% + 155px); }
.pool-form { display: grid; gap: .6rem; }

.info-banner { margin: 1rem 0; padding: .9rem 1rem; display: flex; gap: .75rem; align-items: flex-start; color: #244767; border: 1px solid #cfe0f2; border-radius: 12px; background: #f0f7fd; }
.info-banner .icon { margin-top: .1rem; color: var(--info); }
.info-banner > div { display: grid; }
.info-banner span { color: #59758e; font-size: .82rem; }
.info-banner.compact { margin: 1rem 0 0; }

.branding-layout { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr); gap: 1rem; margin-bottom: 1rem; }
.brand-preview-card { min-height: 390px; overflow: hidden; display: flex; flex-direction: column; color: #fff; border-radius: var(--radius-lg); background: linear-gradient(145deg, #102a43, #0e7c66); box-shadow: var(--shadow); }
.brand-preview-top { padding: 1rem 1.2rem; display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.brand-preview-content { margin: auto 0; padding: 2rem; }
.brand-preview-content .eyebrow { color: rgba(255, 255, 255, .7); }
.brand-preview-content h2 { margin-bottom: .6rem; font-size: 1.7rem; }
.brand-preview-content p { max-width: 390px; color: rgba(255, 255, 255, .78); }
.preview-button { display: inline-flex; padding: .55rem .85rem; border-radius: 9px; color: var(--navy); background: #fff; font-weight: 800; }
.brand-swatches { padding: 1rem 1.2rem; display: flex; gap: .5rem; border-top: 1px solid rgba(255, 255, 255, .14); }
.brand-swatches span { width: 30px; height: 24px; border-radius: 7px; border: 2px solid rgba(255, 255, 255, .7); }
.brand-swatches code { align-self: center; margin-right: .35rem; color: rgba(255, 255, 255, .82); font-size: .7rem; }
.swatch-primary { background: #102a43; }
.swatch-secondary { background: #0e7c66; }
.brand-details { margin-bottom: 0; }
.definition-list { margin: 0; padding: 0 1.25rem; }
.definition-list > div { padding: .85rem 0; display: grid; grid-template-columns: 170px 1fr; gap: 1rem; border-bottom: 1px solid var(--line); }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 720; }
.definition-list dd small { display: block; color: var(--muted); font-weight: 500; }
.asset-grid { padding: 1rem 1.25rem 1.25rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .7rem; }
.asset-preview { margin: 0; padding: .7rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.asset-preview img { display: block; width: 100%; height: 75px; object-fit: contain; }
.asset-preview figcaption { margin-top: .5rem; color: var(--muted); font-size: .72rem; text-align: center; }
.brand-placeholder { grid-column: 1 / -1; min-height: 110px; display: flex; align-items: center; justify-content: center; gap: .7rem; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-muted); }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.two-column .panel { padding-bottom: 1.25rem; }
.two-column form { padding: 1.25rem; }

.activity-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.activity-summary article { padding: 1rem; display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 12px; }
.summary-success { color: var(--green); background: var(--green-soft); }
.summary-warning { color: var(--amber); background: var(--amber-soft); }
.summary-info { color: var(--blue); background: var(--info-soft); }
.activity-summary article > div { display: grid; }
.activity-summary strong { font-size: 1.3rem; line-height: 1.2; }
.activity-summary span:last-child { color: var(--muted); font-size: .75rem; }
.filter-bar { padding: 1rem; display: grid; grid-template-columns: minmax(250px, 1fr) minmax(180px, .35fr) minmax(150px, .28fr) auto auto; gap: .7rem; border-bottom: 1px solid var(--line); }
.filter-bar select, .filter-bar input { margin: 0; }
.search-field { position: relative; }
.search-field .icon { position: absolute; z-index: 1; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 2.5rem; }
.activity-list { padding: .3rem 1.25rem 1.25rem; }
.activity-list-compact { padding-top: .2rem; }
.activity-item { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: .8rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--blue); border-radius: 12px; background: #edf3ff; }
.activity-copy { min-width: 0; }
.activity-title { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.activity-copy p { margin: .2rem 0 0; color: var(--muted); font-size: .83rem; }
.activity-copy time { color: #8a98a9; font-size: .72rem; }
.activity-details { margin-top: .65rem; }
.activity-details summary { width: fit-content; color: var(--blue); font-size: .76rem; font-weight: 750; cursor: pointer; }
.activity-details dl { margin: .65rem 0; display: grid; gap: .4rem; }
.activity-details dl > div { display: grid; grid-template-columns: 95px 1fr; gap: .5rem; }
.activity-details dt { color: var(--muted); }
.activity-details dd { margin: 0; }
.activity-details pre { max-height: 260px; overflow: auto; padding: .8rem; border-radius: 9px; color: #dbe8f3; background: #102a43; font-size: .72rem; }

.secret-panel { padding: 1.4rem; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 1rem; }
.secret-panel-icon { width: 56px; height: 56px; display: grid; place-items: center; color: var(--amber); border-radius: 15px; background: var(--amber-soft); }
.copy-field { display: flex; gap: .6rem; padding: .6rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.copy-field code { flex: 1; align-self: center; }
.secret-panel p { margin: .7rem 0 0; color: var(--muted); font-size: .83rem; }

.profile-layout { display: grid; grid-template-columns: minmax(270px, .55fr) minmax(420px, 1.45fr); gap: 1rem; }
.profile-card { padding: 2rem 1.25rem; text-align: center; }
.profile-avatar { width: 82px; height: 82px; margin: 0 auto 1rem; border-radius: 24px; font-size: 1.3rem; }
.profile-card h2 { margin-bottom: .2rem; }
.profile-card p { color: var(--muted); }
.profile-card .role-list { justify-content: center; }

.alert { padding: .8rem .9rem; display: flex; gap: .7rem; align-items: flex-start; border-radius: 11px; }
.alert .icon { margin-top: .1rem; }
.alert > div { display: grid; }
.alert span { font-size: .83rem; }
.alert-error { color: var(--red); background: var(--red-soft); border: 1px solid #f2c7c2; }
.alert-success { color: var(--green); background: var(--green-soft); border: 1px solid #c3ead7; }
.alert.compact { margin: .75rem 0; }

.auth-body { background: #f6f8fb; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); }
.auth-visual { position: relative; overflow: hidden; padding: clamp(2rem, 5vw, 5rem); color: #fff; background: radial-gradient(circle at 80% 20%, rgba(40, 184, 141, .42), transparent 26%), radial-gradient(circle at 12% 85%, rgba(55, 104, 235, .38), transparent 33%), linear-gradient(145deg, #0c263d, #103a4f 55%, #0b705d 140%); }
.auth-visual::before, .auth-visual::after { content: ""; position: absolute; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; }
.auth-visual::before { width: 420px; height: 420px; right: -180px; top: -130px; box-shadow: 0 0 0 55px rgba(255, 255, 255, .025), 0 0 0 110px rgba(255, 255, 255, .018); }
.auth-visual::after { width: 260px; height: 260px; left: -100px; bottom: -100px; }
.auth-visual-inner { position: relative; z-index: 1; min-height: calc(100vh - clamp(4rem, 10vw, 10rem)); display: flex; flex-direction: column; }
.auth-logo { display: flex; align-items: center; gap: .75rem; font-size: 1.08rem; font-weight: 850; }
.auth-copy { margin: auto 0; max-width: 680px; }
.auth-copy .eyebrow { color: #9be2cd; }
.auth-copy h1 { margin-bottom: 1rem; color: #fff; font-size: clamp(2.7rem, 5vw, 5rem); line-height: .98; }
.auth-copy p { max-width: 590px; color: #bed0dc; font-size: 1.05rem; }
.auth-service-strip { display: flex; flex-wrap: wrap; gap: .7rem; }
.auth-service-strip span { padding: .5rem .75rem; display: inline-flex; align-items: center; gap: .4rem; color: #d8e8ef; border: 1px solid rgba(255, 255, 255, .13); border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: .78rem; font-weight: 700; }
.auth-service-strip .icon { width: 17px; height: 17px; }
.auth-form-wrap { display: grid; place-items: center; padding: 2rem; }
.auth-card { width: min(460px, 100%); }
.auth-card-heading { margin-bottom: 1.6rem; }
.auth-card-heading h2 { margin-bottom: .45rem; font-size: 1.8rem; }
.auth-card-heading p { color: var(--muted); }
.mobile-brand { display: none; align-items: center; gap: .6rem; margin-bottom: 1.3rem; font-weight: 850; }
.input-shell { position: relative; margin-top: .45rem; }
.input-shell .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-shell input { margin: 0; padding-left: 2.7rem; }
.auth-footnote { margin-top: 1.2rem; color: var(--muted); font-size: .75rem; text-align: center; }
.auth-page-simple { grid-template-columns: 1fr; }

.error-page { width: min(650px, calc(100% - 2rem)); margin: 12vh auto; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }

.sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .branding-layout { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: minmax(250px, 1fr) minmax(170px, .4fr) minmax(150px, .35fr); }
    .filter-bar .button { width: 100%; }
    .limit-row { grid-template-columns: minmax(220px, 1.5fr) minmax(110px, .6fr) minmax(110px, .6fr) auto; }
}

@media (max-width: 980px) {
    :root { --sidebar-width: 264px; }
    .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close, .menu-button { display: inline-flex; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(6, 21, 36, .52); backdrop-filter: blur(2px); }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .main-wrap { margin-left: 0; }
    .topbar-profile > span:last-child { display: none; }
    .workspace-hero { align-items: flex-start; flex-direction: column; }
    .hero-actions { justify-content: flex-start; max-width: none; }
    .service-grid { grid-template-columns: 1fr; }
    .two-column, .profile-layout { grid-template-columns: 1fr; }
    .limit-row { grid-template-columns: minmax(220px, 1fr) minmax(110px, .45fr) minmax(110px, .45fr); padding: .8rem 0; }
    .limit-action { grid-column: 1 / -1; text-align: left; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .mobile-brand { display: flex; }
}

@media (max-width: 720px) {
    .topbar { min-height: 64px; padding: .6rem .8rem; }
    .topbar-title { display: none; }
    .organization-switcher { flex: 1; margin-left: 0; }
    .organization-switcher label { min-width: 0; width: 100%; }
    .topbar-profile { display: none; }
    .content-wrap { padding: 1.25rem .9rem .8rem; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading-actions, .page-heading-actions .button { width: 100%; }
    .workspace-hero { min-height: 0; padding: 1.35rem; }
    .workspace-hero::after { width: 160px; height: 160px; }
    .hero-actions, .hero-actions .button { width: 100%; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card small { white-space: normal; }
    .service-grid-large { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: auto; }
    .form-actions { justify-content: stretch; }
    .form-actions .button { width: 100%; }
    .toolbar-note { display: none; }
    .activity-summary { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
    .definition-list > div { grid-template-columns: 1fr; gap: .2rem; }
    .choice-grid { grid-template-columns: 1fr; }
    .limit-row { grid-template-columns: 1fr 1fr; gap: .7rem; }
    .limit-copy { grid-column: 1 / -1; }
    .limit-action { grid-column: 1 / -1; }
    .copy-field { align-items: stretch; flex-direction: column; }
    .secret-panel { grid-template-columns: 1fr; }
    .page-footer { align-items: flex-start; flex-direction: column; }
    .auth-form-wrap { padding: 1.25rem; }
    .auth-card-heading h2 { font-size: 1.55rem; }
}

@media (max-width: 480px) {
    .organization-switcher select { font-size: .78rem; }
    .workspace-hero h1 { font-size: 1.8rem; }
    .hero-meta .muted-id { display: none; }
    .metric-card { align-items: flex-start; }
    .service-card { padding: 1.1rem; }
    .activity-title { align-items: flex-start; flex-direction: column; }
    .limit-row { grid-template-columns: 1fr; }
    .limit-value { grid-column: 1; }
    .row-action-menu-wide { width: 88vw; }
}

/* WhatsApp bridge workspace */
.bridge-connect { max-width: 760px; }
.bridge-connect .stack-form { margin-top: 1.1rem; }
.bridge-metrics { margin-bottom: 1rem; }
.bridge-layout { align-items: stretch; }
.bridge-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.bridge-actions form { margin: 0; }
.resource-link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.resource-link { min-height: 96px; padding: 1rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.resource-link:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.resource-link > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--teal); background: var(--teal-soft); }
.resource-link > .icon { width: 17px; height: 17px; color: var(--muted); }
.bridge-filter { margin-bottom: 1rem; }
.remote-card-list { display: grid; gap: .8rem; }
.remote-card { padding: 1rem; display: grid; grid-template-columns: minmax(220px, .8fr) auto minmax(300px, 1.3fr); align-items: start; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.remote-card h3 { margin-bottom: .25rem; }
.remote-card dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.remote-card dl > div { min-width: 0; }
.remote-card dt { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.remote-card dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.remote-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .55rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.sso-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--canvas); }
.sso-card { width: min(520px, 100%); padding: 2rem; text-align: center; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.sso-card .brand-emblem { margin: 0 auto 1rem; }
.sso-card p { color: var(--muted); }

@media (max-width: 980px) {
    .resource-link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .remote-card { grid-template-columns: minmax(220px, 1fr) auto; }
    .remote-card dl { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    .resource-link-grid { grid-template-columns: 1fr; }
    .remote-card { grid-template-columns: 1fr; }
    .remote-card .status-badge { justify-self: start; }
    .remote-card dl { grid-column: 1; grid-template-columns: 1fr; }
    .bridge-actions, .bridge-actions form, .bridge-actions .button { width: 100%; }
}
