:root {
    --background: #fafafa;
    --card: #ffffff;
    --card-foreground: #09090b;
    --primary: #18181b;
    --primary-hover: #27272a;
    --primary-foreground: #fafafa;
    --secondary: #ffffff;
    --secondary-hover: #f4f4f5;
    --muted: #71717a;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #18181b;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Prompt', 'Inter', -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--card-foreground);
    padding: 40px 20px;
    max-width: 880px;
    margin: auto;
    -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
    font-size: 20px;
    vertical-align: middle;
    user-select: none;
}

.header {
    margin-bottom: 28px;
    text-align: left;
}

.header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--card-foreground);
}

.header p {
    font-size: 0.875rem;
    color: var(--muted);
    margin-top: 4px;
}

.section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
}

.section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--card-foreground);
    margin-bottom: 18px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section h3 .material-symbols-outlined {
    font-size: 20px;
    color: var(--muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.full-width {
    grid-column: 1 / -1;
}

.inline-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.inline-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-group.grow {
    flex: 1;
    min-width: 280px;
}

.inline-group label {
    white-space: nowrap;
    margin-bottom: 0;
}

label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3f3f46;
}

input[type="text"],
input[type="date"],
select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background-color: var(--card);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--card-foreground);
    transition: all 0.15s ease-in-out;
    outline: none;
    width: 100%;
}

#grantorAlienId {
    letter-spacing: 2px;
    font-family: monospace, 'Prompt', sans-serif;
    font-weight: 600;
}

input[type="file"] {
    height: 40px;
    padding: 4px 8px;
    border: 1px dashed var(--input);
    border-radius: var(--radius);
    background-color: #fafafa;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--muted);
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
}

input[type="file"]::file-selector-button {
    padding: 4px 10px;
    margin-right: 10px;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border);
    background-color: #ffffff;
    color: var(--card-foreground);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
    background-color: #f4f4f5;
}

input[type="date"] {
    cursor: pointer;
}

input:focus,
select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.08);
}

input::placeholder {
    color: #a1a1aa;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--card-foreground);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

button:active {
    transform: scale(0.995);
}

.loading-status {
    text-align: center;
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 12px;
    display: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    width: 100%;
    max-width: 900px;
    height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--card-foreground);
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    margin: 0;
    box-shadow: none;
}

.modal-close-btn:hover {
    background-color: #f4f4f5;
    color: var(--card-foreground);
}

.modal-body {
    flex: 1;
    padding: 0;
    background-color: #525659;
    position: relative;
}

.pdf-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 600px) {
    .button-group {
        grid-template-columns: 1fr;
    }

    .modal-container {
        height: 95vh;
        padding: 0;
    }
}