/* ==========================================================================
   Vastworx Businesses - customer portal
   ==========================================================================

   🔴 THIS STYLESHEET INHERITS. IT DOES NOT DECIDE.

   The first version of this file hardcoded a light-mode palette - #fff panel
   backgrounds, #dcdcde borders, #f6f7f7 buttons - and a max-width of 900px.
   On a dark site that produced pale hairlines and light buttons fighting a
   black page, in a column that was a different width from every other page.
   It looked like a plugin bolted on, because it was one.

   The rules are therefore:

     WIDTH    is not set at all. The theme's content container decides it, the
              same way it decides for every other page. A max-width here is a
              second opinion nobody asked for.

     COLOUR   comes from `inherit` and from ONE neutral line colour expressed
              as a translucent grey. rgba(128,128,128,a) darkens a light theme
              and lightens a dark one by the same amount, so a single value
              works on both without this file knowing which it is on - and
              without a prefers-color-scheme block, which would be wrong
              anyway for a site whose theme has its own toggle.

     SURFACE  is a barely-there wash, not a solid fill, for the same reason.

   The only committed colours are the accent (a link/primary blue) and the
   danger red, and both are custom properties a theme can override.

   Structure only, in other words. Typography, background and link colour are
   the theme's business.
   ========================================================================== */

.vwb-portal {
    /* One translucent grey, used for every border and divider. */
    --vwb-line: rgba(128, 128, 128, 0.28);
    --vwb-line-strong: rgba(128, 128, 128, 0.45);

    /* Panels lift off the page by a hair rather than by a fill. */
    --vwb-surface: rgba(128, 128, 128, 0.06);

    --vwb-accent: #3b82f6;
    --vwb-danger: #ef4444;

    --vwb-radius: 8px;

    color: inherit;
}

/* Muted text: the page's own colour at reduced opacity, so it stays legible
   on any background instead of being pinned to one grey. */
.vwb-muted {
    opacity: 0.7;
}

.vwb-small { font-size: 0.875em; }

.vwb-portal h1 {
    margin: 0 0 4px;
    font-size: 1.6em;
    line-height: 1.2;
}

.vwb-portal h2 {
    margin: 0 0 12px;
    font-size: 1.05em;
    letter-spacing: 0.01em;
}

.vwb-back {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.9em;
    text-decoration: none;
    opacity: 0.8;
}

.vwb-back:hover { opacity: 1; }

.vwb-lede {
    margin: 0 0 20px;
    opacity: 0.7;
}

/* --------------------------------------------------------------------------
   PANELS

   Tighter than they were. The old ones used 20px padding and 24px margins
   with a full-strength border, which on three stacked panels turned a short
   form into a page you had to scroll.
   -------------------------------------------------------------------------- */

.vwb-panel {
    margin: 0 0 16px;
    padding: 16px 18px;
    border: 1px solid var(--vwb-line);
    border-radius: var(--vwb-radius);
    background: var(--vwb-surface);
}

.vwb-panel > :last-child { margin-bottom: 0; }

.vwb-empty {
    padding: 20px;
    border: 1px dashed var(--vwb-line);
    border-radius: var(--vwb-radius);
    opacity: 0.7;
    text-align: center;
}

/* --------------------------------------------------------------------------
   NOTICES
   -------------------------------------------------------------------------- */

.vwb-notice {
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid var(--vwb-line);
    border-left: 3px solid var(--vwb-accent);
    border-radius: var(--vwb-radius);
    background: var(--vwb-surface);
}

.vwb-notice-warn { border-left-color: #f59e0b; }

.vwb-notice p { margin: 0 0 6px; }
.vwb-notice p:last-child { margin-bottom: 0; }

/* The one-time invitation link, shown only when the email could not be sent.
   Wraps rather than scrolls: a link that has to be copied by hand must be
   fully visible, and break-all is what stops a long token overflowing a
   theme's content column. */
.vwb-token-link {
    display: block;
    padding: 10px;
    border: 1px solid var(--vwb-line);
    border-radius: 6px;
    background: var(--vwb-surface);
    font-family: ui-monospace, Consolas, Monaco, monospace;
    font-size: 0.85em;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   BUSINESS LIST
   -------------------------------------------------------------------------- */

.vwb-business-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vwb-business-card {
    padding: 14px 16px;
    border: 1px solid var(--vwb-line);
    border-radius: var(--vwb-radius);
    background: var(--vwb-surface);
}

.vwb-business-name {
    font-size: 1.05em;
    font-weight: 600;
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   BADGES

   Translucent tints rather than committed pastels: a #eef4fb chip is
   invisible on a light theme and glaring on a dark one. currentColor keeps
   the text legible whatever the page colour is.
   -------------------------------------------------------------------------- */

.vwb-badge,
.vwb-role {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.18);
    color: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.vwb-badge-suspended {
    background: rgba(239, 68, 68, 0.18);
    color: var(--vwb-danger);
}

.vwb-role-owner   { background: rgba(59, 130, 246, 0.20); }
.vwb-role-manager { background: rgba(168, 85, 247, 0.20); }
.vwb-role-member  { background: rgba(128, 128, 128, 0.18); }

/* --------------------------------------------------------------------------
   TABLE

   🔴 THE WRAPPER IS NOT DECORATION. The team table has a select and two
      buttons in its last cell, which cannot shrink below their content, so on
      a narrow column the table pushed straight through the panel's right
      border - visibly, in the shipped version. overflow-x on a wrapper is
      what contains it; width:100% on the table alone never could.
   -------------------------------------------------------------------------- */

.vwb-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.vwb-table {
    width: 100%;
    border-collapse: collapse;
}

.vwb-table th,
.vwb-table td {
    padding: 8px 10px 8px 0;
    border-bottom: 1px solid var(--vwb-line);
    text-align: left;
    vertical-align: middle;
}

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

.vwb-table th {
    padding-bottom: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    opacity: 0.6;
    text-transform: uppercase;
}

/* Name over email in one cell, so the table needs three columns instead of
   five and stops needing to scroll at all on a normal screen. */
.vwb-person-name { font-weight: 600; }

.vwb-person-email {
    display: block;
    font-size: 0.85em;
    opacity: 0.65;
    word-break: break-word;
}

.vwb-actions {
    text-align: right;
    white-space: nowrap;
}

/* A <form> is block-level, so without this the role control and the remove
   button stack instead of sitting side by side. */
.vwb-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 8px;
    vertical-align: middle;
}

/* First control in a cell, so it should not be indented away from the column
   edge the way a second one should. */
.vwb-inline-flush { margin-left: 0; }

/* --------------------------------------------------------------------------
   FORMS

   Controls inherit the page's colour and sit on a translucent wash, so a
   dark theme gets dark inputs and a light theme light ones without this file
   choosing either.
   -------------------------------------------------------------------------- */

.vwb-portal label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85em;
    font-weight: 600;
    opacity: 0.85;
}

.vwb-portal input[type="text"],
.vwb-portal input[type="email"],
.vwb-portal select {
    box-sizing: border-box;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--vwb-line-strong);
    border-radius: 6px;
    background: rgba(128, 128, 128, 0.08);
    color: inherit;
    font: inherit;
    font-size: 0.95em;
    line-height: 1.4;
}

.vwb-portal input:focus,
.vwb-portal select:focus {
    border-color: var(--vwb-accent);
    outline: 2px solid transparent;
    outline-offset: 1px;
}

/* Two fields side by side once there is room, so the details panel is one
   short block rather than a column of stacked full-width inputs. */
.vwb-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
    margin-bottom: 14px;
}

.vwb-field { margin: 0; }

/* The invite form: one row on a wide column, stacked on a narrow one. */
.vwb-invite-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(120px, 0.8fr) auto;
    gap: 10px;
    align-items: end;
}

@media (max-width: 640px) {
    .vwb-invite-row { grid-template-columns: 1fr; }
}

/* In a table cell a full-width select would push the row wide; here it should
   only be as big as its content. */
.vwb-table select,
.vwb-inline select {
    width: auto;
    min-width: 108px;
    padding: 5px 8px;
    font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */

.vwb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid var(--vwb-line-strong);
    border-radius: 6px;
    background: rgba(128, 128, 128, 0.10);
    color: inherit;
    font: inherit;
    font-size: 0.9em;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.vwb-btn:hover { background: rgba(128, 128, 128, 0.20); }

.vwb-btn-primary {
    border-color: transparent;
    background: var(--vwb-accent);
    color: #fff;
}

.vwb-btn-primary:hover {
    background: var(--vwb-accent);
    filter: brightness(1.1);
}

/* Destructive actions are quiet until you reach for them. A permanently red
   filled button on every team row makes Remove the loudest thing on the
   screen, which is the opposite of what it should be. */
.vwb-btn-danger {
    border-color: transparent;
    background: transparent;
    color: var(--vwb-danger);
    opacity: 0.85;
}

.vwb-btn-danger:hover {
    border-color: var(--vwb-danger);
    background: rgba(239, 68, 68, 0.12);
    opacity: 1;
}

.vwb-btn-small {
    padding: 5px 10px;
    font-size: 0.82em;
}

/* --------------------------------------------------------------------------
   INVITATION PAGE
   -------------------------------------------------------------------------- */

.vwb-invite-lead {
    margin: 14px 0;
    font-size: 1.05em;
}
