/**
 * AuthorShelf — Global & portal UI polish
 * Refinements: typography, focus, cards, scroll hints, brand consistency
 */

/* ============================================
   Foundation
   ============================================ */
html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(156, 188, 218, 0.45);
    color: var(--as-ink);
}

:focus-visible {
    outline: 2px solid var(--as-shelf-deep);
    outline-offset: 2px;
}

img,
video {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Buttons & links
   ============================================ */
.btn {
    border-radius: 8px;
    letter-spacing: 0.01em;
}

.btn:focus-visible {
    outline: 2px solid var(--as-shelf);
    outline-offset: 2px;
}

.btn-primary:active {
    background: var(--as-author-active);
    border-color: var(--as-author-active);
    transform: translateY(0);
}

.btn-secondary:active {
    background: var(--as-shelf-light);
}

a {
    transition: color 0.15s ease;
}

/* ============================================
   Header refinements
   ============================================ */
.header-welcome .brand-author {
    color: var(--as-author);
    font-weight: 700;
}

.header-welcome .brand-shelf {
    color: var(--as-shelf-deep);
    font-weight: 700;
}

.header-cart {
    margin-left: auto;
}

.header-cart .cart-icon {
    font-size: 1.3rem;
}

.header-cart .cart-link .cart-total {
    margin-left: 6px;
    opacity: 0.9;
    font-weight: 600;
}

.mobile-menu {
    background: var(--as-surface);
}

.mobile-menu-header {
    background: var(--as-shelf-pale);
    border-bottom-color: var(--as-border);
}

.mobile-menu-title {
    color: var(--as-ink);
    font-weight: 700;
}

.mobile-navigation a {
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.mobile-navigation a:hover,
.mobile-navigation a:focus-visible {
    background: var(--as-shelf-pale);
    color: var(--as-ink);
    padding-left: 24px;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    background: var(--as-ink);
}

/* ============================================
   Horizontal scroll containers — fade edges
   ============================================ */
.as-scroll-hint {
    position: relative;
}

.as-scroll-hint::before,
.as-scroll-hint::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.as-scroll-hint::before {
    left: 0;
    background: linear-gradient(90deg, var(--as-surface) 0%, transparent 100%);
}

.as-scroll-hint::after {
    right: 0;
    background: linear-gradient(270deg, var(--as-surface) 0%, transparent 100%);
}

.as-scroll-hint.can-scroll-left::before,
.as-scroll-hint.can-scroll-right::after {
    opacity: 1;
}

/* ============================================
   Comparison table scroll affordance
   ============================================ */
.comparison-table-scroll.as-scroll-hint::before,
.comparison-table-scroll.as-scroll-hint::after {
    border-radius: 16px;
}

.comparison-table-scroll.as-scroll-hint::after {
    width: 56px;
}

.comparison-table-scroll .comparison-table-container::after {
    content: 'Scroll →';
    position: sticky;
    float: right;
    right: 10px;
    bottom: 10px;
    margin-top: -34px;
    margin-right: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--as-shelf-deep);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(107, 155, 184, 0.35);
    padding: 5px 10px;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    box-shadow: 0 2px 8px rgba(30, 47, 66, 0.08);
    z-index: 5;
}

@media (max-width: 900px) {
    .comparison-table-scroll .comparison-table-container:not(.is-scrolled-end)::after {
        opacity: 1;
    }

    .comparison-table-scroll .comparison-table-container.is-scrolled-end::after {
        opacity: 0;
    }
}

/* ============================================
   Author portal — page shell
   ============================================ */
.author-portal.site-main {
    background: var(--as-surface-alt);
    min-height: calc(100vh - 120px);
    padding-bottom: 40px;
}

.author-portal .dashboard-tab {
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 12px;
    box-shadow: var(--as-shadow);
}

.author-portal .dashboard-nav .nav-item {
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.author-portal .dashboard-nav .nav-item:hover:not(.active) {
    background: var(--as-shelf-pale);
    color: var(--as-ink);
}

.author-portal .dashboard-nav .nav-item:active {
    transform: scale(0.98);
}

/* Mobile quick links (My Orders / Help) */
.portal-mobile-quicklinks {
    display: none;
    gap: 8px;
    padding: 0 0 12px;
}

.portal-mobile-quicklinks a {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--as-ink);
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 10px;
    box-shadow: var(--as-shadow);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.portal-mobile-quicklinks a:hover {
    border-color: var(--as-shelf);
    background: var(--as-shelf-pale);
}

@media (max-width: 1024px) {
    .portal-mobile-quicklinks {
        display: flex;
    }
}

/* Welcome card */
.portal-welcome-card {
    background: linear-gradient(135deg, var(--as-shelf-pale) 0%, var(--as-surface) 55%);
    border: 1px solid var(--as-border);
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 28px;
    box-shadow: var(--as-shadow);
}

.portal-welcome-card h1 {
    margin: 0 0 6px;
    color: var(--as-ink);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.portal-welcome-card .welcome-subtitle {
    margin: 0;
    color: var(--as-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.portal-welcome-card .welcome-actions {
    margin-top: 16px;
}

.portal-welcome-card .portal-welcome-note {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--as-muted);
    line-height: 1.45;
}

/* Section headings */
.portal-section-heading {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--as-ink);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--as-border-soft);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.portal-section-lead {
    font-size: 0.88rem;
    color: var(--as-muted);
    margin-bottom: 18px;
    line-height: 1.55;
}

/* Todo cards */
.author-portal .todo-section {
    margin-bottom: 14px;
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.author-portal .todo-section:hover {
    border-color: var(--as-shelf);
    box-shadow: 0 2px 12px rgba(107, 155, 184, 0.1);
}

.author-portal .todo-section strong {
    display: block;
    color: var(--as-ink);
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.author-portal .todo-section p {
    font-size: 0.8rem;
    color: var(--as-muted);
    margin: 3px 0 8px;
    line-height: 1.45;
}

.author-portal .todo-section ul {
    margin: 0;
    padding-left: 18px;
    font-size: 0.85rem;
}

.author-portal .todo-section a {
    color: var(--as-shelf-deep);
    font-weight: 600;
    text-decoration: none;
}

.author-portal .todo-section a:hover {
    color: var(--as-author);
    text-decoration: underline;
}

/* Easy access grid */
.portal-easy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    font-size: 0.84rem;
}

.portal-quick-card {
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.portal-quick-card:hover {
    transform: translateY(-2px);
    border-color: var(--as-shelf);
    box-shadow: var(--as-shadow);
}

.portal-quick-card strong {
    display: block;
    color: var(--as-ink);
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.portal-quick-card a {
    display: block;
    margin-top: 6px;
    color: var(--as-shelf-deep);
    font-weight: 600;
    text-decoration: none;
}

.portal-quick-card a:hover {
    color: var(--as-author);
}

.portal-quick-card small {
    display: block;
    margin-top: 4px;
    color: var(--as-muted);
    font-size: 0.72rem;
}

/* Dashboard FAQ + stats columns */
.portal-dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .portal-dashboard-columns {
        grid-template-columns: 1fr;
    }
}

.portal-dashboard-columns h2 {
    font-size: 1.05rem;
    margin: 0 0 10px;
    color: var(--as-ink);
    font-weight: 700;
}

.portal-dashboard-columns .portal-faq-block {
    font-size: 0.84rem;
    line-height: 1.5;
}

.portal-dashboard-columns .portal-faq-block > div + div {
    margin-top: 8px;
}

.portal-dashboard-columns .portal-stats-block {
    font-size: 0.9rem;
}

.portal-dashboard-columns a {
    color: var(--as-shelf-deep);
    font-weight: 600;
    text-decoration: none;
}

.portal-dashboard-columns a:hover {
    color: var(--as-author);
}

/* Wizard step links */
#wizard-steps-nav .wizard-steps-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--as-ink);
    padding: 4px 8px 8px;
    border-bottom: 1px solid var(--as-border);
    margin-bottom: 6px;
    letter-spacing: 0.06em;
}

.wizard-step-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    background: var(--as-surface);
    color: var(--as-text);
    border-color: var(--as-border);
}

.wizard-step-link:hover:not(.wizard-step-link--active) {
    background: var(--as-shelf-pale);
    border-color: var(--as-shelf);
}

.wizard-step-link--active {
    background: var(--as-ink);
    color: #fff;
    font-weight: 600;
    border-color: var(--as-ink);
    box-shadow: 0 2px 8px rgba(30, 47, 66, 0.2);
}

.wizard-step-link--done {
    background: var(--as-shelf-light);
    color: var(--as-shelf-deep);
    border-color: rgba(107, 155, 184, 0.35);
}

.wizard-step-link--locked {
    cursor: default;
    opacity: 0.65;
}

@media (max-width: 1024px) {
    #wizard-steps-nav .wizard-step-link {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        margin-bottom: 0;
    }

    #wizard-steps-nav .wizard-steps-label {
        flex: 0 0 100%;
    }
}

/* Payment options polish */
.authorshelf-payment-options {
    max-width: 28rem;
}

.authorshelf-payment-options label {
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.authorshelf-payment-options label:hover {
    border-color: var(--as-shelf) !important;
}

.authorshelf-payment-options .authorshelf-choose-plan-btn {
    box-shadow: 0 4px 14px rgba(250, 0, 41, 0.22);
}

.authorshelf-payment-options .authorshelf-choose-plan-btn:hover {
    box-shadow: 0 6px 18px rgba(250, 0, 41, 0.3);
}

#as-payment-plans {
    border-radius: 12px !important;
}

/* Footer link polish */
.footer-links a,
.footer-portal a {
    transition: color 0.15s ease, transform 0.15s ease;
}

.footer-links a:hover,
.footer-portal a:hover {
    transform: translateX(2px);
}

/* Body lock when mobile menu open */
body.as-menu-open {
    overflow: hidden;
}

/* Subtle page load fade for portal tabs */
.author-portal .dashboard-tab.active {
    animation: as-fade-in 0.25s ease;
}

@keyframes as-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Portal — Email-style Messages Inbox
   ============================================ */
.author-portal .as-messages-tab {
    padding: 0;
    overflow: hidden;
}

.as-email-inbox {
    display: flex;
    flex-direction: column;
    min-height: 520px;
    max-height: calc(100vh - 220px);
}

.as-email-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.as-email-toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.as-email-toolbar h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--as-ink);
}

.as-email-count {
    font-size: 0.82rem;
    color: #64748b;
}

.as-email-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.as-email-search,
.as-email-filter {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
    background: #fff;
}

.as-email-search {
    min-width: 180px;
}

.as-email-refresh-btn {
    background: #fff;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.as-email-compose {
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.as-email-compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.as-email-compose-close {
    border: none;
    background: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    padding: 0 4px;
}

.as-email-compose-fields {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
    margin-bottom: 10px;
}

.as-email-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #475569;
}

.as-email-field input,
.as-email-field select,
.as-email-compose textarea,
.as-email-reply-box textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}

.as-email-compose textarea {
    resize: vertical;
    min-height: 88px;
}

.as-email-compose-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.as-email-compose-status,
.as-email-reply-status {
    font-size: 0.82rem;
    color: #64748b;
}

.as-email-layout {
    display: grid;
    grid-template-columns: minmax(260px, 36%) 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.as-email-list-pane {
    border-right: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.as-email-list {
    overflow-y: auto;
    flex: 1;
}

.as-email-loading,
.as-email-list-empty,
.as-email-list-error {
    padding: 24px 16px;
    font-size: 0.9rem;
    color: #64748b;
    text-align: center;
    line-height: 1.5;
}

.as-email-list-error a {
    color: var(--as-shelf-deep);
    font-weight: 600;
}

.as-email-row {
    display: grid;
    grid-template-columns: 10px 88px 1fr auto;
    gap: 8px 10px;
    align-items: start;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
    font-family: inherit;
}

.as-email-row:hover {
    background: #f8fafc;
}

.as-email-row.is-selected {
    background: #eff6ff;
    box-shadow: inset 3px 0 0 var(--as-shelf-deep);
}

.as-email-row.is-unread .as-email-row-from,
.as-email-row.is-unread .as-email-row-subject {
    font-weight: 700;
}

.as-email-row-unread {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    margin-top: 6px;
}

.as-email-row.is-unread .as-email-row-unread {
    background: var(--as-author);
}

.as-email-row-from {
    font-size: 0.82rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-email-row-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.as-email-row-subject {
    font-size: 0.9rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-email-row-preview {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-email-row-project {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-email-row-date {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    padding-top: 2px;
}

.as-email-read-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fafbfc;
    overflow: hidden;
}

.as-email-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    color: #64748b;
}

.as-email-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.7;
}

.as-email-empty p {
    margin: 0 0 6px;
    font-size: 1rem;
    color: #475569;
}

.as-email-empty-hint {
    font-size: 0.88rem !important;
    max-width: 280px;
}

.as-email-thread-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.as-email-thread-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.as-inbox-back-btn {
    display: none;
    border: none;
    background: none;
    color: var(--as-shelf-deep);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0 0 8px;
    font-family: inherit;
}

.as-email-thread-meta h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
    color: #1e293b;
    line-height: 1.3;
}

.as-thread-project {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.as-email-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

.as-email-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.as-email-message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
}

.as-email-message.is-received .as-email-message-avatar {
    background: var(--as-shelf-deep);
}

.as-email-message.is-sent .as-email-message-avatar {
    background: #64748b;
}

.as-email-message-content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.as-email-message.is-sent .as-email-message-content {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.as-email-message-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.as-email-message-from {
    font-weight: 600;
    color: #334155;
}

.as-email-message-date {
    color: #94a3b8;
    white-space: nowrap;
}

.as-email-message-subject {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.as-email-message-body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #1e293b;
    word-break: break-word;
}

.as-email-no-messages {
    color: #64748b;
    font-size: 0.9rem;
    padding: 12px 0;
}

.as-email-reply-box {
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.as-email-reply-box label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.as-email-reply-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .as-email-compose-fields {
        grid-template-columns: 1fr;
    }

    .as-email-layout {
        grid-template-columns: 1fr;
    }

    .as-email-layout.as-email-reading .as-email-list-pane {
        display: none;
    }

    .as-inbox-back-btn {
        display: inline-block;
    }

    .as-email-inbox {
        max-height: none;
        min-height: 480px;
    }

    .as-email-row {
        grid-template-columns: 10px 72px 1fr auto;
        padding: 11px 12px;
    }
}

/* ============================================
   Portal Messages — iMessage thread UI
   ============================================ */
.as-messages-tab--imessage {
    --pd-blue: #007aff;
    --pd-grey-bubble: #e9e9eb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.as-messages-tab--imessage .as-imessage-toolbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.as-messages-tab--imessage .as-imessage-search {
    border-radius: 20px;
    background: #f2f2f7;
    border-color: transparent;
}

.as-messages-tab--imessage .as-imessage-list {
    background: #fff;
}

.as-imessage-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #f0f0f5;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
    font-family: inherit;
    position: relative;
}

.as-imessage-row:hover {
    background: #f8f8fc;
}

.as-imessage-row.is-selected {
    background: #eef4ff;
}

.as-imessage-row.is-unread .as-imessage-row-name,
.as-imessage-row.is-unread .as-imessage-row-preview {
    font-weight: 600;
    color: #111;
}

.as-imessage-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--as-shelf-deep) 0%, #4a7a9a 100%);
    letter-spacing: 0.02em;
}

.as-imessage-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.as-imessage-row-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.as-imessage-row-name {
    font-size: 0.92rem;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-imessage-row-date {
    font-size: 0.72rem;
    color: #8e8e93;
    white-space: nowrap;
    flex-shrink: 0;
}

.as-imessage-row-preview {
    font-size: 0.82rem;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-imessage-row-project {
    font-size: 0.7rem;
    color: #aeaeb2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-imessage-unread-dot {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(14px);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--pd-blue);
}

.as-imessage-read-pane {
    background: #fff;
}

.as-imessage-empty-icon {
    color: #c7c7cc;
    margin-bottom: 12px;
}

.as-imessage-thread-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #fff;
}

.as-imessage-thread-header {
    padding: 12px 16px 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9f9fb;
    text-align: center;
    flex-shrink: 0;
}

.as-imessage-thread-header .as-inbox-back-btn {
    display: none;
    text-align: left;
    width: 100%;
}

.as-imessage-thread-meta h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    line-height: 1.25;
}

.as-imessage-thread-meta .as-thread-project {
    margin: 0;
    font-size: 0.75rem;
    color: #8e8e93;
}

.as-imessage-thread-body {
    flex: 1;
    min-height: 280px;
    max-height: none;
    background: #fff;
}

.as-messages-tab--imessage .pd-msg-author .pd-msg-bubble {
    background: var(--pd-blue);
    color: #fff;
}

.as-messages-tab--imessage .pd-msg-admin .pd-msg-bubble {
    background: var(--pd-grey-bubble);
    color: #111;
}

.as-messages-tab--imessage .pd-messages-empty {
    text-align: center;
    color: #8e8e93;
    font-size: 0.88rem;
    padding: 24px 12px;
    margin: 0;
}

.as-inbox-reply-bar {
    border-top: 1px solid #e5e7eb;
    background: #f9f9fb;
    flex-shrink: 0;
}

.as-imessage-send-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--pd-blue);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.1s ease;
}

.as-imessage-send-btn:hover {
    background: #0062cc;
}

.as-imessage-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.as-imessage-reply-status {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: #8e8e93;
    padding: 2px 12px 8px;
    min-height: 16px;
}

/* Subscriptions & Renewals */
.apv2-recurring-dash {
    margin: 24px 24px 0;
}

.apv2-recurring-foot {
    margin: 12px 0 0;
    font-size: 0.82rem;
}

.apv2-recurring-foot a {
    color: var(--as-shelf-deep);
    font-weight: 600;
    text-decoration: none;
}

.as-recur-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.as-recur-table th,
.as-recur-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--as-border);
    text-align: left;
    vertical-align: top;
}

.as-recur-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--as-muted);
    background: var(--as-surface-alt);
}

.as-recur-status--active,
.as-recur-status--pending_publication {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.as-recur-status--active {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.as-recur-status--pending_publication {
    background: rgba(107, 155, 184, 0.15);
    color: var(--as-ink);
}

.as-recur-status--on-hold {
    background: rgba(250, 0, 41, 0.08);
    color: var(--as-author);
}

.as-recur-offers ul {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.as-recur-offer-btn {
    border: 1px solid var(--as-border);
    background: var(--as-surface);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--as-ink);
}

.as-recur-offer-btn:hover {
    border-color: var(--as-shelf-deep);
    background: var(--as-shelf-pale);
}

.as-recur-empty,
.as-recur-loading {
    font-size: 0.85rem;
    color: var(--as-muted);
}

@media (max-width: 768px) {
    .as-recur-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .as-recur-table table {
        min-width: 560px;
    }
}

@media (max-width: 900px) {
    .as-imessage-thread-header .as-inbox-back-btn {
        display: inline-block;
    }

    .as-imessage-thread-header {
        text-align: left;
    }

    .as-imessage-unread-dot {
        right: 12px;
    }
}

/* ========== Author portal polish v1.3.25 ========== */
.author-portal--v2 {
    --apv2-radius: 14px;
    --apv2-radius-sm: 10px;
}

.author-portal--v2 .dashboard-sidebar.apv2-sidebar {
    border-radius: var(--apv2-radius);
}

.author-portal--v2 .dashboard-main > .dashboard-tab {
    border-radius: var(--apv2-radius);
}

.author-portal--v2 .dashboard-nav .nav-item {
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.author-portal--v2 .dashboard-nav .nav-item:focus-visible {
    outline: 2px solid var(--as-shelf-deep);
    outline-offset: -2px;
}

.author-portal--v2 .apv2-hero__actions .btn {
    min-height: 42px;
    padding: 10px 18px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.author-portal--v2 .apv2-hero__actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 0, 5, 0.25);
}

.author-portal--v2 .apv2-trust-bar__item {
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.author-portal--v2 .apv2-trust-bar__item--done .apv2-trust-bar__label {
    text-decoration: none;
}

.author-portal--v2 .apv2-getting-started--global {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08);
}

.author-portal--v2 .apv2-getting-started__actions .btn {
    min-height: 40px;
    font-weight: 600;
}

.author-portal--v2 .project-card .project-header {
    align-items: flex-start;
    gap: 12px;
}

.author-portal--v2 .project-card .project-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--as-ink);
}

.author-portal--v2 .project-card .project-genre {
    font-size: 0.8rem;
    color: var(--as-muted);
    line-height: 1.4;
}

.author-portal--v2 .project-card .status-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 5px 10px;
    border-radius: 999px;
}

.author-portal--v2 .project-card .project-progress {
    margin: 14px 0 12px;
}

.author-portal--v2 .project-card .progress-bar {
    height: 6px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}

.author-portal--v2 .project-card .progress-text {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--as-muted);
    font-weight: 500;
}

.author-portal--v2 .project-card .project-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px 12px;
    padding: 12px 0;
    margin: 0 0 12px;
    border-top: 1px solid var(--as-border-soft, #eef2f6);
    border-bottom: 1px solid var(--as-border-soft, #eef2f6);
    font-size: 0.8rem;
    color: var(--as-ink-soft, #475569);
}

.author-portal--v2 .project-card .project-meta strong {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 2px;
}

.author-portal--v2 .project-card .project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.author-portal--v2 .project-card .project-actions .btn-small,
.author-portal--v2 .project-card .project-actions a.btn-small {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
}

.author-portal--v2 .title-card .title-status-active {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.author-portal--v2 .title-card .title-status-inactive {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.author-portal--v2 .apv2-mobile-quicklinks {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    border-radius: 12px;
    overflow: hidden;
}

.author-portal--v2 .apv2-mobile-quicklinks a {
    font-weight: 600;
    font-size: 0.82rem;
}

.author-portal--v2 .as-email-search,
.author-portal--v2 .as-email-filter {
    border-radius: 8px;
    border: 1px solid var(--as-border);
    min-height: 36px;
}

.author-portal--v2 .as-email-compose {
    border-radius: 0 0 12px 12px;
}

/* Report cards */
.author-portal--v2 .apv2-report-grid {
    display: grid;
    gap: 14px;
    margin-top: 4px;
}

.author-portal--v2 .apv2-report-card {
    border: 1px solid var(--as-border);
    border-radius: 12px;
    padding: 16px 18px;
    background: var(--as-surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.author-portal--v2 .apv2-report-card:hover {
    border-color: var(--as-shelf);
    box-shadow: 0 4px 14px rgba(92, 125, 183, 0.08);
}

.author-portal--v2 .apv2-report-card__title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--as-ink);
    letter-spacing: -0.01em;
}

.author-portal--v2 .apv2-report-card__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.author-portal--v2 .apv2-report-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: var(--as-surface-alt, #f8fafc);
    border-radius: 8px;
    border: 1px solid var(--as-border-soft, #eef2f6);
}

.author-portal--v2 .apv2-report-stat__label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.author-portal--v2 .apv2-report-stat__value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--as-ink);
}

/* Help grid */
.author-portal--v2 .apv2-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.author-portal--v2 .apv2-help-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    background: var(--as-surface);
    border: 1px solid var(--as-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.author-portal--v2 .apv2-help-card:hover {
    border-color: var(--as-shelf);
    transform: translateY(-1px);
}

.author-portal--v2 .apv2-help-card strong {
    font-size: 0.95rem;
    color: var(--as-ink);
}

.author-portal--v2 .apv2-help-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--as-muted);
    flex: 1;
}

.author-portal--v2 .apv2-help-card .btn {
    align-self: flex-start;
    margin-top: 4px;
}

.author-portal--v2 .apv2-help-links {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    line-height: 1.7;
}

.author-portal--v2 .apv2-help-links a {
    color: var(--as-shelf-deep);
    font-weight: 600;
    text-decoration: none;
}

.author-portal--v2 .apv2-help-links a:hover {
    color: var(--as-author);
}

/* Website / service panels */
.author-portal--v2 .apv2-panel--flush {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
}

.author-portal--v2 .apv2-panel__note {
    margin: 12px 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--as-ink-soft, #475569);
}

.author-portal--v2 .apv2-panel__meta {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: var(--as-muted);
}

.author-portal--v2 .apv2-website-list {
    display: grid;
    gap: 10px;
}

.author-portal--v2 .apv2-website-card {
    border: 1px solid var(--as-border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--as-surface);
}

.author-portal--v2 .apv2-website-card__title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--as-ink);
}

.author-portal--v2 .apv2-website-card__meta,
.author-portal--v2 .apv2-website-card__status {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 4px;
    line-height: 1.45;
}

.author-portal--v2 .apv2-website-card__status a {
    font-weight: 600;
    color: var(--as-shelf-deep);
}

/* Account sub-nav polish */
.author-portal--v2 .account-sub-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 20px;
    padding: 6px;
    background: var(--as-surface-alt, #f8fafc);
    border: 1px solid var(--as-border);
    border-radius: 12px;
}

.author-portal--v2 .account-sub-nav .account-sub-link {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--as-ink-soft, #475569);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.author-portal--v2 .account-sub-nav .account-sub-link:hover {
    background: #fff;
    color: var(--as-ink);
}

.author-portal--v2 .account-sub-nav .account-sub-link.active {
    background: #fff;
    color: var(--as-ink);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--as-border);
}

@media (max-width: 768px) {
    .author-portal--v2 .things-to-do-section .todo-section,
    .author-portal--v2 .easy-access-section .portal-quick-card {
        font-size: 0.8rem;
    }

    .author-portal--v2 .project-card .project-actions {
        width: 100%;
    }

    .author-portal--v2 .project-card .project-actions .btn-small,
    .author-portal--v2 .project-card .project-actions a.btn-small {
        flex: 1 1 auto;
        min-height: 40px;
    }

    .author-portal--v2 .account-sub-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .author-portal--v2 .account-sub-nav .account-sub-link {
        white-space: nowrap;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .wiz-modal-content {
        width: 98% !important;
        max-height: 95vh;
    }
}