@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #ea580c;
    --danger-color: #dc2626;
    --info-color: #2563eb;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
    min-height: 100vh;
    color: var(--text-color);
    padding: 20px;
    letter-spacing: -0.011em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.login-box, .search-box, .success-box {
    max-width: 500px;
    margin: 50px auto;
    background: var(--bg-white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

h1 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h2 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.description {
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group label .help-text {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
}

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

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: rgba(37, 99, 235, 0.05);
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-text {
    font-size: 14px;
    color: var(--text-color);
    user-select: none;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    letter-spacing: -0.01em;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-color);
}

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

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger-color);
}

.alert-success {
    background: #f0fdf4;
    color: var(--success-color);
}

.create-token-section {
    background: var(--bg-white);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.inline-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.inline-form .form-group {
    margin-bottom: 0;
    flex: 1;
}

.inline-form .form-group input {
    width: 100%;
}

.token-create-form .form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.token-create-form .form-group {
    margin-bottom: 0;
}

.tokens-section {
    background: var(--bg-white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

thead {
    background: var(--bg-light);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 13px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

tr.inactive {
    opacity: 0.6;
    background: var(--bg-light);
}

tr.exhausted {
    background: #fef2f2;
}

code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d1fae5;
    color: var(--success-color);
}

.status-badge.inactive {
    background: #fee2e2;
    color: var(--danger-color);
}

.link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 12px;
}

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

.actions {
    text-align: center;
}

.action-menu {
    position: relative;
    display: inline-block;
}

.action-menu summary {
    list-style: none;
    cursor: pointer;
    padding: 6px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    transition: all 0.2s;
    user-select: none;
}

.action-menu summary:hover {
    background: var(--border-color);
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu[open] summary {
    background: var(--border-color);
}

.action-content {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    min-width: 260px;
    margin-top: 2px;
}

.action-content form {
    margin-bottom: 6px;
}

.action-content form:last-of-type {
    margin-bottom: 0;
}

.action-content .btn-small {
    width: 100%;
    justify-content: center;
}

.inline-form-small {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.inline-form-small input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
}

.submissions-details {
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.submissions-details summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 8px;
    padding: 4px 0;
    user-select: none;
    transition: color 0.2s;
}

.submissions-details summary:hover {
    color: var(--primary-hover);
}

.submissions-details summary::-webkit-details-marker {
    color: var(--primary-color);
}

.submissions-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.submission-item {
    background: var(--bg-light);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 11px;
    line-height: 1.6;
}

.submission-item div {
    margin-bottom: 4px;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 48px;
    font-weight: bold;
}

.success-message {
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
}

.success-box h1 {
    text-align: center;
}

.welcome-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.welcome-content {
    max-width: 600px;
    text-align: center;
    background: var(--bg-white);
    padding: 60px 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 25px;
    letter-spacing: -0.02em;
}

.welcome-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 35px;
}

.contact-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.welcome-actions {
    margin-top: 30px;
}

.welcome-actions .btn-large {
    max-width: 300px;
    margin: 0 auto;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
}

.token-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.modal-form {
    margin-bottom: 20px;
}

.modal-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-inline {
    display: flex;
    gap: 10px;
}

.form-inline input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.form-inline input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.submissions-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.submissions-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .inline-form {
        flex-direction: column;
    }

    .token-create-form .form-row {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 11px;
    }

    th, td {
        padding: 8px;
    }

    .action-content {
        position: fixed;
        right: 20px;
        left: 20px;
        width: auto;
    }

    .welcome-content {
        padding: 40px 30px;
    }

    .welcome-content h1 {
        font-size: 26px;
    }

    .welcome-text {
        font-size: 15px;
    }

    .modal {
        max-width: 100%;
        margin: 10px;
    }
}
