/*
 * DexAlerts QA Studio
 * Standalone light-first visual system — Pass 1B
 * No external CSS framework or runtime CDN dependency.
 */

:root {
    color-scheme: light;

    --background: #f7f8fc;
    --surface: #ffffff;
    --surface-soft: #f8f9fd;

    --text: #202638;
    --muted: #70798d;
    --subtle: #929aad;

    --border: #e5e9f1;
    --border-strong: #d5dbe8;

    --primary: #6258e8;
    --primary-hover: #5146d5;
    --primary-soft: #eeecff;

    --success: #16815a;
    --success-soft: #eaf8f0;

    --danger: #b83e51;
    --danger-soft: #fff0f2;

    --radius: 12px;
    --radius-lg: 18px;

    --shadow: 0 10px 36px rgba(29, 39, 73, .045);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

:focus-visible {
    outline: 3px solid rgba(98, 88, 232, .65);
    outline-offset: 3px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -.03em;
}

h1 {
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 750;
}

h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

h3 {
    font-size: .95rem;
    font-weight: 700;
}

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

/* Shared brand */

.studio-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
}

.studio-brand:hover {
    color: var(--text);
}

.brand-icon {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.brand-copy strong {
    font-size: .95rem;
    letter-spacing: -.02em;
}

.brand-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .75rem;
}

/* Authentication */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px clamp(20px, 5vw, 60px);
}

.auth-header-note {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 550;
}

.auth-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    width: min(100% - 32px, 420px);
    margin: 20px auto 36px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 55px rgba(29, 39, 73, .065);
    overflow: hidden;
}

.auth-card-inner {
    padding: 34px 32px 28px;
}

.auth-symbol {
    display: grid;
    width: 46px;
    height: 46px;
    margin: 0 auto 22px;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 14px;
    font-size: 1.45rem;
    font-weight: 800;
}

.auth-heading {
    margin-bottom: 27px;
    text-align: center;
}

.auth-eyebrow,
.page-eyebrow,
.card-eyebrow {
    color: var(--primary);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .11em;
}

.auth-heading h1 {
    margin: 8px 0 7px;
    font-size: 1.5rem;
}

.auth-heading p {
    margin-bottom: 0;
    font-size: .86rem;
}

.form-field {
    margin-bottom: 19px;
}

.form-field label {
    display: block;
    margin-bottom: 7px;
    color: #394156;
    font-size: .83rem;
    font-weight: 650;
}

.form-field input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: .9rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-field input::placeholder {
    color: #a0a7b5;
}

.form-field input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(98, 88, 232, .12);
}

.form-field input[aria-invalid="true"] {
    border-color: var(--danger);
}

.field-help,
.field-error {
    margin: 7px 0 0;
    font-size: .78rem;
}

.field-error {
    color: var(--danger);
}

.primary-button {
    display: inline-flex;
    width: 100%;
    min-height: 45px;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
    padding: 11px 16px;
    border: 1px solid var(--primary);
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}

.primary-button:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.auth-card-footer {
    margin-top: 24px;
    padding-top: 19px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .78rem;
    text-align: center;
}

.auth-footer {
    padding: 16px;
    color: var(--subtle);
    font-size: .75rem;
    text-align: center;
}

.invitation-email {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 25px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    overflow-wrap: anywhere;
}

.invitation-email-label {
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.invitation-email strong {
    font-size: .85rem;
    font-weight: 650;
}

/* Workspace shell */

.studio-shell {
    display: grid;
    grid-template-columns: 234px minmax(0, 1fr);
    min-height: 100vh;
}

.studio-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 27px 15px 20px;
    background: #fff;
    border-right: 1px solid var(--border);
}

.studio-sidebar .studio-brand {
    margin: 0 12px 45px;
}

.sidebar-section-label {
    margin: 0 12px 12px;
    color: var(--subtle);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .11em;
}

.studio-navigation {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 34px;
}

.studio-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}

.studio-nav-item:hover,
.studio-nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.studio-nav-item.disabled {
    color: #9ba2b1;
    cursor: default;
}

.nav-icon {
    display: inline-grid;
    width: 20px;
    place-items: center;
    font-size: 1.1rem;
}

.nav-soon {
    margin-left: auto;
    color: var(--subtle);
    font-size: .65rem;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 12px 0;
    border-top: 1px solid var(--border);
}

.sidebar-footer-label {
    color: var(--subtle);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .07em;
}

.sidebar-footer p {
    margin: 6px 0 0;
    font-size: .76rem;
}

.studio-main-column {
    min-width: 0;
}

.studio-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 75px;
    padding: 16px clamp(20px, 4vw, 48px);
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-left {
    min-width: 0;
    font-size: .85rem;
}

.topbar-breadcrumb,
.topbar-separator {
    color: var(--subtle);
}

.topbar-right form {
    margin: 0;
}

.topbar-status,
.account-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    color: var(--success);
    font-size: .78rem;
    font-weight: 650;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #24a36e;
}

.logout-button {
    min-height: 36px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: .8rem;
    font-weight: 650;
    cursor: pointer;
}

.logout-button:hover {
    background: var(--surface-soft);
}

.studio-content {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 40px clamp(20px, 4vw, 48px) 60px;
}

/* Dashboard */

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.page-heading h1 {
    margin: 8px 0;
}

.page-heading p {
    margin-bottom: 0;
}

.account-badge {
    padding: 8px 12px;
    border: 1px solid #d2ecdd;
    border-radius: 999px;
    background: var(--success-soft);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.studio-card {
    min-width: 0;
    padding: 27px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.studio-card h2 {
    margin: 10px 0 12px;
}

.dashboard-intro {
    display: flex;
    flex-direction: column;
}

.dashboard-intro > p {
    max-width: 550px;
    font-size: .9rem;
}

.intro-note {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-top: auto;
    padding: 16px;
    border: 1px solid #d5ecdf;
    border-radius: 12px;
    background: var(--success-soft);
}

.intro-note-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 10px;
    background: #d1f0df;
    color: var(--success);
    font-weight: 800;
}

.intro-note strong,
.intro-note span {
    display: block;
}

.intro-note strong {
    color: var(--success);
    font-size: .85rem;
}

.intro-note div > span {
    margin-top: 2px;
    color: #507664;
    font-size: .78rem;
}

.account-details {
    margin: 16px 0 0;
}

.account-details > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.account-details > div:last-child {
    border-bottom: 0;
}

.account-details dt {
    color: var(--muted);
    font-size: .8rem;
}

.account-details dd {
    min-width: 0;
    margin: 0;
    font-size: .83rem;
    font-weight: 650;
    text-align: right;
}

.break-word {
    overflow-wrap: anywhere;
}

.slot-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .76rem;
}

.text-success {
    color: var(--success);
}

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

.soft-badge {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 650;
    white-space: nowrap;
}

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

.feature-item {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
}

.feature-icon {
    display: grid;
    width: 36px;
    height: 36px;
    margin-bottom: 17px;
    place-items: center;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 750;
}

.feature-item h3 {
    margin-bottom: 7px;
}

.feature-item p {
    margin-bottom: 0;
    font-size: .79rem;
}

.workspace-footnote {
    margin-top: 23px;
    font-size: .78rem;
    text-align: center;
}

/* Server-side feedback */

.studio-alert {
    width: 100%;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: .84rem;
}

.studio-alert.danger {
    border-color: #f0c8d0;
    background: var(--danger-soft);
    color: var(--danger);
}

.studio-alert.success {
    border-color: #c8e9d5;
    background: var(--success-soft);
    color: var(--success);
}

.studio-alert ul {
    margin: 7px 0 0;
    padding-left: 19px;
}

/* Responsive */

@media (max-width: 1120px) {
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .studio-sidebar {
        padding: 16px 20px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .studio-sidebar .studio-brand {
        margin: 0 0 15px;
    }

    .studio-sidebar .sidebar-section-label,
    .studio-sidebar .sidebar-footer,
    .studio-sidebar .studio-navigation:has(.disabled) {
        display: none;
    }

    .studio-navigation {
        margin-bottom: 0;
    }

    .studio-nav-item {
        width: fit-content;
    }

    .studio-topbar {
        min-height: 62px;
    }

    .studio-content {
        padding-top: 28px;
    }
}

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

    .page-heading {
        flex-direction: column;
    }

    .auth-header-note,
    .topbar-status {
        display: none;
    }
}

@media (max-width: 520px) {
    .auth-header {
        padding: 20px 16px;
    }

    .auth-main {
        width: min(100% - 24px, 420px);
    }

    .auth-card-inner {
        padding: 28px 21px 24px;
    }

    .studio-topbar {
        padding: 13px 16px;
    }

    .studio-content {
        padding: 23px 14px 40px;
    }

    .studio-card {
        padding: 20px;
    }

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

    .section-heading {
        flex-wrap: wrap;
    }

    .account-details > div {
        flex-wrap: wrap;
    }
}

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


/* Pass 2 — test library */

.library-filters {
    display: grid;
    grid-template-columns: 1.4fr 1fr .7fr 1.3fr auto auto;
    align-items: end;
    gap: 12px;
}

.library-filters .form-field {
    margin-bottom: 0;
}

.library-filters select,
.library-filters input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: white;
    color: var(--text);
}

.filter-button,
.filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 9px;
    font-weight: 650;
    cursor: pointer;
}

.filter-button {
    border: 0;
    background: var(--primary);
    color: white;
}

.filter-reset {
    border: 1px solid var(--border);
    background: white;
    color: var(--muted);
}

.library-count {
    margin: 26px 0 12px;
    color: var(--muted);
    font-size: .82rem;
}

.library-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.library-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.library-table th {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: .74rem;
    white-space: nowrap;
}

.library-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border);
    font-size: .83rem;
    vertical-align: top;
}

.library-table td strong,
.library-table td small {
    display: block;
}

.library-table td small {
    margin-top: 4px;
    color: var(--muted);
}

.library-table td a {
    font-weight: 750;
}

.library-empty {
    padding: 36px 12px !important;
    color: var(--muted);
    text-align: center;
}

.priority-chip {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.library-pagination {
    margin-top: 20px;
}

.library-back {
    display: inline-block;
    margin-bottom: 25px;
    font-size: .83rem;
    font-weight: 650;
}

.case-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.case-meta > div {
    min-width: 0;
}

.case-meta span,
.case-meta strong {
    display: block;
    overflow-wrap: anywhere;
}

.case-meta span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .75rem;
}

.case-meta strong {
    font-size: .84rem;
}

.case-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.case-section h2 {
    margin: 0 0 10px;
}

.case-section p {
    margin: 0;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.case-pending {
    margin-top: 24px;
    padding: 16px;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: .83rem;
}

@media (max-width: 1100px) {
    .library-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .library-filters,
    .case-meta {
        grid-template-columns: 1fr;
    }
}
