/* AppToFit Org — Gym SaaS design system */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root,
html[data-theme="dark"] {
    --primary: #f24e1d;
    --primary-hover: #e04518;
    --primary-soft: rgba(242, 78, 29, 0.14);
    --primary-ring: rgba(242, 78, 29, 0.32);

    --bg: #121212;
    --bg-subtle: #181818;
    --card: #1c1c1c;
    --surface-muted: #242424;
    --text: #f5f5f5;
    --muted: #a1a1a1;
    --border: #2e2e2e;
    --input-bg: #242424;
    --bg-page: #0f0f0f;
    --body-gradient: #0f0f0f;
    --page-gradient:
        radial-gradient(ellipse 90% 60% at 50% -25%, rgba(242, 78, 29, 0.09), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(242, 78, 29, 0.04), transparent 50%),
        linear-gradient(180deg, #101010 0%, #141414 45%, #121212 100%);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.28);
    --dropdown-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
    --topbar-shadow: none;
    --btn-text: #ffffff;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
    --auth-overlay: linear-gradient(rgba(18, 18, 18, 0.82), rgba(18, 18, 18, 0.92));
    --auth-card-bg: rgba(28, 28, 28, 0.95);
    --table-row-hover: rgba(255, 255, 255, 0.03);
    --header-bg: #1c1c1c;
    --header-text: #f5f5f5;
    --header-muted: #9ca3af;
    --header-border: #2e2e2e;
    --header-surface: #262626;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;
    --accent: var(--primary);
    --accent-hover: var(--primary-hover);
    --comment-text: #7dd3fc;
}

html[data-theme="light"] {
    --bg: #f0f0f0;
    --bg-subtle: #fafafa;
    --card: #ffffff;
    --surface-muted: #f3f3f3;
    --text: #171717;
    --muted: #6b7280;
    --border: #e8e8e8;
    --input-bg: #ffffff;
    --bg-page: #ececec;
    --body-gradient: #ececec;
    --page-gradient:
        radial-gradient(ellipse 80% 55% at 50% -20%, rgba(242, 78, 29, 0.07), transparent 55%),
        linear-gradient(180deg, #e9e9e9 0%, #f0f0f0 40%, #f5f5f5 100%);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
    --dropdown-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
    --topbar-shadow: none;
    --btn-text: #ffffff;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --auth-card-bg: rgba(255, 255, 255, 0.97);
    --table-row-hover: rgba(0, 0, 0, 0.02);
    --header-bg: #1c1c1c;
    --header-text: #f5f5f5;
    --header-muted: #9ca3af;
    --header-border: #2e2e2e;
    --header-surface: #262626;
    --comment-text: #0369a1;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-page);
    background-image: var(--page-gradient);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── App shell ── */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--topbar-shadow);
}

.app-topbar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.app-main {
    flex: 1;
    padding: 1.75rem 0 3rem;
    background: transparent;
    position: relative;
}

.app-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    mask-image: linear-gradient(180deg, transparent 0%, black 8%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 8%, black 92%, transparent 100%);
}

html[data-theme="light"] .app-main::before {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
}

.app-main > .container {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

body.admin-page .container,
body.detail-page .container {
    max-width: 1320px;
}

body.renewals-page .container {
    max-width: 100%;
    padding: 0 1rem;
}

/* ── Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 64px;
    position: relative;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.app-header-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.app-header-logo img {
    display: block;
    max-width: 140px;
    width: 100%;
    height: auto;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    position: relative;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 80;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-nav a {
    color: var(--header-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: .875rem;
    padding: .5rem .9rem;
    border-radius: var(--radius-full);
    transition: color .15s ease, background .15s ease;
    white-space: nowrap;
}

.app-nav a:hover {
    color: var(--header-text);
    background: var(--header-surface);
}

.app-nav a.is-active {
    color: #ffffff;
    background: var(--primary);
}

/* ── Profile menu ── */
.profile-menu {
    position: relative;
    z-index: 80;
}

.profile-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 14px;
}

.profile-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .55rem .3rem .3rem;
    border: 1px solid var(--header-border);
    border-radius: var(--radius-full);
    background: var(--header-surface);
    color: var(--header-text);
    cursor: pointer;
    font: inherit;
    transition: border-color .15s ease, background .15s ease;
}

.profile-menu-trigger:hover,
.profile-menu.is-open .profile-menu-trigger {
    border-color: rgba(255, 255, 255, 0.18);
    background: #303030;
}

.profile-menu-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .84rem;
    font-weight: 600;
}

.profile-menu-chevron {
    font-size: .65rem;
    color: var(--header-muted);
}

.profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.profile-avatar-sm { width: 34px; height: 34px; font-size: .75rem; }
.profile-avatar-md { width: 44px; height: 44px; font-size: .85rem; }
.profile-avatar-lg { width: 88px; height: 88px; font-size: 1.35rem; }

.profile-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 260px;
    padding: .5rem 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--dropdown-shadow);
    z-index: 90;
}

.profile-menu-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.profile-menu.is-open .profile-menu-dropdown { display: block; }

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem 1rem;
    border-bottom: 1px solid var(--border);
}

.profile-menu-header strong {
    display: block;
    font-size: .92rem;
    margin-bottom: .15rem;
}

.profile-menu-header .meta {
    display: block;
    font-size: .8rem;
    word-break: break-all;
}

.profile-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: .9rem;
    transition: background .12s ease, color .12s ease;
}

.profile-menu-dropdown a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: .35rem 0;
}

.profile-menu-logout {
    color: var(--danger) !important;
}

.profile-menu-logout:hover {
    background: rgba(220, 38, 38, 0.08) !important;
    color: var(--danger) !important;
}

.profile-edit-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

@media (hover: hover) and (min-width: 769px) {
    .profile-menu:hover .profile-menu-dropdown,
    .profile-menu:focus-within .profile-menu-dropdown {
        display: block;
    }
}

/* ── Mobile nav ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.5rem;
    height: 2.5rem;
    padding: .4rem;
    border: 1px solid var(--header-border);
    border-radius: var(--radius-sm);
    background: var(--header-surface);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--header-text);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .nav-toggle { display: inline-flex; }
    .app-header-right { gap: .5rem; }
    .app-nav {
        display: none;
        position: absolute;
        top: calc(100% + .5rem);
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        padding: .5rem;
        background: var(--header-bg);
        border: 1px solid var(--header-border);
        border-radius: var(--radius-md);
        box-shadow: var(--dropdown-shadow);
        z-index: 50;
    }
    .app-nav.is-open { display: flex; }
    .app-nav a { padding: .75rem 1rem; }
    .app-header-logo img { max-width: 120px; }
    .profile-menu-name,
    .profile-menu-chevron { display: none; }
}

/* ── Cards & typography ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
}

html[data-theme="dark"] .card {
    background: linear-gradient(180deg, #1f1f1f 0%, #1c1c1c 100%);
    border-color: #333333;
}

html[data-theme="light"] .card {
    background: #ffffff;
    border-color: #e5e5e5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 6px 20px rgba(0, 0, 0, 0.05);
}

.card-narrow { max-width: 440px; margin: 2rem auto; width: 100%; }

h1 {
    margin: 0 0 .35rem;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h2 { letter-spacing: -0.01em; }

.subtitle {
    color: var(--muted);
    margin: 0;
    font-size: .95rem;
    line-height: 1.5;
}

.meta { color: var(--muted); font-size: .875rem; }

label {
    display: block;
    margin-bottom: .4rem;
    font-size: .84rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .01em;
}

input,
select,
textarea {
    width: 100%;
    padding: .7rem .95rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

select { cursor: pointer; }
select option { background: var(--input-bg); color: var(--text); }

textarea {
    resize: vertical;
    line-height: 1.55;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.15rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--btn-text);
    font-weight: 600;
    font-size: .9rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, transform .1s ease;
}

.btn:hover {
    background: var(--primary-hover);
    color: var(--btn-text);
}

.btn:active { transform: translateY(1px); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="light"] .btn-outline:hover {
    border-color: #d4d4d4;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: none;
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.btn-sm {
    padding: .5rem .9rem;
    font-size: .84rem;
}

.btn-danger {
    background: var(--danger);
    box-shadow: none;
    color: #fff;
}

.btn-danger:hover { background: #ef4444; color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: none;
}

.btn-success:hover { background: #10b981; color: #fff; }

/* ── Alerts & badges ── */
.alert {
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.18);
}

.alert-success {
    background: rgba(5, 150, 105, 0.08);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.18);
}

.field-error { color: var(--danger); font-size: .84rem; margin: -.75rem 0 1rem; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-muted {
    background: var(--surface-muted);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge-success {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success);
}

.badge-open {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
}

.badge-closed {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .55rem;
    border-radius: var(--radius-full);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill-open {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
}

.status-pill-closed {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success);
}

/* ── Page header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 { margin-bottom: .25rem; }

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
}

.renewals-period-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}

.renewals-period-filter .filter-field select {
    min-width: 140px;
}

.btn-reset-filter {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 .9rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.renewals-period-filter .btn-reset-filter {
    font: inherit;
    cursor: pointer;
}

.btn-reset-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.renewals-search {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.renewals-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
}

.renewals-search-summary {
    margin-bottom: 1rem;
    font-size: .92rem;
    color: var(--muted);
}

.renewals-search-summary strong {
    color: var(--text);
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .5rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

/* ── Stats strip ── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

html[data-theme="light"] .stat-card {
    background: var(--bg-subtle);
    border-color: #f0f0f0;
}

.stat-card-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}

.stat-card-label {
    display: block;
    margin-top: .2rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card-accent .stat-card-value { color: var(--text); }

html[data-theme="dark"] .stat-card-accent {
    border-color: rgba(242, 78, 29, 0.25);
    background: rgba(242, 78, 29, 0.08);
}

html[data-theme="dark"] .stat-card-accent .stat-card-value {
    color: var(--primary);
}

.stat-card-filterable {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.stat-card-filterable:hover {
    border-color: var(--primary);
}

.stat-card-filterable:active {
    transform: translateY(1px);
}

.stat-card-filterable.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary) inset;
}

.stat-card-filterable.is-active .stat-card-value {
    color: var(--primary);
}

.renewals-table tr.is-filtered-out {
    display: none;
}

/* ── Filters ── */
.list-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.filter-field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.filter-field select,
.filter-field input[type="search"] {
    margin-bottom: 0;
    min-width: 120px;
    font-size: .9rem;
}

.filter-field-grow { flex: 1 1 260px; }
.filter-field-grow input[type="search"] { width: 100%; }

.filter-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.search-input-wrap {
    position: relative;
}

.search-input-wrap input {
    padding-left: 2.5rem;
    margin-bottom: 0;
}

.search-input-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .9rem;
    pointer-events: none;
}

/* ── Data table ── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table th,
.data-table td {
    padding: .85rem 1rem;
    text-align: left;
    vertical-align: middle;
    border: none;
}

.data-table thead {
    background: var(--surface-muted);
}

.data-table thead tr {
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s ease;
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.data-table th {
    color: var(--muted);
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.data-table th .sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.data-table th .sort-link:hover { color: var(--primary); }

.data-table th .sort-link.is-sorted { color: var(--primary); }

.cell-id {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
}

.cell-client strong {
    display: block;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.cell-client .meta {
    display: block;
    margin-top: .15rem;
    font-size: .8rem;
}

.renewals-table .cell-client {
    min-width: 190px;
}

.renewals-table .cell-client .meta {
    white-space: normal;
    word-break: break-word;
}

.client-name-row .client-inline-meta {
    display: inline;
    margin-top: 0;
}

.client-contact-inline {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    line-height: 1.35;
    color: var(--muted);
    white-space: nowrap;
}

.client-contact-inline .client-contact-icon {
    flex: 0 0 auto;
    width: auto;
}

.client-contact-line {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    margin-top: .2rem;
    font-size: .8rem;
    line-height: 1.35;
    color: var(--muted);
}

.client-contact-icon {
    flex: 0 0 1rem;
    width: 1rem;
    text-align: center;
    color: var(--primary);
    opacity: .85;
    line-height: 1.35;
}

.btn-comment-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm, 6px);
    background: transparent;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
}

.btn-comment-edit:hover {
    color: var(--primary);
    background: rgba(242, 78, 29, 0.08);
}

.renewals-status-history {
    margin-top: .35rem;
}

.renewals-latest-history {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: .4rem .6rem;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
    border: none;
    border-radius: 0;
    background: none;
    cursor: pointer;
    transition: color .15s ease;
}

.renewals-latest-history:hover .renewals-history-comment-preview {
    color: var(--primary);
}

.renewals-history-row td {
    padding: 0 1rem .5rem;
    border-top: none;
    vertical-align: top;
}

.renewals-history-row.is-filtered-out {
    display: none;
}

.renewals-table tbody tr.renewals-data-row.has-history {
    border-bottom: none;
}

.renewals-table tbody tr.renewals-data-row.has-history td {
    padding-bottom: .2rem;
}

.renewals-history-link {
    display: inline-block;
    flex-shrink: 0;
    margin-top: 0;
    margin-left: auto;
    font-size: .72rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.renewals-history-comment-preview {
    display: inline;
    margin-top: 0;
    font-size: .76rem;
    line-height: 1.35;
    color: var(--comment-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

.renewals-history-list {
    display: grid;
    gap: .55rem;
    max-height: 50vh;
    overflow: auto;
    margin-bottom: 1rem;
}

.renewals-history-dialog {
    width: min(100%, 34rem);
}

.renewals-history-comment.renewals-history-comment-empty {
    color: var(--muted);
    font-style: italic;
}

.renewals-history-entry {
    margin: .25rem 0 0;
    padding: .35rem .5rem;
    font-size: .76rem;
    line-height: 1.4;
    color: var(--text);
    background: rgba(242, 78, 29, 0.06);
    border-left: 3px solid rgba(242, 78, 29, 0.35);
    border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
}

.renewals-history-meta {
    display: inline;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0;
    white-space: nowrap;
}

.renewals-history-comment {
    display: block;
    color: var(--comment-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.renewals-status-dialog-fields {
    display: grid;
    gap: .85rem;
    margin-bottom: 1rem;
}

.renewals-status-dialog-fields textarea {
    width: 100%;
    min-height: 5.5rem;
    resize: vertical;
}

.renewals-comment {
    margin: .35rem 0 .2rem;
    padding: .4rem .55rem;
    font-size: .78rem;
    line-height: 1.4;
    color: var(--text);
    background: rgba(242, 78, 29, 0.08);
    border-left: 3px solid rgba(242, 78, 29, 0.45);
    border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
    white-space: pre-wrap;
    word-break: break-word;
}

html[data-theme="dark"] .renewals-comment {
    background: rgba(242, 78, 29, 0.12);
    border-left-color: rgba(242, 78, 29, 0.55);
    color: var(--text);
}

.renewals-comment-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
}

.renewals-comment-modal[hidden] {
    display: none !important;
}

.renewals-comment-dialog {
    width: min(100%, 420px);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface, #fff);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.renewals-comment-dialog h3 {
    margin: 0 0 .35rem;
    font-size: 1rem;
}

.renewals-comment-dialog-client {
    margin: 0 0 .75rem;
    font-size: .85rem;
    color: var(--muted);
}

.renewals-comment-dialog textarea {
    width: 100%;
    min-height: 110px;
    margin-bottom: .9rem;
    resize: vertical;
}

.renewals-comment-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
}

.client-name-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.client-name-row strong {
    display: inline;
    white-space: nowrap;
}

.cell-date {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: .84rem;
}

.actions-cell { white-space: nowrap; }

.actions-row {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: .4rem;
    align-items: center;
}

.actions-row .btn-sm {
    padding: .4rem .7rem;
    font-size: .8rem;
}

.inline-form { display: inline-flex; margin: 0; flex-shrink: 0; }

/* Legacy status dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-open { background: var(--muted); }
.status-dot-closed { background: var(--success); }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.35rem;
}

.empty-state h3 {
    margin: 0 0 .35rem;
    font-size: 1.05rem;
}

.empty-state p {
    margin: 0 0 1.25rem;
    color: var(--muted);
    font-size: .9rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Forms ── */
.form-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0 1.5rem;
}

.section-title {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.form-card { max-width: 900px; margin: 0 auto; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.25rem;
}

.form-field { margin-bottom: 1rem; }

.form-field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .84rem;
    color: var(--muted);
}

.form-field input,
.form-field select,
.form-field textarea { margin-bottom: 0; }

.form-field-full { grid-column: 1 / -1; }

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 1.25rem;
    margin-bottom: 0;
}

.form-row-3 > .form-field {
    margin-bottom: 1rem;
}

.platforms-checkbox-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem 1rem;
    padding: .75rem .9rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.form-field .platforms-checkbox-group .platform-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.form-field .platforms-checkbox-group .platform-checkbox-label input {
    margin: 0;
    width: auto;
    flex-shrink: 0;
}

.form-field .client-search-wrap { margin-bottom: 0; }

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .platforms-checkbox-group { grid-template-columns: 1fr; }
}

.password-field { margin-bottom: 1rem; }
.password-field label { display: block; margin-bottom: .35rem; }
.password-input-wrap { position: relative; width: 100%; }
.password-input-wrap input { padding-right: 2.75rem; margin-bottom: 0; }

.password-toggle {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-toggle:hover { color: var(--primary); }
.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.password-toggle .icon-hide { display: none; }
.password-toggle.is-visible .icon-show { display: none; }
.password-toggle.is-visible .icon-hide { display: block; }

/* ── Detail pages ── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
}

.detail-block { margin-top: 1.5rem; }
.detail-block p { margin: .5rem 0 0; white-space: pre-wrap; }

.detail-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, var(--primary-soft), transparent 55%), var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.detail-hero h1 {
    margin: .5rem 0 .35rem;
    font-size: 1.75rem;
}

.detail-subtitle {
    margin: 0 0 .75rem;
    color: var(--muted);
    font-size: .95rem;
}

.detail-hero-top {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .25rem;
}

.detail-badge {
    display: inline-flex;
    align-items: center;
    padding: .25rem .65rem;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .85rem;
}

.detail-pill {
    padding: .4rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-muted);
    font-size: .84rem;
}

.detail-hero-actions {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
    align-items: center;
}

.detail-item-full { grid-column: 1 / -1; }

.detail-section {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
}

.detail-section-head {
    margin-bottom: 1.25rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

.detail-section-head h2 {
    margin: 0 0 .25rem;
    font-size: 1.1rem;
}

.detail-grid-tight { gap: 1rem 1.25rem; }

.detail-item {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

.detail-label {
    font-size: .72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

.detail-value {
    font-size: .92rem;
    word-break: break-word;
}

.detail-link {
    color: var(--primary);
    text-decoration: none;
}

.detail-link:hover { text-decoration: underline; }

.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-callout {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.detail-callout p {
    margin: .45rem 0 0;
    white-space: pre-wrap;
    line-height: 1.55;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.gallery-item {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-muted);
}

.gallery-item figcaption {
    padding: .65rem .85rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

.gallery-item a { display: block; }

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    background: var(--input-bg);
}

.image-preview { margin-bottom: 1rem; }

.image-preview img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .5rem;
    color: var(--muted);
    font-size: .9rem;
}

.checkbox-label input { width: auto; margin: 0; }

.client-search-wrap { position: relative; }
.client-search-wrap label {
    display: block;
    margin-bottom: .35rem;
    font-size: .84rem;
    color: var(--muted);
}

.client-search-wrap input[type="text"] { margin-bottom: .35rem; }

.field-hint {
    margin: .35rem 0 0;
    color: var(--muted);
    font-size: .84rem;
}

.search-dropdown {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: .35rem 0;
    list-style: none;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--dropdown-shadow);
}

.search-dropdown li {
    padding: .65rem 1rem;
    cursor: pointer;
}

.search-dropdown li:hover,
.search-dropdown li.is-active {
    background: var(--primary-soft);
    color: var(--text);
}

.search-dropdown .search-empty {
    color: var(--muted);
    cursor: default;
}

.search-dropdown .search-empty:hover { background: transparent; }

.client-details-panel {
    margin-top: .75rem;
    padding: .85rem 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.client-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem 1rem;
}

.client-details-full { grid-column: 1 / -1; }

.client-details-label {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: .15rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
}

.client-details-value {
    display: block;
    font-size: .88rem;
    word-break: break-word;
}

@media (max-width: 700px) {
    .client-details-grid { grid-template-columns: 1fr; }
}

body.admin-page .admin-card {
    max-width: 520px;
    margin: 0 auto;
}

/* ── Auth pages ── */
.brand { text-align: center; margin-bottom: 1.5rem; }
.brand a { display: inline-block; text-decoration: none; }

.brand-logo {
    display: block;
    max-width: 220px;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

body.auth-page {
    background-color: #121212;
    background-image: var(--auth-overlay), var(--auth-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.auth-page .card {
    background: var(--auth-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.auth-page .container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 2rem 1.25rem;
}

body.auth-page .brand { flex-shrink: 0; margin-bottom: 1.25rem; }

body.auth-page .card-narrow {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 2rem 2.25rem;
    flex-shrink: 0;
}

body.auth-page form { width: 100%; }
body.auth-page input { min-height: 48px; font-size: 1rem; }

.footer-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: .9rem;
}

.footer-link a { color: var(--primary); font-weight: 600; }

/* ── Theme toggle ── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-muted);
    color: var(--text);
    font-size: .84rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.theme-toggle-icon {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
    flex-shrink: 0;
}

body.auth-page > .theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle-menu {
    width: 100%;
    justify-content: flex-start;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: .65rem 1rem !important;
    color: var(--text) !important;
    font-weight: 500;
}

.theme-toggle-menu:hover {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
}

.theme-toggle .theme-icon-light { display: none; }
html[data-theme="light"] .theme-toggle .theme-icon-dark { display: none; }
html[data-theme="light"] .theme-toggle .theme-icon-light { display: inline; }

/* ── Legacy nav (unused in app shell) ── */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.nav a { color: var(--primary); text-decoration: none; margin-left: 1rem; }
.nav-title { font-weight: 600; color: var(--text); }

/* ── Renewals due ── */
.renewals-table {
    table-layout: auto;
}

.renewals-table th,
.renewals-table td {
    padding: .6rem .55rem;
    font-size: .82rem;
}

.renewals-table .cell-date,
.renewals-table .cell-amount,
.renewals-table .renewals-group-total {
    text-align: right;
}

.renewals-table .cell-amount {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 600;
}

.renewals-month-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.renewals-month-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    overflow: hidden;
}

.renewals-month-card.is-filtered-out {
    display: none;
}

.renewals-month-card-header {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.25rem;
    padding: .9rem 1.1rem;
    border: none;
    background: rgba(5, 150, 105, 0.1);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.renewals-month-card-header:hover {
    background: rgba(5, 150, 105, 0.16);
}

.renewals-month-card-title {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.renewals-month-chevron {
    width: .55rem;
    height: .55rem;
    border-right: 2px solid var(--success);
    border-bottom: 2px solid var(--success);
    transform: rotate(-45deg);
    transition: transform .18s ease;
    flex-shrink: 0;
}

.renewals-month-card.is-expanded .renewals-month-chevron {
    transform: rotate(45deg);
}

.renewals-month-label {
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .84rem;
    font-weight: 800;
}

.renewals-month-count {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}

.renewals-month-card-totals {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .5rem .9rem;
    font-size: .82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.renewals-month-total {
    color: var(--success);
}

.renewals-month-renewed-total {
    color: var(--muted);
}

.renewals-month-lost-total {
    color: var(--danger);
}

.stat-card-value.text-danger {
    color: var(--danger) !important;
}

.renewals-month-card-body {
    border-top: 1px solid var(--border);
}

.renewals-month-card-body .table-wrap {
    border: none;
    border-radius: 0;
}

.renewals-table .cell-date-overdue {
    color: var(--danger);
    font-weight: 700;
}

.renewals-group-row td {
    background: rgba(5, 150, 105, 0.12);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.renewals-group-label {
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .78rem;
}

.renewals-group-total {
    color: var(--success);
    font-variant-numeric: tabular-nums;
}

.status-pill-renewed {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success);
}

.status-pill-new {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.status-select {
    min-height: 36px;
    padding: .35rem .6rem;
    font-size: .82rem;
    margin: 0;
    min-width: 140px;
}

.cell-status {
    white-space: nowrap;
}

.cell-status .save-indicator {
    margin-left: .5rem;
}

.toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

.toggle-pill input {
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    cursor: pointer;
}

.toggle-pill-thankyou input:checked ~ span {
    color: var(--success);
    font-weight: 600;
}

.save-indicator {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.save-indicator[hidden] {
    display: none !important;
}

.save-indicator-ok { color: var(--success); }
.save-indicator-error { color: var(--danger); }

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: var(--success);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid rgba(34, 197, 94, 0.3);
    transition: background .15s ease;
}

.btn-whatsapp:hover {
    background: rgba(34, 197, 94, 0.26);
    color: var(--success);
}

.cell-whatsapp-actions {
    white-space: nowrap;
    vertical-align: middle;
}

.btn-renewal-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease;
}

.btn-renewal-action-remind {
    background: rgba(234, 179, 8, 0.14);
    color: #b45309;
    border-color: rgba(234, 179, 8, 0.35);
}

.btn-renewal-action-remind:hover {
    background: rgba(234, 179, 8, 0.26);
    color: #92400e;
}

.btn-renewal-action-thank {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.3);
}

.btn-renewal-action-thank:hover {
    background: rgba(37, 99, 235, 0.22);
    color: #1e40af;
}

html[data-theme="dark"] .btn-renewal-action-remind {
    color: #fbbf24;
}

html[data-theme="dark"] .btn-renewal-action-remind:hover {
    color: #fcd34d;
}

html[data-theme="dark"] .btn-renewal-action-thank {
    color: #60a5fa;
}

html[data-theme="dark"] .btn-renewal-action-thank:hover {
    color: #93c5fd;
}

.renewals-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem 1.25rem;
    font-size: .82rem;
    color: var(--muted);
    margin: 0 0 1rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.legend-item-has-tip {
    cursor: help;
    border-bottom: 1px dotted rgba(161, 161, 161, 0.55);
}

.legend-swatch {
    display: inline-block;
    width: .75rem;
    height: .75rem;
    border-radius: 3px;
    margin-right: .25rem;
    vertical-align: middle;
}

.legend-swatch-overdue { background: rgba(239, 68, 68, 0.35); }
.legend-swatch-reminder { background: rgba(234, 179, 8, 0.3); }
.legend-swatch-new { background: rgba(37, 99, 235, 0.35); }
.legend-swatch-new-existing { background: #7c3aed; }
.legend-swatch-new-branch { background: #38bdf8; }
.legend-swatch-discontinued { background: rgba(75, 85, 99, 0.55); }
.legend-swatch-renewed { background: rgba(34, 197, 94, 0.25); }

.renewals-table tbody tr.renewals-row-overdue td {
    background: rgba(239, 68, 68, 0.08);
}

.renewals-table tbody tr.renewals-row-reminder td {
    background: rgba(234, 179, 8, 0.08);
}

.renewals-table tbody tr.renewals-row-new td {
    background: rgba(37, 99, 235, 0.1);
}

.renewals-table tbody tr.renewals-row-new-existing td {
    background: rgba(124, 58, 237, 0.16);
}

.renewals-table tbody tr.renewals-row-new-branch td {
    background: rgba(56, 189, 248, 0.18);
}

.renewals-table tbody tr.renewals-row-discontinued td {
    background: rgba(75, 85, 99, 0.18);
}
