* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

.app {
    min-height: 100vh;
    width: 100%;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #1e1e2d;
    display: flex;
    flex-direction: column;
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #2d2d3f;
}

.logo-small {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-header span {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: #a0a0b3;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #2d2d3f;
    color: white;
}

.nav-item.active {
    background: #667eea;
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #2d2d3f;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #2d2d3f;
    border-radius: 8px;
}

.admin-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.admin-info span {
    font-size: 14px;
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #a0a0b3;
    border: 1px solid #2d2d3f;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.main-content {
    flex: 1;
    background: #f0f2f5;
    padding: 30px;
    overflow-y: auto;
    margin-left: 260px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stat-icon.users {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.stat-icon.favorites {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.stat-icon.credits {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.stat-icon.signin {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.stat-content .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-content .stat-label {
    color: #666;
    font-size: 14px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.search-box svg {
    color: #999;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 14px;
    min-width: 250px;
}

.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: #f8f9fa;
}

.users-table th,
.users-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.users-table th {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.users-table td {
    color: #555;
    font-size: 14px;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.admin {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.badge.user {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.badge.active {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.badge.banned {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.badge.success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.badge.error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.action-btn.edit {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.action-btn.edit:hover {
    background: #667eea;
    color: white;
}

.action-btn.delete {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.action-btn.delete:hover {
    background: #e74c3c;
    color: white;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .page-info {
    color: #666;
    font-size: 14px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: #999 transparent;
    max-height: calc(90vh - 130px);
}

.modal-scroll-wrapper::-webkit-scrollbar {
    width: 10px;
}

.modal-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.modal-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #666;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 20px;
    color: #333;
    text-align: center;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    min-height: 0;
}

.modal-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px;
}

.modal-pagination button {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.modal-pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.modal-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-pagination .page-info {
    color: #666;
    font-size: 12px;
}

.user-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.user-info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.user-info-item label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-align: left;
}

.user-info-item input,
.user-info-item select,
.user-info-item textarea {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    text-align: left;
    font-family: inherit;
    resize: vertical;
    min-height: 38px;
}

.user-info-item input:focus,
.user-info-item select:focus,
.user-info-item textarea:focus {
    outline: none;
    border-color: #667eea;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    margin-top: 24px;
    text-align: left;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.records-table th,
.records-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.records-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid #e0e0e0;
}

.btn-secondary {
    padding: 10px 24px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.btn-primary {
    padding: 10px 24px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.btn-danger {
    padding: 10px 24px;
    border: 1px solid #e74c3c;
    background: white;
    color: #e74c3c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #e74c3c;
    color: white;
}

.announcement-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.announcement-form .form-group {
    margin-bottom: 16px;
}

.announcement-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.announcement-form .form-group input,
.announcement-form .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.announcement-form .form-group input:focus,
.announcement-form .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.announcement-list {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.announcement-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s;
}

.announcement-item.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.announcement-item:last-child {
    margin-bottom: 0;
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.announcement-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #667eea;
    color: white;
}

.announcement-date {
    font-size: 12px;
    color: #999;
}

.announcement-content {
    color: #555;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.announcement-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.generate-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    justify-content: center;
    flex-wrap: wrap;
}

.generate-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.generate-form .form-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.generate-form .form-group input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 140px;
    text-align: center;
}

.generate-form .form-group input[type="number"]::-webkit-inner-spin-button,
.generate-form .form-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.generate-form .form-group input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.generate-form .form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.buy-link-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    justify-content: center;
    flex-wrap: wrap;
}

.buy-link-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.buy-link-form .form-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.buy-link-form .form-group input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 280px;
    text-align: left;
}

.buy-link-form .form-group input:focus {
    outline: none;
    border-color: #2ecc71;
}

.buy-link-form .form-buttons {
    display: flex;
    gap: 8px;
}

#buyLinkStatus {
    font-size: 12px;
    min-height: 16px;
}

.generated-codes {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.generated-codes .section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 16px 0;
}

.generated-codes .section-title span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.code-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.code-item .code-text {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
}

.code-item .code-credits {
    font-size: 12px;
    color: #666;
}

.copy-btn {
    padding: 4px 10px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: #5a6fd6;
}

.users-table code {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.chart-container {
    margin-top: 24px;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.chart-days {
    display: flex;
    gap: 8px;
}

.day-btn {
    padding: 6px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    color: #666;
}

.day-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.day-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.chart-body {
    width: 100%;
    position: relative;
}

.code-remark {
    font-size: 12px;
    color: #666;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.copy-btn.copied {
    background: #2ecc71 !important;
}

.code-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.token-usage-section {
    margin-top: 24px;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.token-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.token-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.token-progress-container {
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;
}

.token-percent-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
}

.token-percent {
    font-size: 32px;
    font-weight: 700;
    color: #7c3aed;
}

.token-remaining-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.progress-track {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-scale {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7 0%, #7c3aed 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.token-usage-text {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
}

.token-used {
    font-weight: 600;
    color: #333;
}

.token-divider {
    color: #999;
}

.token-total {
    color: #666;
}

.token-note {
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.note-content {
    font-size: 14px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    text-align: right;
}

.note-content:hover {
    background-color: #f0f0f0;
}

.note-content.editing {
    background-color: #fff;
    outline: none;
    min-width: 200px;
}

.note-input {
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
    padding: 0;
    margin: 0;
    min-width: 200px;
}

.token-calibration {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.calibration-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.calibration-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.calibration-row input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 160px;
}

.calibration-row input:focus {
    outline: none;
    border-color: #7c3aed;
}

.calibration-row button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.calibration-row button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

#calibrationStatus {
    font-size: 13px;
    color: #666;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.api-provider-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.api-provider-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.api-provider-card.active {
    border-color: #7c3aed;
    background: linear-gradient(to bottom, #fff, #faf5ff);
}

.api-provider-card.active .provider-name-section h3 {
    color: #7c3aed;
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.provider-name-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.provider-name-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.provider-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn.activate {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.action-btn.activate:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.provider-info {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-label {
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.provider-token-section {
    background: #fafafa;
    border-radius: 12px;
    padding: 20px;
}

.token-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.token-percent-display {
    font-size: 14px;
    font-weight: 600;
    color: #7c3aed;
}

.provider-progress-track {
    margin-bottom: 12px;
}

.provider-progress-bar {
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.provider-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.provider-token-numbers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.token-used-text {
    color: #999;
    font-size: 13px;
}

.provider-calibration {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.calibration-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.calibration-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.api-management-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.provider-bottom-actions {
    display: flex;
    gap: 10px;
}

.provider-calibration-form {
    margin-top: 16px;
    padding-top: 16px;
    background: #fafafa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.api-url {
    font-family: monospace;
    font-size: 12px;
    color: #7c3aed !important;
}

.api-modal {
    max-width: 700px !important;
    width: 90vw;
}

.api-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #faf5ff 0%, #fff 100%);
    margin: -24px -24px 24px -24px;
    padding: 24px;
    border-radius: 16px 16px 0 0;
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.modal-icon svg {
    color: white;
}

.modal-subtitle {
    margin: 4px 0 0 0;
    font-size: 14px;
    color: #888;
    font-weight: 400;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-grid .form-group.full-width {
    grid-column: span 2;
}

.form-grid .form-group label {
    font-weight: 500;
    color: #444;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.form-input::placeholder {
    color: #999;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .form-group.full-width {
        grid-column: span 1;
    }
}

.required {
    color: #ef4444;
    font-weight: 600;
}

.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toggle-password:hover {
    background: #f0f0f0;
    color: #7c3aed;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.api-modal input[type="text"],
.api-modal input[type="password"],
.api-modal input[type="number"],
.api-modal textarea {
    border: 2px solid #e5e7eb;
    transition: all 0.2s;
}

.api-modal input:focus,
.api-modal textarea:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.api-modal .modal-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    gap: 12px;
}

.api-modal .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.api-modal .btn-primary svg {
    flex-shrink: 0;
}

.save-calibration-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.save-calibration-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.provider-note {
    cursor: pointer;
    color: #7c3aed;
    text-decoration: none;
}

.provider-note:hover {
    text-decoration: underline;
}

.api-modal-new {
    max-width: 720px !important;
    width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-header-new {
    padding: 24px 28px;
    background: linear-gradient(135deg, #f8f5ff 0%, #f0f9ff 100%);
    border-bottom: 1px solid #e5e7eb;
}

.modal-header-new h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.modal-header-new .modal-subtitle {
    margin: 6px 0 0 0;
    font-size: 14px;
    color: #6b7280;
}

.modal-body-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: white;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.required-badge {
    font-size: 11px;
    font-weight: 600;
    color: #ef4444;
    background: #fef2f2;
    padding: 2px 6px;
    border-radius: 4px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-control {
    padding-right: 48px;
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.toggle-password-btn:hover {
    background: #f3f4f6;
    color: #7c3aed;
}

.field-hint {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    padding-left: 2px;
}

.modal-footer-new {
    padding: 20px 28px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel {
    padding: 10px 24px;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-save {
    padding: 10px 28px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.modal-body-scrollable::-webkit-scrollbar {
    width: 6px;
}

.modal-body-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body-scrollable::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body-scrollable::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
