:root {
    --ink: #111827;
    --muted: #6b7280;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --soft: #eef3f8;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --teal: #0f9f9a;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
}

* {
    letter-spacing: 0;
}

html {
    min-width: 320px;
}

body {
    color: var(--ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    text-rendering: optimizeLegibility;
}

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

.app-body {
    background:
        linear-gradient(180deg, rgba(219, 234, 254, 0.82) 0, rgba(219, 234, 254, 0) 360px),
        linear-gradient(90deg, rgba(20, 184, 166, 0.07), rgba(245, 158, 11, 0.05)),
        var(--soft);
    animation: pageFadeIn 420ms ease both;
}

.auth-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(20, 184, 166, 0.10)),
        #edf2f7;
    animation: pageFadeIn 420ms ease both;
}

.app-container {
    max-width: 1180px;
}

.app-main {
    min-height: calc(100vh - 70px);
}

.app-navbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
    animation: slideDown 420ms ease both;
}

.navbar-brand {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    gap: 0.65rem;
}

.navbar-brand:hover {
    color: var(--ink);
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--ink), #334155);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
    color: #ffffff;
    display: inline-flex;
    font-size: 0.78rem;
    height: 36px;
    justify-content: center;
    width: 36px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.navbar-brand:hover .brand-mark {
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.22);
    transform: translateY(-1px) rotate(-2deg);
}

.app-navbar .nav-link {
    border-radius: 8px;
    color: #526174;
    font-weight: 700;
    margin: 0 0.15rem;
    padding: 0.62rem 0.85rem;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
    background: #eaf1ff;
    color: var(--primary);
    transform: translateY(-1px);
}

.navbar-toggler {
    border-color: #d8e0ec;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.16rem rgba(37, 99, 235, 0.16);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2817, 24, 39, 0.86%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-actions {
    align-items: center;
    display: flex;
    gap: 0.75rem;
}

.user-chip {
    align-items: center;
    background: #f8fbff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    font-size: 0.9rem;
    gap: 0.42rem;
    max-width: 260px;
    overflow: hidden;
    padding: 0.45rem 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.user-chip:hover {
    border-color: #bfdbfe;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.user-chip small {
    color: var(--primary);
    font-weight: 800;
}

.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.panel:hover {
    border-color: rgba(191, 219, 254, 0.95);
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.11);
}

.page-heading {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92)),
        #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.35rem;
    padding: clamp(1rem, 2vw, 1.35rem);
    animation: riseIn 520ms ease both;
}

.page-heading h1 {
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    font-weight: 850;
    line-height: 1.15;
}

.page-heading p {
    max-width: 620px;
}

.muted-label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.btn {
    border-radius: 8px;
    font-weight: 800;
    min-height: 40px;
    transition: box-shadow 180ms ease, transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.btn:hover,
.btn:focus {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    min-height: 34px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-dark), #1739a5);
    border-color: var(--primary-dark);
}

.btn-light,
.btn-outline-secondary,
.btn-outline-primary {
    border-color: #d8e0ec;
}

.form-label {
    color: #374151;
    font-weight: 750;
}

.form-control,
.form-select {
    background-color: #fbfdff;
    border-color: #d8e0ec;
    border-radius: 8px;
    min-height: 46px;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
    transform: translateY(-1px);
}

.form-text {
    color: #7c8798;
}

.alert {
    border-radius: 8px;
    border-width: 1px;
    animation: alertPop 260ms ease both;
}

.stat-card {
    min-height: 132px;
    overflow: hidden;
    padding: 1.05rem;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-card::after {
    background: currentColor;
    border-radius: 8px;
    content: "";
    height: 76px;
    opacity: 0.09;
    position: absolute;
    right: -22px;
    top: -22px;
    width: 76px;
    transition: opacity 180ms ease, transform 260ms ease;
}

.stat-card:hover::after {
    opacity: 0.16;
    transform: scale(1.08);
}

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

.stat-card.warning {
    color: var(--amber);
}

.stat-card.success {
    color: var(--green);
}

.stat-card.danger {
    color: var(--red);
}

.stat-icon {
    align-items: center;
    border-radius: 8px;
    color: #ffffff;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 850;
    height: 30px;
    justify-content: center;
    margin-bottom: 0.85rem;
    position: relative;
    width: 38px;
    z-index: 1;
    transition: transform 220ms ease;
}

.stat-card:hover .stat-icon {
    transform: translateY(-1px) scale(1.04);
}

.stat-card.primary .stat-icon {
    background: var(--primary);
}

.stat-card.warning .stat-icon {
    background: var(--amber);
}

.stat-card.success .stat-icon {
    background: var(--green);
}

.stat-card.danger .stat-icon {
    background: var(--red);
}

.stat-value {
    color: var(--ink);
    font-size: clamp(1.8rem, 4vw, 2.25rem);
    font-weight: 900;
    line-height: 1;
    margin-top: 0.58rem;
}

.stat-caption {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.42rem;
}

.data-panel,
.filter-panel,
.form-panel,
.detail-panel {
    overflow: hidden;
}

.panel-titlebar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin: -0.2rem -0.2rem 0.9rem;
    padding: 0.2rem 0.2rem 0.9rem;
}

.table-responsive {
    border-radius: 8px;
}

.table {
    --bs-table-hover-bg: #f8fbff;
}

.table tbody tr {
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.table tbody tr:hover {
    transform: translateX(2px);
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

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

.table td,
.table th {
    padding: 1rem 0.9rem;
    vertical-align: middle;
}

.table td {
    color: #1f2937;
}

.status-pill {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 850;
    justify-content: center;
    min-height: 28px;
    padding: 0.34rem 0.62rem;
    white-space: nowrap;
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.status-pill:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.status-pending {
    background: #fff7e6;
    color: #92400e;
}

.status-in-progress {
    background: #e6fffb;
    color: #0f766e;
}

.status-fixed {
    background: #ecfdf3;
    color: #15803d;
}

.status-rejected {
    background: #fef2f2;
    color: #b91c1c;
}

.status-not-started,
.status-not-run {
    background: #f1f5f9;
    color: #475569;
}

.status-active,
.status-passed {
    background: #ecfdf3;
    color: #15803d;
}

.status-on-hold,
.status-blocked,
.status-retest {
    background: #fff7e6;
    color: #92400e;
}

.status-completed,
.status-closed {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-cancelled,
.status-failed,
.status-reopened,
.status-skipped {
    background: #fef2f2;
    color: #b91c1c;
}

.priority-critical {
    background: #7f1d1d;
    color: #ffffff;
}

.priority-blocker {
    background: #111827;
    color: #ffffff;
}

.priority-major {
    background: #fff7e6;
    color: #92400e;
}

.priority-minor {
    background: #f0fdf4;
    color: #15803d;
}

.priority-high {
    background: #fef2f2;
    color: #b91c1c;
}

.priority-medium {
    background: #eff6ff;
    color: #1d4ed8;
}

.priority-low {
    background: #f0fdf4;
    color: #15803d;
}

.bug-screenshot {
    background: #eef2f7;
    border: 1px solid var(--line);
    max-height: 480px;
    object-fit: contain;
}

.sticky-card {
    position: sticky;
    top: 96px;
}

.auth-main {
    min-height: 100vh;
}

.auth-main > .container {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding-bottom: 1.5rem;
    padding-top: 1.5rem;
}

.auth-shell {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.16);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.82fr);
    min-height: min(680px, calc(100vh - 3rem));
    overflow: hidden;
    width: 100%;
    animation: authShellIn 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-visual {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.96), rgba(15, 159, 154, 0.9)),
        #2563eb;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(1.6rem, 4vw, 3rem);
    position: relative;
}

.auth-visual::before {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.11) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.11) 1px, transparent 1px);
    background-size: 36px 36px;
    content: "";
    inset: 0;
    opacity: 0.32;
    position: absolute;
    animation: gridDrift 18s linear infinite;
}

.auth-visual > * {
    position: relative;
    z-index: 1;
}

.auth-visual h1 {
    font-size: clamp(2.15rem, 4.4vw, 3.5rem);
    font-weight: 900;
    line-height: 1.03;
    max-width: 590px;
}

.auth-visual p {
    color: rgba(255, 255, 255, 0.86);
    font-size: 1rem;
    max-width: 520px;
}

.auth-preview {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.16);
    padding: 1rem;
    animation: riseIn 720ms ease 140ms both;
}

.preview-row {
    align-items: center;
    display: flex;
    gap: 0.8rem;
    min-width: 0;
    padding: 0.75rem 0;
}

.preview-dot {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    flex: 0 0 auto;
    height: 38px;
    width: 38px;
    animation: softPulse 2.6s ease-in-out infinite;
}

.preview-line {
    background: rgba(255, 255, 255, 0.66);
    border-radius: 8px;
    height: 10px;
    min-width: 48px;
    overflow: hidden;
    position: relative;
}

.preview-line::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    content: "";
    inset: 0;
    position: absolute;
    transform: translateX(-110%);
    animation: shimmer 2.4s ease-in-out infinite;
}

.auth-card {
    align-self: center;
    padding: clamp(1.55rem, 4vw, 2.75rem);
    animation: riseIn 620ms ease 120ms both;
}

.auth-card h2 {
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 900;
}

.auth-card hr {
    border-color: #e2e8f0;
    opacity: 1;
}

.auth-link {
    color: var(--primary);
    font-weight: 850;
    text-decoration: none;
}

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

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 520ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stat-card.reveal-on-scroll:nth-child(1),
.row > div:nth-child(1) .reveal-on-scroll {
    transition-delay: 40ms;
}

.row > div:nth-child(2) .reveal-on-scroll {
    transition-delay: 90ms;
}

.row > div:nth-child(3) .reveal-on-scroll {
    transition-delay: 140ms;
}

.row > div:nth-child(4) .reveal-on-scroll {
    transition-delay: 190ms;
}

.row > div:nth-child(5) .reveal-on-scroll {
    transition-delay: 240ms;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authShellIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes alertPop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gridDrift {
    from {
        background-position: 0 0, 0 0;
    }
    to {
        background-position: 72px 72px, 72px 72px;
    }
}

@keyframes softPulse {
    0%,
    100% {
        opacity: 0.92;
        transform: scale(1);
    }
    50% {
        opacity: 0.72;
        transform: scale(0.94);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-110%);
    }
    48%,
    100% {
        transform: translateX(110%);
    }
}

@media (max-width: 1199px) {
    .app-container {
        max-width: 100%;
    }
}

@media (max-width: 991px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-visual {
        min-height: 330px;
    }

    .navbar-collapse {
        padding-top: 0.9rem;
    }

    .nav-actions {
        align-items: stretch;
        border-top: 1px solid var(--line);
        flex-direction: column;
        margin-top: 0.8rem;
        padding-top: 0.8rem;
    }

    .user-chip {
        justify-content: space-between;
        max-width: none;
        width: 100%;
    }

    .sticky-card {
        position: static;
    }
}

@media (max-width: 767px) {
    .app-main {
        padding-bottom: 1.25rem;
        padding-top: 1.25rem !important;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading .btn {
        width: 100%;
    }

    .filter-panel .col-md-1,
    .filter-panel .col-md-2,
    .filter-panel .col-md-3 {
        width: 100%;
    }

    .data-panel .table-responsive {
        overflow: visible;
    }

    .data-panel table,
    .data-panel thead,
    .data-panel tbody,
    .data-panel th,
    .data-panel td,
    .data-panel tr {
        display: block;
    }

    .data-panel thead {
        display: none;
    }

    .data-panel tbody tr {
        background: #ffffff;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow-soft);
        margin-bottom: 0.85rem;
        padding: 0.35rem 0;
    }

    .data-panel tbody tr:hover {
        transform: translateY(-2px);
    }

    .data-panel tbody tr:last-child {
        margin-bottom: 0;
    }

    .data-panel td {
        align-items: flex-start;
        border: 0;
        display: flex;
        gap: 1rem;
        justify-content: space-between;
        padding: 0.72rem 0.9rem;
        text-align: right;
        word-break: break-word;
    }

    .data-panel td::before {
        color: #64748b;
        content: attr(data-label);
        flex: 0 0 42%;
        font-size: 0.72rem;
        font-weight: 850;
        text-align: left;
        text-transform: uppercase;
    }

    .data-panel td[colspan] {
        display: block;
        text-align: center;
    }

    .data-panel td[colspan]::before {
        content: none;
    }
}

@media (max-width: 576px) {
    .auth-main > .container {
        padding: 0;
    }

    .auth-shell {
        border: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .auth-visual {
        min-height: auto;
        padding: 1.2rem;
    }

    .auth-visual h1 {
        font-size: 1.85rem;
    }

    .auth-visual p {
        font-size: 0.94rem;
    }

    .auth-preview {
        margin-top: 1.1rem;
        padding: 0.75rem;
    }

    .preview-row {
        gap: 0.55rem;
        padding: 0.5rem 0;
    }

    .preview-dot {
        height: 30px;
        width: 30px;
    }

    .auth-card {
        padding: 1.2rem;
    }

    .panel,
    .page-heading {
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
    }

    .stat-card {
        min-height: 118px;
    }

    .form-panel,
    .detail-panel {
        padding: 1.1rem !important;
    }

    .d-flex.justify-content-end.gap-2 {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .d-flex.justify-content-end.gap-2 .btn {
        width: 100%;
    }
}

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

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
    }
}
