* {
    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;
    padding: 20px;
}

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

/* Login Screen */
#loginScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
}

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

.header h1 {
    color: #333;
    font-size: 24px;
}

/* Card */
.card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    width: 100%;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

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

/* Messages */
.error-message,
.success-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.error-message:not(:empty),
.success-message:not(:empty) {
    display: block;
}

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

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

/* Entries Table */
.entries-table {
    overflow-x: auto;
}

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

.entries-table th,
.entries-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.entries-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
}

.entries-table tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

/* List Header */
.list-header {
    margin-bottom: 20px;
}

.list-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-top: 15px;
}

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

.list-controls .btn {
    white-space: nowrap;
}

/* Mobile Card View */
.entry-card {
    display: none; /* Hidden on desktop */
    background: white;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #667eea;
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.entry-card-main {
    flex: 1;
    min-width: 0;
}

.entry-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.meta-date {
    font-size: 12px;
    color: #666;
}

.entry-card-department {
    color: #555;
    font-size: 14px;
    padding-left: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    * {
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    body {
        padding: 0;
        margin: 0;
        font-size: 14px;
        background: #f5f5f5;
    }

    .container {
        padding: 0;
        margin: 0;
        max-width: 100%;
    }

    .login-box {
        padding: 30px 20px;
        margin: 20px;
        width: calc(100% - 40px);
        max-width: 100%;
    }

    .login-box h1 {
        font-size: 22px;
        margin-bottom: 24px;
    }

    .form-row,
    .list-controls {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        margin-bottom: 16px;
        width: 100%;
    }

    .list-controls .form-group {
        margin-bottom: 12px;
    }

    .list-controls .btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 16px;
        margin: 10px;
        border-radius: 8px;
    }

    .header h1 {
        font-size: 18px;
        margin: 0;
    }

    .card {
        padding: 16px;
        margin: 10px;
        border-radius: 8px;
        width: calc(100% - 20px);
    }

    .card h2 {
        font-size: 17px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
        font-weight: 600;
    }

    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 12px;
        width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }

    .btn {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 52px;
        width: 100%;
        border-radius: 8px;
        font-weight: 600;
    }

    .btn-sm {
        padding: 8px 16px;
        font-size: 13px;
        min-height: auto;
        width: auto;
        white-space: nowrap;
    }

    .entry-card .btn-sm {
        flex-shrink: 0;
    }

    /* Hide table, show cards on mobile */
    .entries-table table {
        display: none !important;
    }

    .entry-card {
        display: block !important;
    }

    .entries-table {
        padding: 0;
    }

    /* Success/Error messages */
    .error-message,
    .success-message {
        font-size: 14px;
        padding: 14px;
        margin: 10px 0;
        border-radius: 6px;
    }

    /* List header on mobile */
    .list-header {
        margin-bottom: 16px;
    }

    .list-header h2 {
        font-size: 17px;
        margin-bottom: 12px;
    }

    /* No data message */
    .no-data {
        padding: 30px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .login-box {
        padding: 24px 16px;
        margin: 15px;
        width: calc(100% - 30px);
    }

    .card {
        padding: 14px;
        margin: 8px;
        width: calc(100% - 16px);
    }

    .header {
        padding: 14px;
        margin: 8px;
        width: calc(100% - 16px);
    }

    .form-group input,
    .form-group select {
        padding: 13px 11px;
        font-size: 16px;
    }

    .entry-card {
        padding: 12px 14px;
        margin-bottom: 8px;
    }

    .entry-card-name {
        font-size: 15px;
        margin-bottom: 5px;
    }

    .entry-card-department {
        font-size: 13px;
    }

    .meta-badge {
        font-size: 11px;
        padding: 2px 8px;
    }

    .meta-date {
        font-size: 11px;
    }

    .btn {
        padding: 15px 18px;
        min-height: 50px;
    }

    .btn-sm {
        padding: 7px 14px;
        font-size: 12px;
    }
}
