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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    min-height: 100vh;
    background: #f5f5f5;
    color: #333;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
}

.sidebar-header h2 {
    font-size: 1.2em;
}

.nav-links {
    list-style: none;
    padding: 10px 0;
}

.nav-links li a {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: background 0.2s;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: #34495e;
    color: #fff;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #34495e;
    margin-top: auto;
}

.logout-link {
    color: #e74c3c;
    text-decoration: none;
    font-size: 0.9em;
}

.logout-link:hover {
    color: #c0392b;
}

/* Content */
.content {
    flex: 1;
    padding: 30px;
    overflow-x: auto;
}

.content h1 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #2c3e50;
    color: #fff;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: #f9f9f9;
}

td .actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn:hover {
    background: #2980b9;
}

.btn:active {
    transform: scale(0.97);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8em;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 0.75em;
}

.btn-primary {
    background: #27ae60;
}

.btn-primary:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    color: #3498db;
    border: 1px solid #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: #fff;
}

.btn-full {
    width: 100%;
    padding: 10px;
}

/* Cards */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.05em;
}

/* User info */
.user-info {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-info p {
    margin: 5px 0;
    line-height: 1.6;
}

/* User config */
.user-config {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-config h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Session cards */
.session-card {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.session-card h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.session-header h3 {
    margin-bottom: 0;
}

.session-meta {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 12px;
}

/* File grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.file-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 15px;
    transition: border-color 0.2s;
}

.file-card:hover {
    border-color: #ccc;
}

.file-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.file-card-header h4 {
    margin-bottom: 0;
    font-size: 0.9em;
    word-break: break-all;
    color: #2c3e50;
}

.file-versions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.version {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version .label {
    font-size: 0.75em;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.version a {
    font-size: 0.8em;
    color: #3498db;
    text-decoration: none;
}

.version a:hover {
    text-decoration: underline;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8em;
    color: #666;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.print-yes {
    color: #27ae60;
    font-weight: 600;
}

.print-no {
    color: #999;
}

/* Forms */
.settings-form {
    max-width: 500px;
    background: #fff;
    padding: 25px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 12px 18px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    background: #f5f5f5;
}

.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 360px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 24px;
    color: #2c3e50;
}

/* Thumbnails */
.thumb {
    max-width: 80px;
    max-height: 60px;
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
    border: 1px solid #e8e8e8;
    transition: opacity 0.2s;
}

.thumb:hover {
    opacity: 0.8;
}

.thumb-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Order cards */
.order-card {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.order-card h3 {
    margin-bottom: 5px;
    color: #2c3e50;
}

.order-address {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.order-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.order-file {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.order-file .thumb {
    max-width: 100%;
    max-height: 100px;
    margin-bottom: 8px;
}

.order-file .file-name {
    font-size: 0.8em;
    color: #666;
    word-break: break-all;
    margin-bottom: 6px;
}

.order-file .file-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.order-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .sidebar-header {
        padding: 10px 15px;
    }

    .sidebar-header h2 {
        font-size: 1em;
    }

    .nav-links {
        display: flex;
        padding: 0;
        flex: 1;
    }

    .nav-links li a {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .sidebar-footer {
        border-top: none;
        border-left: 1px solid #34495e;
        padding: 10px 15px;
        margin-top: 0;
    }

    .content {
        padding: 15px;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .file-grid {
        grid-template-columns: 1fr;
    }
}
