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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f3f4f6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Modern Header with improved navigation */
header.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

header .header-brand {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

header .header-brand h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

header .header-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Modern Navigation Menu */
nav.main-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

nav.main-navigation a {
    color: white;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    background-color: rgba(255,255,255,0.1);
}

nav.main-navigation a:hover {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

nav.main-navigation a.btn-logout {
    background-color: rgba(239,68,68,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

nav.main-navigation a.btn-logout:hover {
    background-color: rgba(239,68,68,0.3);
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    background-color: #f9fafb;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    font-size: 0.9rem;
    color: #6b7280;
}

.breadcrumb-item a {
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s ease;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
    color: #764ba2;
}

.breadcrumb-item.active {
    color: #1f2937;
    font-weight: 600;
}

.breadcrumb-item:not(:last-child)::after {
    content: ">";
    margin-left: 0.5rem;
    color: #9ca3af;
}

@media (max-width: 480px) {
    .breadcrumb-item {
        font-size: 0.85rem;
    }
}

.breadcrumb-nav:empty,
.breadcrumb-nav:has(.breadcrumb-list:empty) {
    display: none;
}

main {
    padding: 2rem 0;
}

footer {
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    width: 24rem;
    max-width: 90%;
}

.login-box h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-box h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #4b5563;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn {
    width: 100%;
    background-color: #2563eb;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}

.btn:hover {
    background-color: #1d4ed8;
}

/* Rimuovi sottolineatura da tutti i link che sono pulsanti */
a.btn, a.btn-sm, a.btn-blue, a.btn-green, a.btn-gray, a.btn-warning, a.btn-success, a.btn-red, a.btn-cancel {
    text-decoration: none;
}

.alert {
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.hidden {
    display: none;
}

.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .grid-cols-3, .grid-cols-4, .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

.stat-box {
    padding: 1rem;
    border-radius: 0.5rem;
}

.stat-box h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-box p {
    font-size: 1.875rem;
    font-weight: bold;
}

.bg-blue {
    background-color: #dbeafe;
}

.text-blue {
    color: #2563eb;
}

.bg-green {
    background-color: #d1fae5;
}

.text-green {
    color: #059669;
}

.bg-red {
    background-color: #fee2e2;
}

.text-red {
    color: #dc2626;
}

.bg-purple {
    background-color: #ede9fe;
}

.text-purple {
    color: #7c3aed;
}

.bg-orange {
    background-color: #ffedd5;
}

.text-orange {
    color: #ea580c;
}

.bg-gray {
    background-color: #f3f4f6;
}

.stat-box small {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    color: white;
    font-size: 0.875rem;
    text-decoration: none;
}

.btn-blue {
    background-color: #2563eb;
}

.btn-blue:hover {
    background-color: #1d4ed8;
}

.btn-green {
    background-color: #059669;
}

.btn-green:hover {
    background-color: #047857;
}

.btn-gray {
    background-color: #4b5563;
}

.btn-gray:hover {
    background-color: #374151;
}

.btn-purple {
    background-color: #7c3aed;
}

.btn-purple:hover {
    background-color: #6d28d9;
}

.btn-warning {
    background-color: #f59e0b;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-success {
    background-color: #10b981;
}

.btn-success:hover {
    background-color: #059669;
}

.text-gray {
    color: #6b7280;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft {
    background-color: #e5e7eb;
    color: #374151;
}

.status-xml_generated {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-sent_to_sdi {
    background-color: #d1fae5;
    color: #065f46;
}

.status-delivered {
    background-color: #10b981;
    color: white;
}

.status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-error {
    background-color: #dc2626;
    color: white;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

table tr:hover {
    background-color: #f9fafb;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.data-table thead th {
    background: transparent;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border: none;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f0f9ff;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Enhanced Table Styling */
.data-table th {
    padding: 1rem;
    text-align: left;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.data-table th.sortable:hover {
    background: rgba(255,255,255,0.1);
}

.data-table th.sortable .sort-indicator {
    margin-left: 0.5rem;
    opacity: 0.6;
    font-size: 0.75rem;
}

.data-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

.data-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.data-table td {
    padding: 0.875rem 1rem;
    color: #374151;
    font-size: 0.9rem;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Table Filter */
.table-filter {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.table-filter input {
    flex: 1;
    min-width: 250px;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.95rem;
}

.table-filter input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.table-filter label {
    font-weight: 600;
    color: #374151;
    margin-right: 0.5rem;
}

/* Empty State Icon */
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Tables */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-filter input {
        width: 100%;
    }
}

.scope-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.2rem;
}

.scope-create {
    background: rgba(16, 185, 129, 0.125);
    color: #10b981;
}

.scope-read {
    background: rgba(59, 130, 246, 0.125);
    color: #3b82f6;
}

.token-status-active {
    display: inline-block;
    background: #f0fdf4;
    color: #16a34a;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid #bbf7d0;
}

.token-status-revoked {
    display: inline-block;
    background: #fef2f2;
    color: #dc2626;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid #fecaca;
}

.token-status-expired {
    display: inline-block;
    background: #fff7ed;
    color: #ea580c;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid #fed7aa;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 2px dashed #d1d5db;
}

.empty-state-title {
    color: #6b7280;
    font-size: 1.1rem;
    margin: 0;
}

.empty-state-subtitle {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.info-box-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.info-box-gradient p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-box-gradient strong {
    font-size: 1.1rem;
}

.info-box-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-box-warning p {
    margin: 0;
    color: #92400e;
}

.info-box-warning strong {
    font-weight: 600;
}

.info-box-success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-box-success p {
    margin: 0;
    color: #065f46;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    margin-bottom: 0;
}

.text-sm {
    font-size: 0.875rem;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.redirect-box {
    text-align: center;
}

.redirect-title {
    font-size: 1.875rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.redirect-link {
    color: #2563eb;
    text-decoration: underline;
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.api-endpoint-box {
    background: white;
    padding: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
}

.api-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.api-code {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.min-height-full {
    min-height: 100vh;
}

.alert-success {
    background-color: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.user-card {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.user-card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.user-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-green {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #4b5563;
}

.user-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-red {
    background-color: #dc2626;
}

.btn-red:hover {
    background-color: #b91c1c;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-footer {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
}

.btn-cancel {
    background-color: #6b7280;
}

.btn-cancel:hover {
    background-color: #4b5563;
}

/* Logs Page Styles */
.logs-filters {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-search {
    flex: 1;
}

.filter-select, .filter-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
}

.filter-input {
    width: 100%;
}

.log-entry {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.log-entry:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(2px);
}

.log-success {
    border-left-color: #10b981;
}

.log-client-error {
    border-left-color: #f59e0b;
}

.log-server-error {
    border-left-color: #ef4444;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.log-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.log-method {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.method-GET {
    background: #dbeafe;
    color: #1e40af;
}

.method-POST {
    background: #d1fae5;
    color: #065f46;
}

.method-PUT {
    background: #fef3c7;
    color: #92400e;
}

.method-DELETE {
    background: #fee2e2;
    color: #991b1b;
}

.method-PATCH {
    background: #e0e7ff;
    color: #3730a3;
}

.log-path {
    font-family: monospace;
    color: #374151;
    font-size: 0.9rem;
}

.log-status {
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8rem;
}

.status-200, .status-201 {
    background: #d1fae5;
    color: #065f46;
}

.status-400, .status-401, .status-404 {
    background: #fef3c7;
    color: #92400e;
}

.status-500 {
    background: #fee2e2;
    color: #991b1b;
}

.log-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.log-time, .log-duration {
    font-family: monospace;
}

.log-details {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.log-error {
    color: #dc2626;
    font-weight: 600;
}

.pagination-controls {
    margin-top: 2rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 900px;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #6b7280;
}

.modal-close:hover {
    color: #374151;
}

.log-detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.log-detail-section:last-child {
    border-bottom: none;
}

.log-detail-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.log-detail-section p {
    margin-bottom: 0.5rem;
}

.log-detail-section pre {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    font-size: 0.875rem;
}

.log-detail-section code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stats-column {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.stats-column h4 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-path {
    font-family: monospace;
    font-size: 0.875rem;
    color: #374151;
}

.bg-yellow {
    background-color: #fef3c7;
}

.text-yellow {
    color: #92400e;
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-details {
        grid-template-columns: 1fr;
    }
}

.stats-box-container {
    margin-bottom: 2rem;
}

/* Gradient Buttons */
.btn-danger-gradient {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.btn-purple-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-danger-gradient:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
}

.btn-purple-gradient:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

/* Invoice Toolbar */
.invoice-toolbar {
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.danger-zone-hidden {
    display: none;
}

.toolbar-right {
    margin-left: auto;
}

/* Form Elements */
.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-hint {
    color: #666;
    font-size: 0.875rem;
}

.modal-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.upload-xml-result-hidden {
    margin-top: 20px;
    display: none;
}

/* ===== COLLAPSIBLE SIDEBAR ===== */

.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 101;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 0.5rem;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.sidebar-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover span {
    width: 28px;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 60px;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 101;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.expanded {
    width: 250px;
}

.sidebar-content {
    padding-top: 80px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar.expanded .sidebar-section-title {
    opacity: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.sidebar-link:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #667eea;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.sidebar-icon {
    font-size: 1.5rem;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-text {
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-text-title {
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-text-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
    opacity: 0.8;
}

.sidebar:not(.expanded) .sidebar-text {
    display: none;
}

.main-wrapper {
    margin-left: 60px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.expanded ~ .main-wrapper {
    margin-left: 250px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .sidebar:not(.expanded) {
        transform: translateX(-60px);
    }

    .sidebar.expanded {
        width: 280px;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .sidebar-toggle {
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
    }

    .sidebar-toggle span {
        width: 22px;
    }

    .sidebar.expanded {
        box-shadow: 4px 0 12px rgba(0,0,0,0.2);
    }
}

/* ===== QUICK ACTIONS SECTION ===== */

.quick-actions-title {
    margin-top: 2rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.action-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid #f3f4f6;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.action-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.2));
}

.action-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.action-card-description {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    flex-grow: 1;
}

.action-card-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.action-card-button:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.action-card-button:active {
    transform: translateY(0);
}

.action-card-button:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.action-card.hidden {
    display: none;
}

/* ===== TOAST NOTIFICATION SYSTEM ===== */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

/* Toast */
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(400px);
}

/* Toast Types */
.toast-success {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.toast-error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.toast-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.toast-info {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

/* Toast Content */
.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: #1f2937;
    font-size: 0.95rem;
    line-height: 1.5;
}

.toast-close {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0,0,0,0.05);
    color: #1f2937;
}

/* Responsive */
@media (max-width: 480px) {
    .toast-container {
        top: 70px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .toast {
        padding: 0.875rem 1rem;
    }
}

/* ===== COMPREHENSIVE RESPONSIVE DESIGN ===== */

/* Tablet and Mobile - 768px and below */
@media (max-width: 768px) {
    /* Header/Navigation Mobile */
    .main-header .header-content {
        padding: 0.75rem 1rem;
    }
    
    .header-brand h1 {
        font-size: 1.1rem;
    }
    
    .header-subtitle {
        font-size: 0.75rem;
    }
    
    .main-navigation {
        gap: 0.5rem;
    }
    
    .main-navigation a {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Forms Mobile */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }
    
    .form-group input,
    .form-group select,
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.625rem 0.875rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions .btn,
    .form-actions a.btn {
        width: 100%;
    }
    
    .modal-form-actions {
        flex-direction: column;
    }
    
    .modal-form-actions .btn {
        width: 100%;
    }
    
    /* Cards/Buttons Mobile */
    .card {
        padding: 1.25rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn,
    .btn-sm {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly size */
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn,
    .btn-group a.btn {
        width: 100%;
    }
    
    .user-card-actions {
        flex-direction: column;
    }
    
    .user-card-actions .btn {
        width: 100%;
    }
    
    /* Container/Layout Mobile */
    .container {
        padding: 1rem;
    }
    
    .page-header {
        margin-bottom: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    /* Adjust spacing utilities */
    .mb-4 { 
        margin-bottom: 1.5rem !important; 
    }
    
    .mb-6 { 
        margin-bottom: 2rem !important; 
    }
    
    .p-6 { 
        padding: 1.5rem !important; 
    }
    
    .p-8 { 
        padding: 2rem !important; 
    }
    
    /* Invoice Toolbar */
    .invoice-toolbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .toolbar-right {
        margin-left: 0;
        width: 100%;
    }
    
    /* Modal Mobile */
    .modal-content {
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .modal-large {
        max-width: 95%;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Login Box Mobile */
    .login-box {
        padding: 1.5rem;
    }
    
    .login-box h2 {
        font-size: 1.25rem;
    }
    
    /* Stats/Dashboard */
    .stat-box h3 {
        font-size: 1rem;
    }
    
    .stat-box p {
        font-size: 1.5rem;
    }
    
    /* Action Cards */
    .action-card {
        padding: 1.25rem;
    }
    
    .action-card-icon {
        font-size: 2.5rem;
    }
    
    .action-card-title {
        font-size: 1.1rem;
    }
    
    .action-card-description {
        font-size: 0.875rem;
    }
    
    /* User Cards */
    .user-card {
        padding: 0.875rem;
    }
    
    .user-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .user-badges {
        flex-wrap: wrap;
    }
    
    /* Logs Filters */
    .logs-filters {
        padding: 1rem;
    }
    
    .log-entry {
        padding: 0.875rem;
    }
    
    .log-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .log-info {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .log-meta {
        flex-wrap: wrap;
    }
    
    .log-details {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Mobile Extra Small - 480px and below */
@media (max-width: 480px) {
    /* Typography Mobile */
    body {
        font-size: 14px;
    }
    
    h1 { 
        font-size: 1.75rem; 
    }
    
    h2 { 
        font-size: 1.5rem; 
    }
    
    h3 { 
        font-size: 1.25rem; 
    }
    
    h4 { 
        font-size: 1.1rem; 
    }
    
    h5 { 
        font-size: 1rem; 
    }
    
    h6 { 
        font-size: 0.95rem; 
    }
    
    /* Header Extra Small */
    .header-brand h1 {
        font-size: 1rem;
    }
    
    .header-subtitle {
        font-size: 0.7rem;
    }
    
    .main-navigation a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Reduce padding further */
    .container {
        padding: 0.75rem;
    }
    
    main {
        padding: 1rem 0;
    }
    
    .card {
        padding: 1rem;
    }
    
    /* Dashboard Title */
    .dashboard-title {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    /* Badges and Status */
    .status-badge,
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    .scope-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        margin: 0.15rem;
    }
    
    /* Action Cards Extra Small */
    .action-card {
        padding: 1rem;
    }
    
    .action-card-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .action-card-title {
        font-size: 1rem;
    }
    
    .action-card-button {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    /* Table Adjustments */
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    /* Info Boxes */
    .info-box-gradient,
    .info-box-warning,
    .info-box-success {
        padding: 1rem;
    }
    
    .info-box-gradient p,
    .info-box-warning p,
    .info-box-success p {
        font-size: 0.875rem;
    }
    
    /* Stat Boxes */
    .stat-box {
        padding: 0.875rem;
    }
    
    .stat-box h3 {
        font-size: 0.95rem;
    }
    
    .stat-box p {
        font-size: 1.25rem;
    }
    
    .stat-box small {
        font-size: 0.7rem;
    }
}

/* Tablet Portrait - 768px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 1.25rem;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .sidebar-toggle,
    .main-header,
    .breadcrumb-nav,
    footer,
    .btn-group,
    .form-actions,
    .table-filter {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .data-table {
        box-shadow: none;
    }
}

/* Tooltip System */
.tooltip {
    position: absolute;
    z-index: 10000;
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.4;
    max-width: 250px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip-visible {
    opacity: 1;
}

/* Tooltip icon/trigger */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
    margin-left: 0.375rem;
    vertical-align: middle;
}

.tooltip-trigger:hover {
    background: #764ba2;
}

/* Keyboard Shortcuts Modal */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcuts-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.shortcuts-modal-content {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.shortcuts-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
}

.shortcuts-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.shortcuts-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: background 0.2s ease;
}

.shortcuts-modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.shortcuts-modal-body {
    padding: 1.5rem;
}

.shortcuts-section {
    margin-bottom: 2rem;
}

.shortcuts-section:last-child {
    margin-bottom: 0;
}

.shortcuts-section h3 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    gap: 1rem;
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.shortcut-keys kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    min-width: 28px;
    text-align: center;
}

.shortcut-keys span {
    color: #9ca3af;
    font-size: 0.75rem;
}

.shortcut-description {
    color: #6b7280;
    font-size: 0.95rem;
    flex: 1;
}

/* Button Icon for Header */
.btn-icon {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .shortcuts-modal-content {
        width: 95%;
    }
    
    .shortcut-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .shortcut-keys {
        margin-bottom: 0.375rem;
    }
}
