/* Admin panel (docs/mockups/admin-part1.png) + the "View as owner" banner. Tokens from ui.css. Dark menu = never an owner screen. */
:root {
    --adm-dark: #14142b;
    --adm-dark-2: #23233f;
    --adm-dark-text: #c9c9dd;
    --adm-gold: #f5b301;
}

/* ---- Frame ---- */
.adm {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--ui-bg);
}

.adm-side {
    flex: none;
    display: flex;
    flex-direction: column;
    width: 232px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px 12px 16px;
    background: var(--adm-dark);
    color: #fff;
}

.adm-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 22px;
    color: #fff;
    text-decoration: none;
}

.adm-logo:hover {
    color: #fff;
}

.adm-logo-tile {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--ui-brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.adm-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.adm-logo-name {
    font-size: 16px;
    font-weight: 700;
}

.adm-logo-tag {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--adm-gold);
}

.adm-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.adm-link {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--adm-dark-text);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
}

.adm-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.adm-link.active {
    background: var(--adm-dark-2);
    color: #fff;
    font-weight: 600;
}

.adm-link.later {
    color: #7d7d99;
    cursor: default;
}

.adm-link.later:hover {
    background: none;
    color: #7d7d99;
}

.adm-later {
    margin-left: auto;
    padding: 1px 6px;
    border: 1px solid #3a3a58;
    border-radius: 5px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #7d7d99;
}

.adm-back {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding: 14px 12px 4px;
    border-top: 1px solid #2c2c48;
    color: var(--adm-dark-text);
    font-size: 13.5px;
    text-decoration: none;
}

.adm-back:hover {
    color: #fff;
}

.adm-top {
    display: none;
}

.adm-main {
    flex: 1;
    min-width: 0;
    padding: 28px 32px 48px;
    max-width: 1240px;
}

/* ---- Page head ---- */
.adm-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.adm-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.adm-sub {
    margin: 2px 0 0;
    font-size: 14px;
    color: var(--ui-muted);
}

.adm-head-btn {
    min-height: 40px;
    font-size: 14px;
}

.adm-empty {
    padding: 24px 4px;
    color: var(--ui-muted);
    font-size: 14px;
}

.adm-muted {
    margin: 0;
    color: var(--ui-muted);
    font-size: 12.5px;
}

.adm-card {
    background: var(--ui-card);
    border: 1px solid var(--ui-line);
    border-radius: 14px;
}

/* ---- Pills ---- */
.adm-pill {
    display: inline-flex;
    align-items: center;
    flex: none;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--ui-fill);
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.adm-pill.paying { background: #e3f5ea; color: var(--ui-ok); }
.adm-pill.trial { background: var(--ui-brand-50); color: var(--ui-brand); }
.adm-pill.failed { background: var(--ui-danger-bg); color: var(--ui-danger); }
.adm-pill.cancelling { background: #fdf1dc; color: var(--ui-warn); }
.adm-pill.closed { background: var(--ui-fill); color: var(--ui-muted); }

/* ---- Overview tiles ---- */
.adm-tiles {
    display: grid;
    grid-template-columns: 1.45fr 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.adm-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 16px 16px 18px;
}

.adm-tile-label {
    font-size: 13px;
    color: var(--ui-muted);
}

.adm-tile-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.adm-tile-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.adm-tile-note {
    font-size: 12.5px;
    color: var(--ui-muted);
}

.adm-tile-note.up { color: var(--ui-ok); }
.adm-tile-note.down { color: var(--ui-danger); }

/* ---- Businesses list ---- */
.adm-list {
    padding: 14px 14px 6px;
}

.adm-list-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.adm-search {
    flex: 0 1 300px;
    min-width: 200px;
}

.adm-search input {
    height: 40px;
    font-size: 14px;
}

.adm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.adm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ui-line);
    border-radius: 9px;
    background: var(--ui-card);
    color: var(--ui-ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.adm-chip:hover {
    border-color: var(--ui-brand-200);
}

.adm-chip-n {
    color: var(--ui-muted);
    font-weight: 500;
}

.adm-chip.on {
    border-color: var(--adm-dark);
    background: var(--adm-dark);
    color: #fff;
}

.adm-chip.on .adm-chip-n {
    color: #c9c9dd;
}

.adm-flag {
    display: inline-block;
    flex: none;
    vertical-align: -2px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(20, 20, 43, 0.08);
}

.adm-table-wrap {
    overflow-x: auto;
}

.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.adm-table th {
    padding: 10px 8px;
    border-bottom: 1px solid var(--ui-line);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ui-muted);
    text-align: left;
    white-space: nowrap;
}

.adm-sort {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.adm-sort:hover, .adm-sort.on {
    color: var(--ui-ink);
}

.adm-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--ui-line);
    vertical-align: middle;
}

.adm-table tr:last-child td {
    border-bottom: 0;
}

.adm-row {
    cursor: pointer;
}

.adm-row:hover td {
    background: #fafafd;
}

.adm-biz-name {
    color: var(--ui-ink);
    font-weight: 600;
    text-decoration: none;
}

.adm-biz-name:hover {
    color: var(--ui-brand);
}

.adm-biz-email {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--ui-muted);
}

.adm-bcard .adm-biz-email {
    max-width: 100%;
}

.adm-date, .adm-number {
    white-space: nowrap;
}

.adm-usage {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    min-width: 76px;
}

.adm-usage-text {
    white-space: nowrap;
}

.adm-bar {
    display: block;
    width: 76px;
    height: 5px;
    border-radius: 99px;
    background: var(--ui-line);
    overflow: hidden;
}

.adm-bar.wide {
    width: 100%;
    height: 6px;
    margin: 2px 0 8px;
}

.adm-bar > span {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: 99px;
    background: var(--ui-brand);
}

.adm-bar.full > span {
    background: var(--ui-danger);
}

.adm-row-more {
    width: 40px;
    text-align: right;
}

.adm-menu-wrap {
    position: relative;
    display: inline-block;
}

.adm-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ui-muted);
    cursor: pointer;
}

.adm-more:hover {
    background: var(--ui-fill);
    color: var(--ui-ink);
}

.adm-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.adm-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 1041;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    background: var(--ui-card);
    box-shadow: 0 12px 32px rgba(20, 20, 43, 0.14);
    text-align: left;
}

.adm-menu a, .adm-menu button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ui-ink);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.adm-menu a:hover, .adm-menu button:hover:not(:disabled) {
    background: var(--ui-bg);
}

.adm-menu button.danger {
    color: var(--ui-danger);
}

.adm-menu button:disabled {
    color: #b3b3c6;
    cursor: not-allowed;
}

.adm-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 4px 6px;
    font-size: 13px;
    color: var(--ui-muted);
}

.adm-pager .ui-icon-btn {
    width: 36px;
    height: 36px;
}

/* Phone cards */
.adm-cards {
    display: flex;
    flex-direction: column;
}

.adm-bcard {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 2px;
    border-top: 1px solid var(--ui-line);
    color: var(--ui-ink);
    font-size: 13.5px;
    text-decoration: none;
}

.adm-bcard:hover {
    color: var(--ui-ink);
}

.adm-bcard-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.adm-bcard-name {
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-bcard-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.adm-bcard-line.muted {
    color: var(--ui-muted);
    font-size: 12.5px;
}

.adm-bcard-usage .adm-usage {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* ---- Business page ---- */
.adm-backlink {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    color: var(--ui-muted);
    font-size: 13px;
    text-decoration: none;
}

.adm-backlink:hover {
    color: var(--ui-ink);
}

.adm-biz-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.adm-biz-avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ui-brand-50);
    color: var(--ui-brand);
    font-size: 16px;
    font-weight: 700;
}

.adm-biz-head-text {
    flex: 1;
    min-width: 0;
}

.adm-biz-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.adm-biz-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.adm-biz-meta {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--ui-muted);
}

.adm-biz-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.adm-biz-actions .ui-btn {
    min-height: 40px;
    font-size: 14px;
}

.adm-biz-actions .ui-btn .ui-icon {
    flex: none;
}

.adm-more-btn {
    width: 44px;
    padding: 0;
}

.adm-notice {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e3f5ea;
    color: var(--ui-ok);
    font-size: 14px;
    font-weight: 500;
}

.adm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.adm-info {
    padding: 14px 14px 12px;
}

.adm-card-title {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ui-muted);
}

.adm-info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 13.5px;
}

.adm-info-row > span {
    color: var(--ui-muted);
}

.adm-info-row > strong {
    font-weight: 600;
    text-align: right;
}

.adm-info-row > strong.bad { color: var(--ui-danger); }
.adm-info-row > strong.warn { color: var(--ui-warn); }

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

.adm-fail-to {
    white-space: nowrap;
}

.adm-fails li {
    display: grid;
    grid-template-columns: 74px auto minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid var(--ui-line);
    font-size: 12.5px;
}

.adm-fails li:first-child {
    border-top: 0;
}

.adm-fail-at, .adm-fail-why {
    color: var(--ui-muted);
}

.adm-log .adm-fails li {
    grid-template-columns: 90px minmax(0, 2fr) minmax(0, 1fr);
}

.adm-log {
    margin-top: 14px;
}

.adm-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.adm-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-muted);
}

.adm-check .ui-icon {
    padding: 2px;
    border-radius: 50%;
    background: var(--ui-fill);
    box-sizing: content-box;
}

.adm-check.on {
    color: var(--ui-ink);
}

.adm-check.on .ui-icon {
    background: #e3f5ea;
    color: var(--ui-ok);
}

.adm-note {
    display: block;
    width: 100%;
    min-height: 64px;
    padding: 8px 10px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    color: var(--ui-ink);
    font: inherit;
    font-size: 13.5px;
    resize: vertical;
}

.adm-note:focus {
    border-color: var(--ui-brand);
    outline: none;
}

.adm-note-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    min-height: 34px;
}

.ui-btn.adm-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13.5px;
}

.adm-saved {
    color: var(--ui-ok);
    font-size: 13px;
    font-weight: 600;
}

.adm-blocked {
    max-width: 460px;
    margin: 64px auto;
    text-align: center;
}

.adm-blocked .ui-icon {
    color: var(--ui-brand);
}

.adm-blocked-title {
    margin: 10px 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.adm-blocked p {
    color: var(--ui-muted);
}

/* ---- Tablet / phone ---- */
@media (max-width: 1100px) {
    .adm-tiles {
        grid-template-columns: 1fr 1fr;
    }

    .adm-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767.98px) {
    .adm {
        flex-direction: column;
    }

    .adm-side {
        display: none;
    }

    .adm-top {
        position: sticky;
        top: 0;
        z-index: 1020;
        display: flex;
        align-items: center;
        gap: 6px;
        height: 56px;
        padding: 0 8px 0 16px;
        background: var(--adm-dark);
    }

    .adm-top .adm-logo {
        padding: 0;
    }

    .adm-top-nav {
        display: flex;
        gap: 2px;
        margin-left: auto;
    }

    .adm-top-link {
        display: inline-flex;
        align-items: center;
        height: 44px;
        padding: 0 10px;
        border-radius: 8px;
        color: var(--adm-dark-text);
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
    }

    .adm-top-link.active {
        background: var(--adm-dark-2);
        color: #fff;
        font-weight: 600;
    }

    .adm-top-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: var(--adm-dark-text);
    }

    .adm-main {
        padding: 16px 16px 40px;
    }

    .adm-head {
        flex-wrap: wrap;
    }

    .adm-title {
        font-size: 23px;
    }

    .adm-tiles {
        gap: 10px;
    }

    .adm-tile-value {
        font-size: 25px;
    }

    .adm-search {
        flex: 1 1 100%;
    }

    .adm-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -14px;
        padding: 0 14px 2px;
        scrollbar-width: none;
    }

    .adm-chip {
        flex: none;
        height: 44px;
    }

    .adm-head-btn {
        min-height: 44px;
    }

    .adm-biz-head {
        flex-wrap: wrap;
    }

    .adm-biz-actions {
        width: 100%;
    }

    .adm-biz-actions .ui-btn {
        min-height: 44px;
    }

    .adm-biz-actions .ui-btn.primary {
        flex: 1 1 100%;
    }

    .adm-grid {
        grid-template-columns: 1fr;
    }

    .adm-menu-right {
        right: 0;
    }

    .adm-pager .ui-icon-btn {
        width: 44px;
        height: 44px;
    }
}

/* ---- "View as owner" (owner pages, MainLayout) ---- */
.viewas-bar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 10px 0 14px;
    background: var(--adm-dark);
    color: #fff;
    font-size: 14px;
}

.viewas-tag {
    flex: none;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--adm-gold);
    color: var(--adm-dark);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.viewas-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewas-gap {
    flex: 1;
}

.viewas-shown {
    color: var(--adm-gold);
    font-size: 13px;
}

.viewas-btn {
    flex: none;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: var(--adm-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.viewas-btn.ghost {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #fff;
    font-weight: 600;
}

.viewas-btn:disabled {
    opacity: 0.6;
}

/* The owner frame sits under the banner. */
.app.viewas .app-top {
    top: 44px;
}

.app.viewas .app-side {
    top: 44px;
    height: calc(100vh - 44px);
}

.viewas-note {
    margin: 20px 0 8px;
    padding: 12px 14px;
    border: 1px solid #f1dfae;
    border-radius: 12px;
    background: #fff8e6;
    color: #7a5b00;
    font-family: var(--ui-font);
    font-size: 14px;
}

@media (max-width: 767.98px) {
    .viewas-bar {
        gap: 8px;
        padding: 0 8px 0 12px;
        font-size: 13px;
    }

    .viewas-btn {
        height: 32px;
        padding: 0 10px;
    }

    .viewas-btn.ghost {
        width: 40px;
        padding: 0;
    }

    .viewas-eye {
        display: inline-flex;
        vertical-align: middle;
    }
}

/* ==== Free plan (docs/mockups/free-plan.png): Give / Edit dialog + plan card buttons ==== */
.adm-fp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.adm-info-row .adm-pill {
    font-size: 12px;
}

.adm-fp-seg .ui-seg-item.on {
    color: var(--ui-ink);
}

.adm-fp-date {
    margin-top: 8px;
}

.adm-fp-note {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--ui-radius);
    background: var(--ui-fill);
    color: var(--ui-muted);
    font-size: 13px;
    line-height: 1.45;
}

.adm-fp-note.warn {
    background: #fdf1dc;
    color: var(--ui-warn);
}

.adm-fp .adm-fp-note + .adm-fp-note {
    margin-top: 8px;
}

.adm-fp .ui-field + .adm-fp-note, .adm-fp .adm-fp-note + .ui-alert, .adm-fp .ui-field + .ui-alert {
    margin-top: 14px;
}

.adm-fp-limits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.adm-fp-limit {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--ui-muted);
}

.adm-fp-foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.adm-fp-foot .ui-btn {
    width: 100%;
    flex: none;
}

.adm-fp-cancel {
    min-height: 40px;
    border: 0;
    background: none;
    color: var(--ui-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.ui-sheet-foot:has(.adm-fp-foot) {
    border-top: 0;
}

.adm-fp-actions .ui-btn.danger {
    border: 1px solid var(--ui-line);
    background: var(--ui-card);
}
