/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #dc2626;
    --primary-dark: #b91c1c;
    --secondary-color: #ef4444;
    --accent-color: #f87171;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-dark: #0a0a0a;
    --border-color: #e5e7eb;
    --gradient: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo img {
    height: 80px;
    width: auto;
    transition: all 0.3s ease;
}

.logo:hover img {
    opacity: 0.8;
    transform: scale(1.02);
}

.ampersand {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient);
    transition: width 0.3s ease;
}

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

.nav-link:hover::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 5rem;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 0;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.hero-cta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1.125rem;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.hero .btn-secondary {
    color: #fff;
    border-color: #fff;
}

.hero .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    border-color: #fff;
}

.hero-background {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    z-index: 1;
    overflow: hidden;
}

.hero-bg-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    opacity: 0.25;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    top: 50%;
    right: 10%;
    animation-delay: 5s;
    opacity: 0.25;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: var(--accent-color);
    bottom: 10%;
    left: 50%;
    animation-delay: 10s;
    opacity: 0.25;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-30px, 30px) scale(0.9);
    }
}

/* Section Styles */
section {
    padding: 6rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Services Section */
.services {
    background: var(--bg-secondary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.service-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.service-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
}

.service-icon svg {
    width: 28px;
    height: 28px;
}

.service-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.service-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Portfolio Section */
.portfolio {
    background: white;
    position: relative;
}

.portfolio-slider {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
}

.slider-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    transition: height 0.35s ease;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.slide.active {
    opacity: 1;
    pointer-events: auto;
}

.slide-content {
    display: grid;
    height: 100%;
    width: 100%;
    background: white;
    position: relative;
    align-items: stretch;
}

/* Default portfolio layout: stacked (image on top, text below) – no JS class required */
.portfolio-slider .slider-wrapper {
    height: 620px;
}

.portfolio-slider .slide-content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
}

.portfolio-slider .slide-content-link {
    grid-row: 1 / -1;
    grid-column: 1;
}

.portfolio-slider .slide-image {
    grid-row: 1;
    grid-column: 1;
    min-height: 0;
}

.portfolio-slider .slide-info {
    grid-row: 2;
    grid-column: 1;
    padding: 1.5rem 2rem 2rem;
    justify-content: flex-start;
}

.portfolio-slider .slide-image img {
    object-fit: contain;
}

/* App only: side-by-side layout (override default stacked) */
.portfolio-slider.portfolio-slider--app .slider-wrapper {
    height: 660px;
}

.portfolio-slider.portfolio-slider--app .slide-content {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.portfolio-slider.portfolio-slider--app .slide-content-link {
    grid-row: 1;
    grid-column: 1 / -1;
}

.portfolio-slider.portfolio-slider--app .slide-image {
    grid-row: 1;
    grid-column: 1;
}

.portfolio-slider.portfolio-slider--app .slide-info {
    grid-row: 1;
    grid-column: 2;
    padding: 3rem;
    justify-content: center;
}

.portfolio-slider.portfolio-slider--app .slide-image img {
    object-fit: contain;
}

@media (max-width: 768px) {
    /* On mobile, stack app slides (image on top, text below) */
    .portfolio-slider.portfolio-slider--app .slide-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    .portfolio-slider.portfolio-slider--app .slide-image {
        grid-row: 1;
        grid-column: 1;
    }
    .portfolio-slider.portfolio-slider--app .slide-info {
        grid-row: 2;
        grid-column: 1;
        padding: 1.5rem 2rem 2rem;
    }
}

.slide-content-link {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.slide-image {
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Website: square/landscape — fill the box (default) */
.slide-image--website img {
    object-fit: cover;
}

/* App: portrait phone screenshot — show full image (1125×2436 etc), no crop */
.slide-image--app {
    max-width: 260px;
    width: 100%;
    margin: 0 auto;
    aspect-ratio: 9 / 19.5;
    max-height: 100%;
}

.slide-image--app img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    transition: transform 0.3s ease;
}

.placeholder-text {
    position: absolute;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-align: center;
    z-index: 1;
}

.placeholder-gradient-1 {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.placeholder-gradient-2 {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.placeholder-gradient-3 {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}

.slide:hover .slide-image img {
    transform: scale(1.05);
}

.slide-info {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.slide-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.slide-info p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.slide-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: var(--primary-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.slider-btn:hover {
    background: white;
    box-shadow: var(--shadow-lg);
    transform: translateY(-50%) scale(1.1);
}

.slider-btn svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.slider-btn.prev {
    left: 1rem;
}

.slider-btn.next {
    right: 1rem;
}

.slider-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* About Section */
.about {
    background: var(--bg-secondary);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-text h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.about-text p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Contact Section */
.contact {
    background: var(--bg-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

.contact-form {
    background: white;
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.contact-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.contact-item p {
    color: var(--text-secondary);
}

.contact-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: var(--primary-dark);
}

/* Footer */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: 3rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.footer-logo .logo {
    color: white;
    display: inline-flex;
}

.footer-logo .logo img {
    height: 48px;
    width: auto;
    opacity: 0.95;
    filter: brightness(0) invert(1);
}

.footer-logo .logo:hover img {
    opacity: 1;
}

.footer-logo .footer-tagline {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin: 0;
}

.footer-copyright p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.footer * {
    color: #ffffff !important;
}

.footer a {
    color: #ffffff !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1rem;
        box-shadow: var(--shadow-lg);
        display: none;
    }

    .nav-menu.active {
        display: flex;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .section-title {
        font-size: 2rem;
    }

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

    .service-card {
        padding: 2rem 1.5rem;
    }

    .slider-wrapper {
        height: 600px;
    }

    .portfolio-slider.portfolio-slider--app .slider-wrapper {
        height: 720px;
    }

    .slide-info {
        padding: 2rem;
    }

    .slide-info h3 {
        font-size: 1.5rem;
    }

    .slide-info p {
        font-size: 1rem;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    /* Stack portfolio image above description only on small phones */
    .slide-content {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .contact-form {
        padding: 2rem 1.5rem;
    }
}

/* Ava Chatbot Widget */
#ava-chat-widget {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 9999;
    font-family: inherit;
}

#ava-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#ava-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 20px -5px rgba(220, 38, 38, 0.4);
}

#ava-chat-toggle .ava-toggle-img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
}

.ava-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#ava-chat-header .ava-header-img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
}

#ava-chat-window {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 640px) {
    #ava-chat-widget {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
    }
    #ava-chat-window {
        left: 0;
        right: 0;
        width: auto;
        max-width: 100%;
        bottom: 70px;
        max-height: calc(100vh - 110px);
    }
    #ava-chat-input {
        font-size: 16px;
    }
}

#ava-chat-widget.open #ava-chat-window {
    display: flex;
}

#ava-chat-header {
    background: var(--gradient);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

#ava-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}

#ava-chat-close:hover {
    opacity: 0.9;
}

#ava-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ava-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ava-msg.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
}

.ava-msg.assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

#ava-chat-input-wrap {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

#ava-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

#ava-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#ava-chat-send {
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

#ava-chat-send:hover {
    background: var(--primary-dark);
}

#ava-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ava-request-wrap {
    display: none;
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border-color);
}
.ava-request-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.ava-request-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}
.ava-request-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   App shell — dashboard + folder library
   -------------------------------------------------------------------------- */
body.app-shell {
    background: #f4f4f5;
    min-height: 100vh;
}

.app-frame {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #18181b;
    color: #fafafa;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
}

.app-sidebar-brand {
    font-weight: 700;
    font-size: 1rem;
    padding: 0 1.25rem 1.5rem;
    letter-spacing: -0.02em;
}

.app-sidebar-nav {
    flex: 1;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1.25rem;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.app-sidebar-link:hover {
    color: #fafafa;
    background: rgba(255, 255, 255, 0.06);
}

.app-sidebar-link.is-active {
    color: #fafafa;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: var(--primary-color);
}

.app-sidebar-icon {
    opacity: 0.85;
    font-size: 1rem;
}

.app-sidebar-footer {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-muted {
    font-size: 0.8rem;
    color: #71717a;
    text-decoration: none;
}

.app-sidebar-muted:hover {
    color: #e4e4e7;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.75rem;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.app-header-org {
    font-weight: 600;
    color: var(--text-primary);
}

.app-header-user {
    color: var(--text-secondary);
}

.app-content {
    flex: 1;
    padding: 1.75rem 2rem 3rem;
    max-width: 1100px;
}

.app-page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.app-page-title-tight h1 {
    margin-bottom: 0.25rem;
}

.app-page-sub {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.app-breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.app-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.app-breadcrumb a:hover {
    text-decoration: underline;
}

.app-bc-sep {
    margin: 0 0.35rem;
    color: var(--text-light);
}

.app-alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.app-alert-error {
    background: #fef2f2;
    color: #b91c1c;
}

.app-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
}

.app-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.app-card-form .app-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.app-input {
    flex: 1;
    min-width: 200px;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.app-btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
}

.app-btn-primary {
    background: var(--gradient);
    color: #fff;
}

.app-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.app-form-group {
    margin-bottom: 1.1rem;
}

.app-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.app-hint {
    display: block;
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.app-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    background: #fff;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.app-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.app-folder-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.25rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.app-folder-tile:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.app-folder-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.app-folder-name {
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
}

.app-table-wrap {
    overflow-x: auto;
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.app-table th,
.app-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.app-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.app-actions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Upload processing overlay (GIF-like animation + step text) */
.cad-upload-process-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
}

.cad-upload-process-overlay[hidden] {
    display: none !important;
}

.cad-upload-process-panel {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 2.25rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.cad-process-visual {
    margin-bottom: 1.25rem;
}

.cad-process-filmstrip {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #e4e4e7;
    margin-bottom: 1.25rem;
    position: relative;
}

.cad-process-filmstrip::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 999px;
    background: var(--gradient);
    animation: cad-process-film 1.4s ease-in-out infinite;
}

@keyframes cad-process-film {
    0% {
        left: -15%;
    }
    100% {
        left: 75%;
    }
}

.cad-process-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 3px solid #e4e4e7;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: cad-process-spin 0.85s linear infinite;
}

@keyframes cad-process-spin {
    to {
        transform: rotate(360deg);
    }
}

.cad-upload-process-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.cad-upload-process-step {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 0.75rem;
    min-height: 1.5em;
    transition: opacity 0.2s ease;
}

.cad-upload-process-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

.cad-upload-process-panel--batch {
    max-width: min(520px, 96vw);
    text-align: left;
}

.cad-upload-batch-summary {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 1rem;
    line-height: 1.45;
    word-break: break-word;
}

.cad-upload-progress-track {
    height: 8px;
    border-radius: 999px;
    background: #e4e4e7;
    overflow: hidden;
    margin-bottom: 0.65rem;
}

.cad-upload-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--gradient);
    transition: width 0.25s ease;
}

.cad-upload-eta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.85rem;
    min-height: 1.25em;
}

.cad-upload-file-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    max-height: min(42vh, 300px);
    overflow-y: auto;
}

.cad-upload-file-row {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.2rem 0.5rem;
    align-items: start;
    font-size: 0.85rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}

.cad-upload-file-row:last-child {
    border-bottom: none;
}

.cad-upload-file-name {
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

.cad-upload-file-phase {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding-left: 1.75rem;
}

.cad-upload-file-row--error .cad-upload-file-phase {
    color: #b91c1c;
}

.cad-upload-file-row--done .cad-upload-file-status {
    color: #15803d;
}

.cad-upload-file-row--working .cad-upload-file-status {
    color: var(--primary-color);
}

/* Review modal (confirm title block before save) */
.cad-review-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(6px);
}

.cad-review-panel {
    background: #fff;
    border-radius: 16px;
    max-width: 1220px;
    width: 100%;
    margin: 2rem auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    padding: 1.5rem 1.75rem 2rem;
}

.cad-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.cad-review-head h2 {
    margin: 0;
    font-size: 1.25rem;
    flex: 1 1 auto;
}

.cad-review-progress {
    width: 100%;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cad-review-cancel {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.cad-review-cancel:hover {
    color: var(--primary-color);
}

.cad-review-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.cad-review-right .app-form-group .app-input,
.cad-review-right .app-form-group textarea.app-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.cad-review-flash {
    margin-bottom: 1rem;
}

.cad-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.25rem;
}

.cad-review-left {
    min-width: 0;
}

.cad-review-right {
    position: sticky;
    top: 1rem;
    align-self: start;
}

@media (max-width: 900px) {
    .cad-review-grid {
        grid-template-columns: 1fr;
    }
    .cad-review-right {
        position: static;
    }
}

.cad-review-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
}

.cad-review-crop-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0 0 0.75rem;
}

.cad-review-pan-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    align-items: center;
}

.cad-pz-readout {
    display: inline-block;
    min-width: 3.5rem;
    padding: 0.35rem 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.cad-pan-btn {
    min-width: 2.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.cad-pan-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cad-review-viewport {
    position: relative;
    width: 100%;
    height: min(58vh, 580px);
    min-height: 280px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    touch-action: none;
    cursor: grab;
    outline: none;
}

.cad-review-viewport:focus-visible {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.cad-review-viewport--dragging {
    cursor: grabbing;
}

.cad-review-zoomlayer {
    flex: 0 0 auto;
    transform-origin: center center;
    will-change: transform;
}

.cad-review-thumb-img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: min(58vh, 580px);
    object-fit: contain;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
}

.cad-review-pan-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0.6rem 0 0;
}

.cad-save-btn--busy {
    position: relative;
    padding-right: 2.35rem;
}

.cad-save-btn--busy::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 0.95rem;
    height: 0.95rem;
    margin-top: -0.475rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cad-spin-save 0.65s linear infinite;
}

@keyframes cad-spin-save {
    to {
        transform: rotate(360deg);
    }
}

.cad-detail-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
    gap: 1.5rem;
    align-items: start;
}

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

.cad-detail-thumb {
    width: 100%;
    max-width: 480px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cad-detail-dl {
    margin: 0;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.95rem;
}

.cad-detail-dl dt {
    color: var(--text-secondary);
    font-weight: 600;
    margin: 0;
}

.cad-detail-meta .app-form-group .app-input,
.cad-detail-meta .app-form-group textarea.app-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.cad-detail-dl dd {
    margin: 0;
}

.app-table-drawings .cad-col-thumb {
    width: 88px;
}

.cad-row-thumb {
    display: block;
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.cad-row-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-light);
}

.cad-col-actions {
    white-space: nowrap;
}

.cad-row-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    margin-right: 0.65rem;
}

.cad-row-link:hover {
    text-decoration: underline;
}

.cad-row-muted {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-right: 0.65rem;
}

body.cad-review-open {
    overflow: hidden;
}

