@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap");

:root {
    --background: #eefaf8;
    --surface: #ffffff;
    --surface-muted: #e8f7f5;
    --border: #cfe7e4;
    --text: #07172f;
    --muted: #667085;
    --brand-teal: #0d9488;
    --brand-teal-dark: #0f766e;
    --brand-teal-light: #ccfbf1;
    --brand-teal-soft: #f0fdfa;
    --primary: var(--brand-teal);
    --primary-dark: var(--brand-teal-dark);
    --navy: #07172f;
    --navy-soft: #10233f;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 22px 55px rgba(13, 148, 136, 0.12);
    --transition: 160ms ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
            radial-gradient(circle at top left, rgba(13, 148, 136, 0.18), transparent 34rem),
            linear-gradient(135deg, #f7fffd 0%, var(--background) 48%, #e4f7f4 100%),
            var(--background);
    color: var(--text);
    font-family: "Montserrat", Arial, Helvetica, sans-serif;
    overflow-x: hidden;
    animation: page-enter 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

a {
    color: inherit;
    text-decoration: none;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 420px);
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 250, 0.94)),
            var(--surface);
    box-shadow: var(--shadow);
}

.form-stack {
    display: grid;
    gap: 12px;
    margin-top: 26px;
}

label,
legend {
    font-weight: 700;
}

input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    min-width: 0;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="password"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="datetime-local"],
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    font: inherit;
    min-width: 0;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="datetime-local"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16);
    outline: none;
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.checkbox-group {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-muted) 100%);
}

.checkbox-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 600;
}

.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    overflow: hidden;
    position: relative;
    text-align: center;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.button-primary::before,
.button-secondary::before,
.button-danger::before,
.icon-action::before {
    content: "";
    position: absolute;
    inset: -35% auto -35% -60%;
    width: 50%;
    background: linear-gradient(90deg, transparent, var(--button-shine), transparent);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-120%) skewX(-21deg);
    transition: transform 560ms ease, opacity 180ms ease;
}

.button-primary:hover::before,
.button-secondary:hover::before,
.button-danger:hover::before,
.icon-action:hover::before {
    opacity: 1;
    transform: translateX(420%) skewX(-21deg);
}

.button-primary:hover,
.button-secondary:hover,
.button-danger:hover {
    transform: translateY(-1px);
}

.button-primary {
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.24);
    color: #ffffff;
    --button-shine: rgba(204, 251, 241, 0.62);
}

.button-primary:hover {
    background: linear-gradient(135deg, #0f9f93 0%, #0b6f67 100%);
    box-shadow: 0 10px 22px rgba(13, 148, 136, 0.32);
}

.button-secondary {
    padding: 10px 22px;
    border: 1px solid #c8d4e3;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.04);
    color: var(--navy);
    --button-shine: rgba(13, 148, 136, 0.18);
}

.button-secondary:hover {
    background: #ffffff;
    border-color: #9eb1c8;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.08);
}

.button-danger {
    padding: 10px 22px;
    border: 1px solid rgba(180, 35, 24, 0.30);
    background: linear-gradient(135deg, #fff7f6 0%, #fee4e2 100%);
    box-shadow: 0 5px 14px rgba(180, 35, 24, 0.08);
    color: var(--danger);
    --button-shine: rgba(180, 35, 24, 0.18);
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 2px;
    border: 0;
    border-radius: 4px;
    appearance: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: background var(--transition), color var(--transition);
    --button-shine: rgba(13, 148, 136, 0.22);
}

.icon-action:hover {
    background: rgba(13, 148, 136, 0.10);
    color: var(--primary-dark);
}

.icon-action-danger {
    color: var(--danger);
    --button-shine: rgba(180, 35, 24, 0.22);
}

.icon-action-success {
    color: var(--success);
    --button-shine: rgba(2, 122, 72, 0.22);
}

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.inline-button {
    display: inline-flex;
    margin-top: 10px;
}

.alert {
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    background: #fef3f2;
    color: var(--danger);
    line-height: 1.4;
}

.alert-success {
    background: #ecfdf3;
    color: var(--success);
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    padding: 28px;
    background:
            radial-gradient(circle at 10% 0%, rgba(204, 251, 241, 0.28), transparent 20rem),
            linear-gradient(160deg, #0f766e 0%, #115e59 52%, #07172f 100%);
    box-shadow: 14px 0 36px rgba(15, 118, 110, 0.18);
    color: #ffffff;
}

.sidebar-header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 800;
}

.brand small {
    display: block;
    margin-top: 3px;
    color: #baf2eb;
    font-size: 12px;
    font-weight: 600;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, var(--brand-teal-light) 100%);
    color: var(--brand-teal-dark);
    box-shadow: 0 10px 24px rgba(4, 47, 46, 0.24);
    font-size: 14px;
}

.menu-list {
    display: grid;
    gap: 8px;
    margin-top: 36px;
    transition: max-height 220ms ease, opacity 180ms ease;
}

.menu-list a {
    display: flex;
    align-items: center;
    padding: 13px 14px;
    border-radius: 12px;
    color: #d7fbf6;
    font-weight: 700;
    transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.menu-list a:hover,
.menu-list a.active {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 3px 0 0 var(--brand-teal-light);
    color: #ffffff;
}

.menu-list a:hover {
    transform: translateX(2px);
}

.menu-group {
    display: grid;
    gap: 4px;
}

.menu-group-label {
    padding: 8px 14px 4px;
    color: #9ae6dc;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.menu-group-label.active {
    color: #ffffff;
}

.menu-submenu {
    display: grid;
    gap: 4px;
    padding-left: 8px;
}

.menu-submenu a {
    padding: 11px 14px;
    font-size: 14px;
}

.menu-toggle-control {
    display: none;
}

.menu-toggle {
    display: none;
    padding: 9px 14px;
    border: 1px solid rgba(204, 251, 241, 0.55);
    border-radius: 999px;
    background: rgba(204, 251, 241, 0.14);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

.main-content {
    min-width: 0;
    padding: 28px;
    background:
            radial-gradient(circle at 100% 0%, rgba(13, 148, 136, 0.14), transparent 28rem),
            linear-gradient(135deg, rgba(240, 253, 250, 0.96) 0%, rgba(236, 253, 245, 0.72) 100%);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 30px rgba(13, 148, 136, 0.08);
    backdrop-filter: blur(10px);
}

.topbar > div:first-child {
    min-width: 0;
}

.topbar form {
    margin: 0;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.page-header {
    margin: 34px 0 24px;
}

.page-header h1,
.login-card h1 {
    margin: 4px 0 8px;
    color: var(--navy);
    line-height: 1.08;
}

.eyebrow {
    margin: 0;
    color: var(--brand-teal-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.role-pill {
    display: inline-flex;
    margin: 6px 0 0 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand-teal-light);
    color: var(--brand-teal-dark);
    font-size: 12px;
    font-weight: 700;
}

.status-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-active {
    background: #ecfdf3;
    color: var(--success);
}

.status-inactive {
    background: #eef4f6;
    color: var(--muted);
}

.status-deleted {
    background: #fef3f2;
    color: var(--danger);
}

.job-status-pill {
    border: 1px solid currentColor;
    background: #ffffff;
}

.empty-state,
.table-card {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.empty-state,
.table-card,
.form-card,
.topbar,
.login-card {
    animation: card-enter 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-state h2 {
    margin-top: 0;
    color: var(--navy);
}

.dashboard-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.dashboard-controls h2 {
    margin: 0 0 6px;
    color: var(--navy);
}

.dashboard-controls .muted {
    margin: 0;
}

.dashboard-filter-form {
    display: grid;
    gap: 8px;
    min-width: min(100%, 360px);
}

.dashboard-filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dashboard-filter-controls select {
    min-width: 220px;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
}

.dashboard-chart-card {
    min-width: 0;
}

.dashboard-chart-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.dashboard-chart-header h2 {
    margin: 5px 0 0;
    color: var(--navy);
}

.dashboard-total {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-teal-light);
    color: var(--brand-teal-dark);
    font-size: 14px;
}

.dashboard-empty-message {
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 600;
}

.dashboard-chart {
    display: grid;
    grid-auto-columns: minmax(52px, 1fr);
    grid-auto-flow: column;
    gap: 12px;
    align-items: end;
    min-height: 250px;
    overflow-x: auto;
    padding-top: 10px;
}

.dashboard-chart-empty {
    opacity: 0.72;
}

.dashboard-bar {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    align-items: end;
    min-width: 52px;
    min-height: 232px;
    text-align: center;
}

.dashboard-bar-value {
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
}

.dashboard-bar-track {
    display: flex;
    align-items: end;
    width: 100%;
    min-height: 170px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, var(--brand-teal-soft) 0%, #ffffff 100%);
    overflow: hidden;
}

.dashboard-bar-fill {
    width: 100%;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
    box-shadow: 0 -8px 18px rgba(13, 148, 136, 0.16);
}

.dashboard-bar-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 22px;
    align-items: start;
    min-width: 0;
}

.wide-grid {
    grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
}

.stacked-content {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.lookup-help {
    margin: -4px 0 4px;
    color: var(--muted);
    font-size: 13px;
}

.readonly-field {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--brand-teal-soft);
    font: inherit;
    font-weight: 700;
    min-height: 46px;
    width: 100%;
}

.form-card {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
    gap: 12px 18px;
    margin: 20px 0 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 800;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.form-card h2,
.table-card h2 {
    margin: 0 0 10px;
}

.table-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.table-card-header h2 {
    margin: 0;
}

.table-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.listing-search-form {
    margin: 0;
}

.listing-search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.listing-search-controls input[type="search"] {
    flex: 0 1 300px;
    width: 300px;
}

.listing-search-controls .button-primary,
.listing-search-controls .button-secondary {
    flex: 0 0 auto;
}

.optional-phone-input::placeholder {
    font-style: italic;
    color: rgba(15, 23, 42, 0.45);
}

.narrow-form {
    width: min(100%, 920px);
    max-width: 920px;
    margin: 0 auto 40px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 16px 18px;
}

.form-sections {
    display: grid;
    gap: 24px;
}

.job-form-section {
    display: grid;
    gap: 14px;
}

.job-form-section-assignment .field {
    grid-template-rows: auto auto minmax(18px, auto);
}

.job-form-section-assignment .field:not(:has(.lookup-help))::after {
    content: "";
    min-height: 18px;
}

.job-form-section legend,
.job-detail-section h3 {
    margin: 0;
    color: var(--navy);
    font-size: 18px;
    font-weight: 800;
}

.detail-card {
    display: grid;
    gap: 20px;
}

.job-detail-section {
    display: grid;
    gap: 14px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 16px 18px;
}

.detail-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

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

.detail-label {
    color: var(--muted);
    font-weight: 800;
}

.detail-value {
    overflow-wrap: anywhere;
}

.assignment-email-status,
.retry-email-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.retry-email-form {
    margin: 0;
}

.section-heading-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.section-heading-row h2,
.section-heading-row h3 {
    margin: 0;
}

.email-type-picker {
    display: grid;
    gap: 20px;
}

.email-type-grid,
.email-type-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.email-type-card,
.email-type-summary-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(15, 42, 74, 0.12);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.email-type-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.email-type-card-header h3,
.email-type-summary-card h4 {
    margin: 0;
    color: var(--navy);
}

.email-type-card-status,
.email-type-summary-status {
    margin: 0;
}

.email-type-send-form {
    margin: 0;
}

.email-type-ready {
    background: rgba(22, 101, 52, 0.12);
    color: #166534;
}

.email-type-waiting {
    background: rgba(146, 64, 14, 0.12);
    color: #92400e;
}

.retry-assignment-email {
    border-color: rgba(180, 35, 24, 0.24);
    background: linear-gradient(135deg, #fff7f6 0%, #fef3f2 100%);
    box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.24);
    color: var(--danger);
    animation: retry-email-pulse 1.8s ease-in-out infinite;
}

.retry-assignment-email:hover {
    border-color: rgba(180, 35, 24, 0.42);
    box-shadow: 0 8px 18px rgba(180, 35, 24, 0.16);
}

@keyframes retry-email-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.24);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(180, 35, 24, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(180, 35, 24, 0);
    }
}

.field {
    display: grid;
    gap: 8px;
}

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

.button-row,
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.button-row {
    gap: 14px;
}

.actions-cell {
    gap: 4px;
}

.actions-cell form {
    margin: 0;
}

.pagination-bar,
.pagination-controls,
.page-size-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.pagination-bar {
    justify-content: space-between;
    margin: 14px 0;
}

.pagination-controls {
    justify-content: flex-end;
    margin-top: 16px;
}

.page-size-form select {
    width: auto;
    min-width: 86px;
}

.pagination-info {
    color: var(--muted);
    font-size: 14px;
}

.disabled {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}

.table-card {
    overflow-x: auto;
    max-width: 100%;
}

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

.listing-shell .listing-desktop table {
    min-width: 0;
    table-layout: auto;
}

.listing-shell .listing-desktop th:not(:last-child),
.listing-shell .listing-desktop td:not(.actions-cell) {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.listing-shell .listing-desktop th:last-child,
.listing-shell .listing-desktop td.actions-cell {
    width: 1%;
    min-width: 6.5rem;
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
}

.listing-shell .listing-desktop td.actions-cell {
    display: table-cell;
}

.listing-shell.listing-multi-action .listing-desktop th:last-child,
.listing-shell.listing-multi-action .listing-desktop td.actions-cell {
    min-width: 9rem;
}

.listing-shell .listing-desktop td.actions-cell form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
}

.listing-shell .listing-desktop td.actions-cell .actions-cell-tools {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    width: max-content;
    max-width: 100%;
}

.listing-shell.listing-three-col .listing-desktop table {
    table-layout: fixed;
}

@media (min-width: 761px) {
    .listing-shell.listing-three-col .listing-desktop th:last-child,
    .listing-shell.listing-three-col .listing-desktop td.actions-cell {
        width: 6.5rem;
        min-width: 6.5rem;
        max-width: 6.5rem;
    }
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

th {
    color: var(--brand-teal-dark);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sort-link {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

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

.sort-arrow {
    width: 0;
    height: 0;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

.sort-arrow-asc {
    border-bottom: 6px solid currentColor;
}

.sort-arrow-desc {
    border-top: 6px solid currentColor;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: rgba(204, 251, 241, 0.22);
}

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

.listing-desktop {
    display: block;
}

.listing-mobile {
    display: none;
}

.listing-mobile-toolbar {
    display: none;
}

.listing-item-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
}

.listing-item-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.listing-item-title {
    color: var(--navy);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.listing-item-title:hover {
    color: var(--primary);
}

.listing-item-fields {
    display: grid;
    gap: 10px;
    margin: 0;
}

.listing-item-field {
    display: grid;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: start;
}

.listing-item-field dt {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.listing-item-field dd {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.listing-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.listing-item-actions > a.listing-action-btn,
.listing-item-actions > form {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
    margin: 0;
}

.listing-item-actions > form {
    display: flex;
}

.listing-item-actions > :last-child:nth-child(odd) {
    flex: 1 1 100%;
    min-width: 100%;
}

.listing-action-btn {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
}

.listing-action-btn .icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.listing-action-btn-danger {
    border-color: rgba(180, 35, 24, 0.30);
    background: linear-gradient(135deg, #fff7f6 0%, #fee4e2 100%);
    color: var(--danger);
}

.listing-action-btn-success {
    border-color: rgba(2, 122, 72, 0.24);
    background: linear-gradient(135deg, #f6fef9 0%, #ecfdf3 100%);
    color: var(--success);
}

.listing-empty-message {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
}

.listing-options-panel {
    width: 100%;
}

.listing-options-summary {
    display: none;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--navy);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    list-style: none;
}

.listing-options-summary::-webkit-details-marker {
    display: none;
}

.listing-mobile-sort {
    display: none;
    gap: 10px;
    align-items: center;
}

.listing-mobile-sort label {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.listing-sort-select {
    flex: 1 1 auto;
    min-width: 0;
}

.listing-sort-direction {
    flex: 0 0 auto;
    min-width: 58px;
    padding-inline: 12px;
}

.listing-pagination-status {
    flex: 1 1 auto;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        min-height: auto;
        padding: 18px 22px;
    }

    .sidebar-header {
        align-items: center;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .menu-list {
        max-height: 0;
        margin-top: 0;
        opacity: 0;
        overflow: hidden;
    }

    .menu-toggle-control:checked + .menu-list {
        max-height: 520px;
        margin-top: 18px;
        opacity: 1;
    }

    .main-content {
        padding: 22px;
    }

    .admin-grid,
    .wide-grid {
        grid-template-columns: 1fr;
    }

    .search-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .listing-shell .table-card-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .listing-shell .table-card-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
    }

    .listing-shell .listing-search-controls {
        width: 100%;
    }

    .listing-shell .listing-search-controls input[type="search"] {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .listing-shell .table-card-actions .button-primary {
        width: 100%;
    }

    .listing-shell .pagination-bar {
        align-items: stretch;
        flex-wrap: wrap;
        gap: 12px;
    }

    .listing-shell .listing-desktop th,
    .listing-shell .listing-desktop td {
        padding: 12px 10px;
        font-size: 13px;
    }

}

@media (max-width: 760px) {
    .sidebar {
        padding: 18px;
    }

    .main-content {
        padding: 16px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .topbar-actions,
    .topbar-actions .button-secondary,
    .topbar-actions form,
    .topbar-actions button {
        width: 100%;
    }

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

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

    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .form-card,
    .table-card,
    .empty-state,
    .login-card {
        padding: 18px;
        border-radius: 18px;
    }

    .page-header {
        margin: 24px 0 18px;
    }

    .page-header h1,
    .login-card h1 {
        font-size: 28px;
    }

    .pagination-bar,
    .pagination-controls,
    .dashboard-controls,
    .dashboard-filter-controls,
    .dashboard-chart-header,
    .table-card-actions,
    .listing-search-controls,
    .button-row,
    .actions-cell {
        align-items: stretch;
        flex-direction: column;
    }

    .listing-search-controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
    }

    .listing-search-controls input[type="search"] {
        flex: 1 1 140px;
        width: auto;
        min-width: 0;
    }

    .listing-mobile-toolbar {
        display: block;
        margin-bottom: 14px;
    }

    .listing-mobile-sort {
        display: flex;
        flex-wrap: wrap;
    }

    .listing-desktop {
        display: none;
    }

    .listing-mobile {
        display: grid;
        gap: 12px;
    }

    .listing-options-summary {
        display: block;
    }

    .listing-options-panel:not([open]) .page-size-form {
        display: none;
    }

    .listing-options-panel[open] .page-size-form,
    .listing-options-panel .page-size-form {
        margin-top: 10px;
    }

    .listing-pagination-controls {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex-direction: row;
        align-items: center;
        margin: 16px -18px -18px;
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(8px);
    }

    .listing-pagination-controls .button-secondary {
        flex: 1 1 0;
        width: auto;
        min-height: 44px;
    }

    .pagination-controls .button-secondary,
    .dashboard-filter-controls select,
    .dashboard-filter-controls .button-primary,
    .table-card-actions,
    .listing-search-controls .button-primary,
    .listing-search-controls .button-secondary,
    .button-row .button-primary,
    .button-row .button-secondary,
    .actions-cell .button-secondary,
    .actions-cell .button-danger,
    .actions-cell form,
    .actions-cell button {
        width: 100%;
    }

}

@media (min-width: 761px) {
    .listing-options-panel .page-size-form {
        display: flex;
    }
}

@media (max-width: 420px) {
    .brand {
        gap: 10px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .brand small {
        display: none;
    }

    .menu-toggle {
        padding: 8px 12px;
    }
}
