:root {
    --app-header-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
}

/* Header */
.header {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(90deg, #00d9ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-auth {
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    flex-shrink: 0;
}

.nav-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-quota {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(12, 24, 42, 0.45);
    color: rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
}

.nav-quota.warn80 {
    border-color: rgba(255, 189, 89, 0.75);
    color: #ffd79a;
}

.nav-quota.warn90 {
    border-color: rgba(255, 138, 120, 0.82);
    color: #ffd0c6;
}

.nav-quota.exceeded {
    border-color: rgba(255, 116, 97, 0.9);
    color: #ffb9ad;
}

.quota-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 8, 19, 0.62);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2600;
    padding: 16px;
}

.quota-modal.active {
    display: flex;
}

.quota-card {
    width: min(560px, 100%);
    background: #0f1d33;
    color: #d9e8ff;
    border: 1px solid rgba(131, 162, 211, 0.28);
    border-radius: 12px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
}

.quota-card-head {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(131, 162, 211, 0.2);
    font-weight: 600;
}

.quota-card-body {
    padding: 14px 16px 16px;
}

.quota-meta {
    font-size: 0.86rem;
    color: #b9cef0;
    margin-bottom: 12px;
}

.quota-field {
    margin-top: 10px;
}

.quota-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: #a2bddf;
}

.quota-field input,
.quota-field textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(131, 162, 211, 0.35);
    background: rgba(255, 255, 255, 0.06);
    color: #ebf2ff;
    padding: 8px 10px;
    font-size: 0.9rem;
    outline: none;
}

.quota-field textarea {
    min-height: 90px;
    resize: vertical;
}

.quota-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.quota-btn {
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 7px 12px;
    font-size: 0.84rem;
}

.quota-btn.ghost {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(131, 162, 211, 0.35);
    color: #c8daf6;
}

.quota-btn.primary {
    background: #2c73d6;
    color: #fff;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #00d9ff;
}

/* Main container */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    min-height: calc(100vh - 140px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px;
}

.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #fff;
}

.hero p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 600px;
    margin: 0 auto;
}

/* Tools grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.tool-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.tool-card h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #fff;
}

.tool-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

.tool-card .badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(0, 217, 255, 0.2);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #00d9ff;
    margin-top: 15px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 40px 20px;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

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

/* Mobile nav drawer (≤720px) */
@media (max-width: 720px) {
    .header {
        padding: 12px 16px;
    }

    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 99;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(8, 15, 26, 0.97);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        max-height: 0;
        overflow: hidden;
        padding: 0 16px;
        transition: max-height 0.28s ease, padding-top 0.2s ease, padding-bottom 0.2s ease;
    }

    .nav.open {
        max-height: 600px;
        padding: 8px 16px 20px;
    }

    .nav .nav-link {
        display: block;
        padding: 13px 0;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        width: 100%;
    }

    .nav-auth {
        display: flex;
        flex-direction: column;
        margin-left: 0;
        padding-top: 8px;
        gap: 0;
        width: 100%;
    }

    .nav-auth .nav-link {
        border-bottom: none;
    }

    .nav-hamburger {
        display: flex;
    }
}

/* Hamburger → X when nav is open */
body.nav-open .nav-hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.nav-open .nav-hamburger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

body.nav-open .nav-hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}
