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

:root {
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --black: #0a0a0a;
    --gray-900: #171717;
    --gray-700: #404040;
    --gray-500: #737373;
    --gray-400: #a3a3a3;
    --gray-300: #d4d4d4;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --gray-50: #fafafa;
    --white: #ffffff;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #eff6ff;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --red: #dc2626;
    --green-bg: #f0fdf4;
    --green-border: #bbf7d0;
    --green-text: #166534;
    --red-bg: #fef2f2;
    --red-border: #fecaca;
    --red-text: #991b1b;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--white);
    color: var(--black);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-mark {
    width: 28px;
    height: 28px;
    background: var(--blue);
    border-radius: 8px;
}

.logo-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--black);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.topbar-banner {
    height: 88px;
    width: auto;
    display: block;
}

.topnav {
    display: flex;
    gap: 0.25rem;
}

.topnav a {
    padding: 0.45rem 0.85rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.topnav a:hover {
    color: var(--black);
    background: var(--gray-100);
}

.topnav a.active {
    color: var(--blue);
    background: var(--blue-light);
    font-weight: 600;
}

/* Content */
.content {
    padding: 2.5rem 2rem;
}

.form-wrapper {
    max-width: 640px;
}

/* Heading */
.heading {
    margin-bottom: 2rem;
}

.heading h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--black);
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.heading p {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* Home page cards */
.home-wrapper {
    max-width: 640px;
}

.card-grid {
    display: flex;
    gap: 1.25rem;
}

.card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    text-decoration: none;
    color: var(--black);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.card-icon-blue {
    background: var(--blue-light);
    color: var(--blue);
}

.card-icon-green {
    background: var(--green-light);
    color: var(--green);
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.card p {
    font-size: 0.85rem;
    color: var(--gray-500);
    line-height: 1.5;
    flex: 1;
}

.card-link {
    display: inline-block;
    margin-top: 1.25rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--blue);
    transition: gap 0.15s ease;
}

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

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert.success {
    background: var(--green-bg);
    color: var(--green-text);
    border: 1px solid var(--green-border);
}

.alert.error {
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid var(--red-border);
}

/* Tab bar */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 2rem;
}

.tab {
    position: relative;
    padding: 0.75rem 1.25rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-400);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--blue);
    font-weight: 600;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--blue);
    border-radius: 2px 2px 0 0;
}

/* Panels */
.panel {
    display: none;
}

.panel.active {
    display: flex;
    flex-direction: column;
    min-height: 28rem;
    animation: fadeUp 0.2s ease;
}

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

/* Form rows */
.row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.col.full {
    flex-basis: 100%;
}

/* Labels */
label {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--gray-700);
}

.req {
    color: var(--red);
}

/* Inputs */
input,
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--black);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--gray-400);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

input.invalid {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.06);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Panel footer */
.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-100);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.35rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--blue-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: none;
    color: var(--gray-500);
    padding: 0.6rem 0.75rem;
}

.btn-ghost:hover {
    color: var(--black);
}

/* Responsive */
@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
    }

    .content {
        padding: 1.5rem 1.25rem;
    }

    .heading h1 {
        font-size: 1.4rem;
    }

    .card-grid {
        flex-direction: column;
    }

    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 0.65rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .row {
        flex-direction: column;
        gap: 0;
        margin-bottom: 0;
    }

    .col {
        margin-bottom: 1rem;
    }
}
