/* =========================================================================
   Posticy UI - shared primitives for the redesigned dashboards and listings.

   Deliberately declares no font-family: every rule inherits Poppins from the
   theme (see layouts/app.blade.php), so a future theme font swap carries here
   without edits.
   ========================================================================= */

:root {
    --pui-ink:        #1B1B3A;
    --pui-ink-soft:   #5E6278;
    --pui-muted:      #8A8AA3;
    --pui-line:       #ECECF4;
    --pui-line-soft:  #F2F2F8;
    --pui-surface:    #FFFFFF;
    --pui-canvas:     #F7F7FC;
    --pui-primary:    #3E23DC;
    --pui-primary-d:  #3319C4;
    --pui-primary-l:  #EFECFE;
    /* Action blue — the designs' call-to-action colour, distinct from the
       violet --pui-primary. Used by the listing pages' primary buttons. */
    --pui-action:     #1668E3;
    --pui-action-d:   #1257C0;
    --pui-action-l:   #EAF1FE;
    --pui-success:    #1BA97B;
    --pui-success-l:  #E4F5EE;
    --pui-warning:    #F5A623;
    --pui-warning-l:  #FDF1DE;
    --pui-danger:     #F1416C;
    --pui-danger-l:   #FDE9EE;
    --pui-info:       #2E8BFF;
    --pui-info-l:     #E7F1FF;
    --pui-radius:     12px;
    --pui-radius-sm:  9px;
}

/* -- Surfaces ---------------------------------------------------------- */

.pui-card {
    background: var(--pui-surface);
    border: 1px solid var(--pui-line);
    border-radius: var(--pui-radius);
    padding: 24px 26px;
    margin-bottom: 16px;
}

/* Edge-to-edge content (a table, typically). Overflow stays visible so a
   dropdown opened in the last row is not clipped by the card; the corners are
   kept round by rounding the table's own first and last header cells instead. */
.pui-card-flush { padding: 0; }
.pui-card-flush > table { margin: 0; }
.pui-card-flush > table > thead > tr > th:first-child { border-top-left-radius: var(--pui-radius); }
.pui-card-flush > table > thead > tr > th:last-child { border-top-right-radius: var(--pui-radius); }

.pui-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--pui-ink);
    margin: 0;
    line-height: 1.3;
}

.pui-section-sub {
    font-size: 0.86rem;
    color: var(--pui-muted);
    margin: 3px 0 0;
}

.pui-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.pui-link-arrow {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pui-primary);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.pui-link-arrow:hover { color: var(--pui-primary-d); text-decoration: none; }

/* -- Buttons ----------------------------------------------------------- */

.pui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: var(--pui-radius-sm);
    border: 1px solid transparent;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}
.pui-btn:hover, .pui-btn:focus { text-decoration: none; outline: none; }

.pui-btn-primary { background: var(--pui-primary); color: #fff; }
.pui-btn-primary:hover { background: var(--pui-primary-d); color: #fff; }

.pui-btn-outline { background: #fff; color: var(--pui-primary); border-color: #D9D3FB; }
.pui-btn-outline:hover { background: var(--pui-primary-l); color: var(--pui-primary-d); }

.pui-btn-ghost { background: #fff; color: var(--pui-ink-soft); border-color: var(--pui-line); }
.pui-btn-ghost:hover { background: var(--pui-line-soft); color: var(--pui-ink); }

.pui-btn-soft { background: var(--pui-primary-l); color: var(--pui-primary); }
.pui-btn-soft:hover { background: #E4DEFD; color: var(--pui-primary-d); }

.pui-btn-teal { background: #0F7B6C; color: #fff; }
.pui-btn-teal:hover { background: #0B6255; color: #fff; }

.pui-btn-teal-outline { background: #fff; color: #0F7B6C; border-color: #B7DED6; }
.pui-btn-teal-outline:hover { background: #E9F6F3; color: #0B6255; }

.pui-btn-block { width: 100%; }
.pui-btn-sm { padding: 7px 14px; font-size: 0.83rem; }

/* -- Badges and pills -------------------------------------------------- */

.pui-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.pui-badge-success { background: var(--pui-success-l); color: var(--pui-success); }
.pui-badge-warning { background: var(--pui-warning-l); color: #B7791F; }
.pui-badge-danger  { background: var(--pui-danger-l);  color: var(--pui-danger); }
.pui-badge-primary { background: var(--pui-primary-l); color: var(--pui-primary); }
.pui-badge-muted   { background: var(--pui-line-soft); color: var(--pui-ink-soft); }

.pui-badge-outline-success {
    background: #fff;
    color: var(--pui-success);
    border: 1px solid #A9E0CB;
}

/* -- Icon medallions --------------------------------------------------- */

.pui-medallion {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pui-medallion-lg { width: 56px; height: 56px; }
.pui-medallion svg { display: block; }
/* Font Awesome glyphs sit at the same optical size as the 22px inline SVGs, and
   take the medallion's accent colour. Both declarations are undoing the theme's
   bare `i { font-size: 1.25rem; color: #B5B5C3 }` (assets/css/style.bundle.css),
   which matches the element directly and so beats the colour inherited here. */
.pui-medallion i { font-size: 1.2rem; line-height: 1; color: inherit; }

.pui-m-primary { background: #EDEAFD; color: var(--pui-primary); }
.pui-m-success { background: #E3F6EE; color: var(--pui-success); }
.pui-m-warning { background: #FDF0DA; color: var(--pui-warning); }
.pui-m-info    { background: #E4EEFF; color: var(--pui-info); }
.pui-m-danger  { background: #FDE4EA; color: var(--pui-danger); }

/* -- Stat tiles -------------------------------------------------------- */

.pui-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.pui-stat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--pui-line);
    border-radius: var(--pui-radius);
    padding: 18px 20px;
    background: var(--pui-surface);
}
a.pui-stat { transition: border-color .15s ease, box-shadow .15s ease; }
a.pui-stat:hover {
    text-decoration: none;
    border-color: #D9D3FB;
    box-shadow: 0 2px 10px rgba(62, 35, 220, 0.06);
}
.pui-stat-top { display: flex; align-items: center; gap: 14px; }
.pui-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pui-ink);
    line-height: 1.15;
}
.pui-stat-label { font-size: 0.86rem; color: var(--pui-ink-soft); }
.pui-stat-delta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pui-success);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Line up with the value/label column, i.e. past the medallion + its gap. */
    margin-left: calc(46px + 14px);
}
.pui-stat-inline .pui-stat-delta { margin-left: 0; }
.pui-stat-delta-flat { color: var(--pui-muted); font-weight: 500; }

/* Inline (borderless) variant used inside a single wide summary card. */
.pui-stat-inline {
    border: 0;
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

@media (max-width: 991.98px) {
    .pui-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .pui-stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* -- To Do banner ------------------------------------------------------ */

.pui-todo-head {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--pui-ink);
    margin-bottom: 14px;
}
.pui-todo-count { color: var(--pui-danger); font-weight: 600; font-size: 0.88rem; }
.pui-todo-dot { color: var(--pui-muted); font-weight: 400; }

.pui-todo-row {
    display: flex;
    align-items: center;
    gap: 18px;
}
.pui-todo-body { flex: 1 1 auto; min-width: 0; }
.pui-todo-title {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--pui-ink);
    margin-bottom: 4px;
}
.pui-todo-title a { color: inherit; }
.pui-todo-title a:hover { color: var(--pui-primary); text-decoration: none; }
.pui-todo-sub { font-size: 0.88rem; color: var(--pui-muted); }
.pui-todo-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    font-size: 0.84rem;
    color: var(--pui-ink-soft);
}
.pui-todo-meta-sep { color: var(--pui-line); }

.pui-todo-close {
    border: 0;
    background: transparent;
    color: var(--pui-muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.pui-todo-close:hover { color: var(--pui-ink); }

@media (max-width: 767.98px) {
    .pui-todo-row { flex-wrap: wrap; }
    .pui-todo-row .pui-btn { flex: 1 1 auto; }
}

/* -- Referral strip ---------------------------------------------------- */

.pui-referral {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #FEF6E7;
    border: 1px solid #F7E4C3;
    border-radius: var(--pui-radius);
    padding: 20px 26px;
    margin-bottom: 16px;
}
.pui-referral-body { flex: 1 1 auto; min-width: 0; }
.pui-referral-title { font-size: 1.02rem; font-weight: 600; color: var(--pui-ink); margin-bottom: 3px; }
.pui-referral-sub { font-size: 0.87rem; color: var(--pui-ink-soft); margin: 0; }
.pui-referral-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

@media (max-width: 767.98px) {
    .pui-referral { flex-wrap: wrap; }
    .pui-referral-actions { width: 100%; }
    .pui-referral-actions .pui-btn { flex: 1 1 0; }
}

/* -- Promo pair (two feature cards side by side) ----------------------- */

.pui-promo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 991.98px) {
    .pui-promo-grid { grid-template-columns: minmax(0, 1fr); }
}

.pui-promo {
    display: flex;
    flex-direction: column;
    border-radius: var(--pui-radius);
    padding: 24px;
    height: 100%;
}
.pui-promo-violet { background: linear-gradient(135deg, #F6F3FE 0%, #F3F0FD 100%); }
.pui-promo-blue   { background: linear-gradient(135deg, #F1F5FE 0%, #EFF4FE 100%); }
.pui-promo-green  { background: linear-gradient(135deg, #EFF9F4 0%, #ECF8F2 100%); }

.pui-promo-head { display: flex; gap: 16px; margin-bottom: 18px; }
.pui-promo-title { font-size: 1.08rem; font-weight: 600; color: var(--pui-ink); margin-bottom: 8px; }
.pui-promo-text { font-size: 0.9rem; color: var(--pui-ink-soft); margin: 0; line-height: 1.55; }

.pui-promo-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--pui-radius-sm);
    margin-bottom: 18px;
}
.pui-promo-fact {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
}
.pui-promo-fact + .pui-promo-fact { border-left: 1px solid var(--pui-line); }
.pui-promo-fact-value { font-size: 1rem; font-weight: 700; color: var(--pui-ink); line-height: 1.25; }
.pui-promo-fact-label { font-size: 0.79rem; color: var(--pui-ink-soft); line-height: 1.35; }
.pui-promo .pui-btn { margin-top: auto; }

/* -- Website performance cards ----------------------------------------- */

.pui-site-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
/* Each card carries a four-across metric row, which needs ~400px; below that
   the three cards go two-up, then one. The breakpoint allows for the
   265px sidebar beside the content. */
@media (max-width: 1599.98px) {
    .pui-site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
    .pui-site-grid { grid-template-columns: minmax(0, 1fr); }
}

.pui-site {
    border: 1px solid var(--pui-line);
    border-radius: var(--pui-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pui-site-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--pui-line);
}
.pui-site-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--pui-line-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pui-ink-soft);
}
.pui-site-logo img { width: 100%; height: 100%; object-fit: cover; }
.pui-site-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pui-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pui-site-name:hover { color: var(--pui-primary); text-decoration: none; }

.pui-site-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 14px 0;
}
.pui-site-metric { text-align: center; padding: 0 8px; }
.pui-site-metric + .pui-site-metric { border-left: 1px solid var(--pui-line); }
.pui-site-metric-value { font-size: 1.05rem; font-weight: 700; color: var(--pui-ink); line-height: 1.3; }
.pui-site-metric-label { font-size: 0.78rem; color: var(--pui-muted); margin-top: 2px; }
.pui-site-metric-value.pui-trend {
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.pui-trend-up   { color: var(--pui-success); }
.pui-trend-flat { color: var(--pui-warning); }

@media (max-width: 575.98px) {
    /* Four metrics across a phone-width card leaves each one too narrow to read
       ("Low visibility" wraps mid-phrase), so they go two per row instead. The
       divider rules have to be re-cut for the new shape: the left border belongs
       to the second column only, and rows after the first get a top border. */
    .pui-site-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pui-site-metric { padding: 10px 8px; }
    .pui-site-metric:nth-child(odd) { border-left: 0; }
    .pui-site-metric:nth-child(n + 3) { border-top: 1px solid var(--pui-line); }
}

.pui-site-note {
    margin: 0 18px 16px;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.85rem;
    line-height: 1.4;
}
.pui-site-note-good { background: var(--pui-success-l); color: #16805F; }
.pui-site-note-warn { background: #FDF1DE; color: #B7791F; }

.pui-site-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 18px 18px;
    margin-top: auto;
}

/* -- Page header (listing pages) --------------------------------------- */

.pui-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.pui-page-title { font-size: 1.65rem; font-weight: 600; color: var(--pui-ink); margin: 0; line-height: 1.2; }
.pui-page-sub { font-size: 0.92rem; color: var(--pui-ink-soft); margin: 6px 0 0; }
.pui-page-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.pui-page-tools-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.pui-search {
    position: relative;
    width: 260px;
    max-width: 100%;
}
.pui-search input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--pui-line);
    border-radius: var(--pui-radius-sm);
    padding: 0 40px 0 14px;
    font-size: 0.9rem;
    color: var(--pui-ink);
    background: #fff;
}
.pui-search input::placeholder { color: var(--pui-muted); }
.pui-search input:focus { outline: none; border-color: #C9BFF8; }
.pui-search-icon {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pui-muted);
    pointer-events: none;
}

@media (max-width: 767.98px) {
    .pui-page-head { flex-direction: column; }
    .pui-page-tools { align-items: stretch; width: 100%; }
    .pui-page-tools-row { justify-content: flex-start; }
    .pui-search { width: 100%; }
}

/* -- Tabs -------------------------------------------------------------- */

.pui-tabs {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    /* Tinted trough. The tabs fill it edge to edge — no padding here, so the
       active chip sits flush and the breathing room lives inside the tab. The
       container clips the end tabs to its own radius. */
    background: #F7F7FB;
    border: 1px solid var(--pui-line);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}
.pui-tab {
    border: 0;
    border-radius: 0;
    background: transparent;
    /* All the spacing is internal, so the label never crowds the chip edge. */
    padding: 12px 22px;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.15;
    color: #3F4254;
    cursor: pointer;
    white-space: nowrap;
}
.pui-tab:hover { color: var(--pui-ink); }
.pui-tab.is-active {
    background: #fff;
    /* Inset so the underline cannot change the tab's height. */
    box-shadow: inset 0 -2px 0 0 #0F7B6C;
    color: #0F7B6C;
    font-weight: 700;
}

/* -- Info footer strip ------------------------------------------------- */

.pui-note-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F1F5FE;
    border-radius: var(--pui-radius);
    padding: 15px 20px;
    font-size: 0.88rem;
    color: var(--pui-ink-soft);
    margin-bottom: 16px;
}
.pui-note-strip a { color: var(--pui-info); text-decoration: underline; }

/* -- Empty state ------------------------------------------------------- */

.pui-empty {
    text-align: center;
    padding: 34px 20px;
    color: var(--pui-muted);
    font-size: 0.9rem;
}
.pui-empty-icon { margin-bottom: 12px; color: #C9C9DC; }
